/** * Grow path stack, if required. */ private void growStack(int depth) { if (nodes.length == depth) { PathNode[] newNodes = new PathNode[ArrayUtil.oversize(nodes.length + 1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)]; System.arraycopy(nodes, 0, newNodes, 0, nodes.length); for (int i = depth, end = newNodes.length; i < end; i++) { newNodes[i] = new PathNode(); } nodes = newNodes; } }
/** * Constructor. * * @param a Automaton to create finite string from. * @param startState The starting state for each path. * @param endState The state where each path should stop or -1 if only accepted states should be final. */ public FiniteStringsIterator(Automaton a, int startState, int endState) { this.a = a; this.endState = endState; this.nodes = new PathNode[16]; for (int i = 0, end = nodes.length; i < end; i++) { nodes[i] = new PathNode(); } this.string = new IntsRefBuilder(); this.pathStates = new BitSet(a.getNumStates()); this.string.setLength(0); this.emitEmptyString = a.isAccept(0); // Start iteration with node startState. if (a.getNumTransitions(startState) > 0) { pathStates.set(startState); nodes[0].resetState(a, startState); string.append(startState); } }
/** * Grow path stack, if required. */ private void growStack(int depth) { if (nodes.length == depth) { PathNode[] newNodes = new PathNode[ArrayUtil.oversize(nodes.length + 1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)]; System.arraycopy(nodes, 0, newNodes, 0, nodes.length); for (int i = depth, end = newNodes.length; i < end; i++) { newNodes[i] = new PathNode(); } nodes = newNodes; } }
/** * Constructor. * * @param a Automaton to create finite string from. * @param startState The starting state for each path. * @param endState The state where each path should stop or -1 if only accepted states should be final. */ public FiniteStringsIterator(Automaton a, int startState, int endState) { this.a = a; this.endState = endState; this.nodes = new PathNode[16]; for (int i = 0, end = nodes.length; i < end; i++) { nodes[i] = new PathNode(); } this.string = new IntsRefBuilder(); this.pathStates = new BitSet(a.getNumStates()); this.string.setLength(0); this.emitEmptyString = a.isAccept(0); // Start iteration with node startState. if (a.getNumTransitions(startState) > 0) { pathStates.set(startState); nodes[0].resetState(a, startState); string.append(startState); } }
/** * Constructor. * * @param a Automaton to create finite string from. */ public FiniteStringsIterator(Automaton a) { this.a = a; this.nodes = new PathNode[16]; for (int i = 0, end = nodes.length; i < end; i++) { nodes[i] = new PathNode(); } this.string = new IntsRefBuilder(); this.pathStates = new BitSet(a.getNumStates()); this.string.setLength(0); this.emitEmptyString = a.isAccept(0); // Start iteration with node 0. if (a.getNumTransitions(0) > 0) { pathStates.set(0); nodes[0].resetState(a, 0); string.append(0); } }
/** * Constructor. * * @param a Automaton to create finite string from. */ public FiniteStringsIterator(Automaton a) { this.a = a; this.nodes = new PathNode[16]; for (int i = 0, end = nodes.length; i < end; i++) { nodes[i] = new PathNode(); } this.string = new IntsRefBuilder(); this.pathStates = new BitSet(a.getNumStates()); this.string.setLength(0); this.emitEmptyString = a.isAccept(0); // Start iteration with node 0. if (a.getNumTransitions(0) > 0) { pathStates.set(0); nodes[0].resetState(a, 0); string.append(0); } }
/** * Grow path stack, if required. */ private void growStack(int depth) { if (nodes.length == depth) { PathNode[] newNodes = new PathNode[ArrayUtil.oversize(nodes.length + 1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)]; System.arraycopy(nodes, 0, newNodes, 0, nodes.length); for (int i = depth, end = newNodes.length; i < end; i++) { newNodes[i] = new PathNode(); } nodes = newNodes; } }
/** * Grow path stack, if required. */ private void growStack(int depth) { if (nodes.length == depth) { PathNode[] newNodes = new PathNode[ArrayUtil.oversize(nodes.length + 1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)]; System.arraycopy(nodes, 0, newNodes, 0, nodes.length); for (int i = depth, end = newNodes.length; i < end; i++) { newNodes[i] = new PathNode(); } nodes = newNodes; } }