本文整理汇总了Java中org.fit.layout.model.Area.getChildCount方法的典型用法代码示例。如果您正苦于以下问题:Java Area.getChildCount方法的具体用法?Java Area.getChildCount怎么用?Java Area.getChildCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fit.layout.model.Area
的用法示例。
在下文中一共展示了Area.getChildCount方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recursivelyFindPairs
import org.fit.layout.model.Area; //导入方法依赖的package包/类
private void recursivelyFindPairs(Area root, List<SepPair> pairs)
{
if (root.isSeparator())
{
//try to complete an existing pair
final List<SepPair> expairs = findPairsFor(root, pairs);
for (SepPair expair : expairs)
{
//expair.addPair(root);
SepPair copy = new SepPair(expair.s1);
copy.addPair(root);
pairs.add(copy);
}
//and create a new one
pairs.add(new SepPair(root));
}
for (int i = 0; i < root.getChildCount(); i++)
recursivelyFindPairs(root.getChildArea(i), pairs);
}
示例2: computeRootStatistics
import org.fit.layout.model.Area; //导入方法依赖的package包/类
/**
* Recursively computes the statistics of the individual colors in a subtree.
* @param root the root of the subtree
*/
private void computeRootStatistics(Area root)
{
if (root.isBackgroundSeparated())
{
Color color = root.getBackgroundColor();
if (color != null)
{
int key = colorKey(color);
Integer val = colors.get(key);
if (val == null) val = 0;
val += root.getBounds().getArea();
colors.put(key, val);
}
}
for (int i = 0; i < root.getChildCount(); i++)
computeRootStatistics(root.getChildArea(i));
}
示例3: recursiveCheckAreas
import org.fit.layout.model.Area; //导入方法依赖的package包/类
private void recursiveCheckAreas(Area root)
{
Set<String> names = new HashSet<String>();
for (Tag tag : root.getTags().keySet())
{
if (srcType.equals(tag.getType()) || destType.equals(tag.getType()))
names.add(tag.getValue());
}
for (String name : names)
{
checkTag(root, name);
}
for (int i = 0; i < root.getChildCount(); i++)
recursiveCheckAreas(root.getChildArea(i));
}
示例4: computeRootStatistics
import org.fit.layout.model.Area; //导入方法依赖的package包/类
/**
* Recursively computes the statistics of the individual colors in a subtree.
* @param root the root of the subtree
*/
private void computeRootStatistics(Area root)
{
for (Box box : root.getBoxes())
{
int len = letterLength(box.getText());
if (len > 0)
{
int key = colorKey(box.getColor());
Integer val = colors.get(key);
if (val == null) val = 0;
val += len;
colors.put(key, val);
}
}
for (int i = 0; i < root.getChildCount(); i++)
computeRootStatistics(root.getChildArea(i));
}
示例5: recursiveExtractInstances
import org.fit.layout.model.Area; //导入方法依赖的package包/类
protected void recursiveExtractInstances(Area root, Instances dest)
{
Instance newinst = features.getAreaFeatures(root, dest);
String cls = defaultClass;
for (Tag tag : root.getTags().keySet())
{
if (tag.getType().equals(tagType))
cls = tag.getValue();
}
newinst.setClassValue(cls);
dest.add(newinst);
for (int i = 0; i < root.getChildCount(); i++)
recursiveExtractInstances(root.getChildArea(i), dest);
}
示例6: findSeparatos
import org.fit.layout.model.Area; //导入方法依赖的package包/类
private List<Area> findSeparatos(Area root, boolean horizontal)
{
List<Area> ret = new Vector<Area>();
for (int i = 0; i < root.getChildCount(); i++)
{
final Area child = root.getChildArea(i);
if ((horizontal && child.isHorizontalSeparator()) || (!horizontal && child.isVerticalSeparator()))
{
ret.add(child);
}
}
return ret;
}
示例7: countAreas
import org.fit.layout.model.Area; //导入方法依赖的package包/类
/**
* Counts the number of sub-areas in the specified region of the area
* @param a the area to be examined
* @param r the grid region of the area to be examined
* @return the number of visual areas in the specified area of the grid
*/
private int countAreas(Area a, Rectangular r)
{
int ret = 0;
for (int i = 0; i < a.getChildCount(); i++)
{
Area n = a.getChildArea(i);
if (a.getTopology().getPosition(n).intersects(r))
ret++;
}
return ret;
}
示例8: getAllTags
import org.fit.layout.model.Area; //导入方法依赖的package包/类
/**
* Obtains all the tags assigned to this area and its child areas (not all descendant areas).
* @return a set of tags
*/
protected Set<Tag> getAllTags(Area area)
{
Set<Tag> ret = new HashSet<Tag>(area.getTags().keySet());
for (int i = 0; i < area.getChildCount(); i++)
ret.addAll(area.getChildArea(i).getTags().keySet());
return ret;
}
示例9: getColorPercentage
import org.fit.layout.model.Area; //导入方法依赖的package包/类
/**
* Obtains the average percentage of all the text that has the given color.
* @param color the color to be tested.
* @return the percentage (0..1)
*/
public double getColorPercentage(Area node)
{
int tlen = 0;
double sum = 0;
for (Box box : node.getBoxes())
{
int len = letterLength(box.getText());
if (len > 0)
{
sum += getColorPercentage(box.getColor()) * len;
tlen += len;
}
}
for (int i = 0; i < node.getChildCount(); i++)
{
Area child = node.getChildArea(i);
int nlen = letterLength(child.getText());
tlen += nlen;
sum += getColorPercentage(child) * nlen;
}
if (tlen == 0)
return 0;
else
return sum / tlen;
}
示例10: tagSubtree
import org.fit.layout.model.Area; //导入方法依赖的package包/类
/**
* Applies all the taggers a subtree of the area tree.
* @param root the root node of the subtree
*/
public void tagSubtree(Area root)
{
tagSingleNode(root);
for (int i = 0; i < root.getChildCount(); i++)
tagSubtree(root.getChildArea(i));
}
示例11: recursivelyExtractAreaData
import org.fit.layout.model.Area; //导入方法依赖的package包/类
private void recursivelyExtractAreaData(Area root)
{
//describe the area and add to the testing set
Instance data = features.getAreaFeatures(root, testset);
testset.add(data);
//store the mapping
mapping.put(root, data);
//repeat recursively for subareas
for (int i = 0; i < root.getChildCount(); i++)
recursivelyExtractAreaData(root.getChildArea(i));
}