com.evelopers.unimod.core.stateworks
Class Association

java.lang.Object
  extended bycom.evelopers.unimod.core.ModelElement
      extended bycom.evelopers.unimod.core.stateworks.Association
All Implemented Interfaces:
java.io.Serializable

public class Association
extends ModelElement

An association between ClassElements

See Also:
Serialized Form

Field Summary
static java.lang.String CLIENT_ROLE_PROPERTY
           
static java.lang.String SUPPLIER_ROLE_PROPERTY
           
 
Fields inherited from class com.evelopers.unimod.core.ModelElement
listeners, name, NAME_PROPERTY, stereotype, STEREOTYPE_PROPERTY
 
Constructor Summary
protected Association(ClassElement source, ClassElement target)
           Creates new association using controlled object name as supplier role.
protected Association(ClassElement source, java.lang.String supplierRole, ClassElement target, java.lang.String clientRole)
           Creates new association.
 
Method Summary
 void attachSource()
           
 void attachTarget()
           
 void detachSource()
           
 void detachTarget()
           
 boolean equals(java.lang.Object o)
          This implementation considers ends of association and value of supplier's role to be immutable.
 java.lang.String getClientRole()
           
 ClassElement getSource()
          Returns state machine that is a client in this association.
 java.lang.String getSupplierRole()
          Supplier role is the name that is used be state machine to identify the controlled object.
 ClassElement getTarget()
          Returns controlled object that is a supplier in this association.
 int hashCode()
          This implementation considers ends of association and value of supplier role to be immutable.
 void reconnect(ClassElement newSource, ClassElement newTarget)
          Reconnects transition to new source and target states.
protected  void setClientRole(java.lang.String newClientRole)
           
 void setSource(ClassElement newSource)
          Sets new source class.
protected  void setSupplierRole(java.lang.String newSupplierRole)
           Sets newSupplierRole as a supplier role for this association.
 void setTarget(ClassElement newTarget)
          Sets new target state.
 
Methods inherited from class com.evelopers.unimod.core.ModelElement
accept, addPropertyChangeListener, firePropertyChange, getName, getStereotype, initListeners, removePropertyChangeListener, setName, setStereotype, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SUPPLIER_ROLE_PROPERTY

public static final java.lang.String SUPPLIER_ROLE_PROPERTY
See Also:
Constant Field Values

CLIENT_ROLE_PROPERTY

public static final java.lang.String CLIENT_ROLE_PROPERTY
See Also:
Constant Field Values
Constructor Detail

Association

protected Association(ClassElement source,
                      ClassElement target)

Creates new association using controlled object name as supplier role. Adds this association to list of associations of given state machine and to list of associations of given controlled object.

Note: sm, co and name of the co shouldn't be null. If implementation needs to pass null to this constructor then methods hashCode() and equals(java.lang.Object) must be overriden.


Association

protected Association(ClassElement source,
                      java.lang.String supplierRole,
                      ClassElement target,
                      java.lang.String clientRole)

Creates new association. Adds this association to list of associations of given state machine and to list of associations of given controlled object.

Note: sm, co and supplierRole shouldn't be null. If implementation needs to pass null to this constructor then methods hashCode() and equals(java.lang.Object) must be overriden.

Parameters:
supplierRole - name of controlled object that is used by state machine to identify controlled object.
Method Detail

getSource

public ClassElement getSource()
Returns state machine that is a client in this association.

Returns:
client of this association

getTarget

public ClassElement getTarget()
Returns controlled object that is a supplier in this association.

Returns:
supplier of this association

getSupplierRole

public java.lang.String getSupplierRole()
Supplier role is the name that is used be state machine to identify the controlled object.

Returns:
supplier's role of controlled object

getClientRole

public java.lang.String getClientRole()

reconnect

public void reconnect(ClassElement newSource,
                      ClassElement newTarget)
Reconnects transition to new source and target states.
  • Detachs from source and sets new source state
  • Detachs from target and sets new target state
  • Attaches to new source state
  • Attaches to new target state


  • setSource

    public void setSource(ClassElement newSource)
    Sets new source class. If old source class was not null - removes this association from outgoing associations of source class.

    Parameters:
    newSource - new source class. If null, then association will only removes itself from old source class outgoing associations list.

    attachSource

    public void attachSource()

    detachSource

    public void detachSource()

    setTarget

    public void setTarget(ClassElement newTarget)
    Sets new target state. If old target state was not null - removes this transition from incoming transitions of target state.


    attachTarget

    public void attachTarget()

    detachTarget

    public void detachTarget()

    setSupplierRole

    protected void setSupplierRole(java.lang.String newSupplierRole)

    Sets newSupplierRole as a supplier role for this association.

    Note: if this method is used by extending classes then methods hashCode() and equals(java.lang.Object) must be overriden.

    Parameters:
    newSupplierRole - new supplier role for this association.

    setClientRole

    protected void setClientRole(java.lang.String newClientRole)

    hashCode

    public int hashCode()
    This implementation considers ends of association and value of supplier role to be immutable.

    Specified by:
    hashCode in class ModelElement
    Returns:
    hash code based on hash codes of ends this association and hash code of supplier role.

    equals

    public boolean equals(java.lang.Object o)
    This implementation considers ends of association and value of supplier's role to be immutable.

    Specified by:
    equals in class ModelElement
    Parameters:
    o - an object to compare this association to
    Returns:
    whether this association is equal to o