| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.tree.tiny; |
| 9 |
|
| 10 |
import net.sf.saxon.event.Receiver; |
| 11 |
import net.sf.saxon.expr.parser.Location; |
| 12 |
import net.sf.saxon.om.AtomicSequence; |
| 13 |
import net.sf.saxon.trans.XPathException; |
| 14 |
import net.sf.saxon.type.Type; |
| 15 |
import net.sf.saxon.value.StringValue; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
final class TinyCommentImpl extends TinyNodeImpl { |
| 26 |
|
| 27 |
public TinyCommentImpl(TinyTree tree, int nodeNr) { |
| 28 |
this.tree = tree; |
| 29 |
this.nodeNr = nodeNr; |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public final String getStringValue() { |
| 37 |
int start = tree.alpha[nodeNr]; |
| 38 |
int len = tree.beta[nodeNr]; |
| 39 |
if (len == 0) return ""; |
| 40 |
char[] dest = new char[len]; |
| 41 |
tree.commentBuffer.getChars(start, start + len, dest, 0); |
| 42 |
return new String(dest, 0, len); |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
public AtomicSequence atomize() { |
| 51 |
return new StringValue(getStringValue()); |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
public final int getNodeKind() { |
| 62 |
return Type.COMMENT; |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
public void copy( Receiver out, int copyOptions, Location locationId) throws XPathException { |
| 70 |
out.comment(getStringValue(), locationId, 0); |
| 71 |
} |
| 72 |
|
| 73 |
} |
| 74 |
|