Class pmr.euclid.Int2
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pmr.euclid.Int2

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

public class Int2
extends Status

Int2 - a pair of integers - no other assumptions

Contains two ints.

The default value is 0, 0.

Author:
(C) P. Murray-Rust, 1996

Constructor Index

 o Int2()
 o Int2(int, int)
 o Int2(Int2)
copy constructor

Method Index

 o clear()
set to 0, 0
 o dotProduct(Int2)
get dot product
 o elementAt(int)
get either value; counts from ZERO
 o equals(Int2)
 o getMidPoint(Int2)
point midway between 'this' and 'p'
 o getX()
get X value
 o getY()
get Y value
 o multiplyBy(int)
multiply a point by a scalar
 o negative()
multiply both components by -1; MODIFIES 'this'
 o plus(Int2)
add two points - vector sum;
 o setX(int)
 o setY(int)
 o sortAscending()
sorts x and y so that x <= y
 o sortDescending()
sorts x and y so that x >= y
 o subtract(Int2)
subtract two points - vector difference;
 o swap()
swaps the x and y values
 o toString()

Constructors

 o Int2
  public Int2()
 o Int2
  public Int2(int x,
              int y)
 o Int2
  public Int2(Int2 r)
copy constructor

Methods

 o swap
  public void swap()
swaps the x and y values
 o sortAscending
  public void sortAscending()
sorts x and y so that x <= y
 o sortDescending
  public void sortDescending()
sorts x and y so that x >= y
 o clear
  public void clear()
set to 0, 0
 o setX
  public void setX(int xx)
 o setY
  public void setY(int yy)
 o equals
  public boolean equals(Int2 r)
 o plus
  public Int2 plus(Int2 r2)
add two points - vector sum;
 o subtract
  public Int2 subtract(Int2 r2)
subtract two points - vector difference;
 o negative
  public void negative()
multiply both components by -1; MODIFIES 'this'
 o multiplyBy
  public Int2 multiplyBy(int f)
multiply a point by a scalar
 o getX
  public int getX()
get X value
 o getY
  public int getY()
get Y value
 o elementAt
  public int elementAt(int elem) throws ArrayIndexOutOfBoundsException
get either value; counts from ZERO
 o getMidPoint
  public Int2 getMidPoint(Int2 p)
point midway between 'this' and 'p'
 o dotProduct
  public int dotProduct(Int2 r)
get dot product
 o toString
  public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index