Пример #1
0
        public void AddCaseTarget(
            CaseType caseValue, DecisionGraphNode target)
        {
            CaseImpl ci = null;

            if (this.mCases.Count == 0)
            {
                ci = new CaseImpl(caseValue);
                ci.Targets.Add(target);
                this.mCases.Add(ci);
            }
            else
            {
                int i;
                EqualityComparer <CaseType> ec
                    = EqualityComparer <CaseType> .Default;
                for (i = this.mCases.Count - 1; i >= 0; i--)
                {
                    ci = this.mCases[i];
                    if (ec.Equals(caseValue, ci.Value))
                    {
                        break;
                    }
                }
                if (i < 0)
                {
                    ci = new CaseImpl(caseValue);
                    this.mCases.Add(ci);
                }
                if (!ci.Targets.Contains(target))
                {
                    ci.Targets.Add(target);
                }
            }
        }
Пример #2
0
 public void AddTarget(DecisionGraphNode target)
 {
     if (!this.mTargets.Contains(target))
     {
         this.mTargets.Add(target);
     }
 }
Пример #3
0
        public void RemoveDecisionMaker(DecisionGraphNode node)
        {
            int index = this.mDecisionMakers.IndexOf(node);

            if (index >= 0)
            {
                this.mDecisionMakers.RemoveAt(index);
            }
        }
Пример #4
0
        public void RemoveEntryPoint(DecisionGraphNode node)
        {
            int index = this.mEntryPoints.IndexOf(node);

            if (index >= 0)
            {
                this.mEntryPoints.RemoveAt(index);
            }
        }
Пример #5
0
        public bool RemoveTarget(DecisionGraphNode target)
        {
            int index = this.mTargets.IndexOf(target);

            if (index < 0)
            {
                return(false);
            }
            this.mTargets.RemoveAt(index);
            return(true);
        }
Пример #6
0
 public void AddDecisionMaker(DecisionGraphNode node)
 {
     if (!this.mDecisionMakers.Contains(node))
     {
         /*int index = this.mEntryPoints.IndexOf(node);
          * if (index >= 0)
          * {
          *  this.mEntryPoints.RemoveAt(index);
          * }/* */
         this.mDecisionMakers.Add(node);
     }
 }
Пример #7
0
 public void Remove(DecisionGraphNode node)
 {
     //if (node.mDecisionGraph == this)
     {
         int index = this.mDecisionMakers.IndexOf(node);
         if (index >= 0)
         {
             this.mDecisionMakers.RemoveAt(index);
         }
         index = this.mEntryPoints.IndexOf(node);
         if (index >= 0)
         {
             this.mEntryPoints.RemoveAt(index);
         }
         //node.mDecisionGraph = null;
     }
 }
Пример #8
0
        public bool RemoveCaseTarget(
            CaseType caseValue, DecisionGraphNode target)
        {
            if (this.mCases.Count == 0)
            {
                return(false);
            }
            int      i;
            CaseImpl ci = null;
            EqualityComparer <CaseType> ec
                = EqualityComparer <CaseType> .Default;

            for (i = this.mCases.Count - 1; i >= 0; i--)
            {
                ci = this.mCases[i];
                if (ec.Equals(caseValue, ci.Value))
                {
                    break;
                }
            }
            if (i < 0)
            {
                return(false);
            }
            int index = ci.Targets.IndexOf(target);

            if (index < 0)
            {
                return(false);
            }
            ci.Targets.RemoveAt(index);
            if (ci.Targets.Count == 0)
            {
                this.mCases.RemoveAt(i);
            }
            return(true);
        }