예제 #1
0
파일: Predicates.cs 프로젝트: dadhi/ecsharp
        private void UpdateSlashDivs(bool slashJoined, int boundary, bool append, Alts bAlts)
        {
            //Debug.Assert(boundary > 0 && boundary < Arms.Count); //not true when joining with error branch
            Division prev  = _divisions.LastOrDefault();
            var      bDivs = bAlts != null ? bAlts._divisions : InternalList <Division> .Empty;

            if (append)
            {
                bDivs = Adjust(bDivs, boundary, true);
                _divisions.AddRange(bDivs);
            }
            else
            {
                prev = bAlts != null?bAlts._divisions.LastOrDefault() : default(Division);

                Adjust(_divisions, boundary, false);
                _divisions.InsertRange(0, bDivs);
            }

            var newDiv = new Division {
                Left = 0, Mid = (short)boundary, Right = (short)Arms.Count, Slash = slashJoined
            };

            _divisions.Add(newDiv);
        }
예제 #2
0
 public virtual void AddRange(IEnumerable <T> items)
 {
     InternalList.AddRange(items);
     if (ItemAdded != null)
     {
         foreach (T i in items)
         {
             ItemAdded.Invoke(this, i);
         }
     }
 }
예제 #3
0
        private void addPossibleNamesToComboBox()
        {
            List <ObjectVariable> listOfOvs        = new List <ObjectVariable>();
            List <EParameter>     listOfParameters = new List <EParameter>();

            if (objectVariable is TGGObjectVariable)
            {
                TGGRule tggRule = objectVariable.StoryPattern as TGGRule;
                listOfOvs = SDMUtil.getTGGObjectVariablesInTggRule(tggRule, repository);
            }
            else if (objectVariable is ObjectVariable)
            {
                Activity activity = objectVariable.StoryPattern.ParentStoryNode.OwningActivity;
                listOfOvs = SDMUtil.getSDMObjectVariablesInActivity(activity, repository);
                try
                {
                    foreach (EParameter eParameter in objectVariable.StoryPattern.ParentStoryNode.OwningActivity.OwningOperation.EParameters)
                    {
                        listOfParameters.Add(eParameter);
                    }
                }
                catch
                {
                }
            }
            ObjectVariable ovToDelete = null;

            foreach (ObjectVariable ov in listOfOvs)
            {
                if (ov.Name == this.objectVariable.ObjectVariableEA.Name)
                {
                    ovToDelete = ov;
                }
            }
            listOfOvs.Remove(ovToDelete);
            InternalList.AddRange(listOfOvs);
            InternalList.AddRange(listOfParameters);

            foreach (Object possibleObject in InternalList)
            {
                if (possibleObject is ObjectVariable)
                {
                    this.Items.Add((possibleObject as ObjectVariable).Name);
                }
                else if (possibleObject is EParameter)
                {
                    this.Items.Add((possibleObject as EParameter).Name);
                }
            }
        }