internal bool AddConstraint(AtlasConstraintValidationQueue queue) { AtlasConstraint newConstraint = new AtlasConstraint(); try { ConstraintValidationStateOne(queue, newConstraint); constraints.Add(newConstraint); return(true); } catch (ArgumentException) { return(false); } }
internal void ConstraintValidationStateSix(AtlasConstraintValidationQueue queue, AtlasConstraint constraint) { if (queue.Peek() != null && queue.Peek().Equals("(")) { queue.Pop(); constraint.Constraints.Add(new AtlasConstraintOperator(AtlasLogicalOperator.LeftBracket)); ConstraintValidationStateOne(queue, constraint); if (queue.Pop().Equals(")")) { constraint.Constraints.Add(new AtlasConstraintOperator(AtlasLogicalOperator.RightBracket)); } else { throw new ArgumentException("Brackets were not properly closed"); } } else { constraint.Constraints.Add(GetFeature(queue.Pop())); } }
internal void ConstraintValidationStateFive(AtlasConstraintValidationQueue queue, AtlasConstraint constraint) { if (queue.Peek() != null && queue.Peek().Equals("¬")) { queue.Pop(); constraint.Constraints.Add(new AtlasConstraintOperator(AtlasLogicalOperator.Not)); } ConstraintValidationStateSix(queue, constraint); }
internal void ConstraintValidationStateFour(AtlasConstraintValidationQueue queue, AtlasConstraint constraint) { ConstraintValidationStateFive(queue, constraint); if (queue.Peek() != null && queue.Peek().Equals("∧")) { queue.Pop(); constraint.Constraints.Add(new AtlasConstraintOperator(AtlasLogicalOperator.And)); ConstraintValidationStateFour(queue, constraint); } }
internal void ConstraintValidationStateTwo(AtlasConstraintValidationQueue queue, AtlasConstraint constraint) { ConstraintValidationStateThree(queue, constraint); if (queue.Peek() != null && queue.Peek().Equals("⇒")) { queue.Pop(); constraint.Constraints.Add(new AtlasConstraintOperator(AtlasLogicalOperator.Implies)); ConstraintValidationStateTwo(queue, constraint); } }
internal void ConstraintValidationStateOne(AtlasConstraintValidationQueue queue, AtlasConstraint constraint) { ConstraintValidationStateTwo(queue, constraint); if (queue.Peek() != null && queue.Peek().Equals("<=>")) //TODO Placeholder { queue.Pop(); constraint.Constraints.Add(new AtlasConstraintOperator(AtlasLogicalOperator.Iff)); ConstraintValidationStateOne(queue, constraint); } }