modhelxs.abstractsemantics
Class Pin

java.lang.Object
  extended by modhelxs.abstractsemantics.NamedEntity
      extended by modhelxs.abstractsemantics.Pin
All Implemented Interfaces:
NamedEntity, Pin

public class Pin
extends NamedEntity
implements Pin

An implementation of Pin for the abstract semantics of ModHel'X.

Author:
boulange

Field Summary
private  java.util.Set<Relation> incoming_
          The relations that have this pin as target.
private  java.util.Set<Relation> outgoing_
          The relations that have this pin as origin.
private  ObservableEntity owner_
          The entity this pin belongs to.
private  java.util.List<Pin> predecessors_
          The list of pins which are the origin of a relation which has this pin as target.
private  java.util.List<Pin> successors_
          The list of pins which are the target of a relation which has this pin as origin.
private  java.util.List<Token> tokens_
          The tokens present on this pin.
 
Constructor Summary
Pin(java.lang.String name, java.lang.Object... properties)
          Build a new pin named name.
 
Method Summary
 void addIncoming(Relation r)
          Add an incoming relation to this pin.
 void addOutgoing(Relation r)
          Add an outgoing relation to this pin.
 Pin addToken(Token token)
          Add a token to this pin.
 Pin clearTokens()
          Delete all tokens on this pin.
 Relation connectTo(Pin dst)
           
 java.util.Collection<Relation> getIncomingRelations()
          Get the incoming relations for this pin (relations whose target is this pin).
 java.util.Collection<Relation> getOutgoingRelations()
          Get the outgoing relations for this pin (relations whose origin is this pin).
 ObservableEntity getOwner()
          Get the observable entity which has this pin in its interface.
 java.util.Collection<Pin> getPredecessorPins()
          Get the predecessors of this pin (pins that are directly connected to it).
 java.util.Collection<Pin> getSuccessorPins()
          Get the successors of this pin (pins to which it is directly connected).
 Token getToken(boolean remove)
          Get a token from this pin, and remove it if remove is true.
 java.util.Collection<Token> getTokens()
          Get the tokens that are on this pin.
 boolean hasToken()
          Tell if this pin has at least a token on it.
<T> Pin
putValue(T value)
          Add a token with a given value on this pin.
<T> Pin
putValue(Value<T> value)
          Add a token with a given value on this pin.
<T> T
readValue(java.lang.Class<T> type, boolean remove)
          Get a token value from this pin, and remove the token if remove is true.
 void setOwner(ObservableEntity o)
          Set the owner of this pin.
 java.lang.String toString()
           
 
Methods inherited from class modhelxs.abstractsemantics.NamedEntity
getName, getProperties, getProperty, hasProperty, removeProperty, setName, setProperties, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface modhelxs.ecore.NamedEntity
getName, getProperties, setName
 

Field Detail

owner_

private ObservableEntity owner_
The entity this pin belongs to.


tokens_

private java.util.List<Token> tokens_
The tokens present on this pin.


incoming_

private java.util.Set<Relation> incoming_
The relations that have this pin as target.


outgoing_

private java.util.Set<Relation> outgoing_
The relations that have this pin as origin.


successors_

private java.util.List<Pin> successors_
The list of pins which are the target of a relation which has this pin as origin.


predecessors_

private java.util.List<Pin> predecessors_
The list of pins which are the origin of a relation which has this pin as target.

Constructor Detail

Pin

public Pin(java.lang.String name,
           java.lang.Object... properties)
Build a new pin named name.

Method Detail

setOwner

public void setOwner(ObservableEntity o)
Set the owner of this pin.


getOwner

public ObservableEntity getOwner()
Description copied from interface: Pin
Get the observable entity which has this pin in its interface.

Specified by:
getOwner in interface Pin

connectTo

public Relation connectTo(Pin dst)

hasToken

public boolean hasToken()
Tell if this pin has at least a token on it.


getToken

public Token getToken(boolean remove)
Get a token from this pin, and remove it if remove is true.


readValue

public <T> T readValue(java.lang.Class<T> type,
                       boolean remove)
Get a token value from this pin, and remove the token if remove is true.


getTokens

public java.util.Collection<Token> getTokens()
Get the tokens that are on this pin.


addToken

public Pin addToken(Token token)
Add a token to this pin.


putValue

public <T> Pin putValue(T value)
Add a token with a given value on this pin.


putValue

public <T> Pin putValue(Value<T> value)
Add a token with a given value on this pin.


clearTokens

public Pin clearTokens()
Delete all tokens on this pin.


getIncomingRelations

public java.util.Collection<Relation> getIncomingRelations()
Description copied from interface: Pin
Get the incoming relations for this pin (relations whose target is this pin).

Specified by:
getIncomingRelations in interface Pin

getOutgoingRelations

public java.util.Collection<Relation> getOutgoingRelations()
Description copied from interface: Pin
Get the outgoing relations for this pin (relations whose origin is this pin).

Specified by:
getOutgoingRelations in interface Pin

addIncoming

public void addIncoming(Relation r)
Add an incoming relation to this pin.


addOutgoing

public void addOutgoing(Relation r)
Add an outgoing relation to this pin.


getSuccessorPins

public java.util.Collection<Pin> getSuccessorPins()
Get the successors of this pin (pins to which it is directly connected).


getPredecessorPins

public java.util.Collection<Pin> getPredecessorPins()
Get the predecessors of this pin (pins that are directly connected to it).


toString

public java.lang.String toString()
Overrides:
toString in class NamedEntity