src/main/java/org/semgus/java/object/SmtTerm.java
static SmtTerm deserialize(Object termDtoRaw) throws DeserializationException {
        if (termDtoRaw instanceof Number value) { // it's a numeric constant
            return new CNumber(value.longValue());
        } else if (termDtoRaw instanceof String value) { // it's a string constant
            return new CString(value);
        } else if (termDtoRaw instanceof JSONObject termDto) { // it's something more complex
            String termType = JsonUtils.getString(termDto, "$termType");
            return switch (termType) {
                case "application" -> deserializeApplication(termDto); // a function application
                case "exists" -> deserializeQuantifier(termDto, Quantifier.Type.EXISTS); // an existential quantifier
                case "forall" -> deserializeQuantifier(termDto, Quantifier.Type.FOR_ALL); // a universal quantifier
                case "variable" -> deserializeVariable(termDto); // a variable
                case "bitvector" -> deserializeBitVector(termDto); // a bit vector
                default -> throw new DeserializationException(
                        String.format("Unknown term type \"%s\"", termType), "$termType");
            };
        }
        throw new DeserializationException(String.format("Could not deserialize SMT term \"%s\"", termDtoRaw));
    }
/**
     * Deserializes an SMT formula term in the SemGuS JSON format.
     *
     * @param termDtoRaw The JSON representation of the term.
     * @return The deserialized term.
     * @throws DeserializationException If {@code termDtoRaw} is not a valid representation of an SMT term.
     */
Deserializes an SMT formula term in the SemGuS JSON format.
@param termDtoRaw The JSON representation of the term.
@return The deserialized term.
@throws DeserializationException If  termDtoRaw is not a valid representation of an SMT term.
Deserializes an SMT formula term in the SemGuS JSON format . @param termDtoRaw The JSON representation of the term . @return The deserialized term . @throws DeserializationException If termDtoRaw is not a valid representation of an SMT term .
static SmtTerm deserialize(Object termDtoRaw) throws DeserializationException {
        if (termDtoRaw instanceof Number value) { 
            return new CNumber(value.longValue());
        } else if (termDtoRaw instanceof String value) { 
            return new CString(value);
        } else if (termDtoRaw instanceof JSONObject termDto) { 
            String termType = JsonUtils.getString(termDto, "$termType");
            return switch (termType) {
                case "application" -> deserializeApplication(termDto); 
                case "exists" -> deserializeQuantifier(termDto, Quantifier.Type.EXISTS); 
                case "forall" -> deserializeQuantifier(termDto, Quantifier.Type.FOR_ALL); 
                case "variable" -> deserializeVariable(termDto); 
                case "bitvector" -> deserializeBitVector(termDto); 
                default -> throw new DeserializationException(
                        String.format("Unknown term type \"%s\"", termType), "$termType");
            };
        }
        throw new DeserializationException(String.format("Could not deserialize SMT term \"%s\"", termDtoRaw));
    }
static SmtTerm deserialize ( Object termDtoRaw ) throws DeserializationException { if ( termDtoRaw instanceof Number value ) { return new CNumber ( value . longValue ( ) ) ; } else if ( termDtoRaw instanceof String value ) { return new CString ( value ) ; } else if ( termDtoRaw instanceof JSONObject termDto ) { String termType = JsonUtils . getString ( termDto , "$termType" ) ; return switch ( termType ) { case "application" -> deserializeApplication ( termDto ) ; case "exists" -> deserializeQuantifier ( termDto , Quantifier . Type . EXISTS ) ; case "forall" -> deserializeQuantifier ( termDto , Quantifier . Type . FOR_ALL ) ; case "variable" -> deserializeVariable ( termDto ) ; case "bitvector" -> deserializeBitVector ( termDto ) ; default -> throw new DeserializationException ( String . format ( "Unknown term type \"%s\"" , termType ) , "$termType" ) ; } ; } throw new DeserializationException ( String . format ( "Could not deserialize SMT term \"%s\"" , termDtoRaw ) ) ; }
Deserializes an SMT formula term in the SemGuS JSON format.
Deserializes an SMT formula term in the SemGuS JSON format .
// it's a numeric constant // it's a string constant // it's something more complex // a function application // an existential quantifier // a universal quantifier // a variable // a bit vector