org.galagosearch.core.parse
Class Tag

java.lang.Object
  extended by org.galagosearch.core.parse.Tag
All Implemented Interfaces:
java.lang.Comparable<Tag>

public class Tag
extends java.lang.Object
implements java.lang.Comparable<Tag>

This class represents a tag in a XML/HTML document. A tag has a name, an optional set of attributes, a beginning position and an end position. The positions are in terms of tokens, so if begin = 5, that means the open tag is between token 5 and token 6.

Author:
trevor

Field Summary
 java.util.Map<java.lang.String,java.lang.String> attributes
           
 int begin
           
 int end
           
 java.lang.String name
           
 
Constructor Summary
Tag(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> attributes, int begin, int end)
          Constructs a tag.
 
Method Summary
 int compareTo(Tag other)
          Compares two tags together.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public java.lang.String name

attributes

public java.util.Map<java.lang.String,java.lang.String> attributes

begin

public int begin

end

public int end
Constructor Detail

Tag

public Tag(java.lang.String name,
           java.util.Map<java.lang.String,java.lang.String> attributes,
           int begin,
           int end)
Constructs a tag.

Parameters:
name - The name of the tag.
attributes - Attributes of the tag.
begin - Location of the start tag within the document, in tokens.
end - Location of the end tag within the document, in tokens.
Method Detail

compareTo

public int compareTo(Tag other)
Compares two tags together. Tags are ordered by the location of the open tag. If we find two tags opening at the same location, the tie is broken by the location of the closing tag.

Specified by:
compareTo in interface java.lang.Comparable<Tag>
Parameters:
other -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009. All Rights Reserved.