Package de.uka.ipd.sdq.workflow.jobs
Class AbstractCompositeJob
- java.lang.Object
-
- de.uka.ipd.sdq.workflow.jobs.AbstractJob
-
- de.uka.ipd.sdq.workflow.jobs.AbstractCompositeJob
-
- All Implemented Interfaces:
ICompositeJob
,IJob
,Iterable<IJob>
,Collection<IJob>
,List<IJob>
- Direct Known Subclasses:
ParallelJob
,SequentialJob
public abstract class AbstractCompositeJob extends AbstractJob implements ICompositeJob, List<IJob>
The Class AbstractCompositeJob.
-
-
Field Summary
Fields Modifier and Type Field Description protected Stack<IJob>
myExecutedJobs
The my executed jobs.protected LinkedList<IJob>
myJobs
The my jobs.-
Fields inherited from class de.uka.ipd.sdq.workflow.jobs.AbstractJob
logger
-
-
Constructor Summary
Constructors Constructor Description AbstractCompositeJob()
Instantiates a new abstract composite job.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(int index, IJob element)
Adds the.boolean
add(IJob e)
Adds the.boolean
addAll(int index, Collection<? extends IJob> c)
Adds the all.boolean
addAll(Collection<? extends IJob> c)
Adds the all.void
addFirst(IJob e)
Adds the first.void
addJob(IJob job)
Adds a job to the end of the list of composite jobs.void
addLast(IJob e)
Adds the last.void
cleanup(IProgressMonitor monitor)
Clean up all temporary side effects of this job.void
clear()
Clear.Object
clone()
Clone.boolean
contains(Object o)
Contains.boolean
containsAll(Collection<?> c)
Contains all.Iterator<IJob>
descendingIterator()
Descending iterator.IJob
element()
Element.boolean
equals(Object o)
Equals.abstract void
execute(IProgressMonitor monitor)
Execute the job.IJob
get(int index)
Gets the.IJob
getFirst()
Gets the first.IJob
getLast()
Gets the last.String
getName()
Supply a name of this job.int
hashCode()
Hash code.int
indexOf(Object o)
Index of.boolean
isEmpty()
Checks if is empty.Iterator<IJob>
iterator()
Iterator.int
lastIndexOf(Object o)
Last index of.ListIterator<IJob>
listIterator()
List iterator.ListIterator<IJob>
listIterator(int index)
List iterator.boolean
offer(IJob e)
Offer.boolean
offerFirst(IJob e)
Offer first.boolean
offerLast(IJob e)
Offer last.IJob
peek()
Peek.IJob
peekFirst()
Peek first.IJob
peekLast()
Peek last.IJob
poll()
Poll.IJob
pollFirst()
Poll first.IJob
pollLast()
Poll last.IJob
pop()
Pop.void
push(IJob e)
Push.IJob
remove()
Removes the.IJob
remove(int index)
Removes the.boolean
remove(Object o)
Removes the.boolean
removeAll(Collection<?> c)
Removes the all.IJob
removeFirst()
Removes the first.boolean
removeFirstOccurrence(Object o)
Removes the first occurrence.IJob
removeLast()
Removes the last.boolean
removeLastOccurrence(Object o)
Removes the last occurrence.boolean
retainAll(Collection<?> c)
Retain all.IJob
set(int index, IJob element)
Sets the.void
setName(String name)
Sets the name.int
size()
Size.List<IJob>
subList(int fromIndex, int toIndex)
Sub list.Object[]
toArray()
To array.<T> T[]
toArray(T[] a)
To array.String
toString()
To string.-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Field Detail
-
myJobs
protected LinkedList<IJob> myJobs
The my jobs.
-
-
Method Detail
-
addJob
public void addJob(IJob job)
Description copied from interface:ICompositeJob
Adds a job to the end of the list of composite jobs.- Specified by:
addJob
in interfaceICompositeJob
- Parameters:
job
- the job to add
-
execute
public abstract void execute(IProgressMonitor monitor) throws JobFailedException, UserCanceledException
Description copied from interface:IJob
Execute the job. In case of an error throw an exception with a meaningful name which can be understood by a user.- Specified by:
execute
in interfaceIJob
- Parameters:
monitor
- the monitor- Throws:
JobFailedException
- the job failedUserCanceledException
- the user has chosen to abort the job
-
getName
public String getName()
Description copied from interface:IJob
Supply a name of this job. This could be used for a progress monitor.
-
setName
public void setName(String name)
Sets the name.- Parameters:
name
- the new name
-
cleanup
public void cleanup(IProgressMonitor monitor) throws CleanupFailedException
Clean up all temporary side effects of this job. This method will always be called after executing this job to remove automatically created files and to leave the environment in a state in which the whole workflow run can be started again with the same results (i.e. in which executed can be called again). Usually, cleanup is called after the whole workflow is completed to allow other jobs to use intermediate results. In some cases, cleanup can be called earlier. However, in those cases, later jobs might not be able to access the intermediate data anymore.
This method ensures to clean up all child jobs in the reverse order in which they were added.- Specified by:
cleanup
in interfaceIJob
- Parameters:
monitor
- the monitor- Throws:
CleanupFailedException
- Thrown if a critical error occurred during clean up so that the whole workflow should abort cleaning up further jobs.
-
add
public boolean add(IJob e)
Adds the.- Specified by:
add
in interfaceCollection<IJob>
- Specified by:
add
in interfaceList<IJob>
- Parameters:
e
- the e- Returns:
- true, if successful
- See Also:
LinkedList.add(java.lang.Object)
-
add
public void add(int index, IJob element)
Adds the.- Specified by:
add
in interfaceList<IJob>
- Parameters:
index
- the indexelement
- the element- See Also:
LinkedList.add(int, java.lang.Object)
-
addAll
public boolean addAll(Collection<? extends IJob> c)
Adds the all.- Specified by:
addAll
in interfaceCollection<IJob>
- Specified by:
addAll
in interfaceList<IJob>
- Parameters:
c
- the c- Returns:
- true, if successful
- See Also:
LinkedList.addAll(java.util.Collection)
-
addAll
public boolean addAll(int index, Collection<? extends IJob> c)
Adds the all.- Specified by:
addAll
in interfaceList<IJob>
- Parameters:
index
- the indexc
- the c- Returns:
- true, if successful
- See Also:
LinkedList.addAll(int, java.util.Collection)
-
addFirst
public void addFirst(IJob e)
Adds the first.- Parameters:
e
- the e- See Also:
LinkedList.addFirst(java.lang.Object)
-
addLast
public void addLast(IJob e)
Adds the last.- Parameters:
e
- the e- See Also:
LinkedList.addLast(java.lang.Object)
-
clear
public void clear()
Clear.- Specified by:
clear
in interfaceCollection<IJob>
- Specified by:
clear
in interfaceList<IJob>
- See Also:
LinkedList.clear()
-
clone
public Object clone()
Clone.- Overrides:
clone
in classObject
- Returns:
- the object
- See Also:
LinkedList.clone()
-
contains
public boolean contains(Object o)
Contains.- Specified by:
contains
in interfaceCollection<IJob>
- Specified by:
contains
in interfaceList<IJob>
- Parameters:
o
- the o- Returns:
- true, if successful
- See Also:
LinkedList.contains(java.lang.Object)
-
containsAll
public boolean containsAll(Collection<?> c)
Contains all.- Specified by:
containsAll
in interfaceCollection<IJob>
- Specified by:
containsAll
in interfaceList<IJob>
- Parameters:
c
- the c- Returns:
- true, if successful
- See Also:
AbstractCollection.containsAll(java.util.Collection)
-
descendingIterator
public Iterator<IJob> descendingIterator()
Descending iterator.- Returns:
- the iterator
- See Also:
LinkedList.descendingIterator()
-
element
public IJob element()
Element.- Returns:
- the i job
- See Also:
LinkedList.element()
-
equals
public boolean equals(Object o)
Equals.- Specified by:
equals
in interfaceCollection<IJob>
- Specified by:
equals
in interfaceList<IJob>
- Overrides:
equals
in classObject
- Parameters:
o
- the o- Returns:
- true, if successful
- See Also:
AbstractList.equals(java.lang.Object)
-
get
public IJob get(int index)
Gets the.- Specified by:
get
in interfaceList<IJob>
- Parameters:
index
- the index- Returns:
- the i job
- See Also:
LinkedList.get(int)
-
getFirst
public IJob getFirst()
Gets the first.- Returns:
- the first
- See Also:
LinkedList.getFirst()
-
getLast
public IJob getLast()
Gets the last.- Returns:
- the last
- See Also:
LinkedList.getLast()
-
hashCode
public int hashCode()
Hash code.- Specified by:
hashCode
in interfaceCollection<IJob>
- Specified by:
hashCode
in interfaceList<IJob>
- Overrides:
hashCode
in classObject
- Returns:
- the int
- See Also:
AbstractList.hashCode()
-
indexOf
public int indexOf(Object o)
Index of.- Specified by:
indexOf
in interfaceList<IJob>
- Parameters:
o
- the o- Returns:
- the int
- See Also:
LinkedList.indexOf(java.lang.Object)
-
isEmpty
public boolean isEmpty()
Checks if is empty.- Specified by:
isEmpty
in interfaceCollection<IJob>
- Specified by:
isEmpty
in interfaceList<IJob>
- Returns:
- true, if is empty
- See Also:
AbstractCollection.isEmpty()
-
iterator
public Iterator<IJob> iterator()
Iterator.- Specified by:
iterator
in interfaceCollection<IJob>
- Specified by:
iterator
in interfaceIterable<IJob>
- Specified by:
iterator
in interfaceList<IJob>
- Returns:
- the iterator
- See Also:
AbstractSequentialList.iterator()
-
lastIndexOf
public int lastIndexOf(Object o)
Last index of.- Specified by:
lastIndexOf
in interfaceList<IJob>
- Parameters:
o
- the o- Returns:
- the int
- See Also:
LinkedList.lastIndexOf(java.lang.Object)
-
listIterator
public ListIterator<IJob> listIterator()
List iterator.- Specified by:
listIterator
in interfaceList<IJob>
- Returns:
- the list iterator
- See Also:
AbstractList.listIterator()
-
listIterator
public ListIterator<IJob> listIterator(int index)
List iterator.- Specified by:
listIterator
in interfaceList<IJob>
- Parameters:
index
- the index- Returns:
- the list iterator
- See Also:
LinkedList.listIterator(int)
-
offer
public boolean offer(IJob e)
Offer.- Parameters:
e
- the e- Returns:
- true, if successful
- See Also:
LinkedList.offer(java.lang.Object)
-
offerFirst
public boolean offerFirst(IJob e)
Offer first.- Parameters:
e
- the e- Returns:
- true, if successful
- See Also:
LinkedList.offerFirst(java.lang.Object)
-
offerLast
public boolean offerLast(IJob e)
Offer last.- Parameters:
e
- the e- Returns:
- true, if successful
- See Also:
LinkedList.offerLast(java.lang.Object)
-
peek
public IJob peek()
Peek.- Returns:
- the i job
- See Also:
LinkedList.peek()
-
peekFirst
public IJob peekFirst()
Peek first.- Returns:
- the i job
- See Also:
LinkedList.peekFirst()
-
peekLast
public IJob peekLast()
Peek last.- Returns:
- the i job
- See Also:
LinkedList.peekLast()
-
poll
public IJob poll()
Poll.- Returns:
- the i job
- See Also:
LinkedList.poll()
-
pollFirst
public IJob pollFirst()
Poll first.- Returns:
- the i job
- See Also:
LinkedList.pollFirst()
-
pollLast
public IJob pollLast()
Poll last.- Returns:
- the i job
- See Also:
LinkedList.pollLast()
-
pop
public IJob pop()
Pop.- Returns:
- the i job
- See Also:
LinkedList.pop()
-
push
public void push(IJob e)
Push.- Parameters:
e
- the e- See Also:
LinkedList.push(java.lang.Object)
-
remove
public IJob remove()
Removes the.- Returns:
- the i job
- See Also:
LinkedList.remove()
-
remove
public IJob remove(int index)
Removes the.- Specified by:
remove
in interfaceList<IJob>
- Parameters:
index
- the index- Returns:
- the i job
- See Also:
LinkedList.remove(int)
-
remove
public boolean remove(Object o)
Removes the.- Specified by:
remove
in interfaceCollection<IJob>
- Specified by:
remove
in interfaceList<IJob>
- Parameters:
o
- the o- Returns:
- true, if successful
- See Also:
LinkedList.remove(java.lang.Object)
-
removeAll
public boolean removeAll(Collection<?> c)
Removes the all.- Specified by:
removeAll
in interfaceCollection<IJob>
- Specified by:
removeAll
in interfaceList<IJob>
- Parameters:
c
- the c- Returns:
- true, if successful
- See Also:
AbstractCollection.removeAll(java.util.Collection)
-
removeFirst
public IJob removeFirst()
Removes the first.- Returns:
- the i job
- See Also:
LinkedList.removeFirst()
-
removeFirstOccurrence
public boolean removeFirstOccurrence(Object o)
Removes the first occurrence.- Parameters:
o
- the o- Returns:
- true, if successful
- See Also:
LinkedList.removeFirstOccurrence(java.lang.Object)
-
removeLast
public IJob removeLast()
Removes the last.- Returns:
- the i job
- See Also:
LinkedList.removeLast()
-
removeLastOccurrence
public boolean removeLastOccurrence(Object o)
Removes the last occurrence.- Parameters:
o
- the o- Returns:
- true, if successful
- See Also:
LinkedList.removeLastOccurrence(java.lang.Object)
-
retainAll
public boolean retainAll(Collection<?> c)
Retain all.- Specified by:
retainAll
in interfaceCollection<IJob>
- Specified by:
retainAll
in interfaceList<IJob>
- Parameters:
c
- the c- Returns:
- true, if successful
- See Also:
AbstractCollection.retainAll(java.util.Collection)
-
set
public IJob set(int index, IJob element)
Sets the.- Specified by:
set
in interfaceList<IJob>
- Parameters:
index
- the indexelement
- the element- Returns:
- the i job
- See Also:
LinkedList.set(int, java.lang.Object)
-
size
public int size()
Size.- Specified by:
size
in interfaceCollection<IJob>
- Specified by:
size
in interfaceList<IJob>
- Returns:
- the int
- See Also:
LinkedList.size()
-
subList
public List<IJob> subList(int fromIndex, int toIndex)
Sub list.- Specified by:
subList
in interfaceList<IJob>
- Parameters:
fromIndex
- the from indextoIndex
- the to index- Returns:
- the list
- See Also:
AbstractList.subList(int, int)
-
toArray
public Object[] toArray()
To array.- Specified by:
toArray
in interfaceCollection<IJob>
- Specified by:
toArray
in interfaceList<IJob>
- Returns:
- the object[]
- See Also:
LinkedList.toArray()
-
toArray
public <T> T[] toArray(T[] a)
To array.
-
toString
public String toString()
To string.- Overrides:
toString
in classObject
- Returns:
- the string
- See Also:
AbstractCollection.toString()
-
-