org.ascape.model.space
Class CoordinateContinuous

java.lang.Object
  extended by org.ascape.model.space.Coordinate
      extended by org.ascape.model.space.CoordinateContinuous
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Coordinate1DContinuous

public abstract class CoordinateContinuous
extends Coordinate
implements java.lang.Cloneable, java.io.Serializable

The base class for a location within a continuous space.

Since:
2.0
Version:
2.0
Author:
Miles Parker
See Also:
Serialized Form

Field Summary
protected  double[] values
          Each element of this array represents the position of this coordinate within a dimension, the index of the element.
 
Constructor Summary
CoordinateContinuous()
          Creates a new discrete coordinate.
CoordinateContinuous(double value)
          Creates a new coordinate with the provided position.
CoordinateContinuous(double[] values)
          Creates a new coordinate with the provided dimensional positions.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Determines whether this coordinate is equal to another.
 int getDimensionCount()
          Returns the number of dimensions this coordinate has.
 double getProduct()
          Returns the product of all the dimension's values.
 double getValueAtDimension(int dimension)
          Gets the value at the specified (1-based) dimension.
 double[] getValues()
          Returns an array of position values for each dimension.
 void setValueAtDimension(int dimension, double value)
          Sets the value at the specified (1-based) dimension.
 void setValues(double[] values)
          Sets the position values for this coordinate.
 java.lang.String toString()
          Returns a string representing this coordinate.
 
Methods inherited from class org.ascape.model.space.Coordinate
add, getDistance
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

values

protected double[] values
Each element of this array represents the position of this coordinate within a dimension, the index of the element.

Constructor Detail

CoordinateContinuous

public CoordinateContinuous()
Creates a new discrete coordinate.


CoordinateContinuous

public CoordinateContinuous(double[] values)
Creates a new coordinate with the provided dimensional positions.

Parameters:
values - the values

CoordinateContinuous

public CoordinateContinuous(double value)
Creates a new coordinate with the provided position.

Parameters:
value - the value
Method Detail

getDimensionCount

public int getDimensionCount()
Returns the number of dimensions this coordinate has.

Returns:
the dimension count

getValues

public final double[] getValues()
Returns an array of position values for each dimension.

Returns:
the values

setValues

public final void setValues(double[] values)
Sets the position values for this coordinate.

Parameters:
values - the values

getValueAtDimension

public final double getValueAtDimension(int dimension)
Gets the value at the specified (1-based) dimension.

Parameters:
dimension - the dimension
Returns:
the value at dimension

setValueAtDimension

public final void setValueAtDimension(int dimension,
                                      double value)
Sets the value at the specified (1-based) dimension.

Parameters:
dimension - the dimension
value - the value

getProduct

public final double getProduct()
Returns the product of all the dimension's values. (A measure of volume of the region enclosed by {0, ..., n} and this coordinate.)

Returns:
the product

equals

public boolean equals(java.lang.Object obj)
Determines whether this coordinate is equal to another. Does it have the same values?

Overrides:
equals in class java.lang.Object
Parameters:
obj - the obj
Returns:
true, if equals

toString

public java.lang.String toString()
Returns a string representing this coordinate.

Overrides:
toString in class java.lang.Object
Returns:
the string


Copyright © 1998-2008 The Brookings Institution, NuTech Solutions, Metascape, LLC All Rights Reserved.