edu.washington.cs.supple.rep
Interface SuppleType

All Superinterfaces:
SuppleBean
All Known Subinterfaces:
ActionType, BooleanType, ContainerType, DateType, DynamicType, ImageType, IntegerType, MapLocationType, SimpleValueType, StringType, TextType, VectorType
All Known Implementing Classes:
ActionTypeImpl, BaseType, BooleanTypeImpl, ContainerTypeImpl, DateTypeImpl, DynamicTypeImpl, ImageTypeImpl, IntegerTypeImpl, MapLocationTypeImpl, SimpleBeanType, SimpleValueTypeImpl, StringTypeImpl, TextTypeImpl, VectorTypeImpl

public interface SuppleType
extends SuppleBean

Author:
kgajos The interface for all Supple UI type objects

Method Summary
 void accept(UiVisitor visitor)
          Visitor pattern.
 java.lang.String getIndex(java.lang.Object value)
           
 java.lang.String getIndex(java.lang.Object value, int maxLength)
          Returns a version of the index that is no longer than the specified maximum
 java.util.Vector getLegalValues()
           
 java.util.Vector getLikelyValues()
           
 java.lang.String getLongestLegalIndex()
          If the type is enumerable, this method will scan through all legal values and return the longest index it finds; if the type is not enumerable, no guarantees are given for the result
 int getMaxNumLegalValues()
           
 int getNumLegalValues()
          For enumerable types, returns the number of legal values; throws UnsupportedOperationException otherwise
 int getNumLikelyValues()
           
 int getTypicalIndexLength()
          Returns the typical lenght of the index
 int getUniqueId()
          Returns a unique id of this instantiation.
 boolean hasIndex()
          Index is a short unique summary of the value (which can be used for choosing present values, etc.
 boolean hasOrdering()
          This method returns true if there exists a natural ordering on the values of this type; false otherwise;
 boolean hasSetLegalValues()
           
 boolean isEnumerable()
          This method tells you if possible values for this type can be (reasonably) enumerated
 boolean isFinalLegalValues()
          Returns true if the legal values are guaranteed not to change throughout the duration of this run time
 boolean isLegalValue(java.lang.Object value)
          Check if a value is legal for this type.
 boolean isLegalValueClass(java.lang.Class c)
          Check if a class is legal for this type.
 boolean isPrimitiveType()
          Test if this is a primitive type.
 java.util.Vector orderValues(java.util.Vector v)
          This method enforces type-specific ordering on values (can only be legally invoked if hasOrdering() returns true)
 java.lang.String toPrettyString(java.lang.String pref)
           
 java.lang.Object verifyCurrentValue(java.lang.Object value)
          This method gets called by UiObjects when they are notified that the legal values of their type have changed; this method looks at the current value of the object and verifies that the value is still legal.
 
Methods inherited from interface edu.washington.cs.supple.rep.SuppleBean
addPropertyChangeListener, removePropertyChangeListener
 

Method Detail

getUniqueId

public int getUniqueId()
Returns a unique id of this instantiation.

Returns:
unique id

accept

public void accept(UiVisitor visitor)
Visitor pattern.


isEnumerable

public boolean isEnumerable()
This method tells you if possible values for this type can be (reasonably) enumerated


hasOrdering

public boolean hasOrdering()
This method returns true if there exists a natural ordering on the values of this type; false otherwise;


orderValues

public java.util.Vector orderValues(java.util.Vector v)
This method enforces type-specific ordering on values (can only be legally invoked if hasOrdering() returns true)

Parameters:
v - values to be ordered
Returns:
ordered vector of values

verifyCurrentValue

public java.lang.Object verifyCurrentValue(java.lang.Object value)
This method gets called by UiObjects when they are notified that the legal values of their type have changed; this method looks at the current value of the object and verifies that the value is still legal. A corrected value or null is returned if some change was needed in response to the change to the legal values of the type.

Parameters:
value - the value to be verified
Returns:
the same value if all was well; a modified value or null if the value was no longer legal

getNumLegalValues

public int getNumLegalValues()
For enumerable types, returns the number of legal values; throws UnsupportedOperationException otherwise


getMaxNumLegalValues

public int getMaxNumLegalValues()

hasSetLegalValues

public boolean hasSetLegalValues()
Returns:
true if legal values have been set, false otherwise

isFinalLegalValues

public boolean isFinalLegalValues()
Returns true if the legal values are guaranteed not to change throughout the duration of this run time


getLegalValues

public java.util.Vector getLegalValues()
Returns:
if the type is enumerable, returns an ordered vector of current legal values; null if not enumerable

isLegalValue

public boolean isLegalValue(java.lang.Object value)
Check if a value is legal for this type.

Parameters:
value - value to be checked
Returns:
true if value is legal (of right type an in the domain), false otherwise

isLegalValueClass

public boolean isLegalValueClass(java.lang.Class c)
Check if a class is legal for this type.

Parameters:
c -
Returns:

getLikelyValues

public java.util.Vector getLikelyValues()
Returns:
the clone of the current list of likely values

getNumLikelyValues

public int getNumLikelyValues()
Returns:
the number of likely values

hasIndex

public boolean hasIndex()
Index is a short unique summary of the value (which can be used for choosing present values, etc.

Returns:
true if the type has an index defined, false otherwise

getIndex

public java.lang.String getIndex(java.lang.Object value)
Returns:
the index of a value (if exists); null otherwise

getIndex

public java.lang.String getIndex(java.lang.Object value,
                                 int maxLength)
Returns a version of the index that is no longer than the specified maximum

Parameters:
maxLength - the maximum length allowed for the index (in characters)
Returns:
the limitted length version of the index

getTypicalIndexLength

public int getTypicalIndexLength()
Returns the typical lenght of the index

Returns:
typical index length (in characters)

getLongestLegalIndex

public java.lang.String getLongestLegalIndex()
If the type is enumerable, this method will scan through all legal values and return the longest index it finds; if the type is not enumerable, no guarantees are given for the result

Returns:
the longest index of all legal values

isPrimitiveType

public boolean isPrimitiveType()
Test if this is a primitive type.

Returns:

toPrettyString

public java.lang.String toPrettyString(java.lang.String pref)