src/main/java/org/semgus/java/object/SmtTerm.java
private static SmtTerm deserializeQuantifier(JSONObject termDto, Quantifier.Type qType)
            throws DeserializationException {
        // collect variables bound by the quantifier
        List<JSONObject> bindingsDto = JsonUtils.getObjects(termDto, "bindings");
        TypedVar[] bindings = new TypedVar[bindingsDto.size()];
        for (int i = 0; i < bindings.length; i++) {
            JSONObject bindingDto = bindingsDto.get(i);
            try {
                String name = JsonUtils.getString(bindingDto, "name");
                Object typeDto = JsonUtils.get(bindingDto, "sort");
                Identifier type;
                try {
                    type = Identifier.deserialize(typeDto);
                } catch (DeserializationException e) {
                    throw e.prepend("sort");
                }
                bindings[i] = new TypedVar(name, type);
            } catch (DeserializationException e) {
                throw e.prepend("bindings." + i);
            }
        }

        // deserialize child term
        Object childDtoRaw = JsonUtils.get(termDto, "child");
        SmtTerm child;
        try {
            child = deserialize(childDtoRaw);
        } catch (DeserializationException e) {
            throw e.prepend("child");
        }

        return new Quantifier(qType, Arrays.asList(bindings), child);
    }
/**
     * Deserializes a quantified subterm.
     *
     * @param termDto The JSON representation of the quantified subterm.
     * @param qType   The type of quantifier.
     * @return The deserialized subterm.
     * @throws DeserializationException If {@code termDto} is not a valid representation of a quantifier.
     */
Deserializes a quantified subterm.
@param termDto The JSON representation of the quantified subterm.
@param qType   The type of quantifier.
@return The deserialized subterm.
@throws DeserializationException If  termDto is not a valid representation of a quantifier.
Deserializes a quantified subterm . @param termDto The JSON representation of the quantified subterm . @param qType The type of quantifier . @return The deserialized subterm . @throws DeserializationException If termDto is not a valid representation of a quantifier .
private static SmtTerm deserializeQuantifier(JSONObject termDto, Quantifier.Type qType)
            throws DeserializationException {
        List<JSONObject> bindingsDto = JsonUtils.getObjects(termDto, "bindings");
        TypedVar[] bindings = new TypedVar[bindingsDto.size()];
        for (int i = 0; i < bindings.length; i++) {
            JSONObject bindingDto = bindingsDto.get(i);
            try {
                String name = JsonUtils.getString(bindingDto, "name");
                Object typeDto = JsonUtils.get(bindingDto, "sort");
                Identifier type;
                try {
                    type = Identifier.deserialize(typeDto);
                } catch (DeserializationException e) {
                    throw e.prepend("sort");
                }
                bindings[i] = new TypedVar(name, type);
            } catch (DeserializationException e) {
                throw e.prepend("bindings." + i);
            }
        }
        Object childDtoRaw = JsonUtils.get(termDto, "child");
        SmtTerm child;
        try {
            child = deserialize(childDtoRaw);
        } catch (DeserializationException e) {
            throw e.prepend("child");
        }
        return new Quantifier(qType, Arrays.asList(bindings), child);
    }
private static SmtTerm deserializeQuantifier ( JSONObject termDto , Quantifier . Type qType ) throws DeserializationException { List < JSONObject > bindingsDto = JsonUtils . getObjects ( termDto , "bindings" ) ; TypedVar [ ] bindings = new TypedVar [ bindingsDto . size ( ) ] ; for ( int i = 0 ; i < bindings . length ; i ++ ) { JSONObject bindingDto = bindingsDto . get ( i ) ; try { String name = JsonUtils . getString ( bindingDto , "name" ) ; Object typeDto = JsonUtils . get ( bindingDto , "sort" ) ; Identifier type ; try { type = Identifier . deserialize ( typeDto ) ; } catch ( DeserializationException e ) { throw e . prepend ( "sort" ) ; } bindings [ i ] = new TypedVar ( name , type ) ; } catch ( DeserializationException e ) { throw e . prepend ( "bindings." + i ) ; } } Object childDtoRaw = JsonUtils . get ( termDto , "child" ) ; SmtTerm child ; try { child = deserialize ( childDtoRaw ) ; } catch ( DeserializationException e ) { throw e . prepend ( "child" ) ; } return new Quantifier ( qType , Arrays . asList ( bindings ) , child ) ; }
Deserializes a quantified subterm.
Deserializes a quantified subterm .
// collect variables bound by the quantifier // deserialize child term