Package org.jcsp.net2
Class NetBarrierLocation
- java.lang.Object
-
- org.jcsp.net2.NetLocation
-
- org.jcsp.net2.NetBarrierLocation
-
- All Implemented Interfaces:
java.io.Serializable
public final class NetBarrierLocation extends NetLocation implements java.io.Serializable
This class is a data structure representing the location of a NetBarrier in a network. The NetBarrierLocation consists of the NodeID of the Node on which the NetBarrier resides, and its Virtual Barrier Number, which is the number uniquely identifying the NetBarrier on said node.To acquire the NetBarrierLocation of a NetBarrier, use the getLocation method:
NetBarrierLocation location = (NetBarrierLocation)bar.getLocation();
The location returned depends on whether the NetBarrier is a client or a server end. A server end of a NetBarrier will return its own location. A client end of a NetBarrier will return the location of the server end it is connected to. This is because we consider the NetBarrier to be a single, virtual construct, with only one location. That location is where the server end of the NetBarrier is located.
- See Also:
NetBarrier
,NetLocation
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private NodeID
nodeID
The NodeID portion of the location structureprivate static long
serialVersionUID
The SUID of this object.private int
vbn
The index portion of the location structure
-
Constructor Summary
Constructors Constructor Description NetBarrierLocation(NodeID aNodeID, int aVBN)
Constructor to create a new NetBarrierLocation
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeAddress
getNodeAddress()
Gets the NodeAddress part of the locationNodeID
getNodeID()
Gets the NodeID part of the locationint
getVBN()
Gets the index part of the locationstatic NetBarrierLocation
parse(java.lang.String str)
Takes the string representation of a NetBarrierLocation and converts it back into an object for usage by JCSP.java.lang.String
toString()
Returns the string representation of the NetBarrierLocation.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
The SUID of this object. Required for Serialization.- See Also:
- Constant Field Values
-
nodeID
private final NodeID nodeID
The NodeID portion of the location structure
-
vbn
private final int vbn
The index portion of the location structure
-
-
Constructor Detail
-
NetBarrierLocation
public NetBarrierLocation(NodeID aNodeID, int aVBN)
Constructor to create a new NetBarrierLocation- Parameters:
aNodeID
- The NodeID portion of the NetBarrierLocationaVBN
- The index part of the NetBarrierLocation
-
-
Method Detail
-
getNodeID
public NodeID getNodeID()
Gets the NodeID part of the location- Specified by:
getNodeID
in classNetLocation
- Returns:
- The NodeID part of the NetBarrierLocation
-
getNodeAddress
public NodeAddress getNodeAddress()
Gets the NodeAddress part of the location- Specified by:
getNodeAddress
in classNetLocation
- Returns:
- The NodeAddress part of the NetBarrierLocation
-
getVBN
public int getVBN()
Gets the index part of the location- Returns:
- The VBN part of the NetBarrierLocation
-
toString
public java.lang.String toString()
Returns the string representation of the NetBarrierLocation. This takes the form of nbl://[NodeID]/[VBN]. This string representation has been created to allow other frameworks to interpret the NetBarrierLocation.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representation of the NetBarrierLocation
-
parse
public static NetBarrierLocation parse(java.lang.String str) throws java.lang.IllegalArgumentException
Takes the string representation of a NetBarrierLocation and converts it back into an object for usage by JCSP.- Parameters:
str
- The string representation of the NetBarrierLocation- Returns:
- A NetBarrierLocation produced from a String representation
- Throws:
java.lang.IllegalArgumentException
- Thrown if a non NetBarrierLocation is attempted to be parsed
-
-