Example #1
0
 protected void preConfigure() {
   super.preConfigure();
   // Add any extra motion constraints
   if (!getExtraConstraints().isEmpty()) {
     for (Constraint constraint : this.getExtraConstraints()) {
       if (constraint.getType().equals(ConstraintType.UPPER)) {
         getMovingEntity().addUpperConstraint(constraint);
       } else if (constraint.getType().equals(ConstraintType.LOWER)) {
         getMovingEntity().addLowerConstraint(constraint);
       } else if (constraint.getType().equals(ConstraintType.STATE)) {
         getMovingEntity().addStateConstraint(constraint);
       }
     } // close for
   } // close if
 }
Example #2
0
  private void postConfigure() {
    // Delete the non-permanent motion constraints
    try {
      for (Constraint constraint : getMovingEntity().getLowerConstraints()) {
        if (!constraint.isPermanent()) {
          getMovingEntity().deleteLowerConstraint(constraint);
        }
      }
      for (Constraint constraint : getMovingEntity().getUpperConstraints()) {
        if (!constraint.isPermanent()) {
          getMovingEntity().deleteUpperConstraint(constraint);
        }
      }
      for (Constraint constraint : getMovingEntity().getStateConstraints()) {
        if (!constraint.isPermanent()) {
          getMovingEntity().deleteStateConstraint(constraint);
        }
      }

    } catch (Exception ex) {
      System.out.println(ex.toString());
    }
  }