## org.ascape.model.space
Class Geometry

    java.lang.Object
      org.ascape.model.space.Geometry

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable

    public class Geometry

extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

An encapsulation of all of the potential space definitions for any space of agents, and a factory for creating realizations of these scapes. At the moment, only one-dimensional and two-dimensional spaces are represented, but this class should eventually suport n-dimensional spaces, non-discrete spaces, and complex graphs. Users of this class are encouraged to use the static definitions whenever possible.

Since:
  1.0
Version:
  2.9, 2.9 4/12/02 fixed issue with static Geometry
Author:
  Miles Parker
See Also:
  Serialized Form

Field Summary
`static int` `EUCLIDIAN` In a Euclidian neighborhood, cells are considered neighbors if they meet the target at any point:
`static int` `MOORE` In a Moore neighborhood, cells are considered neighbors if they meet the target at any point:
`static int` `NOT_APPLICABLE` Neighborhood not applicable.
`static int` `VON_NEUMANN` In a von Neumann neighborhood, cells are considered neighbors if they share an edge with the target:

Constructor Summary
`Geometry()` Creates an empty geometry.
`Geometry(int dimensionCount)` Creates a non-periodic, discrete, geometry with no neighborhood definition.
`Geometry(int dimensionCount, boolean periodic)` Constructs a new fixed size, discrete geometry with the appropriate specifications and no neighborhood definition.
`Geometry(int dimensionCount, boolean periodic, boolean fixedSize, boolean discrete, int neighborhood)` Constructs a new geometry with the appropriate specifications.
`Geometry(int dimensionCount, boolean periodic, int neighborhood)` Constructs a new fixed size, discrete geometry with the appropriate specifications.

Method Summary
`java.lang.Object` `clone()` Clones the geometry.
`int` `getDimensionCount()` Returns the number of dimensions for this lattice.
`int` `getNeighborhood()` Returns the geometry's presumed neighborhood.
`boolean` `isDiscrete()` Is the geometry dicrete or continous?.
`boolean` `isFixedSize()` Returns wether this geometry has a fixed size.
`boolean` `isPeriodic()` Is the geometry periodic or aperiodic? (Do edges wrap to opposite side or not?).
`void` `setDimensionCount(int dimensionCount)` Sets the number of dimensions for this lattice.
`void` `setDiscrete(boolean discrete)` Sets the geometry to discrete or continous.
`void` `setFixedSize(boolean fixedSize)` Sets wether this geometry has a fixed size.
`void` `setNeighborhood(int symbol)` Set the neighborhood to use for calculations within this geometry.
`void` `setPeriodic(boolean periodic)` Sets the geometry to periodic or aperiodic.
`java.lang.String` `toString()` A string representation of this geometry.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### MOORE

    public static final int MOORE

  In a Moore neighborhood, cells are considered neighbors if they meet the target at any point:

       OOO
       OXO
       OOO

  .

  See Also:
    Constant Field Values

### VON_NEUMANN

    public static final int VON_NEUMANN

  In a von Neumann neighborhood, cells are considered neighbors if they share an edge with the target:

       O
       OXO
       O

  .

  See Also:
    Constant Field Values

### EUCLIDIAN

    public static final int EUCLIDIAN

  In a Euclidian neighborhood, cells are considered neighbors if they meet the target at any point:

       OOO
       OXO
       OOO

  This is just an Ascape convention, but you probably shouldn't be concerned with neighbors in a Euclidian model anyway. Instead, you will want to use distances, so that distance 1 = immeadiate vN distance, and >= Sqrt(2) = immeadiate Moore distance.

  See Also:
    Constant Field Values

### NOT_APPLICABLE

    public static final int NOT_APPLICABLE

  Neighborhood not applicable.

  See Also:
    Constant Field Values

Constructor Detail

### Geometry

    public Geometry(int dimensionCount,
                    boolean periodic,
                    boolean fixedSize,
                    boolean discrete,
                    int neighborhood)

  Constructs a new geometry with the appropriate specifications.

  Parameters:
    `dimensionCount` - the number of dimensions of the space
    `periodic` - if the space is connected, or if it has an edge
    `fixedSize` - if the space has a fixed extent
    `discrete` - if the geometry is made up of dicrete locations (nodes)
    `neighborhood` - whether the geometry' assumed neighborhood is Moore, von Neumann, or not applicable for this geometry

### Geometry

    public Geometry(int dimensionCount,
                    boolean periodic,
                    int neighborhood)

  Constructs a new fixed size, discrete geometry with the appropriate specifications.

  Parameters:
    `dimensionCount` - the number of dimensions of the space
    `periodic` - if the space is connected, or if it has an edge
    `neighborhood` - whether the geometry' assumed neighborhood is Moore, von Neumann, or not applicable for this geometry

### Geometry

    public Geometry(int dimensionCount,
                    boolean periodic)

  Constructs a new fixed size, discrete geometry with the appropriate specifications and no neighborhood definition.

  Parameters:
    `dimensionCount` - the number of dimensions of the space
    `periodic` - if the space is connected, or if it has an edge

### Geometry

    public Geometry(int dimensionCount)

  Creates a non-periodic, discrete, geometry with no neighborhood definition.

  Parameters:
    `dimensionCount` - the dimension count

### Geometry

    public Geometry()

  Creates an empty geometry. (No paramter constructor for Java Beans usage.)

Method Detail

### getDimensionCount

    public int getDimensionCount()

  Returns the number of dimensions for this lattice. Returns null if structure is not dimensional.

  Returns:
    the dimension count

### setDimensionCount

    public void setDimensionCount(int dimensionCount)

  Sets the number of dimensions for this lattice. Set to null for non-dimensional Geometry, otherwise, makes Geometry dimensional.

  Parameters:
    `dimensionCount` - the number of dimensions

### isPeriodic

    public boolean isPeriodic()

  Is the geometry periodic or aperiodic? (Do edges wrap to opposite side or not?).

  Returns:
    true, if is periodic

### setPeriodic

    public void setPeriodic(boolean periodic)

  Sets the geometry to periodic or aperiodic.

  Parameters:
    `periodic` - true if periodic (wraps around at each edge), false is aperiodic

### isDiscrete

    public boolean isDiscrete()

  Is the geometry dicrete or continous?.

  Returns:
    true, if is discrete

### setDiscrete

    public void setDiscrete(boolean discrete)

  Sets the geometry to discrete or continous.

  Parameters:
    `discrete` - true if discrete, false is continous

### getNeighborhood

    public int getNeighborhood()

  Returns the geometry's presumed neighborhood.

  Returns:
    the symbol MOORE, VON_NEUMANN, or NOT_APPLICABLE

### setNeighborhood

    public void setNeighborhood(int symbol)

  Set the neighborhood to use for calculations within this geometry.

  Parameters:
    `symbol` - the neighborhood, one of: MOORE, VON_NEUMANN, or NOT_APPLICABLE

### isFixedSize

    public boolean isFixedSize()

  Returns wether this geometry has a fixed size.

  Returns:
    true if the space is always the same size, false otherwise

### setFixedSize

    public void setFixedSize(boolean fixedSize)

  Sets wether this geometry has a fixed size.

  Parameters:
    `fixedSize` - should the space always have the same size?

### toString

    public java.lang.String toString()

  A string representation of this geometry.

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

### clone

    public java.lang.Object clone()

  Clones the geometry. Catches clone not supported, as all geometries support cloning.

  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    the object