Esempio n. 1
0
  @Override
  public boolean equals(Object obj) {
    if (!super.equals(obj)) {
      return false;
    } else if (obj instanceof OperationData) {
      OperationData data = (OperationData) obj;

      // Check all string preferences
      // -------------------------------
      if (isPreferencesEqual(preference, data.getPreferences()) // Check preconditions
          && isResourceBookingEqual(data.getResourceBooking(), resourceBooking)
          && isPreconditionEqual(
              data.getSequenceCondition(), sequenceCondition) // Check postconditions
          && isResourceBookingEqual(data.getPResourceBooking(), pResourceBooking)
          && isPreconditionEqual(
              data.getPSequenceCondition(), pSequenceCondition) // Check invariant
          && isPreconditionEqual(data.getSeqInvariant(), seqInvariant)
          && isListEqual(data.getActions(), actions)) {

        return true;
      }
    }

    return false;
  }
Esempio n. 2
0
  /**
   * Clone everything except id that is set to -1.
   *
   * @return
   */
  public Object clone() {
    OperationData ret = new OperationData(this.getName(), getId());

    if (getCopy()) {
      ret.setId(Model.newId());
      ret.setName(ret.getName() + "_" + ret.getId());
    }

    Set<String> keys = preference.keySet();

    for (String key : keys) {
      ret.setValue(key, getValue(key));
    }

    // Copy preconditions
    //        sequenceCondition

    ret.setSequenceCondition(cloneSequenceConditions(sequenceCondition));
    ret.setPSequenceCondition(cloneSequenceConditions(pSequenceCondition));

    ret.setSeqInvariant(cloneSequenceConditions(seqInvariant));

    ret.setResourceBooking(cloneResources(resourceBooking));
    ret.setPResourceBooking(cloneResources(pResourceBooking));

    ret.setActions(cloneActions(actions));
    return ret;
  }