kirk.io.sdl
Class SDLNormalElement

java.lang.Object
  extended bykirk.io.sdl.SDLElement
      extended bykirk.io.sdl.SDLNormalElement

public class SDLNormalElement
extends SDLElement

This class represents the normal element of an SDL document. It has a name and element values.

Version:
1
Author:
Berend "Kirk" Wouda

Field Summary
static String IDENTIFIER
          The identifier of the normal element type.
protected  ArrayList valuelist
          The list of values of this element.
 
Fields inherited from class kirk.io.sdl.SDLElement
name
 
Constructor Summary
SDLNormalElement(String name)
          Constructs a new normal element with the given name.
 
Method Summary
 void addValue(int index, SDLElement value)
          Adds the given value to the list of values (at the specified index).
 void addValue(SDLElement value)
          Adds the given value to the list of values.
 SDLDataElement getDataElement(String name)
          Returns the SDLDataElement in this element that has the given name.
 Iterator getDataElements()
          Returns the Iterator that iterates over this SDLNormalElement.
 Iterator getDataElements(String name)
          Returns the Iterator that iterates over this SDLNormalElement given the name filter.
 SDLElement getElement(String name)
          Returns the SDLElement in this element that has the given name.
 Iterator getElements()
          Returns the Iterator that iterates over this SDLNormalElement.
 Iterator getElements(String name)
          Returns the Iterator that iterates over this SDLNormalElement given the name filter.
 SDLNormalElement getNormalElement(String name)
          Returns the SDLNormalElement in this element that has the given name.
 Iterator getNormalElements()
          Returns the Iterator that iterates over this SDLNormalElement.
 Iterator getNormalElements(String name)
          Returns the Iterator that iterates over this SDLNormalElement given the name filter.
 int getNumberOfValues()
          Returns how many values there are in the list.
 SDLElement getValue(int index)
          Returns the element at index.
 SDLElement removeValue(int index)
          Removes the given value from the list of values (from the specified index).
 SDLElement removeValue(SDLElement value)
          Removes the given value from the list of values.
 void setValue(SDLElement value, int index)
          Sets the given value in the list of values (at the specified index).
 String toString(String indent)
          Returns a string representation of this SDLNormalElement with the given indentation.
 
Methods inherited from class kirk.io.sdl.SDLElement
getAsDataElement, getAsNormalElement, getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

valuelist

protected ArrayList valuelist
The list of values of this element.


IDENTIFIER

public static final String IDENTIFIER
The identifier of the normal element type.

See Also:
Constant Field Values
Constructor Detail

SDLNormalElement

public SDLNormalElement(String name)
Constructs a new normal element with the given name.

Parameters:
name - The name of this element.
Method Detail

getValue

public SDLElement getValue(int index)
Returns the element at index.

Parameters:
index - The index of the element to be returned.
Returns:
The element at index.

addValue

public void addValue(int index,
                     SDLElement value)
Adds the given value to the list of values (at the specified index). Althought SDL doesn't differentiate on order of elements, you can use this to make the file look like you want.

Parameters:
value - The value to be added.
index - The index to be added on.

addValue

public void addValue(SDLElement value)
Adds the given value to the list of values.

Parameters:
value - The value to be added.

setValue

public void setValue(SDLElement value,
                     int index)
Sets the given value in the list of values (at the specified index).

Parameters:
value - The value to be set.
index - The index to be set on.

removeValue

public SDLElement removeValue(int index)
Removes the given value from the list of values (from the specified index).

Parameters:
index - The index to be removed from.
Returns:
The removed element.

removeValue

public SDLElement removeValue(SDLElement value)
Removes the given value from the list of values.

Parameters:
value - The element to be removed.
Returns:
The removed element.

getNumberOfValues

public int getNumberOfValues()
Returns how many values there are in the list.

Returns:
How many values there are in the list.

getElements

public Iterator getElements()
Returns the Iterator that iterates over this SDLNormalElement.


getElements

public Iterator getElements(String name)
Returns the Iterator that iterates over this SDLNormalElement given the name filter.

Parameters:
name - The name to filter upon.

getNormalElements

public Iterator getNormalElements()
Returns the Iterator that iterates over this SDLNormalElement. It only returns the SDLNormalElement objects.


getNormalElements

public Iterator getNormalElements(String name)
Returns the Iterator that iterates over this SDLNormalElement given the name filter. It only returns the SDLNormalElement objects.

Parameters:
name - The name to filter upon.

getDataElements

public Iterator getDataElements()
Returns the Iterator that iterates over this SDLNormalElement. It only returns the SDLDataElement objects.


getDataElements

public Iterator getDataElements(String name)
Returns the Iterator that iterates over this SDLNormalElement given the name filter. It only returns the SDLDataElement objects.

Parameters:
name - The name to filter upon.

getElement

public SDLElement getElement(String name)
                      throws MultipleMatchException,
                             NoMatchException
Returns the SDLElement in this element that has the given name.

Parameters:
name - The name of the element to return.
Returns:
The SDLElement that has the given name.
Throws:
MultipleMatchException - When more than one element has the given name.
NoMatchException - When no element has the given name.

getNormalElement

public SDLNormalElement getNormalElement(String name)
                                  throws MultipleMatchException,
                                         NoMatchException
Returns the SDLNormalElement in this element that has the given name.

Parameters:
name - The name of the element to return.
Returns:
The SDLNormalElement that has the given name.
Throws:
MultipleMatchException - When more than one element has the given name.
NoMatchException - When no element has the given name.

getDataElement

public SDLDataElement getDataElement(String name)
                              throws MultipleMatchException,
                                     NoMatchException
Returns the SDLDataElement in this element that has the given name.

Parameters:
name - The name of the element to return.
Returns:
The SDLDataElement that has the given name.
Throws:
MultipleMatchException - When more than one element has the given name.
NoMatchException - When no element has the given name.

toString

public String toString(String indent)
Returns a string representation of this SDLNormalElement with the given indentation.

Specified by:
toString in class SDLElement
Parameters:
indent - The indentation to be used.
Returns:
A string representation of this SDLNormalElement.