use of org.eclipse.wst.xml.xpath2.processor.internal.ast.SequenceType in project webtools.sourceediting by eclipse.
the class DefaultEvaluator method isInstanceOf.
private boolean isInstanceOf(ResultSequence rs, SequenceType seqt) {
Object oldParam = this._param;
try {
this._param = new Pair(null, rs);
int sequenceLength = rs.size();
// Run the matcher
seqt.accept(this);
rs = (ResultSequence) ((Pair) _param)._two;
int lengthAfter = rs.size();
if (sequenceLength != lengthAfter)
// Something didn't match, so it's not an instance of it
return false;
return seqt.isLengthValid(sequenceLength);
} finally {
this._param = oldParam;
}
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.SequenceType in project webtools.sourceediting by eclipse.
the class DefaultEvaluator method visit.
/**
* visit instance of expression
*
* @param ioexp
* is the instance of expression.
* @return a new function
*/
public Object visit(InstOfExpr ioexp) {
// get the value
ResultSequence rs = (ResultSequence) ioexp.left().accept(this);
// get the sequence type
SequenceType seqt = (SequenceType) ioexp.right();
return ResultSequenceFactory.create_new(new XSBoolean(isInstanceOf(rs, seqt)));
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.SequenceType in project webtools.sourceediting by eclipse.
the class DefaultEvaluator method visit.
/**
* visit treat-as expression
*
* @param taexp
* is the treat-as expression.
* @return a new function
*/
public Object visit(TreatAsExpr taexp) {
ResultSequence rs = (ResultSequence) taexp.left().accept(this);
SequenceType seqt = (SequenceType) taexp.right();
SeqType st = new SeqType(seqt, _sc, rs);
try {
st.match(rs);
} catch (DynamicError err) {
report_error(err);
}
return rs;
}
Aggregations