org.encog.bot.browse.range
Class DocumentRange

java.lang.Object
  extended by org.encog.bot.browse.range.DocumentRange
Direct Known Subclasses:
Div, Form, FormElement, Link, Span

public class DocumentRange
extends Object

Base class that represents a document range. A document range is a collection of tags that all apply to one "concept". For example, a Form, or a Link. This allows the form to collect the elements inside the form, or a link to collect the text along with the link tag.

Author:
jheaton

Constructor Summary
DocumentRange(WebPage source)
          Construct a document range from the specified WebPage.
 
Method Summary
 void addElement(DocumentRange element)
          Add an element.
 int getBegin()
           
 String getClassAttribute()
           
 List<DocumentRange> getElements()
           
 int getEnd()
           
 String getIdAttribute()
           
 DocumentRange getParent()
           
 WebPage getSource()
           
 String getTextOnly()
          Get the text from this range.
 void setBegin(int begin)
          Set the beginning index.
 void setClassAttribute(String classAttribute)
           
 void setEnd(int end)
          Set the ending index.
 void setIdAttribute(String idAttribute)
           
 void setParent(DocumentRange parent)
          Set the parent.
 void setSource(WebPage source)
          Set the source web page.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DocumentRange

public DocumentRange(WebPage source)
Construct a document range from the specified WebPage.

Parameters:
source - The web page that this range belongs to.
Method Detail

addElement

public void addElement(DocumentRange element)
Add an element.

Parameters:
element - The element to add.

getBegin

public int getBegin()
Returns:
The beginning index.

getClassAttribute

public String getClassAttribute()
Returns:
the classAttribute

getElements

public List<DocumentRange> getElements()
Returns:
The elements of this document range.

getEnd

public int getEnd()
Returns:
The ending index.

getIdAttribute

public String getIdAttribute()
Returns:
the idAttribute

getParent

public DocumentRange getParent()
Returns:
The web page that owns this class.

getSource

public WebPage getSource()
Returns:
The web page that this range is owned by.

getTextOnly

public String getTextOnly()
Get the text from this range.

Returns:
The text from this range.

setBegin

public void setBegin(int begin)
Set the beginning index.

Parameters:
begin - The beginning index.

setClassAttribute

public void setClassAttribute(String classAttribute)
Parameters:
classAttribute - the classAttribute to set

setEnd

public void setEnd(int end)
Set the ending index.

Parameters:
end - The ending index.

setIdAttribute

public void setIdAttribute(String idAttribute)
Parameters:
idAttribute - the idAttribute to set

setParent

public void setParent(DocumentRange parent)
Set the parent.

Parameters:
parent - The parent.

setSource

public void setSource(WebPage source)
Set the source web page.

Parameters:
source - The source web page.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.