// Path: karthik/regex/dataStructures/Stack.java
// public class Stack<T> {
// 
//     StackItem<T> top;
// 
//     public Stack() {
//         top = null;
//     }
// 
//     public T push(T data) {
//         StackItem<T> newStackItem = new StackItem<T>(data);
// 
//         if (this.isEmpty()) {
//             top = newStackItem;
//         } else {
//             newStackItem.setNext(top);
//             top = newStackItem;
//         }
//         return newStackItem.data;
//     }
// 
//     public boolean isEmpty() {
//         return (top == null);
//     }
// 
//     public T pop() {
//         StackItem<T> newStackItem;
// 
//         if (this.isEmpty()) // stack is empty so top will be null
//             return null;
//         
//         newStackItem = top;
//         top = top.getNext();
// 
//         return newStackItem.data;
//     }
// 
//     public T peek() {
//         if(isEmpty())
//             return null;
//         return top.data;
//     }
// 
//      class StackItem<T> {
// 
//         private StackItem<T> next;
//         T data;
// 
//         StackItem(T item) {
//             data = item;
//             next = null;
//         }
// 
//         StackItem<T> getNext() {
//             return next;
//         }
// 
//         StackItem<T> setNext(T item) {
//             next = new StackItem<T>(item);
//             return next;
//         }
// 
//         StackItem<T> setNext(StackItem<T> item) {
//             next = item;
//             return item;
//         }
//     }
// 
// }


import karthik.regex.dataStructures.Stack;
/*
 * Copyright (C) 2014 karthik
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package karthik.regex;


/**
 *
 * @author karthik
 */
class NFASimulator {

    protected Integer finish;
    protected TransitionTable original_start_table;
    protected TransitionTable transMatrix;
    protected CharSequence regex_string = "";
    protected Integer string_index; // global pointer that keeps track of our position in the search string

    protected String search_string;
    protected Integer region_start, region_end;

// Path: karthik/regex/dataStructures/Stack.java
// public class Stack<T> {
// 
//     StackItem<T> top;
// 
//     public Stack() {
//         top = null;
//     }
// 
//     public T push(T data) {
//         StackItem<T> newStackItem = new StackItem<T>(data);
// 
//         if (this.isEmpty()) {
//             top = newStackItem;
//         } else {
//             newStackItem.setNext(top);
//             top = newStackItem;
//         }
//         return newStackItem.data;
//     }
// 
//     public boolean isEmpty() {
//         return (top == null);
//     }
// 
//     public T pop() {
//         StackItem<T> newStackItem;
// 
//         if (this.isEmpty()) // stack is empty so top will be null
//             return null;
//         
//         newStackItem = top;
//         top = top.getNext();
// 
//         return newStackItem.data;
//     }
// 
//     public T peek() {
//         if(isEmpty())
//             return null;
//         return top.data;
//     }
// 
//      class StackItem<T> {
// 
//         private StackItem<T> next;
//         T data;
// 
//         StackItem(T item) {
//             data = item;
//             next = null;
//         }
// 
//         StackItem<T> getNext() {
//             return next;
//         }
// 
//         StackItem<T> setNext(T item) {
//             next = new StackItem<T>(item);
//             return next;
//         }
// 
//         StackItem<T> setNext(StackItem<T> item) {
//             next = item;
//             return item;
//         }
//     }
// 
// }


// Path: karthik/regex/NFASimulator.java
import karthik.regex.dataStructures.Stack;

/*
 * Copyright (C) 2014 karthik
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package karthik.regex;


/**
 *
 * @author karthik
 */
class NFASimulator {

    protected Integer finish;
    protected TransitionTable original_start_table;
    protected TransitionTable transMatrix;
    protected CharSequence regex_string = "";
    protected Integer string_index; // global pointer that keeps track of our position in the search string

    protected String search_string;
    protected Integer region_start, region_end;

    protected Stack<Integer> boundary_stack = new Stack<>();