org.objectweb.jac.ide
Class EnumeratedType

java.lang.Object
  extended byorg.objectweb.jac.ide.ModelElement
      extended byorg.objectweb.jac.ide.Type
          extended byorg.objectweb.jac.ide.EnumeratedType

public class EnumeratedType
extends Type

This class represents an enumerated type. Enumrated types allow to define a set of allowed values for an integer.


Constructor Summary
EnumeratedType()
           
 
Method Summary
 void addName(String name)
           
 String getGenerationFullName()
          Gets full name to use for code generation.
 String getGenerationName()
          Gets name to use for code generation.
 List getNames()
           
 int getStartValue()
           
 int getStep()
           
 void importFromFile(File source)
          Imports names from a file (one name per line)
 int nameToValue(String name)
          Gets the value associated to a name.
 void removeName(String name)
           
 void setStartValue(int startValue)
           
 void setStep(int v)
           
 String valueToName(int value)
          Gets the name associated with a value.
 
Methods inherited from class org.objectweb.jac.ide.Type
getFullName, getPackagePath, isPrimitive, setPackagePath
 
Methods inherited from class org.objectweb.jac.ide.ModelElement
addConfigItem, addEndingLink, addLink, getConfigItems, getDescription, getEndingLinks, getLinks, getName, getType, remove, removeEndingLink, removeLink, setDescription, setEndingLinks, setLinks, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumeratedType

public EnumeratedType()
Method Detail

getGenerationName

public String getGenerationName()
Description copied from class: ModelElement
Gets name to use for code generation. Defaults to name.

Overrides:
getGenerationName in class ModelElement

getGenerationFullName

public String getGenerationFullName()
Description copied from class: ModelElement
Gets full name to use for code generation. Defaults to fullName.

Overrides:
getGenerationFullName in class ModelElement

setStartValue

public void setStartValue(int startValue)

getStartValue

public int getStartValue()

getStep

public int getStep()

setStep

public void setStep(int v)

addName

public void addName(String name)

removeName

public void removeName(String name)

getNames

public List getNames()

importFromFile

public void importFromFile(File source)
                    throws IOException
Imports names from a file (one name per line)

Parameters:
source - file to import from
Throws:
IOException

nameToValue

public int nameToValue(String name)
                throws Exception
Gets the value associated to a name. Raises an exception if the name does not exists.

Parameters:
name - the name
Returns:
the integer value associated with the name
Throws:
Exception

valueToName

public String valueToName(int value)
                   throws Exception
Gets the name associated with a value. Raises an exception if the there's no name with such a value.

Parameters:
value - the value
Returns:
the name value associated with the value
Throws:
Exception