Tabnine Logo
PApplet.split
Code IndexAdd Tabnine to your IDE (free)

How to use
split
method
in
processing.core.PApplet

Best Java code snippets using processing.core.PApplet.split (Showing top 20 results out of 315)

origin: ajavamind/Processing-Cardboard

/**
 * Parse a polyline or polygon from an SVG file.
 * @param close true if shape is closed (polygon), false if not (polyline)
 */
protected void parsePoly(boolean close) {
 family = PATH;
 this.close = close;
 String pointsAttr = element.getString("points");
 if (pointsAttr != null) {
  String[] pointsBuffer = PApplet.splitTokens(pointsAttr);
  vertexCount = pointsBuffer.length;
  vertices = new float[vertexCount][2];
  for (int i = 0; i < vertexCount; i++) {
   String pb[] = PApplet.split(pointsBuffer[i], ',');
   vertices[i][X] = Float.valueOf(pb[0]).floatValue();
   vertices[i][Y] = Float.valueOf(pb[1]).floatValue();
  }
 }
}
origin: ajavamind/Processing-Cardboard

/**
 * Read a set of entries from a Reader that has each key/value pair on
 * a single line, separated by a tab.
 *
 * @nowebref
 */
public StringDict(BufferedReader reader) {
 String[] lines = PApplet.loadStrings(reader);
 keys = new String[lines.length];
 values = new String[lines.length];
 for (int i = 0; i < lines.length; i++) {
  String[] pieces = PApplet.split(lines[i], '\t');
  if (pieces.length == 2) {
   keys[count] = pieces[0];
   values[count] = pieces[1];
   count++;
  }
 }
}
origin: org.processing/core

/**
 * Read a set of entries from a Reader that has each key/value pair on
 * a single line, separated by a tab.
 *
 * @nowebref
 */
public StringDict(BufferedReader reader) {
 String[] lines = PApplet.loadStrings(reader);
 keys = new String[lines.length];
 values = new String[lines.length];
 for (int i = 0; i < lines.length; i++) {
  String[] pieces = PApplet.split(lines[i], '\t');
  if (pieces.length == 2) {
   keys[count] = pieces[0];
   values[count] = pieces[1];
   indices.put(keys[count], count);
   count++;
  }
 }
}
origin: Calsign/APDE

static public String[] packageListFromClassPath(String path, Context context) {
  Hashtable<String, Object> table = new Hashtable<String, Object>();
  String pieces[] = PApplet.split(path, File.pathSeparatorChar);
  
  for(int i = 0; i < pieces.length; i++) {
    if(pieces[i].length() == 0) continue;
    
    if(pieces[i].toLowerCase(Locale.US).endsWith(".jar") || pieces[i].toLowerCase(Locale.US).endsWith(".zip"))
      packageListFromZip(pieces[i], table, context);
    else {  // it's another type of file or directory
      File dir = new File(pieces[i]);
      if(dir.exists() && dir.isDirectory())
        packageListFromFolder(dir, null, table);
    }
  }
  int tableCount = table.size();
  String output[] = new String[tableCount];
  int index = 0;
  Enumeration<String> e = table.keys();
  while(e.hasMoreElements())
    output[index++] = (e.nextElement()).replace('/', '.');
  
  return output;
}

origin: org.processing/core

public boolean write(PrintWriter output, String options) {
 int indentFactor = 2;
 if (options != null) {
  String[] opts = PApplet.split(options, ',');
  for (String opt : opts) {
   if (opt.equals("compact")) {
    indentFactor = -1;
   } else if (opt.startsWith("indent=")) {
    indentFactor = PApplet.parseInt(opt.substring(7), -2);
    if (indentFactor == -2) {
     throw new IllegalArgumentException("Could not read a number from " + opt);
    }
   } else {
    System.err.println("Ignoring " + opt);
   }
  }
 }
 output.print(format(indentFactor));
 output.flush();
 return true;
}
origin: org.processing/core

