}
private void checkEmptyPTA(String[][] arrayPlusStrings,String [][] arrayMinusStrings)
{
Set<List<String>> plusStrings = buildSet(arrayPlusStrings), minusStrings = buildSet(arrayMinusStrings);
DirectedSparseGraph actualA = null, actualC = null, actualD = null, actualE = null;
IllegalArgumentException eA = null, eC = null, eD = null, eE = null;
try
{
actualA = new RPNIBlueFringeLearnerOrig(null,Configuration.getDefaultConfiguration()).createAugmentedPTA(DeterministicDirectedSparseGraph.initialise(), plusStrings, minusStrings);
}
catch(IllegalArgumentException e)
{
// ignore this - it might be expected.
eA = e;
}
try
{
Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
l.init(plusStrings, minusStrings);
actualC = l.scoreComputer.paths.getGraph();
}
catch(IllegalArgumentException e)
{
// ignore this - it might be expected.
eC = e;
}
try
{
Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
PTASequenceEngine engine = buildPTA(plusStrings, minusStrings);
checkPTAConsistency(engine, plusStrings, true);if (engine.numberOfLeafNodes()>0) checkPTAConsistency(engine, minusStrings, false);
l.init(engine,0,0);
actualD = l.scoreComputer.paths.getGraph();
}
catch(IllegalArgumentException e)
{
// ignore this - it might be expected.
eD = e;
}
try
{
Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
l.init(buildPTA(plusStrings, buildSet(new String[][] {})),0,0);
for(List<String> seq:minusStrings)
l.scoreComputer.paths.augmentPTA(buildPTA(buildSet(new String[][] {}),buildSet(new String[][] { (String [])seq.toArray()})));
actualE = l.scoreComputer.paths.getGraph();
}
catch(IllegalArgumentException e)
{
// ignore this - it might be expected.
eE = e;
}
if (eA != null)
{
Assert.assertNotNull(eC);
Assert.assertNotNull(eD);
Assert.assertNotNull(eE);
throw eA;
}
Assert.assertNull(eA);
Assert.assertNull(eC);
Assert.assertNull(eD);
Assert.assertNull(eE);
Assert.assertEquals(1, actualA.getVertices().size());Assert.assertEquals(true, DeterministicDirectedSparseGraph.isAccept( ((Vertex)actualA.getVertices().iterator().next()) ));
Assert.assertEquals(0, actualA.getEdges().size());
Assert.assertEquals(1, actualC.getVertices().size());Assert.assertEquals(true, DeterministicDirectedSparseGraph.isAccept( ((Vertex)actualC.getVertices().iterator().next()) ));
Assert.assertEquals(0, actualC.getEdges().size());
Assert.assertEquals(1, actualD.getVertices().size());Assert.assertEquals(true, DeterministicDirectedSparseGraph.isAccept( ((Vertex)actualD.getVertices().iterator().next()) ));