1 package net.sf.saxon.tinytree; 2 import net.sf.saxon.event.Receiver; 3 import net.sf.saxon.trans.XPathException; 4 import net.sf.saxon.type.Type; 5 6 10 11 final class TinyTextImpl extends TinyNodeImpl { 12 13 public TinyTextImpl(TinyTree tree, int nodeNr) { 14 this.tree = tree; 15 this.nodeNr = nodeNr; 16 } 17 18 22 23 public String getStringValue() { 24 int start = tree.alpha[nodeNr]; 25 int len = tree.beta[nodeNr]; 26 return new String (tree.charBuffer, start, len); 27 } 28 29 33 34 public CharSequence getStringValueCS() { 35 int start = tree.alpha[nodeNr]; 36 int len = tree.beta[nodeNr]; 37 return new CharSlice(tree.charBuffer, start, len); 38 } 39 40 static CharSequence getStringValue(TinyTree tree, int nodeNr) { 41 int start = tree.alpha[nodeNr]; 42 int len = tree.beta[nodeNr]; 43 return new CharSlice(tree.charBuffer, start, len); 44 } 45 46 50 51 public final int getNodeKind() { 52 return Type.TEXT; 53 } 54 55 58 59 public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId) throws XPathException { 60 int start = tree.alpha[nodeNr]; 61 int len = tree.beta[nodeNr]; 62 out.characters(new CharSlice(tree.charBuffer, start, len), 0, 0); 63 } 64 65 66 } 67 68 | Popular Tags |