Example #1
0
 public String convert(long value, int base) {
   long threshold = 1;
   for (int i = 0; i < SYMBOLS.length; i++) {
     if (value < threshold * base) return formatNumber(value, threshold, SYMBOLS[i]);
     threshold *= base;
   }
   return formatNumber(value, threshold / base, ArrayUtil.lastElementOf(SYMBOLS));
 }
 @Override
 public DataContainer<E[]> next(DataContainer<E[]> container) {
   beInitialized(container);
   if (rows.size() == 0 || columnIndex >= rows.get(0).length) return null;
   @SuppressWarnings("unchecked")
   E[] column = ArrayUtil.newInstance((Class<E>) source.getType().getComponentType(), rows.size());
   for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) {
     E[] row = rows.get(rowIndex);
     column[rowIndex] = (columnIndex < row.length ? row[columnIndex] : null);
   }
   columnIndex++;
   return container.setData(column);
 }
Example #3
0
 /**
  * @param args
  * @throws IOException
  */
 public static void main(String[] args) throws IOException {
   if (args.length < 3) {
     printHelp();
     System.exit(-1);
   }
   String schemaUri = args[0];
   String root = args[1];
   String pattern = args[2];
   long fileCount = 1;
   if (args.length >= 4) fileCount = Long.parseLong(args[3]);
   String[] propertiesFiles =
       (args.length > 4 ? ArrayUtil.copyOfRange(args, 4, args.length - 4) : new String[0]);
   createXMLFiles(schemaUri, root, pattern, fileCount, propertiesFiles);
 }