示例#1
0
文件: BXDoc.java 项目: fpapai/basex
 @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();
 }
示例#2
0
 @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();
 }
示例#3
0
 @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;
 }
示例#4
0
 @Override
 public Test intersect(final Test other) {
   throw Util.notExpected(this);
 }