copyright The Portico Project 2008.

org.portico.shared.model
Class Extent

java.lang.Object
  extended by org.portico.shared.model.Extent
All Implemented Interfaces:
Serializable

public class Extent
extends Object
implements Serializable

All the below relates to HLA 1.3

Extent is a construct used for DDM. Extents are created and populated at runtime (much like ACInstances) and are not metadata/fom data (like ACMetadatas).

The DDM constructs for Portico are defined as follows:

A Space is a metadata type that is defined within the FOM

Each Space defines a number of Dimensions that it consists of. (the Dimension class is also a metadata class).

A RegionInstance is defined at runtime. Each Region is associated with a SINGLE Space

A RegionInstance contains a number of Extents. Each Extent defines a bound (a minimum and maximum value) for each Dimension in the Space associated with the RegionInstance it is contained in.

Confused yet? Yeah, I was as well. Wait until you deal with 1516.

See Also:
Serialized Form

Nested Class Summary
 class Extent.Range
          A Range is a structure that contains an upper and lower bound for a specific Dimension.
 
Field Summary
private  Map<Integer,Extent.Range> ranges
           
private static long serialVersionUID
           
 
Constructor Summary
private Extent()
          This constructor is only for use during the cloning process in clone().
  Extent(Space space)
           
 
Method Summary
private  void checkDimension(int dimension)
          The 1.3 spec says that if there is no dimension in the extent for a requested action, an ArrayIndexOutOfBounds exception should be thrown.
protected  Extent clone()
          This method will create a full copy of the current Extent and return it.
 Map<Integer,Extent.Range> getAllRanges()
          Return the map containing all the range values for this extent.
 Extent.Range getRange(Dimension dimension)
          Returns the Extent.Range contained within this Extent for the given Dimension.
 Extent.Range getRange(int dimensionHandle)
          Returns the Extent.Range contained within this Extent for the given dimension handle.
 long getRangeLowerBound(int dimensionHandle)
          Fetches the lower bound for the range associated with the given dimension in this extent and returns it.
 long getRangeUpperBound(int dimensionHandle)
          Fetches the upper bound for the range associated with the given dimension in this extent and returns it.
 boolean overlapsWith(Extent otherExtent)
          Returns true if the ranges for all dimensions in this Extent overlap with the ranges for all the dimensions in the other Extent.
 void setRange(Dimension dimension, Extent.Range range)
          Sets the Extent.Range for the given Dimension in this Extent.
 void setRange(int dimensionHandle, Extent.Range range)
          Sets the Extent.Range for the given dimension handle in this Extent.
 void setRangeLowerBound(int dimensionHandle, long lowerBound)
          Sets the lower bound for the range associated with the given dimension in this extent.
 void setRangeUpperBound(int dimensionHandle, long upperBound)
          Sets the upper bound for the range associated with the given dimension in this extent.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

ranges

private Map<Integer,Extent.Range> ranges
Constructor Detail

Extent

public Extent(Space space)

Extent

private Extent()
This constructor is only for use during the cloning process in clone(). It doesn't require the Space as it doesn't need to create its ranges for the set of dimensions. Rather, the cloning process will copy the existing set.

Method Detail

clone

protected Extent clone()
This method will create a full copy of the current Extent and return it. It is used by the RegionInstance.clone() method.

Overrides:
clone in class Object

overlapsWith

public boolean overlapsWith(Extent otherExtent)
Returns true if the ranges for all dimensions in this Extent overlap with the ranges for all the dimensions in the other Extent.


getRange

public Extent.Range getRange(Dimension dimension)
Returns the Extent.Range contained within this Extent for the given Dimension. If none exists, null is returned.


setRange

public void setRange(Dimension dimension,
                     Extent.Range range)
Sets the Extent.Range for the given Dimension in this Extent. If the given Dimension or Extent.Range is null, no action is taken and nothing will be added.


getAllRanges

public Map<Integer,Extent.Range> getAllRanges()
Return the map containing all the range values for this extent. The key is the dimension handle the range is associated with.


checkDimension

private void checkDimension(int dimension)
                     throws JArrayIndexOutOfBounds
The 1.3 spec says that if there is no dimension in the extent for a requested action, an ArrayIndexOutOfBounds exception should be thrown. This method will do the appropriate check and throw an exception if that is the case.

Throws:
JArrayIndexOutOfBounds

getRange

public Extent.Range getRange(int dimensionHandle)
                      throws JArrayIndexOutOfBounds
Returns the Extent.Range contained within this Extent for the given dimension handle. If none exists, a JArrayIndexOutOfBounds is thrown.

Throws:
JArrayIndexOutOfBounds

setRange

public void setRange(int dimensionHandle,
                     Extent.Range range)
              throws JArrayIndexOutOfBounds
Sets the Extent.Range for the given dimension handle in this Extent. If the given Extent.Range is null, no action is taken and nothing will be added. If the dimension handle does not represent a dimension in the extent, a JArrayIndexOutOfBounds is thrown.

Throws:
JArrayIndexOutOfBounds

getRangeUpperBound

public long getRangeUpperBound(int dimensionHandle)
                        throws JArrayIndexOutOfBounds
Fetches the upper bound for the range associated with the given dimension in this extent and returns it. If the given dimension handle does not exist in this extent, a JArrayIndexOutOfBounds will be thrown.

Throws:
JArrayIndexOutOfBounds

getRangeLowerBound

public long getRangeLowerBound(int dimensionHandle)
                        throws JArrayIndexOutOfBounds
Fetches the lower bound for the range associated with the given dimension in this extent and returns it. If the given dimension handle does not exist in this extent, a JArrayIndexOutOfBounds will be thrown.

Throws:
JArrayIndexOutOfBounds

setRangeUpperBound

public void setRangeUpperBound(int dimensionHandle,
                               long upperBound)
                        throws JArrayIndexOutOfBounds
Sets the upper bound for the range associated with the given dimension in this extent. If the dimension does not exist, a JArrayIndexOutOfBounds will be thrown. There is no checking of the bound value, you can set an invalid value if you wish.

Throws:
JArrayIndexOutOfBounds

setRangeLowerBound

public void setRangeLowerBound(int dimensionHandle,
                               long lowerBound)
                        throws JArrayIndexOutOfBounds
Sets the lower bound for the range associated with the given dimension in this extent. If the dimension does not exist, a JArrayIndexOutOfBounds will be thrown. There is no checking of the bound value, you can set an invalid value if you wish.

Throws:
JArrayIndexOutOfBounds

copyright The Portico Project 2008.