|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.columbia.cs.coms4701.geometry.AbstractVector<java.lang.Integer>
edu.columbia.cs.coms4701.geometry.DiscreteVector
public class DiscreteVector
An n-dimensional vector of integers.
Field Summary | |
---|---|
static DiscreteVector[] |
DIRECTIONS
Array of the eight compass directions (the single-step vector in each direction), in clockwise order (North, Northeast, East, Southwest, South, Southwest, West, Northwest). |
static DiscreteVector |
EAST
East, i.e. |
static DiscreteVector |
NORTH
North, i.e. |
static DiscreteVector |
NORTHEAST
Northeast, i.e. |
static DiscreteVector |
NORTHWEST
Northwest, i.e. |
static DiscreteVector |
SOUTH
South, i.e. |
static DiscreteVector |
SOUTHEAST
Southweast, i.e. |
static DiscreteVector |
SOUTHWEST
Southwest, i.e. |
static DiscreteVector |
WEST
West, i.e. |
Fields inherited from class edu.columbia.cs.coms4701.geometry.AbstractVector |
---|
components, PRIME |
Fields inherited from interface edu.columbia.cs.coms4701.geometry.GeometricVector |
---|
X_DIM, Y_DIM, Z_DIM |
Constructor Summary | |
---|---|
DiscreteVector(int theDimension)
Constructs a new vector of the specified dimension. |
|
DiscreteVector(int theDimension,
java.lang.Integer... theComponents)
Constructs a new vector of the specified dimension, with the specified components. |
Method Summary | |
---|---|
DiscreteVector |
add(GeometricVector<java.lang.Integer> theVector)
add returns a *new* vector, equal to the vector sum of this vector and the argument. |
java.lang.Integer[] |
getComponents()
Returns the components as an array |
DiscreteVector |
multiply(java.lang.Integer theScalar)
multiply returns a *new* vector, equal to the scalar multiple of this vector and the argument. |
Methods inherited from class edu.columbia.cs.coms4701.geometry.AbstractVector |
---|
checkDimension, checkEqualOrSmallerDimensionVector, equals, getComponent, getDimension, getLength, hashCode, iterator, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final DiscreteVector NORTH
public static final DiscreteVector NORTHEAST
public static final DiscreteVector EAST
public static final DiscreteVector SOUTHEAST
public static final DiscreteVector SOUTH
public static final DiscreteVector SOUTHWEST
public static final DiscreteVector WEST
public static final DiscreteVector NORTHWEST
public static final DiscreteVector[] DIRECTIONS
Constructor Detail |
---|
public DiscreteVector(int theDimension)
If no components are specified, the vector will be a zero-vector.
theDimension
- public DiscreteVector(int theDimension, java.lang.Integer... theComponents)
The number of components specified must not exceed the specified dimension (duh). If fewer components are specified than there are dimensions, the remaining components are set to zero.
theDimension
- theComponents
-
java.lang.IllegalArgumentException
- if too manyMethod Detail |
---|
public DiscreteVector add(GeometricVector<java.lang.Integer> theVector)
Performs a component-by-component addition
add
in interface GeometricVector<java.lang.Integer>
add
in class AbstractVector<java.lang.Integer>
theVector
- the vector to add, which must be of equal or lesser dimension
public DiscreteVector multiply(java.lang.Integer theScalar)
Performs a component-by-component scalar multiplication
multiply
in interface GeometricVector<java.lang.Integer>
multiply
in class AbstractVector<java.lang.Integer>
theScalar
- the scalar to multiply by (may be < 1, or indeed < 0)public java.lang.Integer[] getComponents()
AbstractVector
getComponents
in interface GeometricVector<java.lang.Integer>
getComponents
in class AbstractVector<java.lang.Integer>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |