public class DefaultArea extends DefaultContentRect implements Area
Constructor and Description |
---|
DefaultArea(Box box) |
DefaultArea(DefaultArea src) |
DefaultArea(int x1,
int y1,
int x2,
int y2) |
DefaultArea(java.util.List<Box> boxList) |
DefaultArea(Rectangular r) |
Modifier and Type | Method and Description |
---|---|
protected void |
addBox(Box box)
Adds a new box to the area.
|
void |
addTag(Tag tag,
float support)
Adds a tag to this area.
|
void |
appendChild(Area child)
Appends a new child area to the list of child areas of this area.
|
void |
appendChildren(java.util.List<Area> list)
Appends a list of child areas to the list of child areas of this area.
|
boolean |
containsTag(Tag tag)
Tests whether the area or any of its direct child areas have the given tag.
|
void |
createGrid()
Creates the grid of areas from the child areas.
|
Area |
createSuperArea(Rectangular gp,
java.util.List<Area> selected,
java.lang.String name)
Creates a new subarea from a specified region of the area and moves the selected child
nodes to the new area.
|
protected AreaTopology |
createTopology()
Creates a topology for this area.
|
java.util.Vector<Box> |
getAllBoxes()
Obtains all the boxes from this area and all the child areas.
|
java.util.Vector<Box> |
getBoxes()
Returns a vector of boxes that are inside of this area
|
java.lang.String |
getBoxText()
Returns the text string represented by a concatenation of all
the boxes contained directly in this area (no subareas)
|
Rectangular |
getContentBounds() |
java.awt.Color |
getEffectiveBackgroundColor()
Obtains the effective background color visible under the area.
|
AreaGrid |
getGrid()
Obtains the gird of contained areas.
|
int |
getGridHeight() |
Rectangular |
getGridPosition() |
int |
getGridWidth() |
int |
getGridX() |
int |
getGridY() |
Area |
getChildArea(int index)
Obtains the n-th child area.
|
java.util.List<Area> |
getChildAreas()
Returns the list of all the child areas.
|
DefaultArea |
getChildAtGridPos(int x,
int y)
Returns the child area at the specified grid position or null, if there is no
child area at this position.
|
int |
getIndex(Area child)
Returns the index of the specified child in this node's child array.
|
Tag |
getMostSupportedTag()
Obtains the tag with the greatest support that is assigned to this area.
|
java.lang.String |
getName() |
Area |
getNextOnLine() |
Area |
getNextSibling()
Obtains the next siblibg of this area.
|
Area |
getParentArea()
Obtains the parent area of this area.
|
Area |
getPreviousOnLine() |
Area |
getPreviousSibling()
Obtains the previous siblibg of this area.
|
java.util.Map<Tag,java.lang.Float> |
getTags()
Obtains the set of tags assigned to the area.
|
float |
getTagSupport(Tag tag)
Obtains the support of the given tag assignment
|
java.lang.String |
getText()
Returns the complete text contained in this area and its sub area.
|
java.lang.String |
getText(java.lang.String separator)
Returns the complete text contained in this area and its sub area.
|
AreaTopology |
getTopology()
Returns the topology of this area.
|
boolean |
hasTag(Tag tag)
Tests whether the area has this tag.
|
boolean |
hasTag(Tag tag,
float minSupport)
Tests whether the area has this tag with a support greater or equal to the specified value.
|
void |
insertChild(Area child,
int index)
Inserts a new child at the given position.
|
boolean |
isHorizontalSeparator()
Checks whether the area can be interpreted as a horizontal separator.
|
boolean |
isReplaced()
Checks whether this area is formed by replaced boxes.
|
boolean |
isSeparator()
Checks whether the area can be interpreted as any kind of separator.
|
boolean |
isVerticalSeparator()
Checks whether the area can be interpreted as a vertical separator.
|
void |
removeAllTags(java.util.Collection<Tag> c)
Removes all tags that belong to the given collection.
|
void |
removeChild(Area child)
Removes a child area from its parent.
|
void |
removeTag(Tag tag)
Removes the specific tag
|
void |
setGridPosition(Rectangular pos)
Sets the position in the parent area grid for this area
|
void |
setGridX(int gridX) |
void |
setGridY(int gridY) |
void |
SetHorizontalSeparator(boolean hsep) |
void |
setName(java.lang.String name)
Sets the name of the area.
|
void |
setNextOnLine(Area nextOnLine) |
void |
setPreviousOnLine(Area previousOnLine) |
void |
SetVerticalSeparator(boolean vsep) |
java.lang.String |
toString() |
getBackgroundColor, getBorderCount, getBottomBorder, getBounds, getFontSize, getFontStyle, getFontWeight, getHeight, getId, getLeftBorder, getLineThrough, getPage, getRightBorder, getTopBorder, getUnderline, getWidth, getX1, getX2, getY1, getY2, hasBottomBorder, hasLeftBorder, hasRightBorder, hasTopBorder, isBackgroundSeparated, setBackgroundColor, setBackgroundSeparated, setBorders, setBottomBorder, setBounds, setFontSize, setFontStyle, setFontWeight, setId, setLeftBorder, setLineThrough, setPage, setRightBorder, setTopBorder, setUnderline
add, addAttribute, getAttribute, getDepth, getChildAt, getChildCount, getChildren, getIndex, getLeafCount, getNextSiblingNode, getParent, getPreviousSiblingNode, getRoot, insert, isLeaf, isRoot, remove, remove, removeAllChildren
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBackgroundColor, getBorderCount, getBottomBorder, getBounds, getFontSize, getFontStyle, getFontWeight, getId, getLeftBorder, getLineThrough, getPage, getRightBorder, getTopBorder, getUnderline, hasBottomBorder, hasLeftBorder, hasRightBorder, hasTopBorder, isBackgroundSeparated
getHeight, getWidth, getX1, getX2, getY1, getY2
addAttribute, getAttribute, getDepth, getChildCount, getLeafCount, isLeaf, removeAllChildren
public DefaultArea(Rectangular r)
public DefaultArea(DefaultArea src)
public DefaultArea(int x1, int y1, int x2, int y2)
public DefaultArea(Box box)
public DefaultArea(java.util.List<Box> boxList)
public void setName(java.lang.String name)
toString()
name
- The new area namepublic java.lang.String getName()
public Rectangular getContentBounds()
public AreaTopology getTopology()
Area
getTopology
in interface Area
protected AreaTopology createTopology()
public java.awt.Color getEffectiveBackgroundColor()
Area
getEffectiveBackgroundColor
in interface Area
public Area getParentArea()
AreaTreeNode
getParentArea
in interface AreaTreeNode<Area>
null
when this is the root area.public Area getPreviousSibling()
AreaTreeNode
getPreviousSibling
in interface AreaTreeNode<Area>
null
when this is the first child.public Area getNextSibling()
AreaTreeNode
getNextSibling
in interface AreaTreeNode<Area>
null
when this is the last child.public Area getChildArea(int index) throws java.lang.ArrayIndexOutOfBoundsException
AreaTreeNode
getChildArea
in interface AreaTreeNode<Area>
index
- the child indexjava.lang.ArrayIndexOutOfBoundsException
public java.util.List<Area> getChildAreas()
AreaTreeNode
getChildAreas
in interface AreaTreeNode<Area>
public int getIndex(Area child)
AreaTreeNode
getIndex
in interface AreaTreeNode<Area>
child
- the child node to searchpublic void appendChild(Area child)
AreaTreeNode
appendChild
in interface AreaTreeNode<Area>
child
- The new child to be appendedpublic void appendChildren(java.util.List<Area> list)
AreaTreeNode
appendChildren
in interface AreaTreeNode<Area>
list
- The list of new children to be appendedpublic void insertChild(Area child, int index)
AreaTreeNode
insertChild
in interface AreaTreeNode<Area>
child
- the child to be insertedindex
- the index of the new childpublic void removeChild(Area child)
AreaTreeNode
removeChild
in interface AreaTreeNode<Area>
child
- The new child to be appendedpublic Area getPreviousOnLine()
public void setPreviousOnLine(Area previousOnLine)
public Area getNextOnLine()
public void setNextOnLine(Area nextOnLine)
public java.lang.String getText()
Area
public java.lang.String getText(java.lang.String separator)
Area
public boolean isReplaced()
Area
isReplaced
in interface Area
true
if the area contains replaced boxes onlyprotected void addBox(Box box)
box
- public java.util.Vector<Box> getBoxes()
public java.util.Vector<Box> getAllBoxes()
getAllBoxes
in interface Area
public java.lang.String getBoxText()
public void createGrid()
public AreaGrid getGrid()
public int getGridHeight()
public int getGridWidth()
public int getGridX()
public void setGridX(int gridX)
gridX
- The gridX to set.public int getGridY()
public void setGridY(int gridY)
gridY
- The gridY to set.public Rectangular getGridPosition()
public void setGridPosition(Rectangular pos)
pos
- the positionpublic DefaultArea getChildAtGridPos(int x, int y)
public void addTag(Tag tag, float support)
Taggable
public boolean hasTag(Tag tag)
Taggable
public boolean hasTag(Tag tag, float minSupport)
Taggable
public float getTagSupport(Tag tag)
Taggable
getTagSupport
in interface Taggable
tag
- The tag to be testedpublic Tag getMostSupportedTag()
Taggable
getMostSupportedTag
in interface Taggable
null
if there are no tags assigned to this areapublic void removeAllTags(java.util.Collection<Tag> c)
c
- A collection of tags to be removed.public void removeTag(Tag tag)
public boolean containsTag(Tag tag)
tag
- the tag to be tested.true
if the area or its direct child areas have the given tagpublic java.util.Map<Tag,java.lang.Float> getTags()
public void SetHorizontalSeparator(boolean hsep)
public boolean isHorizontalSeparator()
Area
isHorizontalSeparator
in interface Area
true
when this area is a horizontal separatorpublic void SetVerticalSeparator(boolean vsep)
public boolean isVerticalSeparator()
Area
isVerticalSeparator
in interface Area
true
when this area is a vertical separatorpublic boolean isSeparator()
Area
isSeparator
in interface Area
true
when this area is a separatorpublic Area createSuperArea(Rectangular gp, java.util.List<Area> selected, java.lang.String name)
Area
createSuperArea
in interface Area
gp
- the subarea boundsselected
- nodes to be moved to the new areaname
- the name (identification) of the new areapublic java.lang.String toString()
toString
in class java.lang.Object