package edu.fiu.jtlex.data;

import java.util.Map;
import java.util.Set;
import edu.fiu.jtlex.data.IInstance.Aspect;
import edu.fiu.jtlex.data.IInstance.Polarity;
import edu.fiu.jtlex.data.IInstance.Pos;
import edu.fiu.jtlex.data.IInstance.Tense;
import edu.fiu.jtlex.data.ILink.ALinkType;
import edu.fiu.jtlex.data.ILink.LinkTag;
import edu.fiu.jtlex.data.ILink.Origintype;
import edu.fiu.jtlex.data.ILink.SLinkType;
import edu.fiu.jtlex.data.ILink.TLinkType;

/**
 * A class with utility functions for testing purposes.
 * 
 * @author luisrobaina
 *
 */
public class testUtils {
	/**
	 * Utility function to generate a sample test graph. Since many test graphs are
	 * required we can use this method as an interface with the specific test graph
	 * we want to use by giving it an ID.
	 * 
	 * @return A test IGraph or null if no test graph with that ID exists.
	 */

	public static void printGraph(IGraph graph) {

		System.out.println("Nodes Count = " + graph.getNodesCount());
		System.out.println("Links Count = " + graph.getLinksCount());
		System.out.println("\nLinks Count: (Type = Count");

		for (Map.Entry<String, Integer> tuple : graph.getLinkTypesCount().entrySet()) {
			System.out.println(tuple.getKey() + ": " + tuple.getValue());
		}

		System.out.println("Nodes:");
		Set<INode> nodes = graph.getNodes();
		if (nodes != null) {
			for (INode N : nodes) {
				System.out.print(N.getIdStr() + ", ");
			}
		}
		System.out.println("\nLinks: (From -> To)");
		Set<ILink> links = graph.getLinks();
		if (links != null) {
			for (ILink L : links) {
				System.out.println("(" + (L.getEventInstance().getIdStr() + " " + L.getRelType().toString() + " "
						+ (L.getRelatedToEvent()).getIdStr() + ")"));
			}
		}
	}

	public static String graphAsString(IGraph graph) {
		String graphInfo = "";

		graphInfo += ("Nodes Count = " + graph.getNodesCount() + "\n");
		graphInfo += ("Links Count = " + graph.getLinksCount() + "\n");
		
		for (Map.Entry<String, Integer> tuple : graph.getLinkTypesCount().entrySet()) {
			graphInfo += (tuple.getKey() + ": " + tuple.getValue() + "\n");
		}

		graphInfo += ("Nodes:\n");
		Set<INode> nodes = graph.getNodes();
		if (nodes != null) {
			for (INode N : nodes) {
				graphInfo += (N.getIdStr() + ", ");
			}
		}
		graphInfo += ("\nLinks: (From -> To) \n");
		Set<ILink> links = graph.getLinks();
		if (links != null) {
			for (ILink L : links) {
				graphInfo += ("(" + (L.getEventInstance().getIdStr() + " " + L.getRelType().toString() + " "
						+ (L.getRelatedToEvent()).getIdStr() + ")\n"));
			}
		}
		return graphInfo;
	}

	public static IGraph generateTestGraph(int which) {

		switch (which) {
		case 0:
			return testGraph0();
		case 1:
			return testGraph1();
		case 2:
			return testGraph2();
		case 3:
			return testGraph3();
		case 4:
			return testGraph4();
		case 5:
			return testGraph5();
		case 6:
			return testGraph6();
		case 7:
			return testGraph7();
		case 8:
			return testGraph8();
		case 9:
			return testGraph9();
		case 10:
			return testGraph10();
		case 11:
			return testGraph11();
		case 12:
			return testGraph12();
		case 13:
			return testGraph13();
		case 14:
			return testGraph14();
		case 15:
			return testGraph15();
		case 16:
			return testGraph16();
		case 17:
			return testGraph17();
		case 18:
			return testGraph18();
		case 19:
			return testGraph19();
		case 20:
			return testGraph20();
		case 21:
			// Graph with 1-inconsistency.
			return testGraph21();
		case 22:
			// Graph with 2-inconsistency.
			return testGraph22();
		case 23:
			// Graph with 3-inconsistency.
			return testGraph23();
		case 24:
			// Graph with 3-inconsistency 3 BEFORE
			return testGraph24();
		case 25:
			// Graph with a type 3 incosistency and a type 2 inconsistency.
			return testGraph25();
		case 26:
			return testGraph26();
		default:
			return null;
		}

	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph0() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode t9 = new Instance(9, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei73 = new Instance(73, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei74 = new Instance(74, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei75 = new Instance(75, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei76 = new Instance(76, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei77 = new Instance(77, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei78 = new Instance(78, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei79 = new Instance(79, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei80 = new Instance(80, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode t10 = new Instance(10, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei81 = new Instance(81, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(t9);
		TimeML.addNode(ei73);
		TimeML.addNode(ei74);
		TimeML.addNode(ei75);
		TimeML.addNode(ei76);
		TimeML.addNode(ei77);
		TimeML.addNode(ei78);
		TimeML.addNode(ei79);
		TimeML.addNode(ei80);
		TimeML.addNode(t10);
		TimeML.addNode(ei81);

		Link L1 = new Link(LinkTag.TLINK, 1, "", ei73, testSignal, t9, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L1);
		Link L2 = new Link(LinkTag.TLINK, 2, "", ei74, testSignal, ei73, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L2);
		Link L3 = new Link(LinkTag.SLINK, 3, "", ei73, testSignal, ei74, SLinkType.EVIDENTIAL);
		TimeML.addLink(L3);
		Link L4 = new Link(LinkTag.SLINK, 4, "", ei74, testSignal, ei75, SLinkType.MODAL);
		TimeML.addLink(L4);
		Link L5 = new Link(LinkTag.TLINK, 5, "", ei74, testSignal, ei75, TLinkType.AFTER, Origintype.MANUALLY);
		TimeML.addLink(L5);
		Link L6 = new Link(LinkTag.SLINK, 6, "", ei77, testSignal, ei78, SLinkType.MODAL);
		TimeML.addLink(L6);
		Link L7 = new Link(LinkTag.TLINK, 7, "", ei76, testSignal, ei73, TLinkType.SIMULTANEOUS, Origintype.MANUALLY);
		TimeML.addLink(L7);
		Link L8 = new Link(LinkTag.TLINK, 8, "", ei76, testSignal, ei78, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L8);
		Link L9 = new Link(LinkTag.SLINK, 9, "", ei76, testSignal, ei77, SLinkType.EVIDENTIAL);
		TimeML.addLink(L9);
		Link L10 = new Link(LinkTag.SLINK, 10, "", ei76, testSignal, ei80, SLinkType.MODAL);
		TimeML.addLink(L10);
		Link L11 = new Link(LinkTag.SLINK, 11, "", ei78, testSignal, ei79, SLinkType.FACTIVE);
		TimeML.addLink(L11);
		Link L12 = new Link(LinkTag.TLINK, 12, "", ei80, testSignal, t10, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L12);
		Link L13 = new Link(LinkTag.TLINK, 13, "", ei80, testSignal, ei81, TLinkType.ENDS, Origintype.MANUALLY);
		TimeML.addLink(L13);
		Link L14 = new Link(LinkTag.ALINK, 14, "", ei80, testSignal, ei81, ALinkType.CULMINATES);
		TimeML.addLink(L14);

		return TimeML;
	}

	private static IGraph testGraph1() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode t9 = new Instance(9, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei73 = new Instance(73, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei74 = new Instance(74, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei75 = new Instance(75, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei76 = new Instance(76, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei78 = new Instance(78, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode ei80 = new Instance(80, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode t10 = new Instance(10, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(t9);
		TimeML.addNode(ei73);
		TimeML.addNode(ei74);
		TimeML.addNode(ei75);
		TimeML.addNode(ei76);
		TimeML.addNode(ei78);
		TimeML.addNode(ei80);
		TimeML.addNode(t10);

		Link L1 = new Link(LinkTag.TLINK, 1, "", ei73, testSignal, t9, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L1);
		Link L2 = new Link(LinkTag.TLINK, 2, "", ei74, testSignal, ei73, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L2);
		Link L5 = new Link(LinkTag.TLINK, 5, "", ei74, testSignal, ei75, TLinkType.AFTER, Origintype.MANUALLY);
		TimeML.addLink(L5);
		Link L8 = new Link(LinkTag.TLINK, 8, "", ei76, testSignal, ei78, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L8);
		Link L12 = new Link(LinkTag.TLINK, 12, "", ei80, testSignal, t10, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L12);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph2() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph3() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.AFTER, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph4() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.INCLUDES, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph5() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.IS_INCLUDED, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph6() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.DURING, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph7() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.DURING_INV, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph8() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.SIMULTANEOUS, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph9() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.IAFTER, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph10() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.IBEFORE, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph11() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.IDENTITY, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph12() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.BEGINS, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph13() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.ENDS, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph14() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.BEGUN_BY, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph15() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.ENDED_BY, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph16() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, ALinkType.INITIATES, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph17() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, ALinkType.CULMINATES, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph18() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, ALinkType.TERMINATES, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * 
	 * @return
	 */
	private static IGraph testGraph19() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, ALinkType.CONTINUES, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	private static IGraph testGraph20() {

		Graph TimeML = new Graph();

		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, ALinkType.REINITIATES, Origintype.MANUALLY);
		TimeML.addLink(L1);

		return TimeML;
	}

	/**
	 * A sample graph with type 1-inconsistency.
	 * 
	 * @return
	 */
	private static IGraph testGraph21() {
		Graph TimeML = new Graph();
		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		TimeML.addNode(n1);
		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n1, TLinkType.BEFORE, Origintype.MANUALLY);
		TimeML.addLink(L1);
		return TimeML;
	}

	/**
	 * A sample graph with type 2-inconsistency.
	 * 
	 * @return
	 */
	private static IGraph testGraph22() {
		Graph TimeML = new Graph();
		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.INCLUDES, Origintype.MANUALLY);
		Link L2 = new Link(LinkTag.TLINK, 2, "", n1, testSignal, n2, TLinkType.ENDED_BY, Origintype.MANUALLY);

		TimeML.addLink(L1);
		TimeML.addLink(L2);

		return TimeML;
	}

	/**
	 * A sample graph with type 3-inconsistency.
	 * 
	 * @return
	 */
	private static IGraph testGraph23() {
		Graph TimeML = new Graph();
		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n3 = new Instance(3, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);
		TimeML.addNode(n3);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n3, TLinkType.ENDED_BY, Origintype.MANUALLY);
		Link L2 = new Link(LinkTag.TLINK, 2, "", n1, testSignal, n2, TLinkType.BEFORE, Origintype.MANUALLY);
		Link L3 = new Link(LinkTag.TLINK, 3, "", n2, testSignal, n3, TLinkType.IAFTER, Origintype.MANUALLY);

		TimeML.addLink(L1);
		TimeML.addLink(L2);
		TimeML.addLink(L3);

		return TimeML;
	}

	/**
	 * A test graph with a type 3 inconsistency.
	 * 
	 * @return
	 */
	private static IGraph testGraph24() {
		Graph TimeML = new Graph();
		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n3 = new Instance(3, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);
		TimeML.addNode(n3);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.BEFORE, Origintype.MANUALLY);
		Link L2 = new Link(LinkTag.TLINK, 2, "", n2, testSignal, n3, TLinkType.BEFORE, Origintype.MANUALLY);
		Link L3 = new Link(LinkTag.TLINK, 3, "", n3, testSignal, n1, TLinkType.BEFORE, Origintype.MANUALLY);

		TimeML.addLink(L1);
		TimeML.addLink(L2);
		TimeML.addLink(L3);

		return TimeML;
	}

	/**
	 * A test graph with a type 3 inconsistency and a type 2 inconsistency.
	 */
	private static IGraph testGraph25() {
		Graph TimeML = new Graph();
		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");

		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n3 = new Instance(3, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n4 = new Instance(4, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n5 = new Instance(5, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n6 = new Instance(6, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n7 = new Instance(7, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");

		TimeML.addNode(n1);
		TimeML.addNode(n2);
		TimeML.addNode(n3);
		TimeML.addNode(n4);
		TimeML.addNode(n5);
		TimeML.addNode(n6);
		TimeML.addNode(n7);

		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.INCLUDES, Origintype.MANUALLY);
		Link L2 = new Link(LinkTag.TLINK, 2, "", n2, testSignal, n3, TLinkType.BEFORE, Origintype.MANUALLY);
		Link L3 = new Link(LinkTag.TLINK, 3, "", n3, testSignal, n4, TLinkType.BEFORE, Origintype.MANUALLY);
		Link L4 = new Link(LinkTag.TLINK, 4, "", n4, testSignal, n2, TLinkType.BEFORE, Origintype.MANUALLY);
		Link L5 = new Link(LinkTag.TLINK, 5, "", n3, testSignal, n5, TLinkType.ENDS, Origintype.MANUALLY);
		Link L6 = new Link(LinkTag.TLINK, 6, "", n5, testSignal, n6, TLinkType.IDENTITY, Origintype.MANUALLY);
		Link L7 = new Link(LinkTag.TLINK, 7, "", n6, testSignal, n7, TLinkType.BEGINS, Origintype.MANUALLY);
		Link L8 = new Link(LinkTag.TLINK, 8, "", n6, testSignal, n7, TLinkType.AFTER, Origintype.MANUALLY);

		TimeML.addLink(L1);
		TimeML.addLink(L2);
		TimeML.addLink(L3);
		TimeML.addLink(L4);
		TimeML.addLink(L5);
		TimeML.addLink(L6);
		TimeML.addLink(L7);
		TimeML.addLink(L8);

		return TimeML;
	}
	
	private static IGraph testGraph26() {
		Graph TimeML = new Graph();
		ISignal testSignal = new Signal(1, "Test");
		IEvent testEvent = new Event(1, IEvent.EventClass.STATE, "Test");
		
		INode n1 = new Instance(1, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n2 = new Instance(2, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n3 = new Instance(3, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n4 = new Instance(4, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		INode n5 = new Instance(5, testEvent, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE, Polarity.POS, "Test",
				testSignal, "Test");
		TimeML.addNode(n1);
		TimeML.addNode(n2);
		TimeML.addNode(n3);
		TimeML.addNode(n4);
		TimeML.addNode(n5);
		
		Link L1 = new Link(LinkTag.TLINK, 1, "", n1, testSignal, n2, TLinkType.BEFORE, Origintype.MANUALLY);
		Link L2 = new Link(LinkTag.TLINK, 2, "", n2, testSignal, n4, TLinkType.BEFORE, Origintype.MANUALLY);
		Link L3 = new Link(LinkTag.TLINK, 3, "", n4, testSignal, n5, TLinkType.INCLUDES, Origintype.MANUALLY);
		Link L4 = new Link(LinkTag.TLINK, 4, "", n1, testSignal, n3, TLinkType.BEFORE, Origintype.MANUALLY);
		Link L5 = new Link(LinkTag.TLINK, 5, "", n3, testSignal, n4, TLinkType.BEFORE, Origintype.MANUALLY);
	
		TimeML.addLink(L1);
		TimeML.addLink(L2);
		TimeML.addLink(L3);
		TimeML.addLink(L4);
		TimeML.addLink(L5);
		
		return TimeML;
	}
	

}
