javalib.worldimages
Class Posn
java.lang.Object
javalib.worldimages.Posn
public class Posn
- extends Object
To represent a point on the drawing
WorldCanvas
or AppletCanvaas
- Since:
- August 2, 2007
- Author:
- Viera K.
Constructor Summary |
Posn(int x,
int y)
|
origin
public static final Posn origin
x
public int x
y
public int y
Posn
public Posn(int x,
int y)
equals
public boolean equals(Object other)
- Overrides:
equals
in class Object
getX
public int getX()
getY
public int getY()
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
minus
public Posn minus(Posn other)
- Subtract another Posn from this one.
Functional: does NOT modify this!
- Parameters:
other
- another Posn
- Returns:
- a new Posn whose coordinates are the pointwise difference of this and other
- Since:
- Dec. 12, 2012
moved
public Posn moved(int dx,
int dy)
- Get a translated version of the given posn.
Functional: does NOT modify this!
- Parameters:
dx
- the amount to translate in x dimensiondy
- the amount to translate in y dimension
- Returns:
- a new Posn
- Since:
- Dec. 2, 2012
plus
public Posn plus(Posn other)
- Add another Posn to this one.
Functional: does NOT modify this!
- Parameters:
other
- another Posn
- Returns:
- a new Posn whose coordinates are the pointwise sum of this and other
- Since:
- Dec. 12, 2012
toIndentedString
public String toIndentedString(String indent)
toString
public String toString()
- Overrides:
toString
in class Object