|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--websphinx.Region
Region of an HTML page.
Field Summary | |
protected int |
end
|
(package private) static int |
INITIAL_SIZE
|
protected java.util.Hashtable |
names
|
protected Page |
source
|
protected int |
start
|
static java.lang.String |
TRUE
Default value for labels set with setLabel (name). |
Constructor Summary | |
Region(Page page,
int start,
int end)
Makes a Region. |
|
Region(Region region)
Makes a Region by copying another region's parameters. |
Method Summary | |
java.util.Enumeration |
enumerateObjectLabels()
Enumerate the labels of the region. |
static int |
findEnd(Region[] regions,
int p)
Finds a region that ends at or after a given position. |
static int |
findStart(Region[] regions,
int p)
Finds a region that starts at or after a given position. |
int |
getEnd()
Gets offset after end of region. |
Region |
getField(java.lang.String name)
Get a named subregion. |
Region[] |
getFields(java.lang.String name)
Get a set of named subregions. |
java.lang.String |
getLabel(java.lang.String name)
Get a label's value. |
java.lang.String |
getLabel(java.lang.String name,
java.lang.String defaultValue)
Get a label's value. |
int |
getLength()
Gets length of the region. |
java.lang.Number |
getNumericLabel(java.lang.String name,
java.lang.Number defaultValue)
Get a label's value as a number. |
java.lang.Object |
getObjectLabel(java.lang.String name)
Get an object-valued label. |
java.lang.String |
getObjectLabels()
Get a String containing the labels of the region. |
Element |
getRootElement()
Get the root HTML element of the region. |
Page |
getSource()
Gets page containing the region. |
int |
getStart()
Gets starting offset of region in page content. |
boolean |
hasAllLabels(java.lang.String expr)
Test if all of several labels are set. |
boolean |
hasAllLabels(java.lang.String[] labels)
Test if all of several labels are set. |
boolean |
hasAnyLabels(java.lang.String expr)
Test if one or more of several labels are set. |
boolean |
hasAnyLabels(java.lang.String[] labels)
Test if one or more of several labels are set. |
boolean |
hasLabel(java.lang.String name)
Test if a label is set. |
void |
removeLabel(java.lang.String name)
Remove a label. |
void |
setField(java.lang.String name,
Region region)
Name a subregion (by setting a label to point to it). |
void |
setFields(java.lang.String name,
Region[] regions)
Name a set of subregions (by pointing a label to them). |
void |
setLabel(java.lang.String name)
Set a label on the region. |
void |
setLabel(java.lang.String name,
java.lang.String value)
Set a string-valued label. |
void |
setObjectLabel(java.lang.String name,
java.lang.Object value)
Set an object-valued label. |
Region |
span(Region r)
Makes a new Region containing two regions. |
java.lang.String |
toHTML()
Converts the region to HTML, e.g. |
java.lang.String |
toString()
Gets region as raw content. |
java.lang.String |
toTags()
Converts the region to HTML tags with no text, e.g. |
java.lang.String |
toText()
Converts the region to tagless text, e.g. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected Page source
protected int start
protected int end
protected java.util.Hashtable names
static final int INITIAL_SIZE
public static final java.lang.String TRUE
Constructor Detail |
public Region(Page page, int start, int end)
page
- Page containing regionstart
- Starting offset of region in page contentend
- Ending offset of region in pagepublic Region(Region region)
region
- Region to copyMethod Detail |
public Page getSource()
public int getStart()
public int getEnd()
public int getLength()
public java.lang.String toHTML()
and.
public java.lang.String toText()
public java.lang.String toTags()
public java.lang.String toString()
toString
in class java.lang.Object
public Element getRootElement()
public static int findStart(Region[] regions, int p)
regions
- array of regions sorted by starting offsetp
- Desired starting offsetpublic static int findEnd(Region[] regions, int p)
regions
- array of regions sorted by ending offsetp
- Desired ending offsetpublic Region span(Region r)
r
- end of spanning regionpublic void setObjectLabel(java.lang.String name, java.lang.Object value)
name
- name of label (case-sensitive, whitespace permitted)value
- value set for label. If null, the label is removed.public java.lang.Object getObjectLabel(java.lang.String name)
name
- name of label (case-sensitive, whitespace permitted)public java.util.Enumeration enumerateObjectLabels()
public java.lang.String getObjectLabels()
public void setLabel(java.lang.String name, java.lang.String value)
name
- name of label (case-sensitive, whitespace permitted)value
- value set for label. If null, the label is removed.public void setLabel(java.lang.String name)
name
- name of label (case-sensitive, whitespace permitted)public java.lang.String getLabel(java.lang.String name)
name
- name of label (case-sensitive, whitespace permitted)public java.lang.String getLabel(java.lang.String name, java.lang.String defaultValue)
name
- name of label (case-sensitive, whitespace permitted)defaultValue
- default value that should be returned if label is not setpublic java.lang.Number getNumericLabel(java.lang.String name, java.lang.Number defaultValue)
name
- name of label (case-sensitive, whitespace permitted)defaultValue
- default value that should be returned if label is not setpublic boolean hasLabel(java.lang.String name)
name
- name of label (case-sensitive, whitespace permitted)public boolean hasAnyLabels(java.lang.String expr)
expr
- a list of label names separated by spacespublic boolean hasAnyLabels(java.lang.String[] labels)
labels
- an array of label namespublic boolean hasAllLabels(java.lang.String expr)
expr
- a list of label names separated by spacespublic boolean hasAllLabels(java.lang.String[] labels)
labels
- an array of label namespublic void removeLabel(java.lang.String name)
name
- name of label (case-sensitive, whitespace permitted)public void setField(java.lang.String name, Region region)
name
- label name (case-sensitive, whitespace permitted)region
- subregion to namepublic Region getField(java.lang.String name)
name
- label name (case-sensitive, whitespace permitted)public void setFields(java.lang.String name, Region[] regions)
name
- label name (case-sensitive, whitespace permitted)regions
- list of subregionspublic Region[] getFields(java.lang.String name)
name
- label name (case-sensitive, whitespace permitted)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |