Package cl.cromer.azaraka.ai
Class State
- java.lang.Object
-
- cl.cromer.azaraka.ai.State
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
State.Type
The type of operation
-
Constructor Summary
Constructors Constructor Description State(int x, int y, State.Type operation, State predecessor, int importance)
Initialize the state
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(State that)
This is used to compare priorities in a priority queueboolean
equals(java.lang.Object object)
Overridden equals to compare the x and y coordinatesint
getImportance()
Get the importance of the stateState.Type
getOperation()
Get the operation to performState
getPredecessor()
Get the previous stateint
getX()
Get the x position of the stateint
getY()
Get the y position of the stateint
hashCode()
void
setPriority(double priority)
Set the priority of a given state
-
-
-
Constructor Detail
-
State
public State(int x, int y, State.Type operation, State predecessor, int importance)
Initialize the state- Parameters:
x
- The x positiony
- The y positionoperation
- The operation to performpredecessor
- The previous stateimportance
- The importance of the objective
-
-
Method Detail
-
getX
public int getX()
Get the x position of the state- Returns:
- The x coordinate
-
getY
public int getY()
Get the y position of the state- Returns:
- The y coordinate
-
getOperation
public State.Type getOperation()
Get the operation to perform- Returns:
- The operation to perform
-
getPredecessor
public State getPredecessor()
Get the previous state- Returns:
- The previous state
-
getImportance
public int getImportance()
Get the importance of the state- Returns:
- Returns the importance
-
setPriority
public void setPriority(double priority)
Set the priority of a given state- Parameters:
priority
- The priority value
-
equals
public boolean equals(java.lang.Object object)
Overridden equals to compare the x and y coordinates- Overrides:
equals
in classjava.lang.Object
- Parameters:
object
- The object to compare with this- Returns:
- Returns true if they are the same or false otherwise
-
compareTo
public int compareTo(State that)
This is used to compare priorities in a priority queue- Specified by:
compareTo
in interfacejava.lang.Comparable<State>
- Parameters:
that
- The state to compare- Returns:
- Returns the value of Double.compare()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-