Ejemplo n.º 1
0
        /**
         * An intersection of a type predicate and a predicate with a known type is
         * equivalent to the known type predicate.
         */

        private void RemoveRedundantTypeIntersections(ArrayList newPredicateList, ref bool optimized)
        {
            int knownTypeId = -1;

            for (int i = 0; i < newPredicateList.Count; i++)
            {
                ResourceListPredicate predicate = (ResourceListPredicate)newPredicateList [i];
                if (!(predicate.HasAnyTypePredicate()))
                {
                    int predKnownTypeId = predicate.GetKnownType();
                    if (knownTypeId == -1)
                    {
                        knownTypeId = predKnownTypeId;
                    }
                    else if (predKnownTypeId != knownTypeId)
                    {
                        return;
                    }
                }
            }

            if (knownTypeId != -1)
            {
                for (int i = newPredicateList.Count - 1; i >= 0; i--)
                {
                    if (((ResourceListPredicate)newPredicateList [i]).HasTypePredicate(knownTypeId))
                    {
                        newPredicateList.RemoveAt(i);
                        optimized = true;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 internal override int GetKnownType()
 {
     return _lhs.GetKnownType();
 }