net.sourceforge.cilib.games.items
Class GridLocation

java.lang.Object
  extended by net.sourceforge.cilib.type.types.container.AbstractList<Numeric>
      extended by net.sourceforge.cilib.type.types.container.Vector
          extended by net.sourceforge.cilib.games.items.GridLocation
All Implemented Interfaces:
Serializable, Iterable<Numeric>, ItemLocation, VectorMath, StructuredType<Numeric>, Randomizable, Resetable, Type, Cloneable

public class GridLocation
extends Vector
implements ItemLocation

Author:
leo A location inside a grid
See Also:
Serialized Form

Constructor Summary
GridLocation(GridLocation other)
           
GridLocation(int gridWidth, int gridHeight)
           
GridLocation(int xMax, int yMax, int zMax)
           
 
Method Summary
 boolean equals(Object other)
          Determine if this Vector is equal to the provided object.
 GridLocation getClone()
          Create a cloned copy of the current object and return it.
 double getDistance(DistanceMeasure measure, ItemLocation other)
          Calculate the distance between this location and another one with a specified distance measure
 void moveItem(Type amount)
          Move this location by the specified amount
 void setPosition(Vector newPos)
          Set the position of this GridLocation to the given vector
 
Methods inherited from class net.sourceforge.cilib.type.types.container.Vector
accept, add, addAll, append, clear, contains, cross, divide, dot, get, getBit, getDimension, getInt, getReal, hashCode, insert, isEmpty, iterator, multiply, norm, normalize, plus, prepend, randomize, remove, remove, removeAll, reset, set, setBit, setInt, setReal, size, subList, subtract, toArray
 
Methods inherited from class net.sourceforge.cilib.type.types.container.AbstractList
append, append, getRepresentation, prepend, prepend, toString, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.cilib.type.types.Type
hashCode
 

Constructor Detail

GridLocation

public GridLocation(int gridWidth,
                    int gridHeight)

GridLocation

public GridLocation(int xMax,
                    int yMax,
                    int zMax)

GridLocation

public GridLocation(GridLocation other)
Parameters:
Other -
Method Detail

setPosition

public void setPosition(Vector newPos)
Set the position of this GridLocation to the given vector

Parameters:
newPos - the specified position

getClone

public GridLocation getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface ItemLocation
Specified by:
getClone in interface StructuredType<Numeric>
Specified by:
getClone in interface Type
Specified by:
getClone in interface Cloneable
Overrides:
getClone in class Vector
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

getDistance

public double getDistance(DistanceMeasure measure,
                          ItemLocation other)
Calculate the distance between this location and another one with a specified distance measure

Specified by:
getDistance in interface ItemLocation
Parameters:
measure - The distance measure
other - The other location
Returns:
the distance

moveItem

public void moveItem(Type amount)
Move this location by the specified amount

Specified by:
moveItem in interface ItemLocation

equals

public boolean equals(Object other)
Determine if this Vector is equal to the provided object. If object is not the same type of object, false will be returned.

Specified by:
equals in interface ItemLocation
Specified by:
equals in interface Type
Overrides:
equals in class Vector
Parameters:
other - The object to test.
Returns:
true if equal to obj, false otherwise.
See Also:
Object.equals(Object)


Copyright © 2009 CIRG. All Rights Reserved.