public static Matrix fromURL(String url, Object... parameters) throws Exception { if (parameters.length < 2) { throw new RuntimeException("this methods needs additional parameters: user, password, [foldername]"); } String user = StringUtil.convert(parameters[0]); String password = StringUtil.convert(parameters[1]); String foldername = "INBOX"; if (parameters.length > 2) { foldername = StringUtil.convert(parameters[2]); } return new MessagesMatrix(url, user, password, foldername); }
public Map<String, Object> calculateObjects(Map<String, Object> input) { try { Map<String, Object> result = new HashMap<String, Object>(); String command = StringUtil.convert(input.get(SOURCE)); Process p = Runtime.getRuntime().exec(command); int ret = p.waitFor(); result.put(TARGET, ret); return result; } catch (Exception e) { throw new RuntimeException(e); } } }
public Sample get(Object key) { try { return index.getSample(StringUtil.convert(key)); } catch (Exception e) { e.printStackTrace(); return null; } }
public String getAsString(Object key) { return StringUtil.convert(get(key)); }
public String getAsString(long... coordinates) { return StringUtil.convert(getAsObject(coordinates)); }
public String getString(long... coordinates) { return StringUtil.convert(getObject(coordinates)); }
public String getAsString(Object key) { return StringUtil.convert(get(key)); }
public String getAsString(long... coordinates) { return StringUtil.convert(getObject(coordinates)); }
public final String getAsString(String variableKey) { return StringUtil.convert(getObject(variableKey)); }
public final String getAsString(String variableKey) { return StringUtil.convert(getObject(variableKey)); }
public String getAllAsString(String variableKey) { return StringUtil.convert(map.get(variableKey)); }
public static Matrix fromURL(String url, Object... parameters) throws Exception { if (parameters.length < 2) { throw new RuntimeException("this methods needs additional parameters: user, password, [foldername]"); } String user = StringUtil.convert(parameters[0]); String password = StringUtil.convert(parameters[1]); String foldername = "INBOX"; if (parameters.length > 2) { foldername = StringUtil.convert(parameters[2]); } ImapUtil util = new ImapUtil(url, user, password); Matrix m = util.getSubFolders(foldername); util.close(); return m; }
public Map<String, Object> calculateObjects(Map<String, Object> input) { Map<String, Object> result = new HashMap<String, Object>(); String in = StringUtil.convert(input.get(SOURCE)); String ret = null; if (in == null || "".equals(in)) { ret = java.lang.System.getProperty("user.home"); java.lang.System.setProperty("user.dir", ret); } else if (in.startsWith(".")) { String dir = java.lang.System.getProperty("user.dir") + File.separator + in; File file = new File(dir); ret = file.getAbsolutePath(); java.lang.System.setProperty("user.dir", ret); } else { File file = new File(in); ret = file.getAbsolutePath(); java.lang.System.setProperty("user.dir", ret); } result.put(TARGET, ret); return result; }
public final String getRowLabel(long row) { if (getDimensionCount() != 2) { throw new RuntimeException("This function is only supported for 2D matrices"); } return StringUtil.convert(getDimensionMetaData(COLUMN, new long[] { row, 0 })); }
public final String getColumnLabel(long col) { if (getDimensionCount() != 2) { throw new RuntimeException("This function is only supported for 2D matrices"); } return StringUtil.convert(getDimensionMetaData(ROW, new long[] { 0, col })); }
public static final JackcessDenseObjectMatrix2D toFile(File file, Object... parameters) throws IOException { Database db = DatabaseBuilder.open(file); Set<String> tables = db.getTableNames(); String tablename = null; if (parameters.length != 0) { tablename = StringUtil.convert(parameters[0]); } if (tablename == null) { if (tables.size() == 1) { tablename = db.getTableNames().iterator().next(); } } db.close(); if (tablename == null) { throw new IllegalArgumentException( "please append the table name, i.e. one of these tables: " + tables); } return new JackcessDenseObjectMatrix2D(file, tablename); }
private Object convertObject(Object m, Class<?> c) { if (c == Matrix.class) { return MathUtil.getMatrix(m); } else if (c == Object.class) { return m; } else if (c == Integer.TYPE) { return MathUtil.getInt(m); } else if (c == Double.TYPE) { return MathUtil.getDouble(m); } else if (c == Long.TYPE) { return MathUtil.getLong(m); } else if (c == Boolean.TYPE) { return MathUtil.getBoolean(m); } else if (c == String.class) { return StringUtil.convert(m); } else if (c == ListDataSet.class) { return m; } RuntimeException e = new RuntimeException("cannot convert to desired object type " + c.getSimpleName()); result = new Result(e); throw e; }
public URLDiv(Sample sample, String... highlightedWords) { setParameter("class", "url"); String url = StringUtil.convert(sample.getAsMatrix(Sample.URL)); if (url != null && url.length() > 0) { LinkTag link = new LinkTag(url, new EmphasizedText(url, highlightedWords)); link.setParameter("class", "url"); link.setParameter("title", "go to " + url); SpanTag urlTag = new SpanTag(link); urlTag.setParameter("class", "url"); add(urlTag); } }
setParameter("class", "sample"); String label = sample.getLabel(); String type = StringUtil.convert(sample.getAsMatrix("Type")); String id = sample.getId(); path = path + "samples/" + id + "/";