cad.simcad.maps
Class Cell

java.lang.Object
  |
  +--cad.simcad.maps.Cell
All Implemented Interfaces:
java.util.Comparator, MapUnit, PathPlace, java.io.Serializable

public class Cell
extends java.lang.Object
implements PathPlace, java.io.Serializable, MapUnit

Describe a Cell units relative to a map See CellPath for Pathing attributes

Version:
1.0
Author:
Charles-Philip Bentley
See Also:
Serialized Form

Field Summary
protected  java.lang.String _sig
           
 
Constructor Summary
Cell(CellMap cellMap, Filler fil, int i, int j)
           
Cell(CellMap cellMap, Filler fil, int x, int y, int z)
          Create a new Cell with The CellMap as parent The first Filler as Fil x as the x-coordinate y as the y-coordinate z as the z-coordinate The default size of fillers is 3
 
Method Summary
 void addFiller(Filler fil)
           
 void clearCell()
           
 int compare(java.lang.Object cellOne, java.lang.Object cellTwo)
          Compare two Cells.
 boolean contained(PathPlace pp)
           
 boolean contains(PathPlace pp)
           
 boolean containsMapUnit(MapUnit mu)
          Returns true if the PathPlace contains the MapUnit given in argument
 boolean equals(PathPlace pp)
           
 PathPlace[] getAdjacentPathPlaces()
          Returns the array of adjacent PathPlace to this one.
 Filler[] getAllFillers()
          Returns all non null fillers as an array
 int getBiggestXLength()
           
 int getBiggestYLength()
           
 double getCostToReachFrom(MapUnit mu, PathUser pu)
          Returns the cost associated with originating cell and path user WE add to the basic cost of the cell, the cost due to the difference of altitude from the previous cell.
 double getCostToReachFrom(PathPlace pp, PathUser pu)
           
 MapUnit[] getDifference(PathPlace pp)
          Return the MapUnits of the PathPlace that are not contained in the given PathPlace
 int getEastX()
           
 double getElevation()
           
 int getFillersSize()
           
 Filler getFirstFiller()
           
 MapUnit[] getInnerMapUnitBoundary()
          Returns an Array of MapUnits that make the inner boundary of the PathPlace This method applied to a MapUnit PathPlace returns itself
 MapUnit[] getIntersection(PathPlace pp)
          Return the MapUnit contained in both PathPlaces( argument and object)
 AbstractMap getMap()
           
 MapUnit[] getMyAdjacentMapUnits(PathPlace pp)
          Returns the MapUnits of this PathPlace adjacent to the PathPlace given in argument
 int getNorthY()
           
 MapUnit[] getNotMyAdjacentMapUnits(PathPlace pp)
          Returns the MapUnits of the PathPlace given in argument adjacent to this PathPlace If the PathPlace in argument contains
 int getNumberOfUnits()
          Returns the number of units contained in the PathPlace
 MapUnit[] getOuterMapUnitBoundary()
          Returns an Array of MapUnits that make the outer boundary of the PathPlace This method applied to a MapUnit PathPlace returns the same MapUnits
 java.lang.String getSignature()
           
 int getSouthY()
           
 MapUnit[] getUnits()
          Returns an array of the MapUnit making up the PathPlace
 double getValue()
           
 int getWestX()
           
 int getX()
           
 int getY()
           
 int getZ()
           
 boolean isAdjacent(PathPlace pp)
          Returns true if the PathPlace given in argument is adjacent returns false otherwise
 void removeLastFiller()
           
 void resetAllCells()
          Reset all Cell attributes
 void resetCell()
          Reset all Cell value.
 void setFiller(Filler fil, int layer)
           
 void setFirstFiller(Filler fil)
           
 void setValue(double value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

_sig

protected java.lang.String _sig
Constructor Detail

Cell

public Cell(CellMap cellMap,
            Filler fil,
            int x,
            int y,
            int z)
Create a new Cell with The CellMap as parent The first Filler as Fil x as the x-coordinate y as the y-coordinate z as the z-coordinate The default size of fillers is 3


Cell

public Cell(CellMap cellMap,
            Filler fil,
            int i,
            int j)
Method Detail

addFiller

public void addFiller(Filler fil)

removeLastFiller

public void removeLastFiller()

getFillersSize

public int getFillersSize()

getAllFillers

public Filler[] getAllFillers()
Returns all non null fillers as an array


setFiller

public void setFiller(Filler fil,
                      int layer)

setFirstFiller

public void setFirstFiller(Filler fil)
Specified by:
setFirstFiller in interface MapUnit

getFirstFiller

public Filler getFirstFiller()
Specified by:
getFirstFiller in interface MapUnit

getX

public int getX()
Specified by:
getX in interface PathPlace

getY

public int getY()
Specified by:
getY in interface PathPlace

getZ

public int getZ()
Specified by:
getZ in interface MapUnit

getNorthY

public int getNorthY()
Specified by:
getNorthY in interface PathPlace

getSouthY

public int getSouthY()
Specified by:
getSouthY in interface PathPlace

getWestX

public int getWestX()
Specified by:
getWestX in interface PathPlace

getEastX

public int getEastX()
Specified by:
getEastX in interface PathPlace

setValue

public void setValue(double value)
Specified by:
setValue in interface PathPlace

getValue

public double getValue()
Specified by:
getValue in interface MapUnit

getElevation

public double getElevation()

resetCell

public void resetCell()
Reset all Cell value.

Post:
value = null;

resetAllCells

public void resetAllCells()
Reset all Cell attributes


clearCell

public void clearCell()

compare

public int compare(java.lang.Object cellOne,
                   java.lang.Object cellTwo)
Compare two Cells.

Specified by:
compare in interface java.util.Comparator

getCostToReachFrom

public double getCostToReachFrom(MapUnit mu,
                                 PathUser pu)
Returns the cost associated with originating cell and path user WE add to the basic cost of the cell, the cost due to the difference of altitude from the previous cell. We also add the bonus/malus of pathUser


getCostToReachFrom

public double getCostToReachFrom(PathPlace pp,
                                 PathUser pu)
Specified by:
getCostToReachFrom in interface PathPlace

isAdjacent

public boolean isAdjacent(PathPlace pp)
Description copied from interface: PathPlace
Returns true if the PathPlace given in argument is adjacent returns false otherwise

Specified by:
isAdjacent in interface PathPlace
Post:
true if this cell is adjacent to the given PathPlace

getAdjacentPathPlaces

public PathPlace[] getAdjacentPathPlaces()
Description copied from interface: PathPlace
Returns the array of adjacent PathPlace to this one.

Specified by:
getAdjacentPathPlaces in interface PathPlace

getNotMyAdjacentMapUnits

public MapUnit[] getNotMyAdjacentMapUnits(PathPlace pp)
Returns the MapUnits of the PathPlace given in argument adjacent to this PathPlace If the PathPlace in argument contains

Specified by:
getNotMyAdjacentMapUnits in interface PathPlace

getMyAdjacentMapUnits

public MapUnit[] getMyAdjacentMapUnits(PathPlace pp)
Returns the MapUnits of this PathPlace adjacent to the PathPlace given in argument

Specified by:
getMyAdjacentMapUnits in interface PathPlace
Pre:
A PathPlace
Post:
an array of the MapUnits contained in the current PathPlace adjacent the PathPlace given in argument, null if the two PathPlaces are not adjacent

getUnits

public MapUnit[] getUnits()
Returns an array of the MapUnit making up the PathPlace

Specified by:
getUnits in interface PathPlace

getInnerMapUnitBoundary

public MapUnit[] getInnerMapUnitBoundary()
Returns an Array of MapUnits that make the inner boundary of the PathPlace This method applied to a MapUnit PathPlace returns itself

Specified by:
getInnerMapUnitBoundary in interface PathPlace

getMap

public AbstractMap getMap()
Specified by:
getMap in interface PathPlace

getOuterMapUnitBoundary

public MapUnit[] getOuterMapUnitBoundary()
Returns an Array of MapUnits that make the outer boundary of the PathPlace This method applied to a MapUnit PathPlace returns the same MapUnits

Specified by:
getOuterMapUnitBoundary in interface PathPlace

getBiggestXLength

public int getBiggestXLength()
Specified by:
getBiggestXLength in interface PathPlace

getBiggestYLength

public int getBiggestYLength()
Specified by:
getBiggestYLength in interface PathPlace

contains

public boolean contains(PathPlace pp)
Specified by:
contains in interface PathPlace
Post:
true if the object contains entirely the given PathPlace

contained

public boolean contained(PathPlace pp)
Specified by:
contained in interface PathPlace
Post:
true if the object is contained entirely in the PathPlace

containsMapUnit

public boolean containsMapUnit(MapUnit mu)
Returns true if the PathPlace contains the MapUnit given in argument

Specified by:
containsMapUnit in interface PathPlace

getDifference

public MapUnit[] getDifference(PathPlace pp)
Return the MapUnits of the PathPlace that are not contained in the given PathPlace

Specified by:
getDifference in interface PathPlace
Post:
null if none

getIntersection

public MapUnit[] getIntersection(PathPlace pp)
Return the MapUnit contained in both PathPlaces( argument and object)

Specified by:
getIntersection in interface PathPlace

equals

public boolean equals(PathPlace pp)
Specified by:
equals in interface PathPlace

getNumberOfUnits

public int getNumberOfUnits()
Returns the number of units contained in the PathPlace

Specified by:
getNumberOfUnits in interface PathPlace

getSignature

public java.lang.String getSignature()

Logo

With the help of www.sourceforge.net and www.info.ucl.ac.be