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", "")) ); }
public static void main(String[] args) throws Exception { new MavenResolver().initialise(ArrayUtils.join(args, ",")); } }
/** set a property value only if it has not already been set * @param propertyKey the name of the property to set. * @param defaultValue the value of the property to set. */ public static void setDefaultProperty(String propertyKey, String defaultValue) { if (getProperty(propertyKey,null) != null) setProperty(propertyKey, defaultValue); }
/** Copy a file from srcFile to destFile. * @return null if OK * @throws IOException if there was a problem copying */ public static Long copyFile(File srcFile, File destFile) throws IOException { return copyFile(openFileStream(srcFile), writeFileStream(destFile)); }
@Override public String toString() { return "(" + id + "," + tf + ",F[" + ArrayUtils.join(fieldFrequencies, ",") + "])"; } }
/** * Construct a SimpleXMLCollection */ public SimpleXMLCollection() { this(ApplicationSetup.COLLECTION_SPEC, ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("xml.blacklist.docids", ""), ApplicationSetup.TERRIER_ETC)); }
/** Loads the entire file represented by filename into memory * @param filename Location of bit file to read into memory * @throws IOException if anything goes wrong reading the file */ public BitFileInMemory(String filename) throws IOException { this(Files.openFileStream(filename), Files.length(filename)); }
/** Opens a reader to the file called filename. Provided for easy overriding for encoding support etc in * child classes. Called from openNextFile(). * @param filename File to open. * @return BufferedReader of the file */ public static BufferedReader openFileReader(String filename) throws IOException { return openFileReader(filename,null); }
/** * Sorts the given arrays in descending order, using heap-sort. * @param A double[] the first array to be sorted. * @param B int[] the second array to be sorted, according to the * values of the first array. */ public static final void descendingHeapSort(double[] A, int[] B, short[] C) { HeapSort.ascendingHeapSort(A, B, C); reverse(A, B, C, A.length); } /**
public static final int noTimesSameOrder(final int[] term0Positions, final int[] term1Positions, final int windowSize, final int documentLengthInTokens) { //hack for following example: //noTimesSameOrder({1}, {7}, 8, 8) should be 1; if (term0Positions.length == 1 && term1Positions.length == 1 && term1Positions[0] > term0Positions[0] && term1Positions[0] - term0Positions[0] < windowSize) return 1; return noTimesSameOrder(term0Positions, 0, term0Positions.length, term1Positions, 0, term1Positions.length, windowSize, documentLengthInTokens); }
/** * 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; }
/** * Round a float value to a specified number of decimal * places. Calls round(double,int) internally. * * @param val the value to be rounded. * @param places the number of decimal places to round to. * @return val rounded to places decimal places. * @since 1.1.0 */ public static float round(float val, int places) { return (float)round((double)val, places); }
/** {@inheritDoc} */ public String toString() { return "(" + id + "," + tf + ",F[" + ArrayUtils.join(fieldFrequencies, ",") + "])"; } }
public static void main(String[] args) throws Exception { new MavenResolver().initialise(ArrayUtils.join(args, ",")); } }
@Override public String toString() { return "(" + id + "," + tf + ",B[" + ArrayUtils.join(positions, ",") + "])"; } }