dk.brics.string.intermediate
Enum StringType

java.lang.Object
  extended by java.lang.Enum<StringType>
      extended by dk.brics.string.intermediate.StringType
All Implemented Interfaces:
Serializable, Comparable<StringType>

public enum StringType
extends Enum<StringType>

Denotes the type of a string-related object.

Author:
Asger

Enum Constant Summary
COLLECTION
          A mutable collection of immutable strings.
IMMUTABLE
          A single immutable string.
MUTABLE
          A single mutable string.
USELESS
          An object not being modelled as a string.
 
Method Summary
 int getBitmask()
          Returns a bitmask unique for this string-type, with exactly one 1-bit.
 boolean isModifiable()
          Returns true if this is MUTABLE or COLLECTION.
static StringType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static StringType[] 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
 

Enum Constant Detail

COLLECTION

public static final StringType COLLECTION
A mutable collection of immutable strings.

In Java, this corresponds to string-arrays and classes from the collections framework, such as ArrayList<String>.


IMMUTABLE

public static final StringType IMMUTABLE
A single immutable string.

In Java, this corresponds to the java.lang.String class.


MUTABLE

public static final StringType MUTABLE
A single mutable string.

In Java, this corresponds to the java.lang.StringBuffer and java.lang.StringBuilder classes.


USELESS

public static final StringType USELESS
An object not being modelled as a string.

In Java, this is anything not treated as either of the other types.

Method Detail

getBitmask

public int getBitmask()
Returns a bitmask unique for this string-type, with exactly one 1-bit.

Returns:
a bitmask with a single 1-bit

isModifiable

public boolean isModifiable()
Returns true if this is MUTABLE or COLLECTION.


valueOf

public static StringType 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 StringType[] 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 (StringType c : StringType.values())
    System.out.println(c);

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


Copyright © 2003-2009 Anders Møller, Aske Simon Christensen, Asger Feldthaus.