protected void onPostExecute(Void unused) { Dialog.dismiss(); Gson g = new Gson(); Type collection = new TypeToken<List<Users>>() {}.getType(); ls = g.fromJson(Content, collection); List<String> nameTemp = new ArrayList<>(); List<String> imageTemp = new ArrayList<>(); List<Integer> idTemp = new ArrayList<>(); for (Users u : ls) { nameTemp.add(u.getName() + "," + u.getAge()); imageTemp.add(u.getAvatar()); idTemp.add(u.getId()); } String[] names = nameTemp.toArray(new String[] {}); String[] images = imageTemp.toArray(new String[] {}); Integer[] integerArray = idTemp.toArray(new Integer[0]); int[] ids = new int[idTemp.size()]; for (int i = 0; i < idTemp.size(); i++) { ids[i] = idTemp.get(i); } Log.e(TAG, Arrays.deepToString(names)); Log.e(TAG, Arrays.deepToString(images)); Log.e(TAG, ids.toString()); getDataGridView(names, images, ids); ls.clear(); }
public static void print(long timeStamp, Event[] inEvents, Event[] removeEvents) { StringBuilder sb = new StringBuilder(); sb.append("Events{ @timestamp = ") .append(timeStamp) .append(", inEvents = ") .append(Arrays.deepToString(inEvents)) .append(", RemoveEvents = ") .append(Arrays.deepToString(removeEvents)) .append(" }"); System.out.println(sb.toString()); }
private void flushBuffer() throws SQLException { if (rowBuffer.size() == 0) return; // flatten rows into a single params list Object[] queryParams = new Object[rowBuffer.size() * fieldNames.length]; int i = 0; for (Object[] row : rowBuffer) for (Object value : row) queryParams[i++] = value; setQueryRowCount(rowBuffer.size()); try { SQLUtils.setPreparedStatementParams(stmt, queryParams); stmt.execute(); } catch (SQLException e) { try { conn.rollback(); } catch (SQLException ex) { } try { finalize(); } catch (Throwable thrown) { } stmt = null; conn = null; System.err.println("Failed to insert values: " + Arrays.deepToString(rowBuffer.toArray())); e = new SQLExceptionWithQuery(baseQuery + "(...)", e); throw e; } finally { rowBuffer.removeAllElements(); } }
public static String prettyPrintSequenceRecords(SAMSequenceDictionary sequenceDictionary) { String[] sequenceRecordNames = new String[sequenceDictionary.size()]; int sequenceRecordIndex = 0; for (SAMSequenceRecord sequenceRecord : sequenceDictionary.getSequences()) sequenceRecordNames[sequenceRecordIndex++] = sequenceRecord.getSequenceName(); return Arrays.deepToString(sequenceRecordNames); }
/** * Produce the deep string value of an array, whatever the actual class type of the array is. * * @param array the array to get the deep string value of. * @return the deep string value of the array, or null if invalid. */ public static String arrayDeepToString(Object array) { if (array == null) { return null; } Class<?> clazz = array.getClass(); if (!clazz.isArray()) { return null; } if (clazz == boolean[].class) { return Arrays.toString((boolean[]) array); } if (clazz == byte[].class) { return Arrays.toString((byte[]) array); } if (clazz == short[].class) { return Arrays.toString((short[]) array); } if (clazz == char[].class) { return Arrays.toString((char[]) array); } if (clazz == int[].class) { return Arrays.toString((int[]) array); } if (clazz == long[].class) { return Arrays.toString((long[]) array); } if (clazz == float[].class) { return Arrays.toString((float[]) array); } if (clazz == double[].class) { return Arrays.toString((double[]) array); } return Arrays.deepToString((Object[]) array); }
public Container buildContainer(String containerClass) { notNull( containerClass, "Container type " + Arrays.deepToString(Server.values()) + " or container class"); Class<Container> clazz = null; for (Server container : Server.values()) { if (container.name().equalsIgnoreCase(containerClass)) { clazz = loadServerClass(container.serverClass()); break; } } if (clazz == null) clazz = loadServerClass(containerClass); try { return clazz .getConstructor(ContainerConfiguration.class) .newInstance(ContainerConfiguration.from(this)); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof RuntimeException) throw (RuntimeException) e.getTargetException(); else throw new RuntimeException(e.getTargetException().getMessage(), e.getTargetException()); } catch (Exception e) { throw new IllegalArgumentException( "Cannot instanciate class [" + clazz + "]. Ensure there is a public constructor having a parameter of type " + ContainerConfiguration.class.getName(), e); } }
public void testJarFile_Signed_InvalidChain_Check() throws Exception { Certificate[] certs = getSignedJarCerts(INVALID_CHAIN_JAR, true); assertNotNull(certs); assertEquals(Arrays.deepToString(certs), 2, certs.length); assertEquals("CN=fake-chain", ((X509Certificate) certs[0]).getSubjectDN().toString()); assertEquals("CN=intermediate1", ((X509Certificate) certs[1]).getSubjectDN().toString()); }
protected void process(String test, String[] ar, int numPasswords, int passLength) { System.out.println( ManagementFactory.getRuntimeMXBean().getName() + " --> " + Thread.currentThread().getName() + " FLAGS: " + test + " --> " + Arrays.deepToString(ar) + " -> " + passLength); List<String> passwords = PwGenerator.process(ar); Assert.assertEquals(passwords.size(), numPasswords); assertLengthCount(test, passLength, numPasswords, passwords); System.out.println( ManagementFactory.getRuntimeMXBean().getName() + " --> " + Thread.currentThread().getName() + " #############################"); }
@Override public void appendXML(Element elmnt) { if (stats != null) { final Element iwr = new Element("workflowElementResult"); iwr.setAttribute("class", getClass().getCanonicalName()); iwr.setAttribute("slot", getWorkflowSlot().name()); iwr.setAttribute("generator", getWorkflowElement().getClass().getCanonicalName()); final Element resources = new Element("statistics"); for (String key : stats.keySet()) { final Element res = new Element("item"); res.setAttribute("name", key); String value = ""; if (stats.get(key).getClass().isArray()) { value = Arrays.deepToString((Object[]) stats.get(key)); } else { value = stats.get(key).toString(); } res.setAttribute("value", value); resources.addContent(res); } iwr.addContent(resources); elmnt.addContent(iwr); } }
private String arrayToString(Object obj) { if (obj.getClass().getComponentType().isPrimitive()) { if (obj instanceof boolean[]) { return Arrays.toString((boolean[]) obj); } if (obj instanceof char[]) { return Arrays.toString((char[]) obj); } if (obj instanceof short[]) { return Arrays.toString((short[]) obj); } if (obj instanceof byte[]) { return Arrays.toString((byte[]) obj); } if (obj instanceof int[]) { return Arrays.toString((int[]) obj); } if (obj instanceof long[]) { return Arrays.toString((long[]) obj); } if (obj instanceof float[]) { return Arrays.toString((float[]) obj); } if (obj instanceof double[]) { return Arrays.toString((double[]) obj); } } return Arrays.deepToString((Object[]) obj); }
/** * run command on the given file * * @param dataPath the path to the jp2 file * @return the path to the converted file * @throws java.io.IOException if the execution of the tool failed in some fashion */ protected File convert(String dataPath) throws IOException { File resultPath = getConvertedPath(dataPath); String[] commandLine = makeCommandLine(dataPath, getCommandPath(), resultPath); ProcessRunner runner = new ProcessRunner(commandLine); log.debug("Running command '" + Arrays.deepToString(commandLine) + "'"); Map<String, String> myEnv = new HashMap<String, String>(System.getenv()); runner.setEnviroment(myEnv); runner.setOutputCollectionByteSize(Integer.MAX_VALUE); // this call is blocking runner.run(); if (runner.getReturnCode() == 0) { return resultPath; } else { String message = "failed to run, returncode:" + runner.getReturnCode() + ", stdOut:" + runner.getProcessOutputAsString() + " stdErr:" + runner.getProcessErrorAsString(); throw new IOException(message); } }
private <T> T createComponent(Constructor<T> ctor, Object[] args, StringBuilder descr) { try { final T instance = ctor.newInstance(args); /* if (descr.length() > 0) { descr.append(","); } */ descr.append("\n "); descr.append(ctor.getDeclaringClass().getName()); String params = Arrays.deepToString(args); params = params.substring(1, params.length() - 1); descr.append("(").append(params).append(")"); return instance; } catch (InvocationTargetException ite) { final Throwable cause = ite.getCause(); if (cause instanceof IllegalArgumentException || cause instanceof UnsupportedOperationException) { // thats ok, ignore if (VERBOSE) { System.err.println("Ignoring IAE/UOE from ctor:"); cause.printStackTrace(System.err); } } else { Rethrow.rethrow(cause); } } catch (IllegalAccessException iae) { Rethrow.rethrow(iae); } catch (InstantiationException ie) { Rethrow.rethrow(ie); } return null; // no success }
public void before(Thread t, String className, String methodName, Object[] args) { prn(""); prn("--- before ----------->"); prn(" (" + t + ") " + className + "." + methodName + " " + Arrays.deepToString(args)); prn("---------------------->"); prn(""); }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{firstBound=").append(firstBound()); sb.append(", interfaceBounds=").append(Arrays.deepToString(interfaceBounds())); sb.append('}'); return sb.toString(); }
@VisibleForTesting String[] getRemoveCommand(URI uri) { String[] argsArray = Stream.concat(Stream.of(command, "remove", "-uri=" + uri), options.stream()) .toArray(String[]::new); LOGGER.debug("COMMAND: {}", Arrays.deepToString(argsArray)); return argsArray; }
/** * Set the kind of UI presentation requested for this choice, e.g. select vs. suggest. Value must * match one of the PRESENTATIONS. * * @param value pre-determined metadata field key */ public void setChoicesPresentation(String value) throws WingException { restrict( value, PRESENTATIONS, "The 'presentation' parameter must be one of these values: " + Arrays.deepToString(PRESENTATIONS)); this.presentation = value; }
@Override public String toString() { return "OperatorCheckpointStats{" + "checkpointId=" + getCheckpointId() + ", subTaskStats=" + Arrays.deepToString(subTaskStats) + '}'; }
public static void main(String[] args) { int[][] matriz = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}; System.out.println("Volcado normal con toString"); System.out.println(matriz.toString()); System.out.println("Volcado mediante un deepToString"); System.out.println(Arrays.deepToString(matriz)); }
@Override public void d(Object object) { String message; if (object.getClass().isArray()) { message = Arrays.deepToString((Object[]) object); } else { message = object.toString(); } log(DEBUG, null, message); }
@Override public void receive(String streamId, long timestamp, Object[] event) { log.info( "Event count:" + eventCount.incrementAndGet() + ", Stream ID: " + streamId + ", Event: " + Arrays.deepToString(event)); }
/** * Formats a given argument for logging. This method is intended to handle arrays as theses would * otherwise be logged as something like "[Ljava.lang.String;@62a98a". * * @param arg the argument to be formatted * @return a string containing the formatted argument. */ private String formatArg(Object arg) { Object argToAppend; if (arg != null && arg.getClass().isArray()) { Object[] argArray = (Object[]) arg; argToAppend = Arrays.deepToString(argArray); } else { argToAppend = arg; } return "\"" + argToAppend + "\""; }
public static void main(String[] args) { Random rand = new Random(47); // 3-D array with varied-length vectors: int[][][] a = new int[rand.nextInt(7)][][]; for (int i = 0; i < a.length; i++) { a[i] = new int[rand.nextInt(5)][]; for (int j = 0; j < a[i].length; j++) a[i][j] = new int[rand.nextInt(5)]; } System.out.println(Arrays.deepToString(a)); }
public static String toString(short serviceCode, ExpectedAnnotation... annotations) { StringBuilder builder = new StringBuilder(); builder.append('('); builder.append(serviceCode); builder.append(", "); builder.append(Arrays.deepToString(annotations)); builder.append(")"); return builder.toString(); }
public void actions(View view) { getFiveCordinates(); for (Double[] aCordinateChangeFiveLayer : cordinateChangeFiveLayer) { Log.w(TAG, (Arrays.deepToString(aCordinateChangeFiveLayer))); } steady(); sideToSide(); }
private void compare(Integer[] is, ArrayList<Integer> offsets) { for (int i = 0; i < is.length; i++) { if (!is[i].equals(offsets.get(i))) { fail( org.python.pydev.shared_core.string.StringUtils.format( "%s != %s (%s)", is[i], offsets.get(i), Arrays.deepToString(is) + " differs from " + offsets)); } } }
/** * 列出指定目录下的所有子目录 * * @param startDirPath the start dir path * @param excludeDirs the exclude dirs * @param sortType the sort type * @return file [ ] */ public static File[] listDirs(String startDirPath, String[] excludeDirs, SortType sortType) { LogUtils.debug(String.format("list dir %s", startDirPath)); ArrayList<File> dirList = new ArrayList<File>(); File startDir = new File(startDirPath); if (!startDir.isDirectory()) { return new File[0]; } File[] dirs = startDir.listFiles( new FileFilter() { public boolean accept(File f) { if (f == null) { return false; } if (f.isDirectory()) { return true; } return false; } }); if (dirs == null) { return new File[0]; } if (excludeDirs == null) { excludeDirs = new String[0]; } for (File dir : dirs) { File file = dir.getAbsoluteFile(); if (!Arrays.deepToString(excludeDirs).contains(file.getName())) { dirList.add(file); } } if (sortType.equals(SortType.BY_NAME_ASC)) { Collections.sort(dirList, new SortByName()); } else if (sortType.equals(SortType.BY_NAME_DESC)) { Collections.sort(dirList, new SortByName()); Collections.reverse(dirList); } else if (sortType.equals(SortType.BY_TIME_ASC)) { Collections.sort(dirList, new SortByTime()); } else if (sortType.equals(SortType.BY_TIME_DESC)) { Collections.sort(dirList, new SortByTime()); Collections.reverse(dirList); } else if (sortType.equals(SortType.BY_SIZE_ASC)) { Collections.sort(dirList, new SortBySize()); } else if (sortType.equals(SortType.BY_SIZE_DESC)) { Collections.sort(dirList, new SortBySize()); Collections.reverse(dirList); } else if (sortType.equals(SortType.BY_EXTENSION_ASC)) { Collections.sort(dirList, new SortByExtension()); } else if (sortType.equals(SortType.BY_EXTENSION_DESC)) { Collections.sort(dirList, new SortByExtension()); Collections.reverse(dirList); } return dirList.toArray(new File[dirList.size()]); }
public static void main(String[] args) { int[][] a = { { 1, 2, 3, }, { 4, 5, 6, }, }; System.out.println(Arrays.deepToString(a)); }
public static void applyShape( IShape shape, EntityPlayer player, ArrayList<NBTTagCompound> blockDataNbtList, byte baseRotation) { try { ArrayList<BlockData> blockDataList = new ArrayList<>(); for (NBTTagCompound compound : blockDataNbtList) { BlockData blockData = new BlockData(compound); for (int i = 0; i <= blockData.weight; i++) blockDataList.add(blockData); } int x = Helper.round(player.posX), y = Helper.round(player.posY + 1), z = Helper.round(player.posZ); Collection<PointI> points = shape .rotate(baseRotation) .rotate(baseRotation == -1 ? -1 : Helper.getHeading(player)) .move(x, y, z) .getPoints(); for (PointI p : points) { if (!shape.getReplaceableOnly() || player .worldObj .getBlock(p.getX(), p.getY(), p.getZ()) .isReplaceable(player.worldObj, p.getX(), p.getY(), p.getZ())) { BlockData block = blockDataList.size() == 1 ? blockDataList.get(0) : Helper.getRandomFromSet(blockDataList); Block block1 = Block.getBlockById(block.id); player.worldObj.setBlock(p.getX(), p.getY(), p.getZ(), block1, block.meta, 2); if (block.te != null) { TileEntity tileEntity = TileEntity.createAndLoadEntity(block.te); tileEntity.setWorldObj(player.worldObj); tileEntity.xCoord = p.getX(); tileEntity.yCoord = p.getY(); tileEntity.zCoord = p.getZ(); player.worldObj.setTileEntity(p.getX(), p.getY(), p.getZ(), tileEntity); } } } } catch (BlockData.BannedBlockException e) { ((EntityPlayerMP) player).playerNetServerHandler.kickPlayerFromServer(e.getMessage()); } catch (Exception e) { e.printStackTrace(); Pay2Spawn.getLogger().warn("Error spawning in shape."); Pay2Spawn.getLogger().warn("Shape: " + shape.toString()); Pay2Spawn.getLogger().warn("Player: " + player); Pay2Spawn.getLogger() .warn("BlockData array: " + Arrays.deepToString(blockDataNbtList.toArray())); } }
public static void main(String[] args) { String[] strs = {"123", "232", "105", "00", "3456237490"}; int[] targets = {6, 8, 5, 0, 9191}; System.out.println("The results are: "); for (int i = 0; i < strs.length; i++) { System.out.println("Expression: " + strs[i] + ", target: " + targets[i]); System.out.println( "Possible operations are: " + Arrays.deepToString(addOperators(strs[i], targets[i]).toArray())); } }
public String getColumnsValue( Uri uri, String[] index, String[] indexColumn, String targetColumn) { String where = null; if (index.length == 0 && indexColumn.length == 0) { where = null; } else { where = ""; if (index.length != indexColumn.length) { throw new IllegalArgumentException( "Missing params for Columns " + Arrays.deepToString(indexColumn) + ", You provided " + Arrays.deepToString(index)); } if (index.length == indexColumn.length) { for (int i = 0; i < indexColumn.length; i++) { where += indexColumn[i] + "='" + index[i] + "' "; if (i < (index.length - 1)) { where += " AND "; } } } } Log.i("WHERE_CLAUSE", "getColumnValue(" + where + ")"); Cursor cursor = getContext().getContentResolver().query(uri, null, where, null, null); if (cursor != null) { if (cursor.getCount() > 0) { cursor.moveToFirst(); String foundValue = cursor.getString(cursor.getColumnIndex(targetColumn)); cursor.close(); return foundValue; } } if (cursor != null && !cursor.isClosed()) { cursor.close(); } return null; }