src/main/java/org/semgus/java/problem/ProblemGenerator.java
private void consumeDefineTermType(DefineTermTypeEvent event) {
        TermType termType = termTypes.get(event.name());
        if (termType == null) {
            throw new IllegalStateException("Undeclared term type for definition: " + event.name());
        }
        for (DefineTermTypeEvent.Constructor constructor : event.constructors()) {
            if (termType.constructors.containsKey(constructor.name())) {
                throw new IllegalStateException("Duplicate term constructor: " + constructor.name());
            }
            for (String child : constructor.children()) {
                if (!termTypes.containsKey(child)) {
                    throw new IllegalStateException("Undeclared term type for constructor child: " + child);
                }
            }
            termType.constructors.put(constructor.name(), new TermConstructor(constructor.children()));
        }
    }
/**
     * Collects constructor definitions from a "define-term-type" event for a previously-declared term type.
     *
     * @param event The event.
     */
Collects constructor definitions from a "define-term-type" event for a previously-declared term type.
@param event The event.
Collects constructor definitions from a " define - term - type " event for a previously - declared term type . @param event The event .
private void consumeDefineTermType(DefineTermTypeEvent event) {
        TermType termType = termTypes.get(event.name());
        if (termType == null) {
            throw new IllegalStateException("Undeclared term type for definition: " + event.name());
        }
        for (DefineTermTypeEvent.Constructor constructor : event.constructors()) {
            if (termType.constructors.containsKey(constructor.name())) {
                throw new IllegalStateException("Duplicate term constructor: " + constructor.name());
            }
            for (String child : constructor.children()) {
                if (!termTypes.containsKey(child)) {
                    throw new IllegalStateException("Undeclared term type for constructor child: " + child);
                }
            }
            termType.constructors.put(constructor.name(), new TermConstructor(constructor.children()));
        }
    }
private void consumeDefineTermType ( DefineTermTypeEvent event ) { TermType termType = termTypes . get ( event . name ( ) ) ; if ( termType == null ) { throw new IllegalStateException ( "Undeclared term type for definition: " + event . name ( ) ) ; } for ( DefineTermTypeEvent . Constructor constructor : event . constructors ( ) ) { if ( termType . constructors . containsKey ( constructor . name ( ) ) ) { throw new IllegalStateException ( "Duplicate term constructor: " + constructor . name ( ) ) ; } for ( String child : constructor . children ( ) ) { if ( ! termTypes . containsKey ( child ) ) { throw new IllegalStateException ( "Undeclared term type for constructor child: " + child ) ; } } termType . constructors . put ( constructor . name ( ) , new TermConstructor ( constructor . children ( ) ) ) ; } }
Collects constructor definitions from a "define-term-type" event for a previously-declared term type.
Collects constructor definitions from a " define - term - type " event for a previously - declared term type .