/** * Same as above but with an exception. Also needs work. */ public void die(String what, Exception e) { if (e != null) e.printStackTrace(); die(what); }
/** * Same as above but with an exception. Also needs work. */ public void die(String what, Exception e) { if (e != null) e.printStackTrace(); die(what); }
public void unregisterMethod(String name, Object target) { RegisteredMethods meth = registerMap.get(name); if (meth == null) { die("No registered methods with the name " + name + "() were found."); } try { // Method method = o.getClass().getMethod(name, new Class[] {}); // meth.remove(o, method); meth.remove(target); } catch (Exception e) { die("Could not unregister " + name + "() for " + target, e); } }
public void unregisterMethod(String name, Object target) { synchronized (registerLock) { RegisteredMethods meth = registerMap.get(name); if (meth == null) { die("No registered methods with the name " + name + "() were found."); } try { // Method method = o.getClass().getMethod(name, new Class[] {}); // meth.remove(o, method); meth.remove(target); } catch (Exception e) { die("Could not unregister " + name + "() for " + target, e); } } }
private void registerWithArgs(String name, Object o, Class<?> cargs[]) { Class<?> c = o.getClass(); try { Method method = c.getMethod(name, cargs); synchronized (registerLock) { RegisteredMethods meth = registerMap.get(name); if (meth == null) { meth = new RegisteredMethods(); registerMap.put(name, meth); } meth.add(o, method); } } catch (NoSuchMethodException nsme) { die("There is no public " + name + "() method in the class " + o.getClass().getName()); } catch (Exception e) { die("Could not register " + name + " + () for " + o, e); } }
private void registerNoArgs(String name, Object o) { RegisteredMethods meth = registerMap.get(name); if (meth == null) { meth = new RegisteredMethods(); registerMap.put(name, meth); } Class<?> c = o.getClass(); try { Method method = c.getMethod(name, new Class[]{}); meth.add(o, method); } catch (NoSuchMethodException nsme) { die("There is no public " + name + "() method in the class " + o.getClass().getName()); } catch (Exception e) { die("Could not register " + name + " + () for " + o, e); } }
private void registerWithArgs(String name, Object o, Class<?> cargs[]) { RegisteredMethods meth = registerMap.get(name); if (meth == null) { meth = new RegisteredMethods(); registerMap.put(name, meth); } Class<?> c = o.getClass(); try { Method method = c.getMethod(name, cargs); meth.add(o, method); } catch (NoSuchMethodException nsme) { die("There is no public " + name + "() method in the class " + o.getClass().getName()); } catch (Exception e) { die("Could not register " + name + " + () for " + o, e); } }
private void registerNoArgs(String name, Object o) { Class<?> c = o.getClass(); try { Method method = c.getMethod(name); synchronized (registerLock) { RegisteredMethods meth = registerMap.get(name); if (meth == null) { meth = new RegisteredMethods(); registerMap.put(name, meth); } meth.add(o, method); } } catch (NoSuchMethodException nsme) { die("There is no public " + name + "() method in the class " + o.getClass().getName()); } catch (Exception e) { die("Could not register " + name + " + () for " + o, e); } }
public PFont loadFont(String filename) { try { InputStream input = createInput(filename); return new PFont(input); } catch (Exception e) { die("Could not load font " + filename + ". " + "Make sure that the font has been copied " + "to the data folder of your sketch.", e); } return null; }
void add(Object object, Method method) { if (findIndex(object) == -1) { if (objects == null) { objects = new Object[5]; methods = new Method[5]; } else if (count == objects.length) { objects = (Object[]) PApplet.expand(objects); methods = (Method[]) PApplet.expand(methods); } objects[count] = object; methods[count] = method; count++; } else { die(method.getName() + "() already added for this instance of " + object.getClass().getName()); } }
void add(Object object, Method method) { if (findIndex(object) == -1) { if (objects == null) { objects = new Object[5]; methods = new Method[5]; } else if (count == objects.length) { objects = (Object[]) PApplet.expand(objects); methods = (Method[]) PApplet.expand(methods); } objects[count] = object; methods[count] = method; count++; } else { die(method.getName() + "() already added for this instance of " + object.getClass().getName()); } }
die("Could not load font " + filename + ". " + "Make sure that the font has been copied " + "to the data folder of your sketch.", e);