|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpl.edu.agh.cast.model.visual.backward.VisualModelCachingFactory
public class VisualModelCachingFactory
Class responsible for creating visual model elements from base model elements. This class implements a caching mechanism that creates new nodes, connections and connection groups only if they don't exist yet.
| Field Summary | |
|---|---|
protected ConnectionGroupAttributeManager |
connectionGroupPropertyManager
Connection group attribute manager to use for all nodes. |
protected Map<Connection,ConnectionGroup> |
connectionToConnectionGroup
Maps Connection to ConnectionGroup. |
protected Map<Connection,IRelation> |
connectionToRelation
Maps Connection to IRelation. |
protected Map<String,Node> |
entityToNode
Maps IEntity.getId() to Node. |
protected NodeAttributeManager |
nodeAttributeManager
Node attribute manager to use for all nodes. |
protected Map<IRelation,Connection> |
relationToConnection
Maps IRelation to Connection. |
| Constructor Summary | |
|---|---|
VisualModelCachingFactory()
No argument constructor (for deserialization purpose). |
|
VisualModelCachingFactory(NodeAttributeManager nodePropMgr,
ConnectionGroupAttributeManager connectionGroupPropMgr)
Creates new factory with given node and connection group attribute managers. |
|
| Method Summary | |
|---|---|
boolean |
containsNode(String nodeId)
Returns true if factory has created a node with specific id. |
protected void |
copyAttributes(Mappable mappable,
ModelElement element)
Copies entity's attributes to a node. |
Connection |
copyConnection(Connection conn)
Creates a copy of given Connection. |
ConnectionGroup |
copyConnectionGroup(ConnectionGroup cg,
Connection conn)
Creates a copy of given ConnectionGroup containing specified Connection. |
Node |
copyNode(Node node)
Creates a copy of given Node. |
Connection |
createConnection(IRelation relation)
Returns a connection corresponding to the given relation, creating it if necessary. |
Connection |
createConnection(IRelation relation,
Set<String> currentDS)
Returns a connection corresponding to the given relation, creating it if necessary. |
ConnectionGroup |
createConnectionGroup(Connection connection)
Returns a connection group corresponding to the given connection, creating it if necessary. |
Node |
createNode(IEntity entity)
Returns a node corresponding to the given entity, creating if it necessary. |
Node |
createNode(IEntity entity,
Set<String> currentDS)
Returns a node corresponding to the given entity, creating if it necessary. |
Connection |
findConnection(String sourceNodeId,
String targetNodeId,
Date date)
Returns Connection based on given node id's and date. |
Node |
findNode(String nodeId)
Returns Node based on given id. |
IRelation |
findRelation(Connection conn)
Find relation which was used to create given connection. |
protected ConnectionGroup |
getConnectionGroup(Node source,
Node target)
Find ConnectionGroup for given nodes. |
Collection<Connection> |
getConnections()
|
int |
getNodeCount()
|
Collection<Node> |
getNodes()
|
protected Collection<IRelation> |
getRelations()
Returns all relations kept in the local (diagram) model |
void |
initAfterDeserialization(Set<Connection> connections)
Initializes all fields after custom de-serialization. |
void |
removeConnection(Connection c)
Removes given Connection from cache. |
void |
removeNode(Node node)
Removes given Node from cache. |
protected void |
setupConnectionGroups()
|
boolean |
wasCreatedHere(Connection connection)
Checks whether given Connection was created by this factory. |
boolean |
wasCreatedHere(ConnectionGroup cg)
Checks whether given ConnectionGroup was created by this factory. |
boolean |
wasCreatedHere(Node node)
Checks whether given Node was created by this factory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Map<String,Node> entityToNode
IEntity.getId() to Node.
protected Map<IRelation,Connection> relationToConnection
IRelation to Connection.
protected Map<Connection,IRelation> connectionToRelation
Connection to IRelation.
protected Map<Connection,ConnectionGroup> connectionToConnectionGroup
Connection to ConnectionGroup.
protected NodeAttributeManager nodeAttributeManager
protected ConnectionGroupAttributeManager connectionGroupPropertyManager
| Constructor Detail |
|---|
public VisualModelCachingFactory(NodeAttributeManager nodePropMgr,
ConnectionGroupAttributeManager connectionGroupPropMgr)
nodePropMgr - NodeAttributeManager to useconnectionGroupPropMgr - ConnectionGroupAttributeManager to usepublic VisualModelCachingFactory()
| Method Detail |
|---|
public Node createNode(IEntity entity)
entity - IEntity to return node for
Node that wraps given entity
public Node createNode(IEntity entity,
Set<String> currentDS)
currentDS collection holds the IDs of already processed nodes from current
IDataSet. This is to prevent multiple processing of same node's attributes. If
the parameter is null then such processing is performed each time.
entity - IEntity to return node forcurrentDS - collection of the IDs of already processed nodes from current
IDataSet
Node that wraps given entitypublic Connection createConnection(IRelation relation)
relation - input relation
public Connection createConnection(IRelation relation,
Set<String> currentDS)
relation - input relationcurrentDS - see createNode(IEntity, Set) for parameter details
public ConnectionGroup createConnectionGroup(Connection connection)
connection - connection to find connection group for
ConnectionGroup containing given connection
protected ConnectionGroup getConnectionGroup(Node source,
Node target)
ConnectionGroup for given nodes. Create it if it does not exist.
source - connection group source Nodetarget - connection group target Node
protected void copyAttributes(Mappable mappable,
ModelElement element)
mappable - attributes sourceelement - attributes destinationpublic int getNodeCount()
public Collection<Node> getNodes()
public Collection<Connection> getConnections()
public boolean wasCreatedHere(Node node)
Node was created by this factory.
node - node to check
true if node was created by this instance of the factorypublic boolean wasCreatedHere(Connection connection)
Connection was created by this factory.
connection - connection to check
true if connection was created by this instance of the factorypublic boolean wasCreatedHere(ConnectionGroup cg)
ConnectionGroup was created by this factory.
cg - connection group to check
true if cg was created by this instance of the factorypublic void removeNode(Node node)
Node from cache.
node - node to removepublic void removeConnection(Connection c)
Connection from cache.
c - connection to removepublic boolean containsNode(String nodeId)
nodeId - node id
public Node copyNode(Node node)
Node.
node - node to copy
nodepublic Connection copyConnection(Connection conn)
Connection.
conn - connection to copy
conn
public ConnectionGroup copyConnectionGroup(ConnectionGroup cg,
Connection conn)
ConnectionGroup containing specified Connection.
cg - connection group to copyconn - connection contained by copied group
cgpublic Node findNode(String nodeId)
Node based on given id.
nodeId - id of the node to find
public Connection findConnection(String sourceNodeId,
String targetNodeId,
Date date)
Connection based on given node id's and date.
sourceNodeId - id of the connection source nodetargetNodeId - id of the connection target nodedate - date of the connection
public IRelation findRelation(Connection conn)
conn - The connection for which the relation is searched
public void initAfterDeserialization(Set<Connection> connections)
connections - collection of Connections to be used to initialize this instance of factoryprotected Collection<IRelation> getRelations()
protected void setupConnectionGroups()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||