Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gecco.server.qmanager
Class QueuedAutomaton

    java.lang.Object
      gecco.server.qmanager.QueuedAutomaton

All Implemented Interfaces:
  Comparable

public class QueuedAutomaton
extends Object
implements Comparable

This class encapsulates data about an automaton in the queue of the server. It consists of data about which automaton it is, that is, the position on the map, and data about which place in the queue it has, that is, the time until the automaton should be taken from the queue and processed in some way.

Author:
  Henrik Bäärnhielm, Karl Hasselström, Henrik Hägerström

Constructor Summary
`QueuedAutomaton(int x, int y, double absoluteTimeToExecute)` Constructor for the QueuedAutomaton object

Method Summary
`int` | `compareTo(Object a)` Compares this automaton with a given automaton.
`boolean` | `equals(Object a)` Tests whether to QueuedAutomatons are equal, which is true iff they have the same coordinates and the same time for process.
`double` | `getTimeToExecute()` Gets the time when the automaton shoule be processed.
`int` | `getX()` Gets the x coordinate of the automaton
`int` | `getY()` Gets the y coordinate of the automaton
`void` | `setTimeToExecute(double newTimeToExecute)` Sets the time when the automaton should be processed.

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

Constructor Detail

### QueuedAutomaton

    public QueuedAutomaton(int x,
                           int y,
                           double absoluteTimeToExecute)

  Constructor for the QueuedAutomaton object

Parameters:
  `x` - The x-coordinate of the automaton
  `y` - The x-coordinate of the automaton
  `absoluteTimeToExecute` - The time when the automaton should be processed. This is absolute game time, _not_ a relative time from the current time.

Method Detail

### setTimeToExecute

    public void setTimeToExecute(double newTimeToExecute)

  Sets the time when the automaton should be processed.

  Parameters:
    `newTimeToExecute` - The new TimeToExecute value

### getX

    public int getX()

  Gets the x coordinate of the automaton

  Returns:
    The x coordinate

### getY

    public int getY()

  Gets the y coordinate of the automaton

  Returns:
    The y coordinate

### getTimeToExecute

    public double getTimeToExecute()

  Gets the time when the automaton shoule be processed.

  Returns:
    The time (absolute)

### equals

    public boolean equals(Object a)

  Tests whether to QueuedAutomatons are equal, which is true iff they have the same coordinates and the same time for process. This method obeys the general contract of the Comparable interface.

  Parameters:
    `a` - Should be a QueuedAutomaton
  Returns:
    true if a is equal to this automaton, false otherwise

### compareTo

    public int compareTo(Object a)

  Compares this automaton with a given automaton. An automaton is considered less than an other automaton if at least one of the following conditions are satisfied. a) the time for process is less, that is, earlier b) the x coordinate is less c) the y coordinate is less The checks are performed in the above order. This method obeys the general contract of the Comparable interface.

  Specified by:
    `compareTo` in interface `Comparable`
  Parameters:
    `a` - Should be a QueuedAutomaton
  Returns:
    -1 if this automaton is less than a, 0 if the automatons are equal, 1 if a is greater than this automaton

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD