Filter() public method

public Filter ( Parameters parameters, string name, SimDescription sim ) : ICollection
parameters Parameters
name string
sim SimDescription
return ICollection
Beispiel #1
0
 protected ICollection <SimDescription> GetFilteredTargets(SimDescription sim, ICollection <SimDescription> potentials)
 {
     if (mMutualSelection != null)
     {
         return(mTargetFilter.Filter(new SimScenarioFilter.Parameters(this, true), "Targets", mMutualSelection, potentials));
     }
     else
     {
         return(mTargetFilter.Filter(new SimScenarioFilter.Parameters(this, true), "Targets", sim, potentials));
     }
 }
Beispiel #2
0
        protected override GatherResult Gather(List <Scenario> list, ref int continueChance, ref int maximum, ref bool random)
        {
            if ((mMutualSelection == null) && (mMutualFilter != null) && (mMutualFilter.Enabled))
            {
                ICollection <SimDescription> mutuals = mMutualFilter.Filter(new SimScenarioFilter.Parameters(this, false), "Mutual", null);
                if ((mutuals == null) || (mutuals.Count == 0))
                {
                    IncStat("No Mutual");

                    return(GatherResult.Failure);
                }

                mMutualSelection = RandomUtil.GetRandomObjectFromList(new List <SimDescription>(mutuals));

                IncStat("Mutual Selected");
            }

            if (Sim != null)
            {
                if (!Allow(Sim))
                {
                    return(GatherResult.Failure);
                }
            }
            else
            {
                return(base.Gather(list, ref continueChance, ref maximum, ref random));
            }

            continueChance = TargetContinueChance;
            maximum        = TargetMaximum;

            return(TargetGather(list, ref random));
        }