public boolean identityEquals(Object elem) {
    if (!(elem instanceof ElementInMove_c)) {
      return false;
    }

    ElementInMove_c me = (ElementInMove_c) elem;
    // don't allow an empty id-value to produce a false positive result;
    // in this case, use whether the two instances are actually the same
    // one in memory, instead
    if (!getModelRoot().isCompareRoot()
        && ((IdAssigner.NULL_UUID.equals(getElementid())
                || IdAssigner.NULL_UUID.equals(((ElementInMove_c) elem).getElementid()))
            && this != elem)) {
      return false;
    }
    if (!getElementid().equals(((ElementInMove_c) elem).getElementid())) return false;
    // don't allow an empty id-value to produce a false positive result;
    // in this case, use whether the two instances are actually the same
    // one in memory, instead
    if (!getModelRoot().isCompareRoot()
        && ((IdAssigner.NULL_UUID.equals(getDiagramid())
                || IdAssigner.NULL_UUID.equals(((ElementInMove_c) elem).getDiagramid()))
            && this != elem)) {
      return false;
    }
    if (!getDiagramid().equals(((ElementInMove_c) elem).getDiagramid())) return false;
    return true;
  }
  public void unrelateAcrossR301From(Graphelement_c target, boolean notifyChanges) {
    if (target == null) return;

    if (IsSupertypeGraphelement == null) return; // already unrelated

    if (target != IsSupertypeGraphelement) {
      Exception e = new Exception();
      e.fillInStackTrace();
      CanvasPlugin.logError("Tried to unrelate from non-related instance across R301", e);
      return;
    }

    if (target != null) {
      target.clearBackPointerR301To(this);
    }

    if (IsSupertypeGraphelement != null) {

      m_elementid = IsSupertypeGraphelement.getElementid();
      if (IdAssigner.NULL_UUID.equals(m_elementid)) {
        m_elementid = IsSupertypeGraphelement.getElementidCachedValue();
      }
      IsSupertypeGraphelement = null;
      target.removeRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "301", "");
        Ooaofgraphics.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
  public void relateAcrossR301To(Graphelement_c target, boolean notifyChanges) {
    if (target == null) return;

    if (target == IsSupertypeGraphelement) return; // already related

    if (IsSupertypeGraphelement != target) {

      Object oldKey = getInstanceKey();

      if (IsSupertypeGraphelement != null) {

        IsSupertypeGraphelement.clearBackPointerR301To(this);

        if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$
          Ooaofgraphics.log.println(
              ILogger.CONSISTENCY,
              "Graphnode_c.relateAcrossR301To(Graphelement_c target)",
              "Relate performed across R301 from GraphNode to GraphElement without unrelate of prior instance.");
        }
      }

      IsSupertypeGraphelement = target;
      if (IdAssigner.NULL_UUID.equals(target.getElementid())) {
        // do not update cached value
      } else {
        // update cached value
        m_elementid = target.getElementidCachedValue();
      }
      updateInstanceKey(oldKey, getInstanceKey());
      target.setBackPointerR301To(this);
      target.addRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "301", "");
        Ooaofgraphics.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
 public java.util.UUID getElementidCachedValue() {
   if (!IdAssigner.NULL_UUID.equals(m_elementid)) return m_elementid;
   else return getElementid();
 }
 public java.util.UUID getDiagramidCachedValue() {
   if (!IdAssigner.NULL_UUID.equals(m_diagramid)) return m_diagramid;
   else return getDiagramid();
 }