Lines Matching refs:Node
65 static UBool hashNode(const void *node);
93 class Node;
97 Node *makeNode(int32_t start, int32_t limit, int32_t unitIndex, UErrorCode &errorCode);
99 Node *makeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex,
144 * Makes sure that there is only one unique node registered that is
146 * @param newNode Input node. The builder takes ownership.
150 * an equivalent node if newNode is a duplicate.
153 Node *registerNode(Node *newNode, UErrorCode &errorCode);
157 * Avoids creating a node if the value is a duplicate.
164 Node *registerFinalValue(int32_t value, UErrorCode &errorCode);
171 * If they see a failure UErrorCode, they will delete the input node.
175 * NULL Node pointers can be safely passed into other Nodes because
176 * they call the static Node::hashCode() which checks for a NULL pointer first.
178 * Therefore, as long as builder functions register a new node,
180 * a Node pointer, or before setting a new UErrorCode.
189 class Node : public UObject {
191 Node(int32_t initialHash) : hash(initialHash), offset(0) {}
193 // Handles node==NULL.
194 static inline int32_t hashCode(const Node *node) { return node==NULL ? 0 : node->hashCode(); }
196 virtual UBool operator==(const Node &other) const;
197 inline UBool operator!=(const Node &other) const { return !operator==(other); }
199 * Traverses the Node graph and numbers branch edges, with rightmost edges first.
200 * This is to avoid writing a duplicate node twice.
207 * it is a duplicate of a node previously written elsewhere.
221 * @param edgeNumber The first edge number for this node and its sub-nodes.
223 * of the input edge number and the numbers of this node and all of its sub-nodes.
232 // If offset>0 then this node and its sub-nodes have been written already
234 // If this node is part of the unwritten right branch edge,
249 // with the input node, and the
250 // !Node::operator==(other) used inside FinalValueNode::operator==(other)
253 class FinalValueNode : public Node {
255 FinalValueNode(int32_t v) : Node(0x111111*37+v), value(v) {}
256 virtual UBool operator==(const Node &other) const;
265 class ValueNode : public Node {
267 ValueNode(int32_t initialHash) : Node(initialHash), hasValue(FALSE), value(0) {}
268 virtual UBool operator==(const Node &other) const;
284 IntermediateValueNode(int32_t v, Node *nextNode)
286 virtual UBool operator==(const Node &other) const;
290 Node *next;
298 LinearMatchNode(int32_t len, Node *nextNode)
301 virtual UBool operator==(const Node &other) const;
305 Node *next;
311 class BranchNode : public Node {
313 BranchNode(int32_t initialHash) : Node(initialHash) {}
324 virtual UBool operator==(const Node &other) const;
335 // Adds a unit which leads to another match node.
336 void add(int32_t c, Node *node) {
338 equal[length]=node;
341 hash=(hash*37+c)*37+hashCode(node);
344 Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value".
355 SplitBranchNode(UChar middleUnit, Node *lessThanNode, Node *greaterOrEqualNode)
359 virtual UBool operator==(const Node &other) const;
364 Node *lessThan;
365 Node *greaterOrEqual;
368 // Branch head node, for writing the actual node lead unit.
372 BranchHeadNode(int32_t len, Node *subNode)
375 virtual UBool operator==(const Node &other) const;
380 Node *next; // A branch sub-node.
385 virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,
386 Node *nextNode) const = 0;
395 virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node) = 0;