|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<Collection<DOMSequence.TaskElement>>
stella.xml.DOMSequence
public class DOMSequence
An XML-parser-application interface to read sequencer files in
XML format (see jaxp
extension interface to first read
in the file and parse it into a parse() method. Only after this
method has been called, the DOM-sequence can be traversed with a call
to it's iterator method. Note that this iterator delivers a
collection of DOMSequence.TaskElements at calls to its next method.
The Step as the top-level element of the sequence is only used
to construct the list in the correct sequence.
A dom sequence is a specialized list in the way that it only
allows special elements. Concrete, if you add a sequencer step with one of
the list's add method, the object added must be a collection of
DOMSequence.TaskElements. The list's addAll method work only if
the collection added is a dom sequence. In this case, the awkward checking
of the individual elements, as done with the add methods, is not necessarry
as a domsequence is believed to be constructed of the correct types.
Although removal and addition of sequencing steps is also possible after the list has been constructed and although this may happen in different threads it is impossible that addition and removal of elements happen at the same time, therfore no synchronization is necessary.
Grammer of the xml-file:
At the time of this writing, the DTD can be found at
XMLSequencer.
Triggers that should be set
to the appropriate value as this task is ready to execute.DOMTarget.
XMLSequencer,
Serialized Form| Nested Class Summary | |
|---|---|
class |
DOMSequence.TaskElement
Represents a special Element, namely a Task element in an xml-sequencer file. |
static class |
DOMSequence.Test
Use for testing. |
| Field Summary | |
|---|---|
private boolean |
parsed
A boolean indicating successful parsing. |
private Document |
xml
The document gained from parsing the sequence file. |
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
DOMSequence()
Construct a new dom sequence with an empty sequence file. |
|
DOMSequence(Document doc)
Constructs a new dom sequence with the specified target dom. |
|
DOMSequence(File doc)
Constructs a new dom sequence with the specified xml-file. |
|
DOMSequence(URL doc)
Constructs a new dom sequence with the specified xml-file. |
|
| Method Summary | |
|---|---|
int |
abortStep(int index)
Marks all task belonging to the indicated step as done. |
boolean |
addAll(Collection c)
Overrides the parent's addAll method. |
boolean |
addAll(int index,
Collection c)
Overrides the parent's addAll method. |
private boolean |
checkStep(Object o)
Returns true if the object can be inserted as a step into the sequence. |
void |
clearDom()
Clears the document file. |
static DOMSequence |
emptyList()
Returns an empty list. |
Collection<DOMSequence.TaskElement> |
getAllTasks()
Returns all tasks in this sequence as a collection. |
Document |
getDom()
Gets the DOM-documnet this sequence efers to |
private int |
getOffset(String att)
Tests if the attribute is of a back-reference type. |
String |
getSequenceID()
Returns the sequence id of this sequence dom. |
boolean |
parse()
Parses the document. |
void |
setDom(Document dom)
Sets the DOM-document this DOM sequence should refer to. |
void |
setDom(File xml)
Sets the DOM-xml file this DOM sequence should refer to. |
void |
setDom(URL xml)
Sets the DOM-xml file this DOM sequence should refer to. |
protected void |
updateReferences()
Updates command reference attributes with a back-reaction. |
| Methods inherited from class java.util.ArrayList |
|---|
add, add, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
|---|
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList |
| Field Detail |
|---|
private Document xml
private boolean parsed
| Constructor Detail |
|---|
public DOMSequence()
public DOMSequence(File doc)
parse().
public DOMSequence(URL doc)
parse().
public DOMSequence(Document doc)
parse().
| Method Detail |
|---|
public static DOMSequence emptyList()
private boolean checkStep(Object o)
public boolean addAll(Collection c)
addAll in interface Collection<Collection<DOMSequence.TaskElement>>addAll in interface List<Collection<DOMSequence.TaskElement>>addAll in class ArrayList<Collection<DOMSequence.TaskElement>>c - A dom sequence instance.
IllegalArgumentException - If the collection to add is either
null or not an instance of dom sequence.
public boolean addAll(int index,
Collection c)
addAll in interface List<Collection<DOMSequence.TaskElement>>addAll in class ArrayList<Collection<DOMSequence.TaskElement>>index - The index where this task element collection should be
inserted.c - A dom sequence instance.
IllegalArgumentException - If the collection to add is either
null or not an instance of dom sequence.
protected void updateReferences()
throws ParseException
DTDConstants.COMMANDLAST is
replaced with the last identical command template's reference
attribute. If this reserved attribute is followed by a parsable
integer it defines a relative offset in the reference replacemant, i.e.
a -1 indicates that this reference attribute should be
replaced with the attribute of the last occurence of this command
template. If no offset is given, -1 is asumed. If the
offset is 0, -1 is used. If the part following the
reseverd attribute is not parsable, the whole attribute is treated
as generic.This method is synchronized to block any access to the list while updating the references.
ParseException - If an offset reference could not be resolved.private int getOffset(String att)
public void setDom(File xml)
public void setDom(URL xml)
public void setDom(Document dom)
public void clearDom()
public Document getDom()
public String getSequenceID()
public boolean parse()
DTDConstants.STEP Element is considered an entry
in the list. The sequence given in the xml-file is retained. All the
DTDConstants.TASKs comprising one step are stored as a DOMSequence.TaskElement
collection as one entry in the list.Note that this parse is independent of the DocumentBuilder.parse(File) method that parses an xml-file int a dom-document.
public int abortStep(int index)
public Collection<DOMSequence.TaskElement> getAllTasks()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||