edu.harvard.hul.ois.jhove.module.html
Class HtmlStack

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList
                  extended by edu.harvard.hul.ois.jhove.module.html.HtmlStack
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Deque, java.util.List, java.util.Queue

public class HtmlStack
extends java.util.LinkedList

A LinkedList dressed up as a stack for processing HTML objects. It knows about certain elements and their history on the stack.

Author:
Gary McGath
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
HtmlStack()
           
 
Method Summary
protected  boolean excludesTag(java.lang.String tag)
          Returns true if any element on the stack prohibits the specified tag.
protected  boolean isBodySeen()
          Returns true if a BODY element has been pushed on the stack.
protected  boolean isHeadSeen()
          Returns true if a HEAD element has been pushed on the stack.
protected  void popp()
          Pops top element from element stack.
protected  void popTo(int idx)
          Pops elements from the stack up to and including the one indexed by idx
protected  void push(JHOpenTag tag)
          Pushes an element onto the stack.
protected  int search(java.lang.String tag)
          Searches backwards through the element stack for a match to a given tag.
protected  void setBodyElement(HtmlTagDesc elem)
          Sets the value of the HEAD element for easy comparison
protected  void setFramesetElement(HtmlTagDesc elem)
          Sets the value of the HEAD element for easy comparison
protected  void setHeadElement(HtmlTagDesc elem)
          Sets the value of the HEAD element for easy comparison
protected  JHOpenTag top()
          Gets the top of the element stack without popping it.
 
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 
Methods inherited from interface java.util.Deque
iterator
 

Constructor Detail

HtmlStack

public HtmlStack()
Method Detail

setHeadElement

protected void setHeadElement(HtmlTagDesc elem)
Sets the value of the HEAD element for easy comparison


setBodyElement

protected void setBodyElement(HtmlTagDesc elem)
Sets the value of the HEAD element for easy comparison


setFramesetElement

protected void setFramesetElement(HtmlTagDesc elem)
Sets the value of the HEAD element for easy comparison


popp

protected void popp()
Pops top element from element stack. If we ever decide to go to a different stack implementation, it's necessary only to change these methods. Also, they add some type checking. Name changed from "pop" to "popp" to avoid a conflict in Java 1.6 with the List class.


push

protected void push(JHOpenTag tag)
Pushes an element onto the stack. This should have its element field set to function properly.


top

protected JHOpenTag top()
Gets the top of the element stack without popping it.


search

protected int search(java.lang.String tag)
Searches backwards through the element stack for a match to a given tag. Return -1 if no match.


popTo

protected void popTo(int idx)
Pops elements from the stack up to and including the one indexed by idx


isHeadSeen

protected boolean isHeadSeen()
Returns true if a HEAD element has been pushed on the stack.


isBodySeen

protected boolean isBodySeen()
Returns true if a BODY element has been pushed on the stack.


excludesTag

protected boolean excludesTag(java.lang.String tag)
Returns true if any element on the stack prohibits the specified tag.