Provides an implementation for the interface gate.Node.
| 22 | * |
| 23 | */ |
| 24 | public class NodeImpl implements Node, Comparable<Node> |
| 25 | { |
| 26 | /** Freeze the serialization UID. */ |
| 27 | static final long serialVersionUID = -8240414984367916298L; |
| 28 | |
| 29 | /** Construction from id. Creates an unrooted node. |
| 30 | */ |
| 31 | public NodeImpl (Integer id) { |
| 32 | this.id = id; |
| 33 | offset = null; |
| 34 | } // Node() |
| 35 | |
| 36 | /** Construction from id and offset. |
| 37 | * |
| 38 | * @param id the Id of the new node |
| 39 | * @param offset the (temporal) offset of the Node; Should be <b>null</b> |
| 40 | * for non-anchored nodes. |
| 41 | */ |
| 42 | public NodeImpl (Integer id, Long offset) { |
| 43 | this.id = id; |
| 44 | this.offset = offset; |
| 45 | } // Node(id, offset) |
| 46 | |
| 47 | /** Returns the Id of the Node. |
| 48 | */ |
| 49 | @Override |
| 50 | public Integer getId () { return id; } |
| 51 | |
| 52 | /** Offset (will be null when the node is not anchored) |
| 53 | */ |
| 54 | @Override |
| 55 | public Long getOffset () { return offset; } |
| 56 | |
| 57 | /** String representation |
| 58 | */ |
| 59 | @Override |
| 60 | public String toString() { |
| 61 | return "NodeImpl: id=" + id + "; offset=" + offset; |
| 62 | } // toString() |
| 63 | |
| 64 | /** Ordering |
| 65 | */ |
| 66 | @Override |
| 67 | public int compareTo(Node other) throws ClassCastException { |
| 68 | return id.compareTo(other.getId()); |
| 69 | } // compareTo |
| 70 | |
| 71 | /** To allow AnnotationSet to revise offsets during editing |
| 72 | */ |
| 73 | void setOffset(Long offset) { this.offset = offset; } |
| 74 | |
| 75 | /** |
| 76 | * The id of this node (used for persistency) |
| 77 | * |
| 78 | */ |
| 79 | Integer id; |
| 80 | /** |
| 81 | * The offset of this node |
nothing calls this directly
no outgoing calls
no test coverage detected