/** * Join an array of Strings together as a single String, * separated by the whatever's passed in for the separator. */ static public String join(String str[], char separator) { return join(str, String.valueOf(separator)); }
/** * ( begin auto-generated from join.xml ) * * Combines an array of Strings into one String, each separated by the * character(s) used for the <b>separator</b> parameter. To join arrays of * ints or floats, it's necessary to first convert them to strings using * <b>nf()</b> or <b>nfs()</b>. * * ( end auto-generated ) * @webref data:string_functions * @param list array of Strings * @param separator char or String to be placed between each item * @see PApplet#split(String, String) * @see PApplet#trim(String) * @see PApplet#nf(float, int, int) * @see PApplet#nfs(float, int, int) */ static public String join(String[] list, char separator) { return join(list, String.valueOf(separator)); }
static public Process exec(String[] argv) { try { return Runtime.getRuntime().exec(argv); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Could not open " + join(argv, ' ')); } }
/** * Pass a set of arguments directly to the command line. Uses Java's * <A HREF="https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#exec-java.lang.String:A-">Runtime.exec()</A> * method. This is different from the <A HREF="https://processing.org/reference/launch_.html">launch()</A> * method, which uses the operating system's launcher to open the files. * It's always a good idea to use a full path to the executable here. * <pre> * exec("/usr/bin/say", "welcome to the command line"); * </pre> * Or if you want to wait until it's completed, something like this: * <pre> * Process p = exec("/usr/bin/say", "waiting until done"); * try { * int result = p.waitFor(); * println("the process returned " + result); * } catch (InterruptedException e) { } * </pre> * You can also get the system output and error streams from the Process * object, but that's more that we'd like to cover here. * @return a <A HREF="https://docs.oracle.com/javase/8/docs/api/java/lang/Process.html">Process</A> object */ static public Process exec(String... args) { try { return Runtime.getRuntime().exec(args); } catch (Exception e) { throw new RuntimeException("Could not open " + join(args, ' '), e); } }
protected void convertRow(DataOutputStream output, String[] pieces) throws IOException { if (pieces.length > getColumnCount()) { throw new IllegalArgumentException("Row with too many columns: " + PApplet.join(pieces, ","));
protected void convertRow(DataOutputStream output, String[] pieces) throws IOException { if (pieces.length > getColumnCount()) { throw new IllegalArgumentException("Row with too many columns: " + PApplet.join(pieces, ","));
String singleLine = PApplet.join(PApplet.trim(tempLines), ""); if (indent == -1) { return singleLine;
String singleLine = PApplet.join(PApplet.trim(tempLines), ""); if (indent == -1) { return singleLine;
/** * @param shaderSource a string containing the shader's code */ protected boolean compileFragmentShader() { pgl.shaderSource(glFragment, PApplet.join(fragmentShaderSource, "\n")); pgl.compileShader(glFragment); pgl.getShaderiv(glFragment, PGL.COMPILE_STATUS, intBuffer); boolean compiled = intBuffer.get(0) == 0 ? false : true; if (!compiled) { PGraphics.showException("Cannot compile fragment shader:\n" + pgl.getShaderInfoLog(glFragment)); return false; } else { return true; } }
/** * @param shaderSource a string containing the shader's code */ protected boolean compileVertexShader() { pgl.shaderSource(glVertex, PApplet.join(vertexShaderSource, "\n")); pgl.compileShader(glVertex); pgl.getShaderiv(glVertex, PGL.COMPILE_STATUS, intBuffer); boolean compiled = intBuffer.get(0) == 0 ? false : true; if (!compiled) { PGraphics.showException("Cannot compile vertex shader:\n" + pgl.getShaderInfoLog(glVertex)); return false; } else { return true; } }
/** * @param shaderSource a string containing the shader's code */ protected boolean compileVertexShader() { pgl.shaderSource(glVertex, PApplet.join(vertexShaderSource, "\n")); pgl.compileShader(glVertex); pgl.getShaderiv(glVertex, PGL.COMPILE_STATUS, intBuffer); boolean compiled = intBuffer.get(0) == 0 ? false : true; if (!compiled) { PGraphics.showException("Cannot compile vertex shader:\n" + pgl.getShaderInfoLog(glVertex)); return false; } else { return true; } }
/** * @param shaderSource a string containing the shader's code */ protected boolean compileFragmentShader() { pgl.shaderSource(glFragment, PApplet.join(fragmentShaderSource, "\n")); pgl.compileShader(glFragment); pgl.getShaderiv(glFragment, PGL.COMPILE_STATUS, intBuffer); boolean compiled = intBuffer.get(0) == 0 ? false : true; if (!compiled) { PGraphics.showException("Cannot compile fragment shader:\n" + pgl.getShaderInfoLog(glFragment)); return false; } else { return true; } }
protected PGL initTexRectShader() { PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL(); if (!ppgl.loadedTexRectShader || ppgl.texRectShaderContext != ppgl.glContext) { String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion()); String vertSource = PApplet.join(preprocVertSrc, "\n"); String[] preprocFragSrc = preprocessFragmentSource(texRectFragShaderSource, getGLSLVersion()); String fragSource = PApplet.join(preprocFragSrc, "\n"); ppgl.texRectVertShader = createShader(VERTEX_SHADER, vertSource); ppgl.texRectFragShader = createShader(FRAGMENT_SHADER, fragSource); if (0 < ppgl.texRectVertShader && 0 < ppgl.texRectFragShader) { ppgl.texRectShaderProgram = createProgram(ppgl.texRectVertShader, ppgl.texRectFragShader); } if (0 < ppgl.texRectShaderProgram) { ppgl.texRectVertLoc = getAttribLocation(ppgl.texRectShaderProgram, "position"); ppgl.texRectTCoordLoc = getAttribLocation(ppgl.texRectShaderProgram, "texCoord"); ppgl.texRectSamplerLoc = getUniformLocation(ppgl.texRectShaderProgram, "texMap"); } ppgl.loadedTexRectShader = true; ppgl.texRectShaderContext = ppgl.glContext; genBuffers(1, intBuffer); ppgl.texRectGeoVBO = intBuffer.get(0); bindBuffer(ARRAY_BUFFER, ppgl.texRectGeoVBO); bufferData(ARRAY_BUFFER, 16 * SIZEOF_FLOAT, null, STATIC_DRAW); } return ppgl; }
protected PGL initTexRectShader() { PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL(); if (!ppgl.loadedTexRectShader || ppgl.texRectShaderContext != ppgl.glContext) { String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion()); String vertSource = PApplet.join(preprocVertSrc, "\n"); String[] preprocFragSrc = preprocessFragmentSource(texRectFragShaderSource, getGLSLVersion()); String fragSource = PApplet.join(preprocFragSrc, "\n"); ppgl.texRectVertShader = createShader(VERTEX_SHADER, vertSource); ppgl.texRectFragShader = createShader(FRAGMENT_SHADER, fragSource); if (0 < ppgl.texRectVertShader && 0 < ppgl.texRectFragShader) { ppgl.texRectShaderProgram = createProgram(ppgl.texRectVertShader, ppgl.texRectFragShader); } if (0 < ppgl.texRectShaderProgram) { ppgl.texRectVertLoc = getAttribLocation(ppgl.texRectShaderProgram, "position"); ppgl.texRectTCoordLoc = getAttribLocation(ppgl.texRectShaderProgram, "texCoord"); ppgl.texRectSamplerLoc = getUniformLocation(ppgl.texRectShaderProgram, "texMap"); } ppgl.loadedTexRectShader = true; ppgl.texRectShaderContext = ppgl.glContext; genBuffers(1, intBuffer); ppgl.texRectGeoVBO = intBuffer.get(0); bindBuffer(ARRAY_BUFFER, ppgl.texRectGeoVBO); bufferData(ARRAY_BUFFER, 16 * SIZEOF_FLOAT, null, STATIC_DRAW); } return ppgl; }
protected PGL initTex2DShader() { PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL(); if (!ppgl.loadedTex2DShader || ppgl.tex2DShaderContext != ppgl.glContext) { String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion()); String vertSource = PApplet.join(preprocVertSrc, "\n"); String[] preprocFragSrc = preprocessFragmentSource(tex2DFragShaderSource, getGLSLVersion()); String fragSource = PApplet.join(preprocFragSrc, "\n"); ppgl.tex2DVertShader = createShader(VERTEX_SHADER, vertSource); ppgl.tex2DFragShader = createShader(FRAGMENT_SHADER, fragSource); if (0 < ppgl.tex2DVertShader && 0 < ppgl.tex2DFragShader) { ppgl.tex2DShaderProgram = createProgram(ppgl.tex2DVertShader, ppgl.tex2DFragShader); } if (0 < ppgl.tex2DShaderProgram) { ppgl.tex2DVertLoc = getAttribLocation(ppgl.tex2DShaderProgram, "position"); ppgl.tex2DTCoordLoc = getAttribLocation(ppgl.tex2DShaderProgram, "texCoord"); ppgl.tex2DSamplerLoc = getUniformLocation(ppgl.tex2DShaderProgram, "texMap"); } ppgl.loadedTex2DShader = true; ppgl.tex2DShaderContext = ppgl.glContext; genBuffers(1, intBuffer); ppgl.tex2DGeoVBO = intBuffer.get(0); bindBuffer(ARRAY_BUFFER, ppgl.tex2DGeoVBO); bufferData(ARRAY_BUFFER, 16 * SIZEOF_FLOAT, null, STATIC_DRAW); } if (texData == null) { texData = allocateDirectFloatBuffer(texCoords.length); } return ppgl; }
protected PGL initTex2DShader() { PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL(); if (!ppgl.loadedTex2DShader || ppgl.tex2DShaderContext != ppgl.glContext) { String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion()); String vertSource = PApplet.join(preprocVertSrc, "\n"); String[] preprocFragSrc = preprocessFragmentSource(tex2DFragShaderSource, getGLSLVersion()); String fragSource = PApplet.join(preprocFragSrc, "\n"); ppgl.tex2DVertShader = createShader(VERTEX_SHADER, vertSource); ppgl.tex2DFragShader = createShader(FRAGMENT_SHADER, fragSource); if (0 < ppgl.tex2DVertShader && 0 < ppgl.tex2DFragShader) { ppgl.tex2DShaderProgram = createProgram(ppgl.tex2DVertShader, ppgl.tex2DFragShader); } if (0 < ppgl.tex2DShaderProgram) { ppgl.tex2DVertLoc = getAttribLocation(ppgl.tex2DShaderProgram, "position"); ppgl.tex2DTCoordLoc = getAttribLocation(ppgl.tex2DShaderProgram, "texCoord"); ppgl.tex2DSamplerLoc = getUniformLocation(ppgl.tex2DShaderProgram, "texMap"); } ppgl.loadedTex2DShader = true; ppgl.tex2DShaderContext = ppgl.glContext; genBuffers(1, intBuffer); ppgl.tex2DGeoVBO = intBuffer.get(0); bindBuffer(ARRAY_BUFFER, ppgl.tex2DGeoVBO); bufferData(ARRAY_BUFFER, 16 * SIZEOF_FLOAT, null, STATIC_DRAW); } if (texData == null) { texData = allocateDirectFloatBuffer(texCoords.length); } return ppgl; }
public void save() { removeMissingHistoryFiles(); settings.set("data.session", PApplet.join(projectHistory, "::")); settings.set("data.folder", projectFolder); settings.set("missing.string", missingString); settings.set("missing.threshold", Project.missingToString(missingThreshold)); settings.set("binning.algorithm", BinOptimizer.algorithmToString(binAlgorithm)); settings.set("correlation.pvalue", Project.pvalueToString(pValue)); settings.set("correlation.algorithm", DependencyTest.algorithmToString(depTest)); settings.set("correlation.sorting", Project.sortingToString(sortMethod)); settings.setInteger("correlation.surrogates", surrCount); settings.setFloat("correlation.threshold", threshold); settings.setInteger("performance.samplesize", initSliceSize); settings.setInteger("performance.plottime", maxPlotTime); settings.set("dates.parse", dateParsePattern); settings.set("dates.print", datePrintPattern); settings.setBoolean("examples.copy", copyExamples); settings.setBoolean("sessions.save", saveSessions); settings.setBoolean("sessions.oscout", oscOutput); settings.set("sessions.hostname", hostName); settings.setInteger("sessions.port", portNumber); settings.setInteger("plot.width", plotWidth); settings.setInteger("plot.height", plotHeight); settings.setColor("plot.color", plotColor); settings.save(); }