visad
Class Factor

java.lang.Object
  extended byvisad.Factor
All Implemented Interfaces:
Serializable

final class Factor
extends Object
implements Serializable

A class that represents a factor in the dimensionality of a unit. A factor is a base unit and a power.


Field Summary
(package private)  BaseUnit baseUnit
          The base unit.
(package private)  int power
          The power of the base unit.
 
Constructor Summary
(package private) Factor(BaseUnit baseUnit, int power)
          Construct a factor from a base unit and a power.
 
Method Summary
 boolean equals(Factor factor)
           
 boolean equals(Object that)
          Indicates whether or not this instance is equal to an object.
 int hashCode()
          Returns the hash code of this instance.
 String toString()
          Return a string representation of this factor.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

power

final int power
The power of the base unit.


baseUnit

final BaseUnit baseUnit
The base unit.

Constructor Detail

Factor

Factor(BaseUnit baseUnit,
       int power)
Construct a factor from a base unit and a power.

Parameters:
baseUnit - The base unit.
power - The power to raise the base unit by.
Method Detail

toString

public String toString()
Return a string representation of this factor.

Returns:
A string representation of this factor (e.g. "m-2").

equals

public boolean equals(Factor factor)

equals

public boolean equals(Object that)
Indicates whether or not this instance is equal to an object.

Parameters:
that - The object in question.
Returns:
true if and only if this instance equals the unit.

hashCode

public int hashCode()
Returns the hash code of this instance. Object.hashCode() should be overridden whenever Object.equals(Object) is.

Returns:
The hash code of this instance (includes the values).