Package com.yahoo.docproc
Class CallStack
java.lang.Object
com.yahoo.docproc.CallStack
A stack of the processors to call next in this processing. To push which
processor to call next, call addNext, to get and remove the next processor,
call pop.
This is not thread safe.
- Author:
- bratseth
-
Constructor Summary
ConstructorDescriptionCreates a stack from another stack (starting at the next of the given callstack) This does a deep copy of the stack.CallStack
(com.yahoo.jdisc.Metric metric) Creates an empty stackCallStack
(com.yahoo.statistics.Statistics statistics, com.yahoo.jdisc.Metric metric) Deprecated.Creates an empty stack with a nameDeprecated.CallStack
(String name, Collection<DocumentProcessor> docprocs, com.yahoo.jdisc.Metric metric) Creates a stack (with a given name) based on a collection of document processors, which are added to the stack in the iteration order of the collection.CallStack
(String name, Collection<DocumentProcessor> docprocs, com.yahoo.statistics.Statistics manager, com.yahoo.jdisc.Metric metric) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionAdds an element just after the first occurence of some other element on the stack.Adds multiple elements just after another given element on the stack.addAfter
(Call after, DocumentProcessor processor) Adds an element just after the first occurence of some other element on the stack.Adds an element just before the first occurence of some other element on the stack.Adds multiple elements just before the first occurence of some element on the stack.addBefore
(Call before, DocumentProcessor processor) Adds an element just before the first occurence of some element on the stack.Adds an element as the last element on this stackAdds multiple elements as the last elements on this stackaddLast
(DocumentProcessor processor) Adds an element as the last element on this stackPush an element as the next element on this stackPush multiple elements as the next elements on this stackaddNext
(DocumentProcessor processor) Push an element as the next element on this stackvoid
clear()
boolean
Returns whether this stack has this call (left)findCall
(com.yahoo.component.ComponentId processorId) Returns the next call to this processor id, or null if no such calls are leftfindCall
(DocumentProcessor processor) Returns the next call to this processor, or null if no such calls are leftReturns the element that was last popped from this stack, or null if none have been popped or the stack is emptycom.yahoo.jdisc.Metric
getName()
Returns the name of this stack, or null if it is not namedcom.yahoo.statistics.Statistics
Deprecated.iterator()
Returns a modifiable ListIterator over all the remaining elements of this stack, starting by the next elementpeek()
Returns the next element without removing it, or null if there are no more elementspop()
Returns and removes the next element, or null if there are no more elementsRemoves the given call.void
Sets the name of this stackint
size()
Returns the number of remaining elements in this stacktoString()
-
Constructor Details
-
CallStack
public CallStack() -
CallStack
-
CallStack
public CallStack(com.yahoo.jdisc.Metric metric) Creates an empty stack -
CallStack
@Deprecated public CallStack(com.yahoo.statistics.Statistics statistics, com.yahoo.jdisc.Metric metric) Deprecated. -
CallStack
@Deprecated public CallStack(String name, com.yahoo.statistics.Statistics manager, com.yahoo.jdisc.Metric metric) Deprecated. -
CallStack
Creates an empty stack with a name -
CallStack
Creates a stack from another stack (starting at the next of the given callstack) This does a deep copy of the stack. -
CallStack
public CallStack(String name, Collection<DocumentProcessor> docprocs, com.yahoo.jdisc.Metric metric) Creates a stack (with a given name) based on a collection of document processors, which are added to the stack in the iteration order of the collection.- Parameters:
name
- the name of the stackdocprocs
- the document processors to call
-
CallStack
@Deprecated public CallStack(String name, Collection<DocumentProcessor> docprocs, com.yahoo.statistics.Statistics manager, com.yahoo.jdisc.Metric metric) Deprecated.
-
-
Method Details
-
getName
Returns the name of this stack, or null if it is not named -
setName
Sets the name of this stack -
addNext
Push an element as the next element on this stack- Returns:
- this for convenience
-
addNext
Push an element as the next element on this stack- Returns:
- this for convenience
-
addNext
Push multiple elements as the next elements on this stack- Returns:
- this for convenience
-
addLast
Adds an element as the last element on this stack- Returns:
- this for convenience
-
addLast
Adds an element as the last element on this stack- Returns:
- this for convenience
-
addLast
Adds multiple elements as the last elements on this stack- Returns:
- this for convenience
-
addBefore
Adds an element just before the first occurence of some other element on the stack. This can not be called during an iteration.- Parameters:
before
- the call to add this before. If this call is not present (the same object instance), new processor is added as the last elementcall
- the call to add- Returns:
- this for convenience
-
addBefore
Adds an element just before the first occurence of some element on the stack. This can not be called during an iteration.- Parameters:
before
- the call to add this before. If this call is not present (the same object instance), the new processor is added as the last elementprocessor
- the processor to add- Returns:
- this for convenience
-
addBefore
Adds multiple elements just before the first occurence of some element on the stack. This can not be called during an iteration.- Parameters:
before
- the call to add this before. If this call is not present (the same object instance), the new processor is added as the last elementcallStack
- the calls to add- Returns:
- this for convenience
-
addAfter
Adds an element just after the first occurence of some other element on the stack. This can not be called during an iteration.- Parameters:
after
- the call to add this before. If this call is not present, (the same object instance), the new processor is added as the last elementcall
- the call to add- Returns:
- this for convenience
-
addAfter
Adds an element just after the first occurence of some other element on the stack. This can not be called during an iteration.- Parameters:
after
- the call to add this after. If this call is not present, (the same object instance), the new processor is added as the last elementprocessor
- the processor to add- Returns:
- this for convenience
-
addAfter
Adds multiple elements just after another given element on the stack. This can not be called during an iteration.- Parameters:
after
- the call to add this before. If this call is not present, (the same object instance), the new processor is added as the last elementcallStack
- the calls to add- Returns:
- this for convenience
-
remove
Removes the given call. Does nothing if the call is not present.- Parameters:
call
- the call to remove- Returns:
- this for convenience
-
contains
Returns whether this stack has this call (left)- Parameters:
call
- the call to check- Returns:
- true if the call is present, false otherwise
-
findCall
Returns the next call to this processor id, or null if no such calls are left -
findCall
Returns the next call to this processor, or null if no such calls are left -
pop
Returns and removes the next element, or null if there are no more elements -
peek
Returns the next element without removing it, or null if there are no more elements -
getLastPopped
Returns the element that was last popped from this stack, or null if none have been popped or the stack is empty -
clear
public void clear() -
iterator
Returns a modifiable ListIterator over all the remaining elements of this stack, starting by the next element -
size
public int size()Returns the number of remaining elements in this stack -
toString
-
getStatistics
Deprecated. -
getMetric
public com.yahoo.jdisc.Metric getMetric()
-