blob: dec01fa0c19b5b26b961090a8f00da7e57a6ea61 [file] [log] [blame]
package org.eclipse.stem.ui.grapheditor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.stem.core.graph.EdgeLabel;
import org.eclipse.stem.definitions.edges.MigrationEdgeLabel;
import org.eclipse.stem.definitions.labels.CommonBorderRelationshipLabel;
import org.eclipse.stem.definitions.labels.RelativePhysicalRelationshipLabel;
public class ConnectionData
{
URI nodeAURI;
URI nodeBURI;
URI edgeURI;
EdgeLabel edgeLabel;
String edgeTitle;
String edgeIdentifier;
ConnectionData(URI nodeAURI, URI nodeBURI, URI edgeURI, EdgeLabel edgeLabel, String edgeTitle, String edgeIdentifier)
{
this.nodeAURI = nodeAURI;
this.nodeBURI = nodeBURI;
this.edgeURI = edgeURI;
this.edgeLabel = edgeLabel;
this.edgeIdentifier = edgeIdentifier;
this.edgeTitle = edgeTitle;
}
URI getNodeAURI()
{
return this.nodeAURI;
}
URI getNodeBURI()
{
return this.nodeBURI;
}
URI getEdgeURI()
{
return this.edgeURI;
}
EdgeLabel getEdgeLabel()
{
return this.edgeLabel;
}
int getEdgeLabelType()
{
if (this.edgeLabel instanceof MigrationEdgeLabel)
return GraphDefs.MIGRATION_EDGE;
if (this.edgeLabel instanceof RelativePhysicalRelationshipLabel)
return GraphDefs.CONTAINMENT_EDGE;
if (this.edgeLabel instanceof CommonBorderRelationshipLabel)
return GraphDefs.COMMON_BORDER_EDGE;
return GraphDefs.UNDEFINED;
}
String getEdgeIdentifier()
{
return this.edgeIdentifier;
}
String getEdgeTitle()
{
return this.edgeTitle;
}
void setEdgeLabelValue(String value)
{
switch (this.getEdgeLabelType())
{
case GraphDefs.MIGRATION_EDGE:
double newRate;
try {
newRate = Double.parseDouble(value);
} catch (NumberFormatException ex){
newRate = ((MigrationEdgeLabel)this.edgeLabel).getCurrentValue().getMigrationRate();
}
((MigrationEdgeLabel)this.edgeLabel).getCurrentValue().setMigrationRate(newRate);
break;
}
}
void setEdgeTitle(String edgeTitle)
{
this.edgeTitle = edgeTitle;
}
void setNodeAURI(String nodeAURI)
{
this.nodeAURI = URI.createURI(nodeAURI);
}
void setNodeBURI(String nodeBURI)
{
this.nodeBURI = URI.createURI(nodeBURI);
}
void setEdgeURI(String edgeURI)
{
this.edgeURI = URI.createURI(edgeURI);
}
}