public class Metric
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
Metric(java.lang.String name,
java.lang.String symbol)
Class constructor specifying name and symbol.
|
Metric(java.lang.String name,
java.lang.String symbol,
java.lang.String definition)
Class constructor specifying name, symbol and definition.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this
Metric to obj . |
java.lang.String |
getDefinition()
Returns the String containing the definition of this metric.
|
java.lang.String |
getName()
Returns the name of this metric.
|
java.lang.String |
getSymbol()
Returns the symbol of this metric.
|
int |
hashcode()
Returns a hash code for this
Metric object. |
int |
hashCode() |
java.lang.String |
toString()
Returns a string representation of this
Metric object. |
public Metric(java.lang.String name, java.lang.String symbol, java.lang.String definition)
name
- the name of the metric, for example 'meter'symbol
- symbol used to represent the metric, for example 'm'definition
- definition of the metric, i.e. 'the base unit of length in the
International System of Units'public Metric(java.lang.String name, java.lang.String symbol)
name
- the name of the metric, for example 'meter'symbol
- the symbol representing the metric, for example 'm'public java.lang.String getName()
public java.lang.String getSymbol()
public java.lang.String getDefinition()
public boolean equals(java.lang.Object obj)
Metric
to obj
.
Returns false if obj
is not an instance of
Metric
. Otherwise, two Metric
s are equal, if
their symbols and names are equal.equals
in class java.lang.Object
obj
- the Object to which this
is compared.public int hashCode()
hashCode
in class java.lang.Object
public final int hashcode()
Metric
object. The result is
exclusive OR of the hash code of the name and the hash code of the
symbol.Metric
object.public java.lang.String toString()
Metric
object. The
symbol is used to represent a Metric
object as string.toString
in class java.lang.Object