@Override public BXElem getDocumentElement() { final BXNList list = getChildNodes(); for (int l = 0; l < list.getLength(); ++l) { final BXNode n = list.item(l); if (n.getNodeType() == Node.ELEMENT_NODE) return (BXElem) n; } throw Util.notExpected(); }
@Override public Iter iter(final QueryContext qc) throws QueryException { final Value seq = qc.value(ts); for (final TypeCase tc : cases) { final Iter iter = tc.iter(qc, seq); if (iter != null) return iter; } // will never happen throw Util.notExpected(); }
@Override public Test intersect(final Test other) { if (other instanceof NodeTest) { final NodeTest o = (NodeTest) other; if (type != null && o.type != null && type != o.type) return null; final NodeType nt = type != null ? type : o.type; if (name != null && o.name != null && !name.eq(o.name)) return null; final QNm n = name != null ? name : o.name; final boolean both = ext != null && o.ext != null; final Type e = ext == null ? o.ext : o.ext == null ? ext : ext.intersect(o.ext); return both && e == null ? null : new NodeTest(nt, n, e, strip || o.strip); } if (other instanceof KindTest) { return type.instanceOf(other.type) ? this : null; } if (other instanceof NameTest) { throw Util.notExpected(other); } return null; }
@Override public Test intersect(final Test other) { throw Util.notExpected(this); }