Beispiel #1
0
        internal override IntArrayList GetMatchingResources( out bool sortedById )
        {
            bool lhsSortedById = false;
            IntArrayList result = _lhs.GetMatchingResources( out lhsSortedById );
            if ( _rhs.GetSelectionCost() >= 3 )
            {
                for( int i=result.Count-1; i >= 0; i-- )
                {
                    IResource resource;
                    
                    try
                    {
                        resource = MyPalStorage.Storage.LoadResource( result [i], true, _lhs.GetKnownType() );
                    }
                    catch( InvalidResourceIdException )
                    {
                        result.RemoveAt( i );
                        continue;
                    }

                    if ( resource.IsDeleted || _rhs.MatchResource( resource, null ) != PredicateMatch.None )
                    {
                        result.RemoveAt( i );
                    }
                }
            }
            else
            {
                if ( !lhsSortedById )
                {
                    result.Sort();
                    lhsSortedById = true;
                }

                object rhsSyncObject;
                IntArrayList minus = _rhs.GetSortedMatchingResourcesRef( out rhsSyncObject );
                if ( rhsSyncObject == null )
                {
                    result.MinusSorted( minus );
                }
                else
                {
                    lock( rhsSyncObject )
                    {
                        result.MinusSorted( minus );
                    }
                }
            }
            sortedById = lhsSortedById;
            return result;
        }
Beispiel #2
0
 internal void AddSource(ResourceListPredicate pred)
 {
     lock (this)
     {
         if (_sourcePredicatesSelective != null)
         {
             if (pred.GetSelectionCost() <= _minSelectionCost)
             {
                 _sourcePredicatesSelective = AddPredicate(_sourcePredicatesSelective, pred);
             }
             else
             {
                 _sourcePredicatesFiltering = AddPredicate(_sourcePredicatesFiltering, pred);
             }
         }
         _sourcePredicates = AddPredicate(_sourcePredicates, pred);
     }
 }
Beispiel #3
0
 internal override int GetSelectionCost()
 {
     return _lhs.GetSelectionCost();
 }