private int GetIndexOf(StateDFA state){
		// For each state.
		for (int i = 0; i < mStates.size(); ++i){
			// Both states must have equal number of items.
			if (mStates.get(i).mItems.size() == state.mItems.size()){
				// For each item in a state.
				Boolean match = true;
				for (int j = 0; j < mStates.get(i).mItems.size() && match; ++j){
					Item it1 = state.mItems.get(j);
					Item it2 = mStates.get(i).mItems.get(j);
					if (it1.mItemDotPosition == it2.mItemDotPosition &&
							it1.mLeftNonTerminalSymbolIndex == it2.mLeftNonTerminalSymbolIndex &&
							it1.mBEGINS_Set.size() == it2.mBEGINS_Set.size() &&
							it1.mRightSymbolsIndices.size() == it2.mRightSymbolsIndices.size()){
						
						for (int k = 0; k < it1.mRightSymbolsIndices.size(); ++k){ // check right symbols
							if (it1.mRightSymbolsIndices.get(k) != it2.mRightSymbolsIndices.get(k)){
								match = false;
								break;
							}
						}
						if (!match) continue;
						for (int k = 0; k < it1.mBEGINS_Set.size(); ++k){ // check b_sets symbols
							if (it1.mBEGINS_Set.get(k) != it2.mBEGINS_Set.get(k)){
								match = false;
								break;
							}
						}						
					}
					else{
						match = false;
						break; // it doesn't make sense to check other items
					}
				}
				if (match) return i;
			}
			
		}
		return -1;
	}