public class OperationSequence
extends java.lang.Object
Constructor and Description |
---|
OperationSequence()
Constructor that creates an empty sequence
|
OperationSequence(OperationSequence sequence)
Constructor that copies a given sequence in the new object
|
Modifier and Type | Method and Description |
---|---|
java.util.Collection<OperationSequence> |
abstractionStrictToAbstractOperationSequences()
Generates OperationSequence from the current one but without any
abstractionStrictOperation Will modify the given Tree !
|
java.util.Collection<OperationSequence> |
abstractionToOperationSequences(Tree t)
Generates OperationSequence from the current one but without any
abstraction.
|
void |
addAddressPrefix(Address reference)
Changes the Address of every Operations of the Sequence by adding the
given Address at the begin of their Addresses
|
void |
addOperation(Operation operation)
Adds an Operation at the end of the sequence
|
void |
addOperation(Operation operation,
int position)
Adds an Operation at the given position in the sequence
|
void |
addOperationSequence(OperationSequence sequence)
Adds every a copy Operation of the OperatiosSequence at the end of the
current sequence
|
void |
addOperationSequence(OperationSequence sequence,
int position)
Adds a copy of every Operation of the OperatiosSequence at the end of the
current sequence
|
boolean |
equals(java.lang.Object o)
Returns true if the given object is an OperationSequence with the same
hashCode
|
int |
getAddressOffset(Address address)
Calculates the offset generated by the making of the operation already
done when the next one to be added will be make.
|
int |
getCost(Tree t)
Calculates the global cost of the sequence for doing every Operations on
the Tree given
|
Operation |
getOperation(int i)
Returns the Operation that is at the position given
|
int |
getOperationNumber()
Returns the number of operation contained by the sequence
|
int |
hashCode()
Returns an unique hashCode
|
boolean |
isAbstract()
Return True if there is an Operation in the Sequence that isn't an
EditOperation
|
boolean |
isAbstractStrict()
Return True if there is an Operation in the Sequence that isn't an
Abstract UpdateOperation
|
java.util.Iterator<Operation> |
iterator()
Returns an iterator to access to every Operation of the OperationSequence
|
void |
make(Tree t)
Makes every Operation of the OperationSequence on the Tree given
|
void |
removeOperation(int i)
Removes the Operation that is at the given position
|
java.lang.String |
toString()
Returns a String that is like this: sequence[list of operations]
|
org.jdom.Element |
toXmlElement()
Returns the OperationSequence formated to fit Xml as JDOM
|
org.jdom.Element |
toXmlElement(Tree t,
int id)
Returns the OperationSequence formated to fit Xml as JDOM.
|
org.jdom.Element |
toXmlElement(Tree t,
VocabTranslator vt,
int id)
Returns the OperationSequence formated to fit Xml as JDOM.
|
org.jdom.Element |
toXmlElement(VocabTranslator vt)
Returns the OperationSequence formated to fit Xml as JDOM
|
public OperationSequence(OperationSequence sequence)
sequence
- OperationSequence to copypublic OperationSequence()
public void addOperation(Operation operation)
operation
- Operation to addpublic void addOperation(Operation operation, int position)
operation
- Operation to addposition
- Position where the Operation should be addedpublic void addOperationSequence(OperationSequence sequence)
sequence
- OperationSequence to usepublic void addOperationSequence(OperationSequence sequence, int position)
sequence
- OperationSequence to useposition
- Where the operations should be addedpublic int getCost(Tree t) throws badOperationException, noNodeException
t
- Tree that should be used to do the sequencebadOperationException
- Throws this Exception if an error occurs while doing the
OperationsnoNodeException
- Throws t his Exception if an Operation implicates the use of
a Node that doesn't existspublic void make(Tree t) throws addNodeException, noNodeException, removeNodeException, badAddressException, headerNodeException, abstractOperationException
t
- Tree where the Operations should be doneaddNodeException
- Throws this Exception if there is an error while trying to
add a NodenoNodeException
- Throws this Exception if an Operation tries to access to a
Node that doesn't existremoveNodeException
- Throws this Exception if there is an error while trying to
remove a NodebadAddressException
- Throws this Exception if there is an error while creating new
AddressesheaderNodeException
- Throws this exception is the header of the new node is ""abstractOperationException
- Throws this exception if the is an abstract operation in the
sequence like AddMinimalTreeOperationpublic void addAddressPrefix(Address reference)
reference
- Address to add at the begin of every Operation's Addresspublic boolean isAbstract()
public boolean isAbstractStrict()
public int getOperationNumber()
public Operation getOperation(int i)
i
- Position, from 0 to number-1public void removeOperation(int i)
i
- Position between 0 and total-1public int getAddressOffset(Address address)
address
- Address where the next operation to be add should interferpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.Collection<OperationSequence> abstractionStrictToAbstractOperationSequences()
public java.util.Collection<OperationSequence> abstractionToOperationSequences(Tree t) throws badOperationException, badAddressException, noNodeException, headerNodeException, addNodeException, removeNodeException, abstractOperationException
t
- Tree to use to unabstractbadOperationException
badAddressException
noNodeException
headerNodeException
addNodeException
removeNodeException
abstractOperationException
public org.jdom.Element toXmlElement(Tree t, int id) throws addNodeException, noNodeException, removeNodeException, badAddressException, headerNodeException, abstractOperationException
t
- Tree to use for the operationsaddNodeException
noNodeException
removeNodeException
badAddressException
headerNodeException
abstractOperationException
public org.jdom.Element toXmlElement(Tree t, VocabTranslator vt, int id) throws addNodeException, noNodeException, removeNodeException, badAddressException, headerNodeException, abstractOperationException
t
- Tree to use for the operationsvt
- Vocabulary translator establishing the correspondence between
XML elements and charactersaddNodeException
noNodeException
removeNodeException
badAddressException
headerNodeException
abstractOperationException
public org.jdom.Element toXmlElement()
public org.jdom.Element toXmlElement(VocabTranslator vt)
vt
- Vocabulary translator establishing the correspondence between
XML elements and characterspublic java.util.Iterator<Operation> iterator()