Example #1
0
 public static List<BinaryTemporalConstraint> getBinaryConstraints(
     EPlanElement element, boolean mustExist) {
   ConstraintsMember constraintsMember = element.getMember(ConstraintsMember.class, mustExist);
   if (constraintsMember == null) {
     return Collections.emptyList();
   }
   return constraintsMember.getBinaryTemporalConstraints();
 }
Example #2
0
 public static void attachConstraint(final BinaryTemporalConstraint constraint) {
   ConstraintsMember memberA =
       constraint.getPointA().getElement().getMember(ConstraintsMember.class, true);
   memberA.getBinaryTemporalConstraints().add(constraint);
   ConstraintsMember memberB =
       constraint.getPointB().getElement().getMember(ConstraintsMember.class, true);
   memberB.getBinaryTemporalConstraints().add(constraint);
 }
Example #3
0
 public static void detachConstraint(final BinaryTemporalConstraint constraint) {
   EPlanElement elementA = constraint.getPointA().getElement();
   if (elementA != null) {
     ConstraintsMember memberA = elementA.getMember(ConstraintsMember.class, true);
     memberA.getBinaryTemporalConstraints().remove(constraint);
   }
   EPlanElement elementB = constraint.getPointB().getElement();
   if (elementB != null) {
     ConstraintsMember memberB = elementB.getMember(ConstraintsMember.class, true);
     memberB.getBinaryTemporalConstraints().remove(constraint);
   }
 }
Example #4
0
 public static List<PeriodicTemporalConstraint> getPeriodicConstraints(
     EPlanElement element, Timepoint timepoint, boolean mustExist) {
   ConstraintsMember constraintsMember = element.getMember(ConstraintsMember.class, mustExist);
   if (constraintsMember == null) {
     return Collections.emptyList();
   }
   List<PeriodicTemporalConstraint> result = new ArrayList<PeriodicTemporalConstraint>();
   for (PeriodicTemporalConstraint constraint :
       constraintsMember.getPeriodicTemporalConstraints()) {
     ConstraintPoint point = constraint.getPoint();
     if ((point.getElement() == element) && (point.getEndpoint() == timepoint)) {
       result.add(constraint);
     }
   }
   return result;
 }
 private Set<PeriodicTemporalConstraint> getRelevantConstraints(ConstraintsMember facet) {
   Set<PeriodicTemporalConstraint> result = new LinkedHashSet<PeriodicTemporalConstraint>();
   for (PeriodicTemporalConstraint constraint : facet.getPeriodicTemporalConstraints()) {
     if (isRelevantConstraint(constraint)) {
       result.add(constraint);
     }
   }
   return result;
 }
Example #6
0
 public static void detachConstraint(final PeriodicTemporalConstraint constraint) {
   ConstraintsMember member =
       constraint.getPoint().getElement().getMember(ConstraintsMember.class, true);
   member.getPeriodicTemporalConstraints().remove(constraint);
 }