public class DOMSequence extends ArrayList<Collection<DOMSequence.TaskElement>> implements DTDConstants
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| Modifier and Type | Class and Description |
|---|---|
class |
DOMSequence.TaskElement
Represents a special Element, namely a Task element in an xml-sequencer
file.
|
static class |
DOMSequence.Test
Use for testing.
|
| Modifier and Type | Field and Description |
|---|---|
private boolean |
parsed
A boolean indicating successful parsing.
|
private Document |
xml
The document gained from parsing the sequence file.
|
modCountABORT, ABOVE, ABSTRACT, ABSTRACTPROPOSAL, ADDRESS, BELOW, BLOCK, BROADCAST, BROADCASTWITH, BV, CHAINING, CHANGE, CLASS, COMMAND, COMMANDID, COMMANDINIT, COMMANDLAST, COMMANDPARAMETER, COMMANDREF, COMMENT, COMPLETE, CONDITION, CONSTANT, CONSTANTNAME, CONSTANTVALUE, CONSTRAINT, CONSTRAINTOVERDUE, CONSTRAINTRELAX, DATA, DAUGHTER, DEC, DELAY, DELAYMAX, DELAYTIME, DISABLED, DOCPATH, DURATION, ELAPSED, EMAIL, ENABLED, EPOCH, EQUINOX, EXCEPTION, EXCEPTIONDAUGHTER, EXCEPTIONFOR, EXCEPTIONSUCCESSOR, EXCEPTIONTHIS, FALSE, FIELDOFVIEW, FILE, FITSHEADER, FITSHEADERID, FORMATCLASS, FORMATPATTERN, FROM, GAIN, HISTORY, HISTORYCOMPLETE, HISTORYDB, HISTORYMAX, HISTORYREAD, IGNORE, IMAGETYPE, INIT, INSTITUTION, INSTRUMENT, INTERN, KEY, MAX, MERIT, MIN, NOTIFY, OBJECT, OBJECTID, OBJECTNAME, OBSERVSTART, PICK, PICKMERIT, PICKSUCCESS, PMDEC, PMRA, POSITION, RA, RATE, REC, REQUIRES, RETRY, RETRYMAX, SELECT, SENDING, SEQUENCE, SEQUENCETYPE, SET, SETNAME, SETUP, SETUPID, STEP, STEPCOUNTER, STEPWHILE, SUCCESSOR, TARGET, TARGETACCESS, TARGETDB, TARGETNAME, TARGETNAMEPROPOSAL, TARGETREAD, TARGETSUBMITTED, TARGETTYPE, TASK, TASKDONE, TASKID, TEAM, TIMESLOT, TITLE, TO, TRUE, USER, V, VARIABLE| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
add, add, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streamprivate Document xml
private boolean parsed
public DOMSequence()
public DOMSequence(File doc)
parse().public DOMSequence(URL doc)
parse().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()