// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final int ENDLESS = 1000;
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String FRED = "fred:";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String NULL = "Null";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String PIVOT = "Pivot";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String TOP = "top";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String VN_ROLE = "vn.role:";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String AMR_ARG = ":arg.";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String AMR_ARG0 = ":arg0";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String AMR_ARG1 = ":arg1";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String AMR_ARG2 = ":arg2";


import static amr2fred.Glossary.AMR_ARG1;
import static amr2fred.Glossary.AMR_ARG2;
import static amr2fred.Glossary.ENDLESS;
import static amr2fred.Glossary.FRED;
import static amr2fred.Glossary.NULL;
import static amr2fred.Glossary.PIVOT;
import static amr2fred.Glossary.TOP;
import static amr2fred.Glossary.VN_ROLE;
import static amr2fred.Glossary.NodeStatus.AMR;
import static amr2fred.Glossary.NodeStatus.OK;
import static amr2fred.Glossary.NodeStatus.REMOVE;
import static amr2fred.Glossary.NodeType.VERB;
import java.util.ArrayList;
import java.util.Iterator;
import static amr2fred.Glossary.AMR_ARG;
import static amr2fred.Glossary.AMR_ARG0;
        //verifica inversi
        root = this.inverseChecker(root);

        //verifica rate-entity-91
        root = this.rateEntity(root);

        // verifica reifing
        root = this.reifi(root);

        //Elaborazione della lista dei nodi contenuti nel nodo attualmente in lavorazione
        root = this.listElaboration(root);

        //elaborazione del nodo figlio denominato instance in amr
        root = this.instanceElaboration(root);

        return root;
    }

    /*
    Controlla ed elabora alcuni casi particolari di verbi che introducono possibilità oppure obbligo
     */
    private Node modality(Node root) {
        //TODO eliminare i magic numbers
        if (root == null || root.getInstance() == null || root.getInstance().var.length() < 4) {
            return root;
        }
        Node instance = root.getInstance();
        String lemma = instance.var.substring(0, instance.var.length() - 3);

        if (lemma.equalsIgnoreCase("likely") || lemma.equalsIgnoreCase("recommend")) {
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final int ENDLESS = 1000;
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String FRED = "fred:";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String NULL = "Null";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String PIVOT = "Pivot";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String TOP = "top";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String VN_ROLE = "vn.role:";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String AMR_ARG = ":arg.";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String AMR_ARG0 = ":arg0";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String AMR_ARG1 = ":arg1";
// 
// Path: amr2Fred/src/amr2fred/Glossary.java
// public static final String AMR_ARG2 = ":arg2";


// Path: amr2Fred/src/amr2fred/Parser.java
import static amr2fred.Glossary.AMR_ARG1;
import static amr2fred.Glossary.AMR_ARG2;
import static amr2fred.Glossary.ENDLESS;
import static amr2fred.Glossary.FRED;
import static amr2fred.Glossary.NULL;
import static amr2fred.Glossary.PIVOT;
import static amr2fred.Glossary.TOP;
import static amr2fred.Glossary.VN_ROLE;
import static amr2fred.Glossary.NodeStatus.AMR;
import static amr2fred.Glossary.NodeStatus.OK;
import static amr2fred.Glossary.NodeStatus.REMOVE;
import static amr2fred.Glossary.NodeType.VERB;
import java.util.ArrayList;
import java.util.Iterator;
import static amr2fred.Glossary.AMR_ARG;
import static amr2fred.Glossary.AMR_ARG0;

        //verifica inversi
        root = this.inverseChecker(root);

        //verifica rate-entity-91
        root = this.rateEntity(root);

        // verifica reifing
        root = this.reifi(root);

        //Elaborazione della lista dei nodi contenuti nel nodo attualmente in lavorazione
        root = this.listElaboration(root);

        //elaborazione del nodo figlio denominato instance in amr
        root = this.instanceElaboration(root);

        return root;
    }

    /*
    Controlla ed elabora alcuni casi particolari di verbi che introducono possibilità oppure obbligo
     */
    private Node modality(Node root) {
        //TODO eliminare i magic numbers
        if (root == null || root.getInstance() == null || root.getInstance().var.length() < 4) {
            return root;
        }
        Node instance = root.getInstance();
        String lemma = instance.var.substring(0, instance.var.length() - 3);

        if (lemma.equalsIgnoreCase("likely") || lemma.equalsIgnoreCase("recommend")) {
            Node arg1 = root.getChild(Glossary.AMR_ARG1);