use of org.sirix.service.xml.xpath.AtomicValue in project sirix by sirixdb.
the class AbstractFunction method evaluate.
/**
* {@inheritDoc}
*/
@Override
public void evaluate() throws SirixXPathException {
// compute the function's result
final byte[] value = computeResult();
// create an atomic value, add it to the list and move the cursor to it.
final int itemKey = getTrx().getItemList().addItem(new AtomicValue(value, mReturnType));
mKey = itemKey;
}
use of org.sirix.service.xml.xpath.AtomicValue in project sirix by sirixdb.
the class Function method fnnumber.
/**
* Returns the value of the context item after atomization converted to an xs:double.
*
* @param rtx Read Transaction.
* @return fnnumber boolean.
*/
public static boolean fnnumber(final XdmNodeReadTrx rtx) {
// TODO: add error handling
final AtomicValue item = new AtomicValue(rtx.getValue().getBytes(), rtx.keyForName("xs:double"));
final int itemKey = rtx.getItemList().addItem(item);
rtx.moveTo(itemKey);
return true;
}
use of org.sirix.service.xml.xpath.AtomicValue in project sirix by sirixdb.
the class Function method exactlyOne.
public static boolean exactlyOne(final XdmNodeReadTrx rtx, final AbstractAxis axis) throws SirixXPathException {
if (axis.hasNext()) {
if (axis.hasNext()) {
throw EXPathError.FORG0005.getEncapsulatedException();
} else {
final int itemKey = rtx.getItemList().addItem(new AtomicValue(true));
// only once
rtx.moveTo(itemKey);
}
} else {
throw EXPathError.FORG0005.getEncapsulatedException();
}
return true;
}
use of org.sirix.service.xml.xpath.AtomicValue in project sirix by sirixdb.
the class Function method empty.
public static boolean empty(final XdmNodeReadTrx rtx, final AbstractAxis axis) {
final boolean result = !axis.hasNext();
final int itemKey = rtx.getItemList().addItem(new AtomicValue(result));
rtx.moveTo(itemKey);
return true;
}
use of org.sirix.service.xml.xpath.AtomicValue in project sirix by sirixdb.
the class Function method exists.
public static boolean exists(final XdmNodeReadTrx rtx, final AbstractAxis axis) {
final boolean result = axis.hasNext();
final int itemKey = rtx.getItemList().addItem(new AtomicValue(result));
rtx.moveTo(itemKey);
return true;
}
Aggregations