com.rubecula.jquantity
Class Compound

java.lang.Object
  extended bycom.rubecula.util.Item
      extended bycom.rubecula.jquantity.Compound
All Implemented Interfaces:
Auditable, java.lang.Cloneable, java.lang.Comparable, CompoundModel, Divisible, Identifiable, Millable, Mutable, Nameable, Normalizable, Presentable, java.io.Serializable
Direct Known Subclasses:
OneMatrix, SparseMatrix, TwoMatrix

public abstract class Compound
extends Item
implements Divisible, Normalizable, Mutable, Nameable, Millable, CompoundModel

Class

Since:
V_0_4
Version:
$Revision: 1.1 $
Author:
Robin Hillyard
See Also:
Serialized Form

Field Summary
private  boolean _Constant
           
 
Fields inherited from class com.rubecula.util.Item
JQUANTITY_TEST
 
Constructor Summary
Compound()
           
 
Method Summary
 java.lang.String audit(java.lang.String label)
          Method to return a detailed string from an object for debugging purposes.
 java.lang.String getIdentifier()
          Method to get the specific identifier for an object.
 boolean isMutable()
          This method indicates whether this particular instance is mutable, i.e. it has not been designated a constant.
static void main(java.lang.String[] args)
           
 Presentable makePresentableInstance(Presentation presentation)
          Instance method to convert a Presentation into a Presentable.
 Presentation present(AttrMap attributes)
          Convert this Presentable object into a Presentation, according to the set of attributes provided.
 Mutable setConstant()
          This method sets this instance to be a constant, i.e. immutable.
 void setIdentifier(java.lang.String identifier)
          Method to set a specific identifier to an object.
 
Methods inherited from class com.rubecula.util.Item
audit, audit, compareTo, Debug, getClassNameShort, getType, IsDebug, present, SetDebug, test, test, toString, Wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rubecula.jquantity.Divisible
factored, inverse, quotient
 
Methods inherited from interface com.rubecula.jquantity.Normalizable
isNormal, normalize
 
Methods inherited from interface com.rubecula.util.Auditable
audit, audit
 
Methods inherited from interface com.rubecula.jquantity.CompoundModel
getDimensions, getElement, setElement
 

Field Detail

_Constant

private boolean _Constant
Constructor Detail

Compound

public Compound()
Method Detail

isMutable

public boolean isMutable()
Description copied from interface: Mutable
This method indicates whether this particular instance is mutable, i.e. it has not been designated a constant.

Specified by:
isMutable in interface Mutable
Returns:
true if this instance can be mutated, otherwise false (it is constant).

setConstant

public Mutable setConstant()
Description copied from interface: Mutable
This method sets this instance to be a constant, i.e. immutable. Future calls to the isMutable() method will yield false.

Specified by:
setConstant in interface Mutable
Returns:
as a convenience this method returns itself.

setIdentifier

public void setIdentifier(java.lang.String identifier)
Description copied from interface: Nameable
Method to set a specific identifier to an object.

Specified by:
setIdentifier in interface Nameable
Parameters:
identifier - the identifier to associate with the object.

getIdentifier

public java.lang.String getIdentifier()
Description copied from interface: Identifiable
Method to get the specific identifier for an object.

Specified by:
getIdentifier in interface Identifiable
Returns:
the identifier.

audit

public java.lang.String audit(java.lang.String label)
Description copied from interface: Auditable
Method to return a detailed string from an object for debugging purposes.

Specified by:
audit in interface Auditable
Parameters:
label - the label to associate with the data. If label is non-null, a more detailed audit will be returned (this normally occurs only at the top level).
Returns:
the detailed string.

present

public Presentation present(AttrMap attributes)
                     throws PresentationException
Description copied from interface: Presentable
Convert this Presentable object into a Presentation, according to the set of attributes provided.

Specified by:
present in interface Presentable
Parameters:
attributes - a map of the attributes desired for the construction of the new presentation (may be empty).
Returns:
an appropriate instance of Presentation.
Throws:
PresentationException - in case of parsing error.

makePresentableInstance

public Presentable makePresentableInstance(Presentation presentation)
                                    throws PresentationException
Description copied from interface: Presentable
Instance method to convert a Presentation into a Presentable. Ideally, this would be a class method, but such a method cannot be defined in an interface. Nor can it be defined in an abstract class with the intention of overriding it in a subclass. Polymorphism just doesn't work that way.
Therefore, the present value (as in fields) of the instance is essentially ignored - only the methods are important.

Specified by:
makePresentableInstance in interface Presentable
Parameters:
presentation - of a number to be converted into a Presentable number.
Returns:
a number in the form of a Presentable.
Throws:
PresentationException - in case of parsing error.

main

public static void main(java.lang.String[] args)