Java Code Examples for org.sat4j.specs.TimeoutException#printStackTrace()

The following examples show how to use org.sat4j.specs.TimeoutException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DReXUnitTest.java    From symbolicautomata with Apache License 2.0 6 votes vote down vote up
private SFA<CharPred, Character> alphaNumSFA(UnaryCharIntervalSolver ba) {

		Collection<SFAMove<CharPred, Character>> transitionsA = new ArrayList<SFAMove<CharPred, Character>>();
		CharPred alphaNum = ba.MkOr(alpha, num);

		transitionsA.add(new SFAInputMove<CharPred, Character>(0, 0, alphaNum));

		// Output function just outputs x

		try {
			return SFA.MkSFA(transitionsA, 0, Arrays.asList(0), ba);
		} catch (TimeoutException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
 
Example 2
Source File: BooleanAlgebra.java    From symbolicautomata with Apache License 2.0 6 votes vote down vote up
/**
 * @return true iff there are at least <code>numOfWitnesses</code> many witnesses that satisfy <code>predicate</code>
 */
public boolean hasNDistinctWitnesses(P predicate, Integer numOfWitnesses) {
    // generate as many witnesses as requested
    for (int witnessID = 0; witnessID < numOfWitnesses; witnessID++) {
        try {
            // generate a witness for the predicate
            S witness = generateWitness(predicate);

            // If it's satisfiable:
            if (witness != null) {
                // Update the predicate to exclude the current witness.
                predicate = MkAnd(predicate, MkNot(MkAtom(witness)));
            } else {
                // If it isn't then we don't have enough witnesses.
                return false;
            }
        } catch (TimeoutException e) {
            e.printStackTrace();
            System.out.println("Distinct witnesses check timeout.");
            return false;
        }
    }
    // If we get here then we have generated enough witnesses.
    return true;
}
 
Example 3
Source File: SRAUnitTest.java    From symbolicautomata with Apache License 2.0 5 votes vote down vote up
private SRA<CharPred, Character> getSRAa(UnaryCharIntervalSolver ba) {
       LinkedList<Character> registers = new LinkedList<Character>();
       registers.add(null);
	Collection<SRAMove<CharPred, Character>> transitionsA = new LinkedList<SRAMove<CharPred, Character>>();
	transitionsA.add(new SRACheckMove<CharPred, Character>(0, 0, alpha, 0));
       transitionsA.add(new SRAFreshMove<CharPred, Character>(0, 0, alpha, 0, registers.size()));
	try {
		return SRA.MkSRA(transitionsA, 0, Collections.singleton(0), registers, ba);
	} catch (TimeoutException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
}
 
Example 4
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 5 votes vote down vote up
private static SRA<CharPred, Character> getProductParserCL2(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null, null));
    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();
    transitions.add(new SRAStoreMove<CharPred, Character>(0, 1, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 2, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 3, ba.MkNot(space), 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(3, 4, ba.MkNot(space), 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(4, 5, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(5, 6, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(6, 7, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(7, 8, alphaNum, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(8, 9, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(9, 10, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(10, 11, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(11, 12, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 12, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 13, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 14, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 15, new CharPred(':'), 0));
    transitions.add(new SRACheckMove<CharPred, Character>(15, 16, ba.MkNot(space), 1));
    transitions.add(new SRACheckMove<CharPred, Character>(16, 17, ba.MkNot(space), 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(17, 18, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(18, 19, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(19, 20, new CharPred(':'), 0));
    transitions.add(new SRACheckMove<CharPred, Character>(20, 21, alphaNum, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(21, 22, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(22, 23, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(23, 24, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(24, 25, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(25, 25, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(25, 13, space, 0));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(25), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 5
Source File: SFAUnitTest.java    From symbolicautomata with Apache License 2.0 5 votes vote down vote up
private SFA<CharPred, Character> getSFAc(UnaryCharIntervalSolver ba) {

		Collection<SFAMove<CharPred, Character>> transitionsA = new LinkedList<SFAMove<CharPred, Character>>();
		transitionsA.add(new SFAInputMove<CharPred, Character>(0, 0, alpha));
		try {
			return SFA.MkSFA(transitionsA, 0, Arrays.asList(0), ba);
		} catch (TimeoutException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
 
Example 6
Source File: SFAUnitTest.java    From symbolicautomata with Apache License 2.0 5 votes vote down vote up
private SFA<CharPred, Character> getSFAtoMin2(UnaryCharIntervalSolver ba) {

		Collection<SFAMove<CharPred, Character>> transitionsA = new LinkedList<SFAMove<CharPred, Character>>();

		transitionsA.add(new SFAInputMove<CharPred, Character>(0, 1, alpha));
		transitionsA.add(new SFAInputMove<CharPred, Character>(1, 2, alpha));
		transitionsA.add(new SFAInputMove<CharPred, Character>(2, 2, alpha));
		try {
			return SFA.MkSFA(transitionsA, 0, Arrays.asList(1, 2), ba);
		} catch (TimeoutException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
 
Example 7
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 5 votes vote down vote up
private static SFA<CharPred, Character> getSSNParserLastSFA(UnaryCharIntervalSolver ba) {
    Collection<SFAMove<CharPred, Character>> transitions = new LinkedList<SFAMove<CharPred, Character>>();
    List<Integer> finalStates = new LinkedList<Integer>();

    transitions.add(new SFAInputMove<CharPred, Character>(0, 1, upperAlpha));
    transitions.add(new SFAInputMove<CharPred, Character>(1, 1, lowerAlpha));
    transitions.add(new SFAInputMove<CharPred, Character>(1, 2, comma));
    transitions.add(new SFAInputMove<CharPred, Character>(2, 3, space));
    transitions.add(new SFAInputMove<CharPred, Character>(3, 3, space));

    Character secondInitial = upperAlpha.intervals.get(0).left;
    Character secondEnd = upperAlpha.intervals.get(0).right;
    for (int secondCounter = 0; secondInitial < secondEnd; secondCounter++, secondInitial++) {
        transitions.add(new SFAInputMove<CharPred, Character>(3, (secondCounter * 7) + 4, new CharPred(secondInitial)));
        transitions.add(new SFAInputMove<CharPred, Character>((secondCounter * 7) + 4, (secondCounter * 7) + 4, lowerAlpha));
        transitions.add(new SFAInputMove<CharPred, Character>((secondCounter * 7) + 4, (secondCounter * 7) + 5, comma));
        transitions.add(new SFAInputMove<CharPred, Character>((secondCounter * 7) + 5, (secondCounter * 7) + 6, space));
        transitions.add(new SFAInputMove<CharPred, Character>((secondCounter * 7) + 6, (secondCounter * 7) + 6, space));
        transitions.add(new SFAInputMove<CharPred, Character>((secondCounter * 7) + 6, (secondCounter * 7) + 7, upperAlpha));
        transitions.add(new SFAInputMove<CharPred, Character>((secondCounter * 7) + 7, (secondCounter * 7) + 8, new CharPred(secondInitial)));
        finalStates.add((secondCounter * 7) + 8);
    }


    try {
        return SFA.MkSFA(transitions, 0, finalStates, ba, false, false);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 8
Source File: SFABooleanAlgebra.java    From symbolicautomata with Apache License 2.0 5 votes vote down vote up
@Override
public SFA<P, D> True() {
	try {
		return SFA.getFullSFA(ba);
	} catch (TimeoutException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 9
Source File: SFAUnitTest.java    From symbolicautomata with Apache License 2.0 5 votes vote down vote up
private SFA<CharPred, Character> getSFAb(UnaryCharIntervalSolver ba) {

		Collection<SFAMove<CharPred, Character>> transitionsB = new LinkedList<SFAMove<CharPred, Character>>();
		transitionsB.add(new SFAInputMove<CharPred, Character>(0, 1, alpha));
		transitionsB.add(new SFAInputMove<CharPred, Character>(1, 1, num));
		transitionsB.add(new SFAInputMove<CharPred, Character>(0, 2, allAlpha));
		try {
			return SFA.MkSFA(transitionsB, 0, Arrays.asList(1), ba);
		} catch (TimeoutException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
 
Example 10
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getSmallXMLParserSRA(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList('<', '>', '/', null, null, null));
    Integer garbageReg = registers.size() - 1;

    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();

    // Read opening character
    transitions.add(new SRACheckMove<CharPred, Character>(0, 1, open, 0));

    // Read tag
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 2, alpha, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 3, alpha, 4));

    // Read closing character
    transitions.add(new SRACheckMove<CharPred, Character>(2, 5, close, 1));
    transitions.add(new SRACheckMove<CharPred, Character>(3, 5, close, 1));
    transitions.add(new SRACheckMove<CharPred, Character>(4, 5, close, 1));

    // Read any content (or not)
    transitions.add(new SRAStoreMove<CharPred, Character>(5, 5, alphaNum, garbageReg));

    // Read opening character and slash
    transitions.add(new SRACheckMove<CharPred, Character>(5, 6, open, 0));
    transitions.add(new SRACheckMove<CharPred, Character>(6, 7, slash, 2));

    // Read repeated tag (AAA, BBB, ...)
    transitions.add(new SRACheckMove<CharPred, Character>(7, 8, alpha, 3));
    transitions.add(new SRACheckMove<CharPred, Character>(8, 9, alpha, 4));

    // Read closing character
    transitions.add(new SRACheckMove<CharPred, Character>(8, 11, close, 1));
    transitions.add(new SRACheckMove<CharPred, Character>(9, 11, close, 1));
    transitions.add(new SRACheckMove<CharPred, Character>(10, 11, close, 1));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(11), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 11
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getProductParserCL4(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null, null, null, null));
    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();
    transitions.add(new SRAStoreMove<CharPred, Character>(0, 1, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 2, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 3, ba.MkNot(space), 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(3, 4, ba.MkNot(space), 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(4, 5, ba.MkNot(space), 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(5, 6, ba.MkNot(space), 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(6, 7, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(7, 8, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(8, 9, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(9, 10, alphaNum, 5));
    transitions.add(new SRAStoreMove<CharPred, Character>(10, 11, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(11, 12, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 13, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 14, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 14, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 15, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(15, 16, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(16, 17, new CharPred(':'), 0));
    transitions.add(new SRACheckMove<CharPred, Character>(17, 18, ba.MkNot(space), 1));
    transitions.add(new SRACheckMove<CharPred, Character>(18, 19, ba.MkNot(space), 2));
    transitions.add(new SRACheckMove<CharPred, Character>(19, 20, ba.MkNot(space), 3));
    transitions.add(new SRACheckMove<CharPred, Character>(20, 21, ba.MkNot(space), 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(21, 22, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(22, 23, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(23, 24, new CharPred(':'), 0));
    transitions.add(new SRACheckMove<CharPred, Character>(24, 25, alphaNum, 5));
    transitions.add(new SRAStoreMove<CharPred, Character>(25, 26, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(26, 27, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(27, 28, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(28, 29, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(29, 29, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(29, 15, space, 0));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(29), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 12
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getIP9PacketParserSRA(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null, null, null, null, null, null, null, null));

    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();

    for (int index = 0; index < "srcip:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index, index + 1, new CharPred("srcip:".charAt(index)), 9));

    transitions.add(new SRAStoreMove<CharPred, Character>(6, 7, num, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(7, 8, num, 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(8, 9, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(9, 10, dot, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(10, 11, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(11, 12, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 13, num, 5));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 14, dot, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 15, num, 6));
    transitions.add(new SRAStoreMove<CharPred, Character>(15, 16, num, 7));
    transitions.add(new SRAStoreMove<CharPred, Character>(16, 17, num, 8));
    transitions.add(new SRAStoreMove<CharPred, Character>(17, 18, dot, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(18, 19, num, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(19, 20, num, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(20, 21, num, 9));

    for (int index = 0; index < " prt:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 21, index + 22, new CharPred(" prt:".charAt(index)), 9));

    transitions.add(new SRAStoreMove<CharPred, Character>(26, 27, num, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(27, 27, num, 9));

    for (int index = 0; index < " dstip:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 27, index + 28, new CharPred(" dstip:".charAt(index)), 9));

    transitions.add(new SRACheckMove<CharPred, Character>(34, 35, num, 0));
    transitions.add(new SRACheckMove<CharPred, Character>(35, 36, num, 1));
    transitions.add(new SRACheckMove<CharPred, Character>(36, 37, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(37, 38, dot, 9));
    transitions.add(new SRACheckMove<CharPred, Character>(38, 39, num, 3));
    transitions.add(new SRACheckMove<CharPred, Character>(39, 40, num, 4));
    transitions.add(new SRACheckMove<CharPred, Character>(40, 41, num, 5));
    transitions.add(new SRACheckMove<CharPred, Character>(41, 42, dot, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(41, 42, dot, 9));
    transitions.add(new SRACheckMove<CharPred, Character>(42, 43, num, 6));
    transitions.add(new SRACheckMove<CharPred, Character>(43, 44, num, 7));
    transitions.add(new SRACheckMove<CharPred, Character>(44, 45, num, 8));
    transitions.add(new SRAStoreMove<CharPred, Character>(45, 46, dot, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(46, 47, num, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(47, 48, num, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(48, 49, num, 9));

    for (int index = 0; index < " prt:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 49, index + 50, new CharPred(" prt:".charAt(index)), 9));

    transitions.add(new SRAStoreMove<CharPred, Character>(54, 55, num, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(55, 55, num, 9));

    for (int index = 0; index < " pload:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 55, index + 56, new CharPred(" pload:".charAt(index)), 9));

    transitions.add(new SRAStoreMove<CharPred, Character>(62, 63, new CharPred('\''), 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(63, 64, alphaNum, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(64, 64, alphaNum, 9));
    transitions.add(new SRAStoreMove<CharPred, Character>(64, 65, new CharPred('\''), 9));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(65), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 13
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getIP4PacketParserSRA(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null, null, null));

    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();

    for (int index = 0; index < "srcip:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index, index + 1, new CharPred("srcip:".charAt(index)), 4));

    transitions.add(new SRAStoreMove<CharPred, Character>(6, 7, num, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(7, 8, num, 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(8, 9, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(9, 10, dot, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(10, 11, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(11, 12, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 13, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 14, dot, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 15, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(15, 16, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(16, 17, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(17, 18, dot, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(18, 19, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(19, 20, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(20, 21, num, 4));

    for (int index = 0; index < " prt:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 21, index + 22, new CharPred(" prt:".charAt(index)), 4));

    transitions.add(new SRAStoreMove<CharPred, Character>(26, 27, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(27, 27, num, 4));

    for (int index = 0; index < " dstip:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 27, index + 28, new CharPred(" dstip:".charAt(index)), 4));

    transitions.add(new SRACheckMove<CharPred, Character>(34, 35, num, 0));
    transitions.add(new SRACheckMove<CharPred, Character>(35, 36, num, 1));
    transitions.add(new SRACheckMove<CharPred, Character>(36, 37, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(37, 38, dot, 4));
    transitions.add(new SRACheckMove<CharPred, Character>(38, 39, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(39, 40, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(40, 41, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(41, 42, dot, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(42, 43, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(43, 44, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(44, 45, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(45, 46, dot, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(46, 47, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(47, 48, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(48, 49, num, 4));

    for (int index = 0; index < " prt:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 49, index + 50, new CharPred(" prt:".charAt(index)), 4));

    transitions.add(new SRAStoreMove<CharPred, Character>(54, 55, num, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(55, 55, num, 4));

    for (int index = 0; index < " pload:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 55, index + 56, new CharPred(" pload:".charAt(index)), 4));

    transitions.add(new SRAStoreMove<CharPred, Character>(62, 63, new CharPred('\''), 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(63, 64, alphaNum, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(64, 64, alphaNum, 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(64, 65, new CharPred('\''), 4));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(65), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 14
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getSSNParser(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null));

    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();
    // Read first initial and store it in register 0
    transitions.add(new SRAStoreMove<CharPred, Character>(0, 1, upperAlpha, 0));

    // Read an unbound number of lowercase letters for the rest of the first name.
    // Dispose of them on the dummy register (2)
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 1, lowerAlpha, 2));

    // Read a comma and dispose of it on register (2)
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 2, comma, 2));

    // Read an unbound number of spaces.
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 2, space, 2));

    // Read the second initial and store it in register 1
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 3, upperAlpha, 1));

    // Read an unbound number of lowercase letters for the rest of the last name.
    // Dispose of them on the dummy register (2)
    transitions.add(new SRAStoreMove<CharPred, Character>(3, 3, lowerAlpha, 2));

    // Read a comma and dispose of it on register (2)
    transitions.add(new SRAStoreMove<CharPred, Character>(3, 4, comma, 2));

    // Read an unbound number of spaces.
    transitions.add(new SRAStoreMove<CharPred, Character>(4, 4, space, 2));

    // Read the first initial and compare it to register 0
    transitions.add(new SRACheckMove<CharPred, Character>(4, 5, upperAlpha, 0));

    // Read the second initial and compare it to register 1
    transitions.add(new SRACheckMove<CharPred, Character>(5, 6, upperAlpha, 1));

    try {
        return SRA.MkSRA(transitions, 0, Arrays.asList(6), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 15
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getIP2PacketParserSimplifiedSRA(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null));

    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();

    for (int index = 0; index < "s:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index, index + 1, new CharPred("s:".charAt(index)), 2));

    transitions.add(new SRAStoreMove<CharPred, Character>(2, 3, num, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(3, 4, num, 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(4, 5, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(5, 6, dot, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(6, 7, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(7, 8, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(8, 9, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(9, 10, dot, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(10, 11, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(11, 12, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 13, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 14, dot, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 15, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(15, 16, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(16, 17, num, 2));

    transitions.add(new SRAStoreMove<CharPred, Character>(17, 18, space, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(18, 18, ba.MkOr(new CharPred(':'), alphaNum), 2));

    for (int index = 0; index < " d:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 18, index + 19, new CharPred(" d:".charAt(index)), 2));

    transitions.add(new SRACheckMove<CharPred, Character>(21, 22, num, 0));
    transitions.add(new SRACheckMove<CharPred, Character>(22, 23, num, 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(23, 24, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(24, 25, dot, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(25, 26, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(26, 27, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(27, 28, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(28, 29, dot, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(29, 30, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(30, 31, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(31, 32, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(32, 33, dot, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(33, 34, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(34, 35, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(35, 36, num, 2));

    transitions.add(new SRAStoreMove<CharPred, Character>(36, 37, space, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(37, 37, ba.MkOr(new CharPred(':'), alphaNum), 2));

    for (int index = 0; index < " p:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 37, index + 38, new CharPred(" p:".charAt(index)), 2));

    transitions.add(new SRAStoreMove<CharPred, Character>(40, 41, new CharPred('\''), 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(41, 42, alphaNum, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(42, 42, alphaNum, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(42, 43, new CharPred('\''), 2));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(43), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 16
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getProductParserC3(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null, null));
    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();
    transitions.add(new SRAStoreMove<CharPred, Character>(0, 1, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 2, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 3, ba.MkNot(space), 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(3, 4, ba.MkNot(space), 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(4, 5, ba.MkNot(space), 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(5, 6, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(6, 7, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(7, 8, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(8, 9, alphaNum, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(9, 10, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(10, 11, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(11, 12, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 13, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 13, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 14, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 15, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(15, 16, new CharPred(':'), 0));
    transitions.add(new SRACheckMove<CharPred, Character>(16, 17, ba.MkNot(space), 1));
    transitions.add(new SRACheckMove<CharPred, Character>(17, 18, ba.MkNot(space), 2));
    transitions.add(new SRACheckMove<CharPred, Character>(18, 19, ba.MkNot(space), 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(19, 20, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(20, 21, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(21, 22, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(22, 23, alphaNum, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(23, 24, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(24, 25, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(25, 26, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(26, 27, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(27, 27, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(27, 14, space, 0));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(27), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 17
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getIP3PacketParserSRA(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null, null));

    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();

    for (int index = 0; index < "srcip:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index, index + 1, new CharPred("srcip:".charAt(index)), 3));

    transitions.add(new SRAStoreMove<CharPred, Character>(6, 7, num, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(7, 8, num, 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(8, 9, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(9, 10, dot, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(10, 11, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(11, 12, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 13, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 14, dot, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 15, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(15, 16, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(16, 17, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(17, 18, dot, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(18, 19, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(19, 20, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(20, 21, num, 3));

    for (int index = 0; index < " prt:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 21, index + 22, new CharPred(" prt:".charAt(index)), 3));

    transitions.add(new SRAStoreMove<CharPred, Character>(26, 27, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(27, 27, num, 3));

    for (int index = 0; index < " dstip:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 27, index + 28, new CharPred(" dstip:".charAt(index)), 3));

    transitions.add(new SRACheckMove<CharPred, Character>(34, 35, num, 0));
    transitions.add(new SRACheckMove<CharPred, Character>(35, 36, num, 1));
    transitions.add(new SRACheckMove<CharPred, Character>(36, 37, num, 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(37, 38, dot, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(38, 39, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(39, 40, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(40, 41, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(41, 42, dot, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(42, 43, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(43, 44, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(44, 45, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(45, 46, dot, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(46, 47, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(47, 48, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(48, 49, num, 3));

    for (int index = 0; index < " prt:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 49, index + 50, new CharPred(" prt:".charAt(index)), 3));

    transitions.add(new SRAStoreMove<CharPred, Character>(54, 55, num, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(55, 55, num, 3));

    for (int index = 0; index < " pload:".length(); index++)
        transitions.add(new SRAStoreMove<CharPred, Character>(index + 55, index + 56, new CharPred(" pload:".charAt(index)), 3));

    transitions.add(new SRAStoreMove<CharPred, Character>(62, 63, new CharPred('\''), 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(63, 64, alphaNum, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(64, 64, alphaNum, 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(64, 65, new CharPred('\''), 3));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(65), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 18
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getSSNParserFirst(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null));
    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();

    // Read the first initial and store it in register 0
    transitions.add(new SRAStoreMove<CharPred, Character>(0, 1, upperAlpha, 0));

    // Read an unbound number of lowercase characters
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 1, lowerAlpha, 1));

    // Read a comma
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 2, comma, 1));

    // Read an unbound number of spaces
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 2, space, 1));

    // Read a different second initial or a repeated second initial and store it in 1
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 3, upperAlpha, 1));

    // Read an unbound number of lowercase characters
    transitions.add(new SRAStoreMove<>(3, 3, lowerAlpha,1));

    // Read a comma
    transitions.add(new SRAStoreMove<CharPred, Character>(3, 4, comma, 1));

    // Read an unbound number of spaces
    transitions.add(new SRAStoreMove<CharPred, Character>(4, 4, space, 1));

    // Read a capital that matches both registers or a capital that matches the first register
    transitions.add(new SRACheckMove<CharPred, Character>(4, 5, upperAlpha, 0));

    // Read a second capital
    transitions.add(new SRAStoreMove<CharPred, Character>(5, 6, upperAlpha, 1));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(6), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 19
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getProductParserC6(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null, null, null, null, null));
    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();
    transitions.add(new SRAStoreMove<CharPred, Character>(0, 1, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 2, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 3, ba.MkNot(space), 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(3, 4, ba.MkNot(space), 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(4, 5, ba.MkNot(space), 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(5, 6, ba.MkNot(space), 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(6, 7, ba.MkNot(space), 5));
    transitions.add(new SRAStoreMove<CharPred, Character>(7, 8, ba.MkNot(space), 6));
    transitions.add(new SRAStoreMove<CharPred, Character>(8, 9, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(9, 10, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(10, 11, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(11, 12, alphaNum, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 13, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 14, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 15, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(15, 16, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(16, 16, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(16, 17, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(17, 18, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(18, 19, new CharPred(':'), 0));
    transitions.add(new SRACheckMove<CharPred, Character>(19, 20, ba.MkNot(space), 1));
    transitions.add(new SRACheckMove<CharPred, Character>(20, 21, ba.MkNot(space), 2));
    transitions.add(new SRACheckMove<CharPred, Character>(21, 22, ba.MkNot(space), 3));
    transitions.add(new SRACheckMove<CharPred, Character>(22, 23, ba.MkNot(space), 4));
    transitions.add(new SRACheckMove<CharPred, Character>(23, 24, ba.MkNot(space), 5));
    transitions.add(new SRACheckMove<CharPred, Character>(24, 25, ba.MkNot(space), 6));
    transitions.add(new SRAStoreMove<CharPred, Character>(25, 26, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(26, 27, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(27, 28, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(28, 29, alphaNum, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(29, 30, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(30, 31, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(31, 32, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(32, 33, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(33, 33, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(33, 17, space, 0));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(33), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
 
Example 20
Source File: Experiments.java    From symbolicautomata with Apache License 2.0 4 votes vote down vote up
private static SRA<CharPred, Character> getProductParserC4(UnaryCharIntervalSolver ba) {
    LinkedList<Character> registers = new LinkedList<Character>(Arrays.asList(null, null, null, null, null));
    Collection<SRAMove<CharPred, Character>> transitions = new LinkedList<SRAMove<CharPred, Character>>();
    transitions.add(new SRAStoreMove<CharPred, Character>(0, 1, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(1, 2, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(2, 3, ba.MkNot(space), 1));
    transitions.add(new SRAStoreMove<CharPred, Character>(3, 4, ba.MkNot(space), 2));
    transitions.add(new SRAStoreMove<CharPred, Character>(4, 5, ba.MkNot(space), 3));
    transitions.add(new SRAStoreMove<CharPred, Character>(5, 6, ba.MkNot(space), 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(6, 7, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(7, 8, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(8, 9, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(9, 10, alphaNum, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(10, 11, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(11, 12, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(12, 13, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(13, 14, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 14, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(14, 15, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(15, 16, new CharPred('C'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(16, 17, new CharPred(':'), 0));
    transitions.add(new SRACheckMove<CharPred, Character>(17, 18, ba.MkNot(space), 1));
    transitions.add(new SRACheckMove<CharPred, Character>(18, 19, ba.MkNot(space), 2));
    transitions.add(new SRACheckMove<CharPred, Character>(19, 20, ba.MkNot(space), 3));
    transitions.add(new SRACheckMove<CharPred, Character>(20, 21, ba.MkNot(space), 4));
    transitions.add(new SRAStoreMove<CharPred, Character>(21, 22, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(22, 23, new CharPred('L'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(23, 24, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(24, 25, alphaNum, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(25, 26, space, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(26, 27, new CharPred('D'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(27, 28, new CharPred(':'), 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(28, 29, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(29, 29, alpha, 0));
    transitions.add(new SRAStoreMove<CharPred, Character>(29, 15, space, 0));

    try {
        return SRA.MkSRA(transitions, 0, Collections.singleton(29), registers, ba);
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}