jumbo.euclid
Class Int2

java.lang.Object
  |
  +--jumbo.euclid.Status
        |
        +--jumbo.euclid.Int2

public class Int2
extends Status

Int2 - a pair of integers - no other assumptions

Contains two ints.

The default value is 0, 0.


Constructor Summary
Int2()
           
Int2(Int2 r)
          copy constructor
Int2(int x, int y)
           
 
Method Summary
 void clear()
          set to 0, 0
 int dotProduct(Int2 r)
          get dot product
 int elementAt(int elem)
          get either value; counts from ZERO
 boolean equals(Int2 r)
           
 Int2 getMidPoint(Int2 p)
          point midway between 'this' and 'p'
 int getX()
          get X value
 int getY()
          get Y value
 Int2 multiplyBy(int f)
          multiply a point by a scalar
 void negative()
          multiply both components by -1; MODIFIES 'this'
 Int2 plus(Int2 r2)
          add two points - vector sum;
 void setX(int xx)
           
 void setY(int yy)
           
 void sortAscending()
          sorts x and y so that x <= y
 void sortDescending()
          sorts x and y so that x >= y
 Int2 subtract(Int2 r2)
          subtract two points - vector difference;
 void swap()
          swaps the x and y values
 java.lang.String toString()
           
 
Methods inherited from class jumbo.euclid.Status
NYI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Int2

public Int2()

Int2

public Int2(int x,
            int y)

Int2

public Int2(Int2 r)
copy constructor
Method Detail

swap

public void swap()
swaps the x and y values

sortAscending

public void sortAscending()
sorts x and y so that x <= y

sortDescending

public void sortDescending()
sorts x and y so that x >= y

clear

public void clear()
set to 0, 0

setX

public void setX(int xx)

setY

public void setY(int yy)

equals

public boolean equals(Int2 r)

plus

public Int2 plus(Int2 r2)
add two points - vector sum;

subtract

public Int2 subtract(Int2 r2)
subtract two points - vector difference;

negative

public void negative()
multiply both components by -1; MODIFIES 'this'

multiplyBy

public Int2 multiplyBy(int f)
multiply a point by a scalar

getX

public int getX()
get X value

getY

public int getY()
get Y value

elementAt

public int elementAt(int elem)
              throws java.lang.ArrayIndexOutOfBoundsException
get either value; counts from ZERO

getMidPoint

public Int2 getMidPoint(Int2 p)
point midway between 'this' and 'p'

dotProduct

public int dotProduct(Int2 r)
get dot product

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object