Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

dk.rode.thesis.bridge
Enum SequenceValuePolicy

java.lang.Object
  extended by java.lang.Enum<SequenceValuePolicy>
      extended by dk.rode.thesis.bridge.SequenceValuePolicy
All Implemented Interfaces:
StringablePolicy<SequenceValueGenerator<?>>, Serializable, Comparable<SequenceValuePolicy>

public enum SequenceValuePolicy
extends Enum<SequenceValuePolicy>
implements StringablePolicy<SequenceValueGenerator<?>>

Standard policies for formatting SequenceValueGenerator objects into char sequences (not part of the core Bridge implementation).

Implementation notes:
This is NOT part of the core Bridge functionality, merely to provide better log descriptions!

See implementation notes for the ObjectPolicy enumeration.

Author:
Gunni Rode / rode.dk
See Also:
ObjectPolicy

Nested Class Summary
 
Nested classes/interfaces inherited from interface dk.rode.thesis.strategy.StringablePolicy
StringablePolicy.NameIdiom, StringablePolicy.Type
 
Enum Constant Summary
ID
          Generates a char sequence representation of a value generator having the following format: SequenceValueGenerator[..]
IDENTITY
          Generates a char sequence representation of a value generator having the following format: SequenceValueGenerator[hash-code: ..[; identity-hash-code: ..]; size: ..]
NAME
          Generates a char sequence representation of a value generator having the following format: SequenceValueGenerator Where SequenceValueGenerator is the simple class name of the class of the values.
VALUES
          Generates a char sequence representation of a value generator having the following format: SequenceValueGenerator[hash-code: ..[; identity-hash-code: ..]; size: ..; number: ..; [values: ..]]
VERBOSE
          Generates a char sequence representation of a value generator having the following format: SequenceValueGenerator[hash-code: ..[; identity-hash-code: ..]; type: ..; size: ..; number: ..; ordered: ..; sorted: ..; duplicates: ..]
 
Method Summary
 StringablePolicy.Type type()
          Returns the type of this policy.
static SequenceValuePolicy valueOf(String name)
          Returns the enum constant of this type with the specified name.
static SequenceValuePolicy[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface dk.rode.thesis.strategy.StringablePolicy
toString
 

Enum Constant Detail

ID

public static final SequenceValuePolicy ID
Generates a char sequence representation of a value generator having the following format:
   SequenceValueGenerator[..]
 
Where SequenceValueGenerator is the simple class name of the class of the values, and .. is the identity hash-code of the values.

See Also:
ObjectPolicy.ID

IDENTITY

public static final SequenceValuePolicy IDENTITY
Generates a char sequence representation of a value generator having the following format:
   SequenceValueGenerator[hash-code: ..[; identity-hash-code: ..]; size: ..]
 
Where SequenceValueGenerator is the simple class name of the class of the values, and .. are the hash-code(s) and size of the values, respectively.

See Also:
ObjectPolicy.IDENTITY_OPEN

NAME

public static final SequenceValuePolicy NAME
Generates a char sequence representation of a value generator having the following format:
   SequenceValueGenerator
 
Where SequenceValueGenerator is the simple class name of the class of the values.

See Also:
ObjectPolicy.NAME

VALUES

public static final SequenceValuePolicy VALUES
Generates a char sequence representation of a value generator having the following format:
   SequenceValueGenerator[hash-code: ..[; identity-hash-code: ..]; size: ..; number: ..; [values: ..]] 
 
Where SequenceValueGenerator is the simple class name of the class of the values, and values list the actual values for value collections, ordered and sorted, if possible.

See Also:
ObjectPolicy.IDENTITY_OPEN

VERBOSE

public static final SequenceValuePolicy VERBOSE
Generates a char sequence representation of a value generator having the following format:
   SequenceValueGenerator[hash-code: ..[; identity-hash-code: ..]; type: ..; size: ..; number: ..; ordered: ..; sorted: ..; duplicates: ..] 
 
Where SequenceValueGenerator is the simple class name of the class of the values.

See Also:
ObjectPolicy.IDENTITY_OPEN
Method Detail

type

public StringablePolicy.Type type()
Description copied from interface: StringablePolicy
Returns the type of this policy.

The stringable context can use the type to decide how to use the textual representation of this policy in conjunction with additional text.

Specified by:
type in interface StringablePolicy<SequenceValueGenerator<?>>
Returns:
StringablePolicy.Type.APPENDABLE.

valueOf

public static SequenceValuePolicy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

values

public static SequenceValuePolicy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SequenceValuePolicy c : SequenceValuePolicy.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.