예제 #1
0
        /// <summary>
        ///     Gets all values from source to target
        /// </summary>
        /// <param name="source"></param>
        protected virtual void UpdateModelElementAccordingToSource(ModelElement source)
        {
            IGraphicalDisplay sourceGraphicalDisplay = source as IGraphicalDisplay;
            IGraphicalDisplay targetGraphicalDisplay = this as IGraphicalDisplay;

            if (sourceGraphicalDisplay != null && targetGraphicalDisplay != null)
            {
                int  x      = targetGraphicalDisplay.X;
                int  y      = targetGraphicalDisplay.Y;
                int  width  = targetGraphicalDisplay.Width;
                int  height = targetGraphicalDisplay.Height;
                bool hidden = targetGraphicalDisplay.Hidden;

                Comparer.Duplicate(source, this);

                targetGraphicalDisplay.X      = x;
                targetGraphicalDisplay.Y      = y;
                targetGraphicalDisplay.Width  = width;
                targetGraphicalDisplay.Height = height;
                targetGraphicalDisplay.Hidden = hidden;
            }
            else
            {
                Comparer.Duplicate(source, this);
            }
        }
예제 #2
0
        /// <summary>
        ///     Updates (if possible) the initial state for this transition
        /// </summary>
        /// <param name="initialBox"></param>
        public void SetInitialBox(IGraphicalDisplay initialBox)
        {
            State initialState = (State)initialBox;

            if (Action != null)
            {
                if (PreCondition != null)
                {
                    if (PreCondition.Rule == Action.Rule)
                    {
                        List <State> states = StateMachine.GetStates(PreCondition.Expression);
                        if (states.Count == 1)
                        {
                            PreCondition.ExpressionText = "THIS == " + initialState.FullName;
                            Source = initialState;
                        }
                        else
                        {
                            throw new CannotChangeRuleException("More than one state in the pre condition expression");
                        }
                    }
                    else
                    {
                        throw new CannotChangeRuleException("Precondition is not at the same level as the action");
                    }
                }
                else
                {
                    RuleCondition ruleCondition = Action.Enclosing as RuleCondition;
                    if (ruleCondition != null)
                    {
                        Rule rule = ruleCondition.EnclosingRule;

                        if (EnclosingFinder <State> .find(rule) == Source)
                        {
                            if (rule.RuleConditions.Count == 1)
                            {
                                Source.StateMachine.removeRules(rule);
                                Source = initialState;
                                Source.StateMachine.appendRules(rule);
                            }
                            else
                            {
                                rule.removeConditions(ruleCondition);
                                Source = initialState;
                                Rule newRule = (Rule)acceptor.getFactory().createRule();
                                newRule.Name = rule.Name;
                                newRule.appendConditions(ruleCondition);
                                Source.StateMachine.appendRules(newRule);
                            }
                        }
                        else
                        {
                            throw new CannotChangeRuleException("Action is not defined directly in the state");
                        }
                    }
                }
            }
            Source = initialState;
        }
예제 #3
0
        /// <summary>
        ///     Sets the source box for this arrow
        /// </summary>
        /// <param name="initialBox"></param>
        public void SetInitialBox(IGraphicalDisplay initialBox)
        {
            Source.removeDependancies(this);
            RequirementSet newSource = (RequirementSet)initialBox;

            newSource.appendDependancies(this);
        }
예제 #4
0
        /// <summary>
        ///     Updates (if possible) the target state of this transition
        /// </summary>
        /// <param name="targetBox"></param>
        public void SetTargetBox(IGraphicalDisplay targetBox)
        {
            State targetState = (State)targetBox;

            if (Action != null)
            {
                Action.ExpressionText = "THIS <- " + targetState.LiteralName;
            }
            Target = targetState;
        }
 /// <summary>
 ///     Sets the target box for this arrow
 /// </summary>
 /// <param name="targetBox"></param>
 public override void SetTargetBox(IGraphicalDisplay targetBox)
 {
     Collection collection = Source as Collection;
     Type type = targetBox as Type;
     if (collection != null && type != null)
     {
         collection.Type = type;
         Target = targetBox;
     }
 }
 /// <summary>
 ///     Sets the source box for this arrow
 /// </summary>
 /// <param name="initialBox"></param>
 public override void SetInitialBox(IGraphicalDisplay initialBox)
 {
     Collection collection = initialBox as Collection;
     Type type = Target as Type;
     if (collection != null && type != null)
     {
         collection.Type = type;
         Source = initialBox;
     }
 }
 /// <summary>
 ///     Sets the target box for this arrow
 /// </summary>
 /// <param name="targetBox"></param>
 public override void SetTargetBox(IGraphicalDisplay targetBox)
 {
     StructureElement structureElement = ReferencedModel as StructureElement;
     Type type = targetBox as Type;
     if (structureElement != null && type != null)
     {
         structureElement.Type = type;
         Target = targetBox;
     }
 }
 /// <summary>
 ///     Sets the target box for this arrow
 /// </summary>
 /// <param name="targetBox"></param>
 public override void SetTargetBox(IGraphicalDisplay targetBox)
 {
     IVariable variable = Source as IVariable;
     Type type = targetBox as Type;
     if (variable != null && type != null)
     {
         variable.Type = type;
         Target = targetBox;
     }
 }
 /// <summary>
 ///     Sets the source box for this arrow
 /// </summary>
 /// <param name="initialBox"></param>
 public override void SetInitialBox(IGraphicalDisplay initialBox)
 {
     IVariable variable = initialBox as IVariable;
     Type type = Target as Type;
     if (variable != null && type != null)
     {
         variable.Type = type;
         Source = initialBox;
     }
 }
예제 #10
0
        /// <summary>
        ///     Sets the source box for this arrow
        /// </summary>
        /// <param name="initialBox"></param>
        public override void SetInitialBox(IGraphicalDisplay initialBox)
        {
            IVariable variable = initialBox as IVariable;
            Type      type     = Target as Type;

            if (variable != null && type != null)
            {
                variable.Type = type;
                Source        = initialBox;
            }
        }
예제 #11
0
        /// <summary>
        ///     Sets the target box for this arrow
        /// </summary>
        /// <param name="targetBox"></param>
        public override void SetTargetBox(IGraphicalDisplay targetBox)
        {
            IVariable variable = Source as IVariable;
            Type      type     = targetBox as Type;

            if (variable != null && type != null)
            {
                variable.Type = type;
                Target        = targetBox;
            }
        }
        /// <summary>
        ///     Sets the target box for this arrow
        /// </summary>
        /// <param name="targetBox"></param>
        public override void SetTargetBox(IGraphicalDisplay targetBox)
        {
            StructureElement structureElement = ReferencedModel as StructureElement;
            Type             type             = targetBox as Type;

            if (structureElement != null && type != null)
            {
                structureElement.Type = type;
                Target = targetBox;
            }
        }
예제 #13
0
        /// <summary>
        ///     Sets the source box for this arrow
        /// </summary>
        /// <param name="initialBox"></param>
        public override void SetInitialBox(IGraphicalDisplay initialBox)
        {
            Collection collection = initialBox as Collection;
            Type       type       = Target as Type;

            if (collection != null && type != null)
            {
                collection.Type = type;
                Source          = initialBox;
            }
        }
예제 #14
0
        /// <summary>
        ///     Sets the target box for this arrow
        /// </summary>
        /// <param name="targetBox"></param>
        public override void SetTargetBox(IGraphicalDisplay targetBox)
        {
            Collection collection = Source as Collection;
            Type       type       = targetBox as Type;

            if (collection != null && type != null)
            {
                collection.Type = type;
                Target          = targetBox;
            }
        }
예제 #15
0
        public override void visit(IXmlBBase obj, bool visitSubNodes)
        {
            IGraphicalDisplay graphicalDisplay = obj as IGraphicalDisplay;

            if (graphicalDisplay != null)
            {
                graphicalDisplay.X      = -1;
                graphicalDisplay.Y      = -1;
                graphicalDisplay.Width  = 0;
                graphicalDisplay.Height = 0;
                graphicalDisplay.Hidden = false;
                graphicalDisplay.Pinned = false;
            }
            base.visit(obj);
        }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="source"></param>
 /// <param name="target"></param>
 public OthewiseArrow(IGraphicalDisplay source, IGraphicalDisplay target)
     : base(source, target, "", null)
 {
 }
예제 #17
0
 /// <summary>
 ///     Sets the target box for this arrow
 /// </summary>
 /// <param name="targetBox"></param>
 public override void SetTargetBox(IGraphicalDisplay targetBox)
 {
 }
예제 #18
0
 /// <summary>
 ///     Sets the source box for this arrow
 /// </summary>
 /// <param name="initialBox"></param>
 public override void SetInitialBox(IGraphicalDisplay initialBox)
 {
 }
예제 #19
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="source"></param>
 /// <param name="target"></param>
 public OthewiseArrow(IGraphicalDisplay source, IGraphicalDisplay target)
     : base(source, target, "", null)
 {
 }
예제 #20
0
        /// <summary>
        ///     Sets the target box for this arrow
        /// </summary>
        /// <param name="targetBox"></param>
        public void SetTargetBox(IGraphicalDisplay targetBox)
        {
            RequirementSet target = (RequirementSet)targetBox;

            setTarget(target.Guid);
        }
예제 #21
0
 /// <summary>
 ///     Sets the target box for this arrow
 /// </summary>
 /// <param name="targetBox"></param>
 public void SetTargetBox(IGraphicalDisplay targetBox)
 {
     // We cannot change a call through this
 }
 /// <summary>
 ///     Sets the source box for this arrow
 /// </summary>
 /// <param name="initialBox"></param>
 public override void SetInitialBox(IGraphicalDisplay initialBox)
 {
 }
 /// <summary>
 ///     Sets the target box for this arrow
 /// </summary>
 /// <param name="targetBox"></param>
 public override void SetTargetBox(IGraphicalDisplay targetBox)
 {
 }
예제 #24
0
 /// <summary>
 ///     Sets the source box for this arrow
 /// </summary>
 /// <param name="initialBox"></param>
 public void SetInitialBox(IGraphicalDisplay initialBox)
 {
     // We cannot change a call through this
 }