|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.portico.shared.model.RegionInstance
public class RegionInstance
This class represents a HLA 1.3 Region.
ARegionInstance
contains a number of Extent
, where each Extent
contains a
set of upper and lower bounds for a number of Dimension
s. Extent
s are contained
within the RegionInstance
in an array, so you must specify the size etc... on construction.
A RegionInstance
is also linked to a single routing Space
.
Field Summary | |
---|---|
private Extent[] |
extents
|
private int |
federateHandle
|
private int |
regionToken
|
private static long |
serialVersionUID
|
private int |
spaceHandle
|
Constructor Summary | |
---|---|
private |
RegionInstance(int regionToken,
int federateHandle,
int spaceHandle,
int extentCount)
This constructor is used in the clone() method only. |
|
RegionInstance(int federateHandle,
Space space,
int extentCount)
|
Method Summary | |
---|---|
private void |
checkIndex(int index)
Checks the provided index to make sure it is valid for this Region (greater than 0 and less than the number of contained extents-1). |
RegionInstance |
clone()
This method will do a deep-copy of the current , returning the new instance such that it has all the values that the original (current) instance has. |
void |
copy(RegionInstance other)
Remove any current state and copy all the values from the given RegionInstance
to this one. |
boolean |
equals(Object other)
Returns true if the parameter is an instance of RegionInstance and
it has the same region token as the current instance, false otherwise. |
Extent |
getExtent(int index)
Get the extent at the given index. |
int |
getFederateHandle()
Returns the handle of the federate that created this region |
long |
getNumberOfExtents()
|
long |
getRangeLowerBound(int index,
int dimension)
|
long |
getRangeLowerBoundNotificationLimit(int extentHandle,
int dimensionHandle)
For now, this just returns the exact same value as getRangeLowerBound(int, int) |
long |
getRangeUpperBound(int index,
int dimension)
|
long |
getRangeUpperBoundNotificationLimit(int extentHandle,
int dimensionHandle)
For now, this just returns the exact same value as getRangeUpperBound(int, int) |
int |
getSize()
Get the number of extents stored in this region |
int |
getSpaceHandle()
|
int |
getToken()
Get the unique handle for this region instance |
boolean |
overlapsWith(RegionInstance other)
This method will return true if the given region overlaps with the other
region, false otherwise. |
void |
setExtent(Extent extent,
int index)
Set the extent at the given index. |
void |
setRangeLowerBound(int index,
int dimension,
long bound)
Modify lower bound of extent along indicated dimension. |
void |
setRangeUpperBound(int index,
int dimension,
long bound)
Modify upper bound of extent along indicated dimension. |
void |
setToken(int regionHandle)
Set the unique handle for this region instance |
String |
toString()
|
String |
toVerboseString()
Generates a verbose string outlining the current state of the region. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private int spaceHandle
private int regionToken
private Extent[] extents
private int federateHandle
Constructor Detail |
---|
public RegionInstance(int federateHandle, Space space, int extentCount)
private RegionInstance(int regionToken, int federateHandle, int spaceHandle, int extentCount)
clone()
method only. It doesn't require a
Space
as it doesn't need to build the entire instance from scratch.
Method Detail |
---|
public RegionInstance clone()
clone
in class Object
public void copy(RegionInstance other)
RegionInstance
to this one. Note that this is a semi-clone in that it will create new instances
of all the contained Extent
s, rather than just using the same references that
exist in the other region. This way, changes to the other region will not affect this
region.
public boolean equals(Object other)
true
if the parameter is an instance of RegionInstance
and
it has the same region token as the current instance, false
otherwise. Note
that only the token is checked. The values contained in the two instances could be totally
different (if one had been changed locally for example).
equals
in class Object
private void checkIndex(int index) throws JArrayIndexOutOfBounds
JArrayIndexOutOfBounds
public Extent getExtent(int index) throws JArrayIndexOutOfBounds
JArrayIndexOutOfBounds
public int getSize()
public void setExtent(Extent extent, int index) throws JArrayIndexOutOfBounds
Extent
already exists at the given index, it will be overwritten.
JArrayIndexOutOfBounds
public int getToken()
public void setToken(int regionHandle)
public int getFederateHandle()
public boolean overlapsWith(RegionInstance other)
true
if the given region overlaps with the other
region, false
otherwise. This method will compare each of the Extent
s
in this region, with each of the Extent
s in the other region. If *any* extent from
this region overlaps with one from the other region, then true
will be
returned.
public String toString()
toString
in class Object
public String toVerboseString()
public long getNumberOfExtents()
public long getRangeLowerBound(int index, int dimension) throws JArrayIndexOutOfBounds
extentIndex
- intdimensionHandle
- int
JArrayIndexOutOfBounds
public long getRangeUpperBound(int index, int dimension) throws JArrayIndexOutOfBounds
extentIndex
- intdimensionHandle
- int
JArrayIndexOutOfBounds
public int getSpaceHandle()
public void setRangeLowerBound(int index, int dimension, long bound) throws JArrayIndexOutOfBounds
extentIndex
- intdimensionHandle
- intnewLowerBound
- long
JArrayIndexOutOfBounds
public void setRangeUpperBound(int index, int dimension, long bound) throws JArrayIndexOutOfBounds
extentIndex
- intdimensionHandle
- intnewUpperBound
- long
JArrayIndexOutOfBounds
public long getRangeLowerBoundNotificationLimit(int extentHandle, int dimensionHandle) throws JArrayIndexOutOfBounds
getRangeLowerBound(int, int)
JArrayIndexOutOfBounds
public long getRangeUpperBoundNotificationLimit(int extentHandle, int dimensionHandle) throws JArrayIndexOutOfBounds
getRangeUpperBound(int, int)
JArrayIndexOutOfBounds
|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |