/**
 * Copyright (c) 2013 HAN University of Applied Sciences
 * Arjan Oortgiese
 * Boyd Hofman
 * Joëll Portier
 * Michiel Westerbeek
 * Tim Waalewijn
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
package nl.han.ica.ap.nlp.listeners;

import nl.han.ica.ap.nlp.controller.TreeController;
import nl.han.ica.ap.nlp.controller.VerbDirectionController;
import nl.han.ica.ap.nlp.model.Class;
import nl.han.ica.ap.nlp.NlpBaseListener;
import nl.han.ica.ap.nlp.NlpParser.WerkwoordContext;
import nl.han.ica.ap.nlp.NlpParser.ZelfstandignaamwoordContext;

public class ZelfstandignaamwoordListener extends NlpBaseListener {
	TreeController controller;	
	ZelfstandignaamwoordContext znw;
	boolean direction;
	boolean start = false;
	
	public ZelfstandignaamwoordListener(TreeController controller) {
		this.controller = controller;
	}
	
	@Override
	public void enterZelfstandignaamwoord(ZelfstandignaamwoordContext ctx) {
		if(start) {
			if(!direction) {
				Class c = new Class(znw.getText());
				c.addAssociation(new Class(ctx.getText()));					
				controller.addClass(c);
			} else {
				Class c = new Class(ctx.getText());
				c.addAssociation(new Class(znw.getText()));	
				controller.addClass(c);
			}
			start = false;
		} else {
			znw = ctx;
			start = true;
		}		
	}

	@Override
	public void enterWerkwoord(WerkwoordContext ctx) {
		VerbDirectionController vc = new VerbDirectionController();
		direction = vc.getDirection(ctx.getText());		
	}
}


@@ -1462,24 +1462,195 @@
 seListener;%0A
+import nl.han.ica.ap.nlp.NlpParser.SamengesteldContext;%0Aimport nl.han.ica.ap.nlp.NlpParser.VerbaleconstituentContext;%0Aimport nl.han.ica.ap.nlp.NlpParser.VoegwoordContext;%0A
 import nl.ha
@@ -1824,16 +1824,24 @@
 ener %7B%0A%09
+private 
 TreeCont
@@ -1861,16 +1861,24 @@
 ller;%09%0A%09
+private 
 Zelfstan
@@ -1902,13 +1902,38 @@
 xt z
-nw;%0A%09
+elfstandignaamwoord;%0A%09private 
 bool
@@ -1948,16 +1948,24 @@
 ction;%0A%09
+private 
 boolean 
@@ -2220,34 +2220,51 @@
  c = new Class(z
-nw
+elfstandignaamwoord
 .getText());%0A%09%09%09
@@ -2425,18 +2425,35 @@
  Class(z
-nw
+elfstandignaamwoord
 .getText
@@ -2495,26 +2495,11 @@
 %09%09%09%7D
-%0A
 %09%09%09
-start = false;
 %0A%09%09%7D
@@ -2514,10 +2514,27 @@
 %09%09%09z
-nw
+elfstandignaamwoord
  = c
@@ -2740,11 +2740,113 @@
 );%09%09%0A%09%7D%0A
+%09%0A%09@Override%0A%09public void exitVerbaleconstituent(VerbaleconstituentContext ctx) %7B%0A%09%09start = false;%0A%09%7D%0A
 %7D%0A%0A

Support for composite sentences