Exemplo n.º 1
0
        /// <summary>
        /// Generic method inserting/updating items from first list, and deleting parameters from second list
        /// </summary>
        public void ApplyUpdates <T>(IEnumerable <T> items,
                                     IList <T> deletedItems,
                                     DelegatePredicate <T> insertCriterium,
                                     DelegatePredicate <T> updateCriterium)
        {
            // Applying deletes
            if (deletedItems != null)
            {
                foreach (T item in deletedItems)
                {
                    this.Delete(item);
                }
                deletedItems.Clear();
            }

            // Applying inserts and updates
            if (items != null)
            {
                foreach (T item in items)
                {
                    if (insertCriterium(item))
                    {
                        this.Insert(item);
                    }
                    else if (updateCriterium(item))
                    {
                        this.Update(item);
                    }
                }
            }
        }
 public PredicateOrFunctor(DelegatePredicate <type>[] functors)
 {
     foreach (DelegatePredicate <type> functor in functors)
     {
         _predicates += functor;
     }
 }
 public void AddRung(DelegatePredicate <ISubject> predicates, DelegateClosure <IExtendedSubject> executor)
 {
     try {
         _lockRung.AcquireWriterLock(-1);
         _rungs.Add(new Rung(predicates, executor));
     }
     finally {
         _lockRung.ReleaseLock();
     }
 }
 public PredicateProxy(IList <type> parent, DelegatePredicate <type> predicate)
     : base(parent)
 {
     _predicate = predicate;
 }
 public IntegerData(DelegatePredicate <int> predicate)
 {
     _predicate = predicate;
 }
 public static DelegatePredicate <type> CreateInstance(DelegatePredicate <type> functor1, DelegatePredicate <type> functor2)
 {
     return(CreateInstance(new DelegatePredicate <type>[] { functor1, functor2 }));
 }
 public Rung(DelegatePredicate <ISubject> predicate, DelegateClosure <IExtendedSubject> executor)
 {
     _predicates = predicate;
     _executor   = executor;
 }