src/creator/Rabinizer.java
private static ArrayList<Boolean> whichSecondSubformulas(String token, HashMap<String, ArrayList<String>> candidates) {
		ArrayList<Boolean> result = new ArrayList<Boolean>();
		
		ArrayList<String> keys = new ArrayList<String>(candidates.keySet().size());
		for (String key : candidates.keySet())
			keys.add(key);
		
		ArrayList<ArrayList<Boolean>> subr = new ArrayList<ArrayList<Boolean>>(keys.size());
		for (int i=0; i<keys.size(); i++) {
			subr.add(new ArrayList<Boolean>(candidates.get(keys.get(i)).size()+1));
			for (int j=0; j<candidates.get(keys.get(i)).size()+1; j++) // one bit for each candidate plus one bit if this Gcand was present
				subr.get(i).add(false);
		}
		
		// find
		
		int start = 0;
		int brackets = 0;
		int end;
		while (start < token.length()) {
			if (token.charAt(start) == 'G') {
				int gcandstart = start;
				while (token.charAt(start) != '=') start++;
				int gcandend = start;
				String gcand = token.substring(gcandstart, gcandend);
				
				int gcandindex = -1;
				for (int i=0; i<keys.size(); i++)
					if (gcand.equals(keys.get(i))) {
						gcandindex = i;
						break;
					}
				assert(gcandindex != -1);
				
				// set bit that this Gcand was found
				subr.get(gcandindex).set( subr.get(gcandindex).size()-1 , true);
				
				// get gtoken
				assert(token.charAt(start+1) == '{');
				end = start; start++;
				brackets = 0;
				do {
					end++;
					if (token.charAt(end) == '{') brackets++;
					if (token.charAt(end) == '}') brackets--;
				} while (brackets > 0 || token.charAt(end) != '}');
				end++;
				
				String gtoken = token.substring(start, end);
				int gtokenend = end;
				
				// find formulae in gtoken, make corresponding bits true
				boolean stop;
				assert(gtoken.charAt(0) == '{' && gtoken.charAt(gtoken.length()-1) == '}');
				start = 1;
				do {
					end = start;
					while (gtoken.charAt(end) != '=') end++;
					
					String cand = gtoken.substring(start, end);
					int there = -1;
					for (int i=0; i<candidates.get(gcand).size(); i++)
						if (candidates.get(gcand).get(i).equals(cand)) {
							there = i;
							break;
						}
					assert(there != -1);
					assert(subr.get(gcandindex).get(there).equals(false));
					subr.get(gcandindex).set(there, true); // set bit
					
					stop = true;
					for (int i=end; i<gtoken.length(); i++)
						if (gtoken.charAt(i) == ',') {
							stop = false;
							assert(gtoken.charAt(i+1) == ' ');
							start = i+2;
							break;
						}
				} while (!stop);
				
				start = gtokenend;
			} else start++;
		}
		
		// end-find
		
		for (int i=0; i<subr.size(); i++)
			result.addAll(subr.get(i));
		result.trimToSize();
		
		return result;
	}
/**
	 * State-information encoding: subformulas in second part
	 * @param filename	Name of the parity automaton file (filename.hoa)
	 * @return			State-information
	 */
State-information encoding: subformulas in second part
@param filename      Name of the parity automaton file (filename.hoa)
@return                      State-information
State - information encoding : subformulas in second part @param filename Name of the parity automaton file ( filename . hoa ) @return State - information
private static ArrayList<Boolean> whichSecondSubformulas(String token, HashMap<String, ArrayList<String>> candidates) {
		ArrayList<Boolean> result = new ArrayList<Boolean>();
		ArrayList<String> keys = new ArrayList<String>(candidates.keySet().size());
		for (String key : candidates.keySet())
			keys.add(key);
		ArrayList<ArrayList<Boolean>> subr = new ArrayList<ArrayList<Boolean>>(keys.size());
		for (int i=0; i<keys.size(); i++) {
			subr.add(new ArrayList<Boolean>(candidates.get(keys.get(i)).size()+1));
			for (int j=0; j<candidates.get(keys.get(i)).size()+1; j++) 
				subr.get(i).add(false);
		}
		int start = 0;
		int brackets = 0;
		int end;
		while (start < token.length()) {
			if (token.charAt(start) == 'G') {
				int gcandstart = start;
				while (token.charAt(start) != '=') start++;
				int gcandend = start;
				String gcand = token.substring(gcandstart, gcandend);
				int gcandindex = -1;
				for (int i=0; i<keys.size(); i++)
					if (gcand.equals(keys.get(i))) {
						gcandindex = i;
						break;
					}
				assert(gcandindex != -1);
				subr.get(gcandindex).set( subr.get(gcandindex).size()-1 , true);
				assert(token.charAt(start+1) == '{');
				end = start; start++;
				brackets = 0;
				do {
					end++;
					if (token.charAt(end) == '{') brackets++;
					if (token.charAt(end) == '}') brackets--;
				} while (brackets > 0 || token.charAt(end) != '}');
				end++;
				String gtoken = token.substring(start, end);
				int gtokenend = end;
				 formulae in gtoken, make corresponding bits true
				boolean stop;
				assert(gtoken.charAt(0) == '{' && gtoken.charAt(gtoken.length()-1) == '}');
				start = 1;
				do {
					end = start;
					while (gtoken.charAt(end) != '=') end++;
					String cand = gtoken.substring(start, end);
					int there = -1;
					for (int i=0; i<candidates.get(gcand).size(); i++)
						if (candidates.get(gcand).get(i).equals(cand)) {
							there = i;
							break;
						}
					assert(there != -1);
					assert(subr.get(gcandindex).get(there).equals(false));
					subr.get(gcandindex).set(there, true); 
					stop = true;
					for (int i=end; i<gtoken.length(); i++)
						if (gtoken.charAt(i) == ',') {
							stop = false;
							assert(gtoken.charAt(i+1) == ' ');
							start = i+2;
							break;
						}
				} while (!stop);
				start = gtokenend;
			} else start++;
		}
		for (int i=0; i<subr.size(); i++)
			result.addAll(subr.get(i));
		result.trimToSize();
		return result;
	}
