## edu.cwru.SimpleRTS.environment
Class State

    java.lang.Object
      edu.cwru.SimpleRTS.environment.State

All Implemented Interfaces:
  java.io.Serializable

    public class State

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

See Also:
  Serialized Form

Nested Class Summary
`static class` `State.StateBuilder` Builder class that allows one-time access to a new state for construction purposes.
`static class` `State.StateView` Provides a read-only view of class values

Constructor Summary
`State()`

Method Summary
`void` `addResource(ResourceNode resource)`
`void` `addTemplate(Template t, int player)`
`void` `addUnit(Unit u)`
`boolean` `checkValidSupplyAddition(int player, int amounttoadd, int offsettingcapgain)`
`void` `depositResources(int player, ResourceType type, int amount)`
`boolean` `doesPlayerHaveUnit(int player, int templateid)`
`boolean` `equals(java.lang.Object obj)`
`ActionLogger` `getActionLog()`
`int[]` `getClosestPosition(int x, int y)` Find the closest unoccupied position using a spiraling out search pattern
`EventLogger` `getEventLog()`
`ResourceNode` `getResource(int resourceId)`
`int` `getResourceAmount(int player, ResourceType type)`
`java.util.List<ResourceNode>` `getResources()`
`int` `getSupplyAmount(int player)`
`int` `getSupplyCap(int player)`
`Template` `getTemplate(int templateId)`
`Template` `getTemplate(int player, java.lang.String name)`
`java.util.Map<java.lang.Integer,Template>` `getTemplates(int player)`
`java.lang.String` `getTextString()`
`int` `getTurnNumber()`
`Unit` `getUnit(int unitId)`
`java.util.Map<java.lang.Integer,Unit>` `getUnits()`
`java.util.Map<java.lang.Integer,Unit>` `getUnits(int player)`
`State.StateView` `getView()`
`int` `getXExtent()`
`int` `getYExtent()`
`int` `hashCode()`
`boolean` `hasUpgrade(java.lang.Integer upgradetemplateid, int player)`
`boolean` `inBounds(int x, int y)`
`void` `incrementTurn()`
`boolean` `positionAvailable(int x, int y)`
`void` `removeResourceNode(int resourceID)`
`void` `removeUnit(int unitID)`
`ResourceNode` `resourceAt(int x, int y)`
`void` `setSize(int x, int y)`
`boolean` `tryProduceUnit(Unit u)`
`boolean` `tryProduceUpgrade(Upgrade upgrade)`
`Unit` `unitAt(int x, int y)`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### State

    public State()

Method Detail

### getActionLog

    public ActionLogger getActionLog()

### getEventLog

    public EventLogger getEventLog()

### getTurnNumber

    public int getTurnNumber()

### getUnits

    public java.util.Map<java.lang.Integer,Unit> getUnits()

### getUnit

    public Unit getUnit(int unitId)

### getResource

    public ResourceNode getResource(int resourceId)

### addResource

    public void addResource(ResourceNode resource)

### getClosestPosition

    public int[] getClosestPosition(int x,
                                    int y)

  Find the closest unoccupied position using a spiraling out search pattern

  Parameters:
    `x` -
    `y` -
  Returns:

### getTemplate

    public Template getTemplate(int templateId)

### getTemplate

    public Template getTemplate(int player,
                                java.lang.String name)

### getTemplates

    public java.util.Map<java.lang.Integer,Template> getTemplates(int player)

### doesPlayerHaveUnit

    public boolean doesPlayerHaveUnit(int player,
                                      int templateid)

### setSize

    public void setSize(int x,
                        int y)

### getTextString

    public java.lang.String getTextString()

### getUnits

    public java.util.Map<java.lang.Integer,Unit> getUnits(int player)

### tryProduceUnit

    public boolean tryProduceUnit(Unit u)

### addUnit

    public void addUnit(Unit u)

### removeUnit

    public void removeUnit(int unitID)

### addTemplate

    public void addTemplate(Template t,
                            int player)

### tryProduceUpgrade

    public boolean tryProduceUpgrade(Upgrade upgrade)

### hasUpgrade

    public boolean hasUpgrade(java.lang.Integer upgradetemplateid,
                              int player)

### getResources

    public java.util.List<ResourceNode> getResources()

### removeResourceNode

    public void removeResourceNode(int resourceID)

### positionAvailable

    public boolean positionAvailable(int x,
                                     int y)

### unitAt

    public Unit unitAt(int x,
                       int y)

### inBounds

    public boolean inBounds(int x,
                            int y)

### getXExtent

    public int getXExtent()

### getYExtent

    public int getYExtent()

### resourceAt

    public ResourceNode resourceAt(int x,
                                   int y)

### getResourceAmount

    public int getResourceAmount(int player,
                                 ResourceType type)

### depositResources

    public void depositResources(int player,
                                 ResourceType type,
                                 int amount)

### getSupplyAmount

    public int getSupplyAmount(int player)

### getSupplyCap

    public int getSupplyCap(int player)

### checkValidSupplyAddition

    public boolean checkValidSupplyAddition(int player,
                                            int amounttoadd,
                                            int offsettingcapgain)

### incrementTurn

    public void incrementTurn()

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### getView

    public State.StateView getView()