src/main/java/org/semgus/java/object/RelationApp.java
public static RelationApp deserialize(JSONObject relAppDto) throws DeserializationException {
        String name = JsonUtils.getString(relAppDto, "name");

        // deserialize argument name and type lists
        JSONArray sigDto = JsonUtils.getArray(relAppDto, "signature");
        List<String> args = JsonUtils.getStrings(relAppDto, "arguments");
        if (sigDto.size() != args.size()) {
            throw new DeserializationException(String.format(
                    "Signature and arguments of relation application have different lengths %d != %d",
                    sigDto.size(), args.size()));
        }

        // deserialize type identifiers
        Identifier[] types = new Identifier[sigDto.size()];
        for (int i = 0; i < types.length; i++) {
            try {
                types[i] = Identifier.deserialize(sigDto.get(i));
            } catch (DeserializationException e) {
                throw e.prepend("signature." + i);
            }
        }

        return new RelationApp(name, TypedVar.fromNamesAndTypes(args, Arrays.asList(types)));
    }
/**
     * Deserializes a relation application from the SemGuS JSON format.
     *
     * @param relAppDto JSON object representing the relation application.
     * @return The deserialized relation application.
     * @throws DeserializationException If {@code relAppDto} is not a valid representation of a relation application.
     */
Deserializes a relation application from the SemGuS JSON format.
@param relAppDto JSON object representing the relation application.
@return The deserialized relation application.
@throws DeserializationException If  relAppDto is not a valid representation of a relation application.
Deserializes a relation application from the SemGuS JSON format . @param relAppDto JSON object representing the relation application . @return The deserialized relation application . @throws DeserializationException If relAppDto is not a valid representation of a relation application .
public static RelationApp deserialize(JSONObject relAppDto) throws DeserializationException {
        String name = JsonUtils.getString(relAppDto, "name");
        JSONArray sigDto = JsonUtils.getArray(relAppDto, "signature");
        List<String> args = JsonUtils.getStrings(relAppDto, "arguments");
        if (sigDto.size() != args.size()) {
            throw new DeserializationException(String.format(
                    "Signature and arguments of relation application have different lengths %d != %d",
                    sigDto.size(), args.size()));
        }
        Identifier[] types = new Identifier[sigDto.size()];
        for (int i = 0; i < types.length; i++) {
            try {
                types[i] = Identifier.deserialize(sigDto.get(i));
            } catch (DeserializationException e) {
                throw e.prepend("signature." + i);
            }
        }
        return new RelationApp(name, TypedVar.fromNamesAndTypes(args, Arrays.asList(types)));
    }
public static RelationApp deserialize ( JSONObject relAppDto ) throws DeserializationException { String name = JsonUtils . getString ( relAppDto , "name" ) ; JSONArray sigDto = JsonUtils . getArray ( relAppDto , "signature" ) ; List < String > args = JsonUtils . getStrings ( relAppDto , "arguments" ) ; if ( sigDto . size ( ) != args . size ( ) ) { throw new DeserializationException ( String . format ( "Signature and arguments of relation application have different lengths %d != %d" , sigDto . size ( ) , args . size ( ) ) ) ; } Identifier [ ] types = new Identifier [ sigDto . size ( ) ] ; for ( int i = 0 ; i < types . length ; i ++ ) { try { types [ i ] = Identifier . deserialize ( sigDto . get ( i ) ) ; } catch ( DeserializationException e ) { throw e . prepend ( "signature." + i ) ; } } return new RelationApp ( name , TypedVar . fromNamesAndTypes ( args , Arrays . asList ( types ) ) ) ; }
Deserializes a relation application from the SemGuS JSON format.
Deserializes a relation application from the SemGuS JSON format .
// deserialize argument name and type lists // deserialize type identifiers