本文整理匯總了Java中mesquite.lib.MesquiteString.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java MesquiteString.getValue方法的具體用法?Java MesquiteString.getValue怎麽用?Java MesquiteString.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mesquite.lib.MesquiteString
的用法示例。
在下文中一共展示了MesquiteString.getValue方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTerminals
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public static int getTerminals(Element element, String[] names, boolean[] leaves, boolean[] hasChildren, MesquiteString termName, MesquiteInteger c) {
boolean isNode = isNode(element);
boolean isName = "Name".equalsIgnoreCase(element.getName());
List children = element.content();
Iterator iterator = children.iterator();
int terms = 0;
while (iterator.hasNext()) {
Object o = iterator.next();
if (isName){
if (o instanceof CDATA) {
termName.setValue(((CDATA)o).getText());
}
}
else if (o instanceof Element) {
Element e = (Element)o;
if (isContinuable(e))
terms += getTerminals((Element) o, names, leaves,hasChildren, termName, c);
}
}
if (isNode && terms == 0) {
names[c.getValue()] = new String(termName.getValue()); //element.getAttributeValue("NAME");
if (isLeaf(element))
leaves[c.getValue()] = true;
else
leaves[c.getValue()] = false;
if (hasChildren(element))
hasChildren[c.getValue()] = true;
else
hasChildren[c.getValue()] = false;
c.increment();
return 1;
}
else
return terms;
}
示例2: getTerminals
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public static int getTerminals(Element element, String[] names, boolean[] leaves, boolean[] hasChildren, MesquiteString termName, MesquiteInteger c) {
boolean isNode = isNode(element);
boolean isName = "Name".equalsIgnoreCase(element.getName());
List children = element.getContent();
Iterator iterator = children.iterator();
int terms = 0;
while (iterator.hasNext()) {
Object o = iterator.next();
if (isName){
if (o instanceof CDATA) {
termName.setValue(((CDATA)o).getText());
}
}
else if (o instanceof Element) {
Element e = (Element)o;
if (isContinuable(e))
terms += getTerminals((Element) o, names, leaves,hasChildren, termName, c);
}
}
if (isNode && terms == 0) {
names[c.getValue()] = new String(termName.getValue()); //element.getAttributeValue("NAME");
if (isLeaf(element))
leaves[c.getValue()] = true;
else
leaves[c.getValue()] = false;
if (hasChildren(element))
hasChildren[c.getValue()] = true;
else
hasChildren[c.getValue()] = false;
c.increment();
return 1;
}
else
return terms;
}
示例3: getTerminalsWithAuthors
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public static int getTerminalsWithAuthors(Element element, String[] names, String[] authors, boolean[] leaves, boolean[] hasChildren, MesquiteString termName,MesquiteString authorName, MesquiteInteger c) {
boolean isNode = isNode(element);
boolean isName = "Name".equalsIgnoreCase(element.getName());
boolean isAuthor = "Authority".equalsIgnoreCase(element.getName());
List children = element.content();
Iterator iterator = children.iterator();
int terms = 0;
while (iterator.hasNext()) {
Object o = iterator.next();
if (isName){
if (o instanceof CDATA) {
termName.setValue(((CDATA)o).getText());
}
}
else if (isAuthor){
if (o instanceof CDATA) {
authorName.setValue(((CDATA)o).getText());
}
}
else if (o instanceof Element) {
Element e = (Element)o;
if (isContinuable(e))
terms += getTerminals((Element) o, names, leaves,hasChildren, termName, c);
}
}
if (isNode && terms == 0) {
names[c.getValue()] = new String(termName.getValue()); //element.getAttributeValue("NAME");
authors[c.getValue()] = new String(authorName.getValue()); //element.getAttributeValue("NAME");
if (isLeaf(element))
leaves[c.getValue()] = true;
else
leaves[c.getValue()] = false;
if (hasChildren(element))
hasChildren[c.getValue()] = true;
else
hasChildren[c.getValue()] = false;
c.increment();
return 1;
}
else
return terms;
}