rogue
Class Pt

java.lang.Object
  extended by rogue.Pt

public class Pt
extends java.lang.Object

Simple class defining point coordinate.


Constructor Summary
Pt()
          Default constructor - point at 0,0
Pt(int x, int y)
          Creates point with given x,y coordinates
Pt(Pt other)
          Creates a new point, just like the existing point
 
Method Summary
 boolean adjacent(Pt other)
          Tests whether this point is adjacent to other point
 int distance(Pt other)
          Calculates distance from this point to other point
 boolean equals(Pt other)
          Tests equality of points (same coordinates)
 void read(java.io.BufferedReader in)
          Reads two lines of data - x-coord on first line, y-coord on second line
 void setPt(int x, int y)
          Change location of Pt
 int x()
          Return x coord
 int y()
          Return y coord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pt

public Pt()
Default constructor - point at 0,0


Pt

public Pt(Pt other)
Creates a new point, just like the existing point

Parameters:
other - Existing point

Pt

public Pt(int x,
          int y)
Creates point with given x,y coordinates

Parameters:
x - X coordinate
y - Y coordinate
Method Detail

equals

public boolean equals(Pt other)
Tests equality of points (same coordinates)

Parameters:
other - Another point
Returns:
boolean - true if points are identical

adjacent

public boolean adjacent(Pt other)
Tests whether this point is adjacent to other point

Parameters:
other - Another point
Returns:
boolean - true if points are adjacent

read

public void read(java.io.BufferedReader in)
Reads two lines of data - x-coord on first line, y-coord on second line

Parameters:
in - BufferedReader connected to dungeon definition file

distance

public int distance(Pt other)
Calculates distance from this point to other point

Parameters:
other - Another point
Returns:
integer representing rounded distance between points

setPt

public void setPt(int x,
                  int y)
Change location of Pt

Parameters:
x - New x value
y - New y value

x

public int x()
Return x coord

Returns:
x coord

y

public int y()
Return y coord

Returns:
y coord