Ejemplo n.º 1
0
        public override void Handle(Goal element, ParsedExceptAttribute attribute, KAOSModel model)
        {
            var exception = new GoalException(model);

            exception.AnchorGoalIdentifier       = element.Identifier;
            exception.ResolvingGoalIdentifier    = attribute.CountermeasureIdentifier;
            exception.ResolvedObstacleIdentifier = attribute.ObstacleIdentifier;

            if (!model.goalRepository.GoalExists(attribute.CountermeasureIdentifier))
            {
                model.Add(new Goal(model)
                {
                    Identifier = attribute.CountermeasureIdentifier,
                    Implicit   = true
                });
            }

            if (!model.obstacleRepository.ObstacleExists(attribute.ObstacleIdentifier))
            {
                model.Add(new Obstacle(model)
                {
                    Identifier = attribute.ObstacleIdentifier,
                    Implicit   = true
                });
            }

            model.Add(exception);
        }
Ejemplo n.º 2
0
        public void Add(GoalException exception)
        {
            if (GoalExceptions.ContainsKey(exception.Identifier))
            {
                throw new ArgumentException(string.Format("Goal Exception identifier already exist: {0}", exception.Identifier));
            }

            GoalExceptions.Add(exception.Identifier, exception);
        }
        void KeepObstructedGoal(Resolution resolution)
        {
            // Create the exception
            var exception = new GoalException(_model);

            exception.AnchorGoalIdentifier       = resolution.AnchorIdentifier;
            exception.ResolvedObstacleIdentifier = resolution.ObstacleIdentifier;
            exception.ResolvingGoalIdentifier    = resolution.ResolvingGoalIdentifier;

            _model.Add(exception);

            var anchor = _model.Goal(resolution.AnchorIdentifier);

            Propagate(anchor, resolution.Obstacle());

            Obstacle obstacle = resolution.Obstacle();

            obstacle.Resolved = true;
        }
        protected void Render(GoalException exception)
        {
            if (!shapes.ContainsKey(exception.ResolvingGoalIdentifier))
            {
                return;
            }

            if (!shapes.ContainsKey(exception.AnchorGoalIdentifier))
            {
                return;
            }

            var anchorGoalGraphic    = shapes [exception.AnchorGoalIdentifier].First();
            var resolvingGoalGraphic = shapes [exception.ResolvingGoalIdentifier].First();

            var topArrow = GetArrow(anchorGoalGraphic, resolvingGoalGraphic);

            topArrow.Style.Stroke.Pattern = StrokePattern.Dashed;
            AddText(topArrow, @"\b Except \b0" + exception.Obstacle().FriendlyName);
            Add(exception.Identifier, topArrow);
        }
Ejemplo n.º 5
0
        public BDDNode GetObstructionSet(GoalException exception)
        {
            var child = exception.ResolvingGoal();

            return(GetObstructionSet(child));
        }