public boolean write(PrintWriter output, String options) {
 int indentFactor = 2;
 if (options != null) {
  String[] opts = PApplet.split(options, ',');
  for (String opt : opts) {
   if (opt.equals("compact")) {
    indentFactor = -1;
   } else if (opt.startsWith("indent=")) {
    indentFactor = PApplet.parseInt(opt.substring(7), -2);
    if (indentFactor == -2) {
     throw new IllegalArgumentException("Could not read a number from " + opt);
    }
   } else {
    System.err.println("Ignoring " + opt);
   }
  }
 }
 output.print(format(indentFactor));
 output.flush();
 return true;
}
origin: org.processing/core

 extensions = new String[] { opt.substring(10) };
} else if (opt.startsWith("extensions=")) {
 extensions = split(opt.substring(10), ',');
} else if (opt.equals("files")) {
 directories = false;
origin: org.processing/core

/**
 * Read a set of entries from a Reader that has each key/value pair on
 * a single line, separated by a tab.
 *
 * @nowebref
 */
public FloatDict(BufferedReader reader) {
 String[] lines = PApplet.loadStrings(reader);
 keys = new String[lines.length];
 values = new float[lines.length];
 for (int i = 0; i < lines.length; i++) {
  String[] pieces = PApplet.split(lines[i], '\t');
  if (pieces.length == 2) {
   keys[count] = pieces[0];
   values[count] = PApplet.parseFloat(pieces[1]);
   indices.put(pieces[0], count);
   count++;
  }
 }
}
origin: org.processing/core

/**
 * Read a set of entries from a Reader that has each key/value pair on
 * a single line, separated by a tab.
 *
 * @nowebref
 */
public IntDict(BufferedReader reader) {
 String[] lines = PApplet.loadStrings(reader);
 keys = new String[lines.length];
 values = new int[lines.length];
 for (int i = 0; i < lines.length; i++) {
  String[] pieces = PApplet.split(lines[i], '\t');
  if (pieces.length == 2) {
   keys[count] = pieces[0];
   values[count] = PApplet.parseInt(pieces[1]);
   indices.put(pieces[0], count);
   count++;
  }
 }
}
origin: org.processing/core

/**
 * Get a child by its name or path.
 *
 * @param name element name or path/to/element
 * @return the first matching element or null if no match
 */
public XML getChild(String name) {
 if (name.length() > 0 && name.charAt(0) == '/') {
  throw new IllegalArgumentException("getChild() should not begin with a slash");
 }
 if (name.indexOf('/') != -1) {
  return getChildRecursive(PApplet.split(name, '/'), 0);
 }
 int childCount = getChildCount();
 for (int i = 0; i < childCount; i++) {
  XML kid = getChild(i);
  String kidName = kid.getName();
  if (kidName != null && kidName.equals(name)) {
   return kid;
  }
 }
 return null;
}
origin: org.processing/core

class AsyncImageLoader extends Thread {
 String filename;
 String extension;
 PImage vessel;
 public AsyncImageLoader(String filename, String extension, PImage vessel) {
  // Give these threads distinct name so we can check whether we are loading
  // on the main/background thread; for now they are all named the same
  super(ASYNC_IMAGE_LOADER_THREAD_PREFIX);
  this.filename = filename;
  this.extension = extension;
  this.vessel = vessel;
 }
 @Override
 public void run() {
  while (requestImageCount == requestImageMax) {
   try {
    Thread.sleep(10);
   } catch (InterruptedException e) { }
  }
  requestImageCount++;
  PImage actual = loadImage(filename, extension);
  // An error message should have already printed
  if (actual == null) {
   vessel.width = -1;
   vessel.height = -1;
origin: ajavamind/Processing-Cardboard

/**
 * Get a child by its name or path.
 *
 * @param name element name or path/to/element
 * @return the first matching element
 */
public XML getChild(String name) {
 if (name.length() > 0 && name.charAt(0) == '/') {
  throw new IllegalArgumentException("getChild() should not begin with a slash");
 }
 if (name.indexOf('/') != -1) {
  return getChildRecursive(PApplet.split(name, '/'), 0);
 }
 int childCount = getChildCount();
 for (int i = 0; i < childCount; i++) {
  XML kid = getChild(i);
  String kidName = kid.getName();
  if (kidName != null && kidName.equals(name)) {
   return kid;
  }
 }
 return null;
}
origin: ajavamind/Processing-Cardboard

 /**
  * Read a set of entries from a Reader that has each key/value pair on
  * a single line, separated by a tab.
  *
  * @nowebref
  */
 public IntDict(BufferedReader reader) {
//  public IntHash(PApplet parent, String filename) {
  String[] lines = PApplet.loadStrings(reader);
  keys = new String[lines.length];
  values = new int[lines.length];

//    boolean csv = (lines[0].indexOf('\t') == -1);
  for (int i = 0; i < lines.length; i++) {
//      String[] pieces = csv ? Table.splitLineCSV(lines[i]) : PApplet.split(lines[i], '\t');
   String[] pieces = PApplet.split(lines[i], '\t');
   if (pieces.length == 2) {
    keys[count] = pieces[0];
    values[count] = PApplet.parseInt(pieces[1]);
    count++;
   }
  }
 }

origin: ajavamind/Processing-Cardboard

 /**
  * Read a set of entries from a Reader that has each key/value pair on
  * a single line, separated by a tab.
  *
  * @nowebref
  */
 public FloatDict(BufferedReader reader) {
//  public FloatHash(PApplet parent, String filename) {
  String[] lines = PApplet.loadStrings(reader);
  keys = new String[lines.length];
  values = new float[lines.length];

//    boolean csv = (lines[0].indexOf('\t') == -1);
  for (int i = 0; i < lines.length; i++) {
//      String[] pieces = csv ? Table.splitLineCSV(lines[i]) : PApplet.split(lines[i], '\t');
   String[] pieces = PApplet.split(lines[i], '\t');
   if (pieces.length == 2) {
    keys[count] = pieces[0];
    values[count] = PApplet.parseFloat(pieces[1]);
    count++;
   }
  }
 }

origin: org.processing/core

return getChildrenRecursive(PApplet.split(name, '/'), 0);
origin: ajavamind/Processing-Cardboard

return getChildrenRecursive(PApplet.split(name, '/'), 0);
origin: org.processing/core

String[] opts = PApplet.trim(PApplet.split(options, ','));
origin: ajavamind/Processing-Cardboard

 setColumnTitles(tsv ? PApplet.split(line, '\t') : splitLineCSV(line));
 header = false;
} else {
 setRow(row, tsv ? PApplet.split(line, '\t') : splitLineCSV(line));
 row++;
origin: org.processing/core

 setColumnTitles(tsv ? PApplet.split(line, '\t') : splitLineCSV(line, reader));
 header = false;
} else {
 setRow(row, tsv ? PApplet.split(line, '\t') : splitLineCSV(line, reader));
 row++;
origin: org.processing/core

try {
 String optionStr = Table.extensionOptions(true, filename, options);
 String[] optionList = trim(split(optionStr, ','));
processing.corePAppletsplit

Javadoc

Split a string into pieces along a specific character. Most commonly used to break up a String along a space or a tab character.

This operates differently than the others, where the single delimeter is the only breaking point, and consecutive delimeters will produce an empty string (""). This way, one can split on tab characters, but maintain the column alignments (of say an excel file) where there are empty columns.

Popular methods of PApplet

  • constrain
  • createGraphics
    Create an offscreen graphics surface for drawing, in this case for a renderer that writes to a file
  • loadStrings
    ( begin auto-generated from loadStrings.xml ) Reads the contents of a file or url and creates a Stri
  • saveStrings
    ( begin auto-generated from saveStrings.xml ) Writes an array of strings to a file, one line per str
  • abs
  • createImage
    ( begin auto-generated from createImage.xml ) Creates a new PImage (the datatype for storing images)
  • createShape
  • createWriter
    ( begin auto-generated from createWriter.xml ) Creates a new file in the sketch folder, and a PrintW
  • loadImage
  • main
    main() method for running this class from the command line. Usage: PApplet [options] [s
  • max
  • parseInt
  • max,
  • parseInt,
  • random,
  • round,
  • sqrt,
  • unhex,
  • arrayCopy,
  • ceil,
  • checkExtension

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • startActivity (Activity)
  • getSystemService (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Runner (org.openjdk.jmh.runner)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now