private static ArrayList < Boolean > whichSecondSubformulas ( String token , HashMap < String , ArrayList < String > > candidates ) { ArrayList < Boolean > result = new ArrayList < Boolean > ( ) ; ArrayList < String > keys = new ArrayList < String > ( candidates . keySet ( ) . size ( ) ) ; for ( String key : candidates . keySet ( ) ) keys . add ( key ) ; ArrayList < ArrayList < Boolean > > subr = new ArrayList < ArrayList < Boolean > > ( keys . size ( ) ) ; for ( int i = 0 ; i < keys . size ( ) ; i ++ ) { subr . add ( new ArrayList < Boolean > ( candidates . get ( keys . get ( i ) ) . size ( ) + 1 ) ) ; for ( int j = 0 ; j < candidates . get ( keys . get ( i ) ) . size ( ) + 1 ; j ++ ) subr . get ( i ) . add ( false ) ; } int start = 0 ; int brackets = 0 ; int end ; while ( start < token . length ( ) ) { if ( token . charAt ( start ) == 'G' ) { int gcandstart = start ; while ( token . charAt ( start ) != '=' ) start ++ ; int gcandend = start ; String gcand = token . substring ( gcandstart , gcandend ) ; int gcandindex = - 1 ; for ( int i = 0 ; i < keys . size ( ) ; i ++ ) if ( gcand . equals ( keys . get ( i ) ) ) { gcandindex = i ; break ; } assert ( gcandindex != - 1 ) ; subr . get ( gcandindex ) . set ( subr . get ( gcandindex ) . size ( ) - 1 , true ) ; assert ( token . charAt ( start + 1 ) == '{' ) ; end = start ; start ++ ; brackets = 0 ; do { end ++ ; if ( token . charAt ( end ) == '{' ) brackets ++ ; if ( token . charAt ( end ) == '}' ) brackets -- ; } while ( brackets > 0 || token . charAt ( end ) != '}' ) ; end ++ ; String gtoken = token . substring ( start , end ) ; int gtokenend = end ; boolean stop ; assert ( gtoken . charAt ( 0 ) == '{' && gtoken . charAt ( gtoken . length ( ) - 1 ) == '}' ) ; start = 1 ; do { end = start ; while ( gtoken . charAt ( end ) != '=' ) end ++ ; String cand = gtoken . substring ( start , end ) ; int there = - 1 ; for ( int i = 0 ; i < candidates . get ( gcand ) . size ( ) ; i ++ ) if ( candidates . get ( gcand ) . get ( i ) . equals ( cand ) ) { there = i ; break ; } assert ( there != - 1 ) ; assert ( subr . get ( gcandindex ) . get ( there ) . equals ( false ) ) ; subr . get ( gcandindex ) . set ( there , true ) ; stop = true ; for ( int i = end ; i < gtoken . length ( ) ; i ++ ) if ( gtoken . charAt ( i ) == ',' ) { stop = false ; assert ( gtoken . charAt ( i + 1 ) == ' ' ) ; start = i + 2 ; break ; } } while ( ! stop ) ; start = gtokenend ; } else start ++ ; } for ( int i = 0 ; i < subr . size ( ) ; i ++ ) result . addAll ( subr . get ( i ) ) ; result . trimToSize ( ) ; return result ; }
State-information encoding: subformulas in second part
 @param filename      Name of the parity automaton file (filename.hoa)
 @return                      State-information
State - information encoding : subformulas in second part @param filename Name of the parity automaton file ( filename . hoa ) @return State - information
// one bit for each candidate plus one bit if this Gcand was present // find // set bit that this Gcand was found // get gtoken // find formulae in gtoken, make corresponding bits true // set bit // end-find