/** * parse comma delimited int * @param src * @return int[] */ public static int[] parseCommaDelimitedInts(String src) { final String[] parts = parseCommaDelimitedString(src); if (parts.length == 0) return new int[0]; int[] rtr = new int[parts.length]; for(int i=0;i<parts.length;i++) rtr[i] = Integer.parseInt(parts[i]); return rtr; } /**
/** * parse comma delimited int * @param src * @param sep * @return int[] */ public static int[] parseDelimitedInts(String src, String sep) { final String[] parts = parseDelimitedString(src, sep); if (parts.length == 0) return new int[0]; int[] rtr = new int[parts.length]; for(int i=0;i<parts.length;i++) rtr[i] = Integer.parseInt(parts[i]); return rtr; }
public MemoryMetaIndex() { this( ArrayUtils.parseCommaDelimitedString(ApplicationSetup.getProperty("indexer.meta.forward.keys", "")), ArrayUtils.parseCommaDelimitedInts(ApplicationSetup.getProperty("indexer.meta.forward.keylens", "")), ArrayUtils.parseCommaDelimitedString(ApplicationSetup.getProperty("indexer.meta.reverse.keys", "")) ); }
if (! ArrayUtils.contains(meta.getReverseKeys(), metaKey)) System.err.println("Document Length: " + die.getDocumentLength()); if (die instanceof FieldDocumentIndexEntry) System.err.println("Field Lengths: " + ArrayUtils.join(((FieldDocumentIndexEntry)die).getFieldLengths(), ",")); if (die.getNumberOfEntries() > 0) System.err.println("Document Uniq Terms: " + die.getNumberOfEntries());
/** * Calls to ArrayUtils to enlarge the buffer in a specified amount, and copy the * data to a new location. * @param enlarge amount the buffer expects to grow. * @throws IOException if an I/O error occurs. */ private void enlargeBuffer(final int enlarge) throws IOException{ int preLen = buffer.length; buffer = ArrayUtils.grow(buffer, buffer.length + enlarge); avail += buffer.length - preLen; }
@Test public void testParseCommaDelimitedInt() throws Exception { assertTrue(Arrays.equals(new int[0], ArrayUtils.parseCommaDelimitedInts(""))); assertTrue(Arrays.equals(new int[0], ArrayUtils.parseCommaDelimitedInts(" "))); assertTrue(Arrays.equals(new int[]{1}, ArrayUtils.parseCommaDelimitedInts("1"))); assertTrue(Arrays.equals(new int[]{1}, ArrayUtils.parseCommaDelimitedInts(" 1"))); assertTrue(Arrays.equals(new int[]{1}, ArrayUtils.parseCommaDelimitedInts("1 "))); assertTrue(Arrays.equals(new int[]{1}, ArrayUtils.parseCommaDelimitedInts(" 1 "))); assertTrue(Arrays.equals(new int[]{1,2}, ArrayUtils.parseCommaDelimitedInts("1,2"))); assertTrue(Arrays.equals(new int[]{1,2}, ArrayUtils.parseCommaDelimitedInts("1 ,2"))); assertTrue(Arrays.equals(new int[]{1,2}, ArrayUtils.parseCommaDelimitedInts("1, 2"))); assertTrue(Arrays.equals(new int[]{1,2}, ArrayUtils.parseCommaDelimitedInts("1 , 2"))); assertTrue(Arrays.equals(new int[]{12,256}, ArrayUtils.parseCommaDelimitedInts("12,256"))); }
StringBuilder sbuffer = new StringBuilder(); String[] docnos; if (ArrayUtils.contains(results.getMetaKeys(), metaIndexDocumentKey))
final String[] metaTags = ArrayUtils.parseCommaDelimitedString(srcIndex1.getIndexProperty("index.meta.key-names", "docno")); final int[] metaTagLengths = ArrayUtils.parseCommaDelimitedInts(srcIndex1.getIndexProperty("index.meta.value-lengths", "20")); final String[] metaReverseTags = MetaReverse ? ArrayUtils.parseCommaDelimitedString(srcIndex1.getIndexProperty("index.meta.reverse-key-names", "")) : new String[0]; final MetaIndexBuilder metaBuilder = new CompressingMetaIndexBuilder(destIndex, metaTags, metaTagLengths, metaReverseTags);
if (! ArrayUtils.contains(meta.getReverseKeys(), metaKey)) System.err.println("Document Length: " + die.getDocumentLength()); if (die instanceof FieldDocumentIndexEntry) System.err.println("Field Lengths: " + ArrayUtils.join(((FieldDocumentIndexEntry)die).getFieldLengths(), ",")); if (die.getNumberOfEntries() > 0) System.err.println("Document Uniq Terms: " + die.getNumberOfEntries());
/** * Calls to ArrayUtils to enlarge the buffer in a specified amount, and copy the * data to a new location. * @param enlarge amount the buffer expects to grow. * @throws IOException if an I/O error occurs. */ private void enlargeBuffer(final int enlarge) throws IOException{ int preLen = buffer.length; buffer = ArrayUtils.grow(buffer, buffer.length + enlarge); avail += buffer.length - preLen; }
StringBuilder sbuffer = new StringBuilder(); String[] docnos; if (ArrayUtils.contains(results.getMetaKeys(), metaIndexDocumentKey))
@Override public String toString() { return "(" + id + "," + tf + ",B[" + ArrayUtils.join(positions, ",") + "])"; } }
/** * parse comma delimited int * @param src * @return int[] */ public static int[] parseCommaDelimitedInts(String src) { final String[] parts = parseCommaDelimitedString(src); if (parts.length == 0) return new int[0]; int[] rtr = new int[parts.length]; for(int i=0;i<parts.length;i++) rtr[i] = Integer.parseInt(parts[i]); return rtr; } /**
ArrayUtils.parseCommaDelimitedInts(ApplicationSetup .getProperty("indexer.meta.forward.keylens", "")), ArrayUtils.parseCommaDelimitedString(ApplicationSetup .getProperty("indexer.meta.reverse.keys", "")));
/** * parse comma delimited int * @param src * @param sep * @return int[] */ public static int[] parseDelimitedInts(String src, String sep) { final String[] parts = parseDelimitedString(src, sep); if (parts.length == 0) return new int[0]; int[] rtr = new int[parts.length]; for(int i=0;i<parts.length;i++) rtr[i] = Integer.parseInt(parts[i]); return rtr; }
/** * Checks if the buffer needs to be reallocated, and if it is the case, it calls to ArrayUtils to enlarge it and copy the * data to a new location * @throws IOException if an I/O error occurs */ private void enlargeBuffer() throws IOException { if(avail == 0){ int preLen = buffer.length; buffer = ArrayUtils.grow(buffer, buffer.length + enlargeQ); avail = buffer.length - preLen; } }
@Override public String toString() { return "(" + id + "," + tf + ",F[" + ArrayUtils.join(fieldFrequencies, ",") + "])"; } }
public static int getFieldId(Index index, String structureName, String fieldName) { if (fieldName == null) return -1; String[] fieldNames = ArrayUtils.parseCommaDelimitedString(index.getIndexProperty("index.direct.fields.names", "")); int i=-1; for(String f : fieldNames) { i++; if (f.equals(fieldName)) return i; } return -1; }
ArrayUtils.parseCommaDelimitedInts(ApplicationSetup .getProperty("indexer.meta.forward.keylens", "")), ArrayUtils.parseCommaDelimitedString(ApplicationSetup .getProperty("indexer.meta.reverse.keys", "")));