Lines Matching refs:Node
69 static int32_t hashNode(const void *node);
97 class Node;
101 Node *makeNode(int32_t start, int32_t limit, int32_t unitIndex, UErrorCode &errorCode);
103 Node *makeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex,
148 * Makes sure that there is only one unique node registered that is
150 * @param newNode Input node. The builder takes ownership.
154 * an equivalent node if newNode is a duplicate.
157 Node *registerNode(Node *newNode, UErrorCode &errorCode);
161 * Avoids creating a node if the value is a duplicate.
168 Node *registerFinalValue(int32_t value, UErrorCode &errorCode);
175 * If they see a failure UErrorCode, they will delete the input node.
179 * NULL Node pointers can be safely passed into other Nodes because
180 * they call the static Node::hashCode() which checks for a NULL pointer first.
182 * Therefore, as long as builder functions register a new node,
184 * a Node pointer, or before setting a new UErrorCode.
197 class Node : public UObject {
199 Node(int32_t initialHash) : hash(initialHash), offset(0) {}
201 // Handles node==NULL.
202 static inline int32_t hashCode(const Node *node) { return node==NULL ? 0 : node->hashCode(); }
204 virtual UBool operator==(const Node &other) const;
205 inline UBool operator!=(const Node &other) const { return !operator==(other); }
207 * Traverses the Node graph and numbers branch edges, with rightmost edges first.
208 * This is to avoid writing a duplicate node twice.
215 * it is a duplicate of a node previously written elsewhere.
229 * @param edgeNumber The first edge number for this node and its sub-nodes.
231 * of the input edge number and the numbers of this node and all of its sub-nodes.
240 // If offset>0 then this node and its sub-nodes have been written already
242 // If this node is part of the unwritten right branch edge,
258 // with the input node, and the
259 // !Node::operator==(other) used inside FinalValueNode::operator==(other)
262 class FinalValueNode : public Node {
264 FinalValueNode(int32_t v) : Node(0x111111u*37u+v), value(v) {}
265 virtual UBool operator==(const Node &other) const;
277 class ValueNode : public Node {
279 ValueNode(int32_t initialHash) : Node(initialHash), hasValue(FALSE), value(0) {}
280 virtual UBool operator==(const Node &other) const;
297 IntermediateValueNode(int32_t v, Node *nextNode)
299 virtual UBool operator==(const Node &other) const;
303 Node *next;
314 LinearMatchNode(int32_t len, Node *nextNode)
317 virtual UBool operator==(const Node &other) const;
321 Node *next;
328 class BranchNode : public Node {
330 BranchNode(int32_t initialHash) : Node(initialHash) {}
341 virtual UBool operator==(const Node &other) const;
352 // Adds a unit which leads to another match node.
353 void add(int32_t c, Node *node) {
355 equal[length]=node;
358 hash=(hash*37u+c)*37u+hashCode(node);
361 Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value".
372 SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode)
376 virtual UBool operator==(const Node &other) const;
381 Node *lessThan;
382 Node *greaterOrEqual;
385 // Branch head node, for writing the actual node lead unit.
389 BranchHeadNode(int32_t len, Node *subNode)
392 virtual UBool operator==(const Node &other) const;
397 Node *next; // A branch sub-node.
404 virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,
405 Node *nextNode) const = 0;
414 virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node) = 0;