package org.simantics.db.impl.query; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; import org.simantics.utils.FileUtils; public class CodeGen { int indent = 4; class GenerationInfo { String p1; String keyName; String keyToId; String procedure; boolean useNeedsToBlock; String entryCreationArguments; GenerationInfo(String p1, String keyName, String keyToId, String p4, String procedure, String entryCreationArguments, boolean useNeedsToBlock) { this.p1 = p1; this.keyName = keyName; this.keyToId = keyToId; this.procedure = procedure; this.useNeedsToBlock = useNeedsToBlock; this.entryCreationArguments = entryCreationArguments; } } GenerationInfo signatureR1RelationInfo = new GenerationInfo ( "int r", "r", "keyR", "long", "InternalProcedure", "", false ); GenerationInfo signatureR1Bytes = new GenerationInfo ( "int r", "r", "keyR", "long", "InternalProcedure", "", false ); GenerationInfo signatureR1IntSet = new GenerationInfo ( "int r", "r", "keyR", "long", "InternalProcedure", "", false ); GenerationInfo signatureR1IP = new GenerationInfo ( "int r", "r", "keyR", "long", "IntProcedure", "", false ); GenerationInfo signatureR2IP = new GenerationInfo ( "int r1, int r2", "r1,r2", "keyR2", "long", "IntProcedure", "", false ); GenerationInfo signatureR2TIP = new GenerationInfo ( "int r1, int r2", "r1,r2", "keyR2", "long", "TripleIntProcedure", "", false ); GenerationInfo signatureID1 = new GenerationInfo ( "String id", "id", "keyID", "String", "InternalProcedure", "", false ); GenerationInfo signatureID2 = new GenerationInfo ( "String id", "id", "keyID", "String", "InternalProcedure>", "", false ); GenerationInfo signatureChildMap = new GenerationInfo ( "int r", "r", "keyR", "long", "InternalProcedure>", "", false ); GenerationInfo signatureRead = new GenerationInfo ( "Read r", "r", "id", "long", "AsyncProcedure", "", true ); GenerationInfo signatureAsyncRead = new GenerationInfo ( "AsyncRead r", "r", "id", "long", "AsyncProcedure", "", true ); GenerationInfo signatureMultiRead = new GenerationInfo ( "MultiRead r", "r", "id", "long", "SyncMultiProcedure", "", false ); GenerationInfo signatureAsyncMultiRead = new GenerationInfo ( "AsyncMultiRead r", "r", "id", "long", "AsyncMultiProcedure", "", false ); GenerationInfo signatureExternalRead = new GenerationInfo ( "ExternalRead r", "r", "id", "long", "AsyncProcedure", ", graph", false ); private void line(StringBuilder content, String line) { for(int i=0;i