use of org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType in project webtools.sourceediting by eclipse.
the class ResultSequence method string.
/**
* retrieve items in sequence
*
* @return result string
*/
public String string() {
String result = "";
int num = 1;
StringBuffer buf = new StringBuffer();
for (Iterator i = iterator(); i.hasNext(); ) {
AnyType elem = (AnyType) i.next();
buf.append(num + ") ");
buf.append(elem.string_type() + ": ");
String value = elem.getStringValue();
if (elem instanceof NodeType) {
QName tmp = ((NodeType) elem).node_name();
if (tmp != null)
value = tmp.expanded_name();
}
buf.append(value + "\n");
num++;
}
result = buf.toString();
if (num == 1)
result = "Empty results\n";
return result;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType in project webtools.sourceediting by eclipse.
the class OpIntersect method op_intersect.
/**
* Op-Intersect operation.
*
* @param args
* Result from the expressions evaluation.
* @throws DynamicError
* Dynamic error.
* @return Result of operation.
*/
public static ResultSequence op_intersect(Collection args) throws DynamicError {
ResultBuffer rs = new ResultBuffer();
// convert arguments
Collection cargs = Function.convert_arguments(args, expected_args());
// get arguments
Iterator iter = cargs.iterator();
ResultSequence one = (ResultSequence) iter.next();
ResultSequence two = (ResultSequence) iter.next();
// XXX lame
for (Iterator i = one.iterator(); i.hasNext(); ) {
NodeType node = (NodeType) i.next();
boolean found = false;
// death
for (Iterator j = two.iterator(); j.hasNext(); ) {
NodeType node2 = (NodeType) j.next();
if (node.node_value() == node2.node_value()) {
found = true;
break;
}
}
if (found)
rs.add(node);
}
rs = NodeType.linarize(rs);
return rs.getSequence();
}
Aggregations