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>myExecutedJobsThe my executed jobs.protected LinkedList<IJob>myJobsThe 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 voidadd(int index, IJob element)Adds the.booleanadd(IJob e)Adds the.booleanaddAll(int index, Collection<? extends IJob> c)Adds the all.booleanaddAll(Collection<? extends IJob> c)Adds the all.voidaddFirst(IJob e)Adds the first.voidaddJob(IJob job)Adds a job to the end of the list of composite jobs.voidaddLast(IJob e)Adds the last.voidcleanup(IProgressMonitor monitor)Clean up all temporary side effects of this job.voidclear()Clear.Objectclone()Clone.booleancontains(Object o)Contains.booleancontainsAll(Collection<?> c)Contains all.Iterator<IJob>descendingIterator()Descending iterator.IJobelement()Element.booleanequals(Object o)Equals.abstract voidexecute(IProgressMonitor monitor)Execute the job.IJobget(int index)Gets the.IJobgetFirst()Gets the first.IJobgetLast()Gets the last.StringgetName()Supply a name of this job.inthashCode()Hash code.intindexOf(Object o)Index of.booleanisEmpty()Checks if is empty.Iterator<IJob>iterator()Iterator.intlastIndexOf(Object o)Last index of.ListIterator<IJob>listIterator()List iterator.ListIterator<IJob>listIterator(int index)List iterator.booleanoffer(IJob e)Offer.booleanofferFirst(IJob e)Offer first.booleanofferLast(IJob e)Offer last.IJobpeek()Peek.IJobpeekFirst()Peek first.IJobpeekLast()Peek last.IJobpoll()Poll.IJobpollFirst()Poll first.IJobpollLast()Poll last.IJobpop()Pop.voidpush(IJob e)Push.IJobremove()Removes the.IJobremove(int index)Removes the.booleanremove(Object o)Removes the.booleanremoveAll(Collection<?> c)Removes the all.IJobremoveFirst()Removes the first.booleanremoveFirstOccurrence(Object o)Removes the first occurrence.IJobremoveLast()Removes the last.booleanremoveLastOccurrence(Object o)Removes the last occurrence.booleanretainAll(Collection<?> c)Retain all.IJobset(int index, IJob element)Sets the.voidsetName(String name)Sets the name.intsize()Size.List<IJob>subList(int fromIndex, int toIndex)Sub list.Object[]toArray()To array.<T> T[]toArray(T[] a)To array.StringtoString()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:ICompositeJobAdds a job to the end of the list of composite jobs.- Specified by:
addJobin interfaceICompositeJob- Parameters:
job- the job to add
-
execute
public abstract void execute(IProgressMonitor monitor) throws JobFailedException, UserCanceledException
Description copied from interface:IJobExecute the job. In case of an error throw an exception with a meaningful name which can be understood by a user.- Specified by:
executein 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:IJobSupply 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:
cleanupin 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:
addin interfaceCollection<IJob>- Specified by:
addin 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:
addin 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:
addAllin interfaceCollection<IJob>- Specified by:
addAllin 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:
addAllin 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:
clearin interfaceCollection<IJob>- Specified by:
clearin interfaceList<IJob>- See Also:
LinkedList.clear()
-
clone
public Object clone()
Clone.- Overrides:
clonein classObject- Returns:
- the object
- See Also:
LinkedList.clone()
-
contains
public boolean contains(Object o)
Contains.- Specified by:
containsin interfaceCollection<IJob>- Specified by:
containsin 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:
containsAllin interfaceCollection<IJob>- Specified by:
containsAllin 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:
equalsin interfaceCollection<IJob>- Specified by:
equalsin interfaceList<IJob>- Overrides:
equalsin 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:
getin 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:
hashCodein interfaceCollection<IJob>- Specified by:
hashCodein interfaceList<IJob>- Overrides:
hashCodein classObject- Returns:
- the int
- See Also:
AbstractList.hashCode()
-
indexOf
public int indexOf(Object o)
Index of.- Specified by:
indexOfin 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:
isEmptyin interfaceCollection<IJob>- Specified by:
isEmptyin interfaceList<IJob>- Returns:
- true, if is empty
- See Also:
AbstractCollection.isEmpty()
-
iterator
public Iterator<IJob> iterator()
Iterator.- Specified by:
iteratorin interfaceCollection<IJob>- Specified by:
iteratorin interfaceIterable<IJob>- Specified by:
iteratorin interfaceList<IJob>- Returns:
- the iterator
- See Also:
AbstractSequentialList.iterator()
-
lastIndexOf
public int lastIndexOf(Object o)
Last index of.- Specified by:
lastIndexOfin 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:
listIteratorin interfaceList<IJob>- Returns:
- the list iterator
- See Also:
AbstractList.listIterator()
-
listIterator
public ListIterator<IJob> listIterator(int index)
List iterator.- Specified by:
listIteratorin 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:
removein 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:
removein interfaceCollection<IJob>- Specified by:
removein 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:
removeAllin interfaceCollection<IJob>- Specified by:
removeAllin 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:
retainAllin interfaceCollection<IJob>- Specified by:
retainAllin 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:
setin 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:
sizein interfaceCollection<IJob>- Specified by:
sizein interfaceList<IJob>- Returns:
- the int
- See Also:
LinkedList.size()
-
subList
public List<IJob> subList(int fromIndex, int toIndex)
Sub list.- Specified by:
subListin 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:
toArrayin interfaceCollection<IJob>- Specified by:
toArrayin 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:
toStringin classObject- Returns:
- the string
- See Also:
AbstractCollection.toString()
-
-