@SuppressWarnings({"unchecked"})
    public static Decision eval(InternalNode<?> midd, Map<Integer, Variable<?>> variables) {
        AbstractNode currentNode = midd;

        while (currentNode instanceof InternalNode) {
            InternalNode currentInternalNode = (InternalNode) currentNode;

            Variable<?> currentVar = null;
            // attribute not found:
            if (!variables.containsKey(currentInternalNode.getID())) {
                // create a null variable
                currentVar = createVariable(currentInternalNode.getID(), null, currentInternalNode.getType());
            } else {
                currentVar = variables.get(currentInternalNode.getID());
            }

            if (currentVar.getType() != currentInternalNode.getType()) {
                throw new RuntimeException("Error evaluation, either tree or values have error: same attribute with different variable identifiers");
            }

            try {
                AbstractEdge<?> e = currentInternalNode.match(currentVar.getValue());
                currentNode = e.getSubDiagram();
            } catch (UnmatchedException ex) {
                return currentInternalNode.buildDecision();
            } catch (MIDDException e) {
                throw new RuntimeException(e);
            }
        }
        if (currentNode == null) {
            throw new RuntimeException("Incorrect MIDD: leaf node must not be null");
        }

        return ((ExternalNode3) currentNode).buildDecision();
    }
@ SuppressWarnings ( { "unchecked" } ) public static Decision eval ( InternalNode < ? > midd , Map < Integer , Variable < ? > > variables ) { AbstractNode currentNode = midd ; while ( currentNode instanceof InternalNode ) { InternalNode currentInternalNode = ( InternalNode ) currentNode ; Variable < ? > currentVar = null ; if ( ! variables . containsKey ( currentInternalNode . getID ( ) ) ) { currentVar = createVariable ( currentInternalNode . getID ( ) , null , currentInternalNode . getType ( ) ) ; } else { currentVar = variables . get ( currentInternalNode . getID ( ) ) ; } if ( currentVar . getType ( ) != currentInternalNode . getType ( ) ) { throw new RuntimeException ( "Error evaluation, either tree or values have error: same attribute with different variable identifiers" ) ; } try { AbstractEdge < ? > e = currentInternalNode . match ( currentVar . getValue ( ) ) ; currentNode = e . getSubDiagram ( ) ; } catch ( UnmatchedException ex ) { return currentInternalNode . buildDecision ( ) ; } catch ( MIDDException e ) { throw new RuntimeException ( e ) ; } } if ( currentNode == null ) { throw new RuntimeException ( "Incorrect MIDD: leaf node must not be null" ) ; } return ( ( ExternalNode3 ) currentNode ) . buildDecision ( ) ; }
Evaluate a map of attributes (from id to variable) against a multitype interval decision diagram (MIDD).

@param midd  the DAG which has its root is the first attribute (x0)
@param variables vector of attributes, starting from x0. If there's missing any attribute, its value is null.
@return The external node that holds effect value and obligations (optional).