public override Node Register(StringTrieBuilder builder) { next = next.Register(builder); // Break the linear-match sequence into chunks of at most kMaxLinearMatchLength. #pragma warning disable 612, 618 int maxLinearMatchLength = builder.MaxLinearMatchLength; #pragma warning restore 612, 618 while (length > maxLinearMatchLength) { int nextOffset = stringOffset + length - maxLinearMatchLength; length -= maxLinearMatchLength; LinearMatchNode suffixNode = new LinearMatchNode(strings, nextOffset, maxLinearMatchLength, next); suffixNode.SetHashCode(); next = builder.RegisterNode(suffixNode); } Node result; #pragma warning disable 612, 618 if (hasValue && !builder.MatchNodesCanHaveValues) #pragma warning restore 612, 618 { int intermediateValue = value; value = 0; hasValue = false; SetHashCode(); result = new IntermediateValueNode(intermediateValue, builder.RegisterNode(this)); } else { SetHashCode(); result = this; } return(builder.RegisterNode(result)); }
public override bool Equals(object other) { if (this == other) { return(true); } if (!base.Equals(other)) { return(false); } IntermediateValueNode o = (IntermediateValueNode)other; return(next == o.next); }
public override Node Register(StringTrieBuilder builder) { Node subNode = Register(builder, 0, chars.Length); BranchHeadNode head = new BranchHeadNode(chars.Length, subNode); Node result = head; if (hasValue) { if (builder.MatchNodesCanHaveValues) { head.SetValue(value); } else { result = new IntermediateValueNode(value, builder.RegisterNode(head)); } } return(builder.RegisterNode(result)); }