repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/discord/HOTSAXImplementation.java
HOTSAXImplementation.hashToFreqEntries
@Deprecated private static ArrayList<FrequencyTableEntry> hashToFreqEntries( HashMap<String, ArrayList<Integer>> hash) { ArrayList<FrequencyTableEntry> res = new ArrayList<FrequencyTableEntry>(); for (Entry<String, ArrayList<Integer>> e : hash.entrySet()) { char[] payload = e.getKey().toCharArray(...
java
@Deprecated private static ArrayList<FrequencyTableEntry> hashToFreqEntries( HashMap<String, ArrayList<Integer>> hash) { ArrayList<FrequencyTableEntry> res = new ArrayList<FrequencyTableEntry>(); for (Entry<String, ArrayList<Integer>> e : hash.entrySet()) { char[] payload = e.getKey().toCharArray(...
[ "@", "Deprecated", "private", "static", "ArrayList", "<", "FrequencyTableEntry", ">", "hashToFreqEntries", "(", "HashMap", "<", "String", ",", "ArrayList", "<", "Integer", ">", ">", "hash", ")", "{", "ArrayList", "<", "FrequencyTableEntry", ">", "res", "=", "n...
Translates the hash table into sortable array of substrings. @param hash @return
[ "Translates", "the", "hash", "table", "into", "sortable", "array", "of", "substrings", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/discord/HOTSAXImplementation.java#L651-L663
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/discord/HOTSAXImplementation.java
HOTSAXImplementation.distance
private static double distance(double[] subseries, double[] series, int from, int to, double nThreshold) throws Exception { double[] subsequence = tp.znorm(tp.subseriesByCopy(series, from, to), nThreshold); Double sum = 0D; for (int i = 0; i < subseries.length; i++) { double tmp = subseries[i] -...
java
private static double distance(double[] subseries, double[] series, int from, int to, double nThreshold) throws Exception { double[] subsequence = tp.znorm(tp.subseriesByCopy(series, from, to), nThreshold); Double sum = 0D; for (int i = 0; i < subseries.length; i++) { double tmp = subseries[i] -...
[ "private", "static", "double", "distance", "(", "double", "[", "]", "subseries", ",", "double", "[", "]", "series", ",", "int", "from", ",", "int", "to", ",", "double", "nThreshold", ")", "throws", "Exception", "{", "double", "[", "]", "subsequence", "="...
Calculates the Euclidean distance between two points. Don't use this unless you need that. @param subseries The first subsequence -- ASSUMED TO BE Z-normalized. @param series The second point. @param from the initial index of the range to be copied, inclusive @param to the final index of the range to be copied, exclus...
[ "Calculates", "the", "Euclidean", "distance", "between", "two", "points", ".", "Don", "t", "use", "this", "unless", "you", "need", "that", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/discord/HOTSAXImplementation.java#L676-L685
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/bitmap/Shingles.java
Shingles.addShingledSeries
public void addShingledSeries(String key, Map<String, Integer> shingledSeries) { // allocate the weights array corresponding to the time series int[] counts = new int[this.indexTable.size()]; // fill in the counts for (String str : shingledSeries.keySet()) { Integer idx = this.indexTable.get(str);...
java
public void addShingledSeries(String key, Map<String, Integer> shingledSeries) { // allocate the weights array corresponding to the time series int[] counts = new int[this.indexTable.size()]; // fill in the counts for (String str : shingledSeries.keySet()) { Integer idx = this.indexTable.get(str);...
[ "public", "void", "addShingledSeries", "(", "String", "key", ",", "Map", "<", "String", ",", "Integer", ">", "shingledSeries", ")", "{", "// allocate the weights array corresponding to the time series", "int", "[", "]", "counts", "=", "new", "int", "[", "this", "....
Adds a shingled series assuring the proper index. @param key the timeseries key (i.e., label). @param shingledSeries a shingled timeseries in a map of &lt;shingle, index&gt; entries.
[ "Adds", "a", "shingled", "series", "assuring", "the", "proper", "index", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/bitmap/Shingles.java#L75-L87
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/tinker/ParallelPerformanceEvaluation.java
ParallelPerformanceEvaluation.main
public static void main(String[] args) throws Exception { NormalAlphabet na = new NormalAlphabet(); SAXProcessor sp = new SAXProcessor(); String dataFileName = args[0]; System.out.println("data file: " + dataFileName); double[] ts = TSProcessor.readFileColumn(dataFileName, 0, 0); System.out.p...
java
public static void main(String[] args) throws Exception { NormalAlphabet na = new NormalAlphabet(); SAXProcessor sp = new SAXProcessor(); String dataFileName = args[0]; System.out.println("data file: " + dataFileName); double[] ts = TSProcessor.readFileColumn(dataFileName, 0, 0); System.out.p...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "NormalAlphabet", "na", "=", "new", "NormalAlphabet", "(", ")", ";", "SAXProcessor", "sp", "=", "new", "SAXProcessor", "(", ")", ";", "String", "dataFileN...
Runs the evaluation. @param args some accepted, see the code. @throws Exception thrown if an error occured.
[ "Runs", "the", "evaluation", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/tinker/ParallelPerformanceEvaluation.java#L38-L103
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.markVisited
public void markVisited(int loc) { if (checkBounds(loc)) { if (ZERO == this.registry[loc]) { this.unvisitedCount--; } this.registry[loc] = ONE; } else { throw new RuntimeException( "The location " + loc + " out of bounds [0," + (this.registry.length - 1) + "]"); ...
java
public void markVisited(int loc) { if (checkBounds(loc)) { if (ZERO == this.registry[loc]) { this.unvisitedCount--; } this.registry[loc] = ONE; } else { throw new RuntimeException( "The location " + loc + " out of bounds [0," + (this.registry.length - 1) + "]"); ...
[ "public", "void", "markVisited", "(", "int", "loc", ")", "{", "if", "(", "checkBounds", "(", "loc", ")", ")", "{", "if", "(", "ZERO", "==", "this", ".", "registry", "[", "loc", "]", ")", "{", "this", ".", "unvisitedCount", "--", ";", "}", "this", ...
Marks location visited. If it was unvisited, counter decremented. @param loc The location to mark.
[ "Marks", "location", "visited", ".", "If", "it", "was", "unvisited", "counter", "decremented", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L48-L59
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.markVisited
public void markVisited(int from, int upTo) { if (checkBounds(from) && checkBounds(upTo - 1)) { for (int i = from; i < upTo; i++) { this.markVisited(i); } } else { throw new RuntimeException("The location " + from + "," + upTo + " out of bounds [0," + (this.registry.lengt...
java
public void markVisited(int from, int upTo) { if (checkBounds(from) && checkBounds(upTo - 1)) { for (int i = from; i < upTo; i++) { this.markVisited(i); } } else { throw new RuntimeException("The location " + from + "," + upTo + " out of bounds [0," + (this.registry.lengt...
[ "public", "void", "markVisited", "(", "int", "from", ",", "int", "upTo", ")", "{", "if", "(", "checkBounds", "(", "from", ")", "&&", "checkBounds", "(", "upTo", "-", "1", ")", ")", "{", "for", "(", "int", "i", "=", "from", ";", "i", "<", "upTo", ...
Marks as visited a range of locations. @param from the start of labeling (inclusive). @param upTo the end of labeling (exclusive).
[ "Marks", "as", "visited", "a", "range", "of", "locations", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L67-L77
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.getNextRandomUnvisitedPosition
public int getNextRandomUnvisitedPosition() { // if all are visited, return -1 // if (0 == this.unvisitedCount) { return -1; } // if there is space continue with random sampling // int i = this.randomizer.nextInt(this.registry.length); while (ONE == registry[i]) { i = this....
java
public int getNextRandomUnvisitedPosition() { // if all are visited, return -1 // if (0 == this.unvisitedCount) { return -1; } // if there is space continue with random sampling // int i = this.randomizer.nextInt(this.registry.length); while (ONE == registry[i]) { i = this....
[ "public", "int", "getNextRandomUnvisitedPosition", "(", ")", "{", "// if all are visited, return -1", "//", "if", "(", "0", "==", "this", ".", "unvisitedCount", ")", "{", "return", "-", "1", ";", "}", "// if there is space continue with random sampling", "//", "int", ...
Get the next random unvisited position. @return The next unvisited position.
[ "Get", "the", "next", "random", "unvisited", "position", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L84-L99
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.isNotVisited
public boolean isNotVisited(int loc) { if (checkBounds(loc)) { return (ZERO == this.registry[loc]); } else { throw new RuntimeException( "The location " + loc + " out of bounds [0," + (this.registry.length - 1) + "]"); } }
java
public boolean isNotVisited(int loc) { if (checkBounds(loc)) { return (ZERO == this.registry[loc]); } else { throw new RuntimeException( "The location " + loc + " out of bounds [0," + (this.registry.length - 1) + "]"); } }
[ "public", "boolean", "isNotVisited", "(", "int", "loc", ")", "{", "if", "(", "checkBounds", "(", "loc", ")", ")", "{", "return", "(", "ZERO", "==", "this", ".", "registry", "[", "loc", "]", ")", ";", "}", "else", "{", "throw", "new", "RuntimeExceptio...
Check if position is not visited. @param loc The index. @return true if not visited.
[ "Check", "if", "position", "is", "not", "visited", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L107-L115
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.isVisited
public boolean isVisited(int from, int upTo) { if (checkBounds(from) && checkBounds(upTo - 1)) { // perform the visit check // for (int i = from; i < upTo; i++) { if (ONE == this.registry[i]) { return true; } } return false; } else { throw new Ru...
java
public boolean isVisited(int from, int upTo) { if (checkBounds(from) && checkBounds(upTo - 1)) { // perform the visit check // for (int i = from; i < upTo; i++) { if (ONE == this.registry[i]) { return true; } } return false; } else { throw new Ru...
[ "public", "boolean", "isVisited", "(", "int", "from", ",", "int", "upTo", ")", "{", "if", "(", "checkBounds", "(", "from", ")", "&&", "checkBounds", "(", "upTo", "-", "1", ")", ")", "{", "// perform the visit check", "//", "for", "(", "int", "i", "=", ...
Check if the interval and its boundaries were visited. @param from The interval start (inclusive). @param upTo The interval end (exclusive). @return True if visited.
[ "Check", "if", "the", "interval", "and", "its", "boundaries", "were", "visited", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L124-L139
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.isVisited
public boolean isVisited(int loc) { if (checkBounds(loc)) { return (ONE == this.registry[loc]); } else { throw new RuntimeException( "The location " + loc + " out of bounds [0," + (this.registry.length - 1) + "]"); } }
java
public boolean isVisited(int loc) { if (checkBounds(loc)) { return (ONE == this.registry[loc]); } else { throw new RuntimeException( "The location " + loc + " out of bounds [0," + (this.registry.length - 1) + "]"); } }
[ "public", "boolean", "isVisited", "(", "int", "loc", ")", "{", "if", "(", "checkBounds", "(", "loc", ")", ")", "{", "return", "(", "ONE", "==", "this", ".", "registry", "[", "loc", "]", ")", ";", "}", "else", "{", "throw", "new", "RuntimeException", ...
Check if the location specified is visited. @param loc the location. @return true if visited
[ "Check", "if", "the", "location", "specified", "is", "visited", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L147-L156
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.getUnvisited
public ArrayList<Integer> getUnvisited() { if (0 == this.unvisitedCount) { return new ArrayList<Integer>(); } ArrayList<Integer> res = new ArrayList<Integer>(this.unvisitedCount); for (int i = 0; i < this.registry.length; i++) { if (ZERO == this.registry[i]) { res.add(i); } ...
java
public ArrayList<Integer> getUnvisited() { if (0 == this.unvisitedCount) { return new ArrayList<Integer>(); } ArrayList<Integer> res = new ArrayList<Integer>(this.unvisitedCount); for (int i = 0; i < this.registry.length; i++) { if (ZERO == this.registry[i]) { res.add(i); } ...
[ "public", "ArrayList", "<", "Integer", ">", "getUnvisited", "(", ")", "{", "if", "(", "0", "==", "this", ".", "unvisitedCount", ")", "{", "return", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "}", "ArrayList", "<", "Integer", ">", "res", ...
Get the list of unvisited positions. @return list of unvisited positions.
[ "Get", "the", "list", "of", "unvisited", "positions", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L163-L174
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.getVisited
public ArrayList<Integer> getVisited() { if (0 == (this.registry.length - this.unvisitedCount)) { return new ArrayList<Integer>(); } ArrayList<Integer> res = new ArrayList<Integer>(this.registry.length - this.unvisitedCount); for (int i = 0; i < this.registry.length; i++) { if (ONE == this.r...
java
public ArrayList<Integer> getVisited() { if (0 == (this.registry.length - this.unvisitedCount)) { return new ArrayList<Integer>(); } ArrayList<Integer> res = new ArrayList<Integer>(this.registry.length - this.unvisitedCount); for (int i = 0; i < this.registry.length; i++) { if (ONE == this.r...
[ "public", "ArrayList", "<", "Integer", ">", "getVisited", "(", ")", "{", "if", "(", "0", "==", "(", "this", ".", "registry", ".", "length", "-", "this", ".", "unvisitedCount", ")", ")", "{", "return", "new", "ArrayList", "<", "Integer", ">", "(", ")"...
Get the list of visited positions. Returns NULL if none are visited. @return list of visited positions.
[ "Get", "the", "list", "of", "visited", "positions", ".", "Returns", "NULL", "if", "none", "are", "visited", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L181-L192
train
jMotif/SAX
src/main/java/net/seninp/util/UCRUtils.java
UCRUtils.readUCRData
public static Map<String, List<double[]>> readUCRData(String fileName) throws IOException, NumberFormatException { Map<String, List<double[]>> res = new HashMap<String, List<double[]>>(); BufferedReader br = new BufferedReader(new FileReader(new File(fileName))); String line = ""; while ((line =...
java
public static Map<String, List<double[]>> readUCRData(String fileName) throws IOException, NumberFormatException { Map<String, List<double[]>> res = new HashMap<String, List<double[]>>(); BufferedReader br = new BufferedReader(new FileReader(new File(fileName))); String line = ""; while ((line =...
[ "public", "static", "Map", "<", "String", ",", "List", "<", "double", "[", "]", ">", ">", "readUCRData", "(", "String", "fileName", ")", "throws", "IOException", ",", "NumberFormatException", "{", "Map", "<", "String", ",", "List", "<", "double", "[", "]...
Reads bunch of series from file. First column treats as a class label. Rest as a real-valued series. @param fileName the input filename. @return time series read. @throws IOException if error occurs. @throws NumberFormatException if error occurs.
[ "Reads", "bunch", "of", "series", "from", "file", ".", "First", "column", "treats", "as", "a", "class", "label", ".", "Rest", "as", "a", "real", "-", "valued", "series", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/UCRUtils.java#L35-L69
train
jMotif/SAX
src/main/java/net/seninp/util/UCRUtils.java
UCRUtils.datasetStats
public static String datasetStats(Map<String, List<double[]>> data, String name) { int globalMinLength = Integer.MAX_VALUE; int globalMaxLength = Integer.MIN_VALUE; double globalMinValue = Double.MAX_VALUE; double globalMaxValue = Double.MIN_VALUE; for (Entry<String, List<double[]>> e : data.entr...
java
public static String datasetStats(Map<String, List<double[]>> data, String name) { int globalMinLength = Integer.MAX_VALUE; int globalMaxLength = Integer.MIN_VALUE; double globalMinValue = Double.MAX_VALUE; double globalMaxValue = Double.MIN_VALUE; for (Entry<String, List<double[]>> e : data.entr...
[ "public", "static", "String", "datasetStats", "(", "Map", "<", "String", ",", "List", "<", "double", "[", "]", ">", ">", "data", ",", "String", "name", ")", "{", "int", "globalMinLength", "=", "Integer", ".", "MAX_VALUE", ";", "int", "globalMaxLength", "...
Prints the dataset statistics. @param data the UCRdataset. @param name the dataset name to use. @return stats.
[ "Prints", "the", "dataset", "statistics", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/UCRUtils.java#L78-L112
train
jMotif/SAX
src/main/java/net/seninp/util/UCRUtils.java
UCRUtils.saveData
public static void saveData(Map<String, List<double[]>> data, File file) throws IOException { BufferedWriter bw = new BufferedWriter(new FileWriter(file)); for (Entry<String, List<double[]>> classEntry : data.entrySet()) { String classLabel = classEntry.getKey(); for (double[] arr : classEntry.get...
java
public static void saveData(Map<String, List<double[]>> data, File file) throws IOException { BufferedWriter bw = new BufferedWriter(new FileWriter(file)); for (Entry<String, List<double[]>> classEntry : data.entrySet()) { String classLabel = classEntry.getKey(); for (double[] arr : classEntry.get...
[ "public", "static", "void", "saveData", "(", "Map", "<", "String", ",", "List", "<", "double", "[", "]", ">", ">", "data", ",", "File", "file", ")", "throws", "IOException", "{", "BufferedWriter", "bw", "=", "new", "BufferedWriter", "(", "new", "FileWrit...
Saves the dataset. @param data the dataset. @param file the file handler. @throws IOException if error occurs.
[ "Saves", "the", "dataset", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/UCRUtils.java#L133-L146
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.readTS
public double[] readTS(String dataFileName, int loadLimit) throws SAXException, IOException { Path path = Paths.get(dataFileName); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader reader = Files.newBufferedReader(path, D...
java
public double[] readTS(String dataFileName, int loadLimit) throws SAXException, IOException { Path path = Paths.get(dataFileName); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader reader = Files.newBufferedReader(path, D...
[ "public", "double", "[", "]", "readTS", "(", "String", "dataFileName", ",", "int", "loadLimit", ")", "throws", "SAXException", ",", "IOException", "{", "Path", "path", "=", "Paths", ".", "get", "(", "dataFileName", ")", ";", "if", "(", "!", "(", "Files",...
Read at least N elements from the one-column file. @param dataFileName the file name. @param loadLimit the load limit. @return the read data or empty array if nothing to load. @throws SAXException if error occurs. @throws IOException if error occurs.
[ "Read", "at", "least", "N", "elements", "from", "the", "one", "-", "column", "file", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L126-L137
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.max
public double max(double[] series) { double max = Double.MIN_VALUE; for (int i = 0; i < series.length; i++) { if (max < series[i]) { max = series[i]; } } return max; }
java
public double max(double[] series) { double max = Double.MIN_VALUE; for (int i = 0; i < series.length; i++) { if (max < series[i]) { max = series[i]; } } return max; }
[ "public", "double", "max", "(", "double", "[", "]", "series", ")", "{", "double", "max", "=", "Double", ".", "MIN_VALUE", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "series", ".", "length", ";", "i", "++", ")", "{", "if", "(", "max",...
Finds the maximal value in timeseries. @param series The timeseries. @return The max value.
[ "Finds", "the", "maximal", "value", "in", "timeseries", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L145-L153
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.min
public double min(double[] series) { double min = Double.MAX_VALUE; for (int i = 0; i < series.length; i++) { if (min > series[i]) { min = series[i]; } } return min; }
java
public double min(double[] series) { double min = Double.MAX_VALUE; for (int i = 0; i < series.length; i++) { if (min > series[i]) { min = series[i]; } } return min; }
[ "public", "double", "min", "(", "double", "[", "]", "series", ")", "{", "double", "min", "=", "Double", ".", "MAX_VALUE", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "series", ".", "length", ";", "i", "++", ")", "{", "if", "(", "min",...
Finds the minimal value in timeseries. @param series The timeseries. @return The min value.
[ "Finds", "the", "minimal", "value", "in", "timeseries", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L161-L169
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.mean
public double mean(double[] series) { double res = 0D; int count = 0; for (double tp : series) { res += tp; count += 1; } if (count > 0) { return res / ((Integer) count).doubleValue(); } return Double.NaN; }
java
public double mean(double[] series) { double res = 0D; int count = 0; for (double tp : series) { res += tp; count += 1; } if (count > 0) { return res / ((Integer) count).doubleValue(); } return Double.NaN; }
[ "public", "double", "mean", "(", "double", "[", "]", "series", ")", "{", "double", "res", "=", "0D", ";", "int", "count", "=", "0", ";", "for", "(", "double", "tp", ":", "series", ")", "{", "res", "+=", "tp", ";", "count", "+=", "1", ";", "}", ...
Computes the mean value of timeseries. @param series The timeseries. @return The mean value.
[ "Computes", "the", "mean", "value", "of", "timeseries", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L177-L189
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.median
public double median(double[] series) { double[] clonedSeries = series.clone(); Arrays.sort(clonedSeries); double median; if (clonedSeries.length % 2 == 0) { median = (clonedSeries[clonedSeries.length / 2] + (double) clonedSeries[clonedSeries.length / 2 - 1]) / 2; } els...
java
public double median(double[] series) { double[] clonedSeries = series.clone(); Arrays.sort(clonedSeries); double median; if (clonedSeries.length % 2 == 0) { median = (clonedSeries[clonedSeries.length / 2] + (double) clonedSeries[clonedSeries.length / 2 - 1]) / 2; } els...
[ "public", "double", "median", "(", "double", "[", "]", "series", ")", "{", "double", "[", "]", "clonedSeries", "=", "series", ".", "clone", "(", ")", ";", "Arrays", ".", "sort", "(", "clonedSeries", ")", ";", "double", "median", ";", "if", "(", "clon...
Computes the median value of timeseries. @param series The timeseries. @return The median value.
[ "Computes", "the", "median", "value", "of", "timeseries", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L217-L230
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.stDev
public double stDev(double[] series) { double num0 = 0D; double sum = 0D; int count = 0; for (double tp : series) { num0 = num0 + tp * tp; sum = sum + tp; count += 1; } double len = ((Integer) count).doubleValue(); return Math.sqrt((len * num0 - sum * sum) / (len ...
java
public double stDev(double[] series) { double num0 = 0D; double sum = 0D; int count = 0; for (double tp : series) { num0 = num0 + tp * tp; sum = sum + tp; count += 1; } double len = ((Integer) count).doubleValue(); return Math.sqrt((len * num0 - sum * sum) / (len ...
[ "public", "double", "stDev", "(", "double", "[", "]", "series", ")", "{", "double", "num0", "=", "0D", ";", "double", "sum", "=", "0D", ";", "int", "count", "=", "0", ";", "for", "(", "double", "tp", ":", "series", ")", "{", "num0", "=", "num0", ...
Speed-optimized implementation. @param series The timeseries. @return the standard deviation.
[ "Speed", "-", "optimized", "implementation", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L258-L269
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.znorm
public double[] znorm(double[] series, double normalizationThreshold) { double[] res = new double[series.length]; double sd = stDev(series); if (sd < normalizationThreshold) { // return series.clone(); // return array of zeros return res; } double mean = mean(series); ...
java
public double[] znorm(double[] series, double normalizationThreshold) { double[] res = new double[series.length]; double sd = stDev(series); if (sd < normalizationThreshold) { // return series.clone(); // return array of zeros return res; } double mean = mean(series); ...
[ "public", "double", "[", "]", "znorm", "(", "double", "[", "]", "series", ",", "double", "normalizationThreshold", ")", "{", "double", "[", "]", "res", "=", "new", "double", "[", "series", ".", "length", "]", ";", "double", "sd", "=", "stDev", "(", "...
Z-Normalize routine. @param series the input timeseries. @param normalizationThreshold the zNormalization threshold value. @return Z-normalized time-series.
[ "Z", "-", "Normalize", "routine", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L278-L291
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.ts2String
public char[] ts2String(double[] vals, double[] cuts) { char[] res = new char[vals.length]; for (int i = 0; i < vals.length; i++) { res[i] = num2char(vals[i], cuts); } return res; }
java
public char[] ts2String(double[] vals, double[] cuts) { char[] res = new char[vals.length]; for (int i = 0; i < vals.length; i++) { res[i] = num2char(vals[i], cuts); } return res; }
[ "public", "char", "[", "]", "ts2String", "(", "double", "[", "]", "vals", ",", "double", "[", "]", "cuts", ")", "{", "char", "[", "]", "res", "=", "new", "char", "[", "vals", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i"...
Converts the timeseries into string using given cuts intervals. Useful for not-normal distribution cuts. @param vals The timeseries. @param cuts The cut intervals. @return The timeseries SAX representation.
[ "Converts", "the", "timeseries", "into", "string", "using", "given", "cuts", "intervals", ".", "Useful", "for", "not", "-", "normal", "distribution", "cuts", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L363-L369
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.ts2Index
public int[] ts2Index(double[] series, double[] cuts) throws Exception { int[] res = new int[series.length]; for (int i = 0; i < series.length; i++) { res[i] = num2index(series[i], cuts); } return res; }
java
public int[] ts2Index(double[] series, double[] cuts) throws Exception { int[] res = new int[series.length]; for (int i = 0; i < series.length; i++) { res[i] = num2index(series[i], cuts); } return res; }
[ "public", "int", "[", "]", "ts2Index", "(", "double", "[", "]", "series", ",", "double", "[", "]", "cuts", ")", "throws", "Exception", "{", "int", "[", "]", "res", "=", "new", "int", "[", "series", ".", "length", "]", ";", "for", "(", "int", "i",...
Convert the timeseries into the index using SAX cuts. @param series The timeseries to convert. @param cuts The alphabet cuts. @return SAX cuts indices. @throws Exception if error occurs.
[ "Convert", "the", "timeseries", "into", "the", "index", "using", "SAX", "cuts", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L379-L385
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.num2char
public char num2char(double value, double[] cuts) { int idx = 0; if (value >= 0) { idx = cuts.length; while ((idx > 0) && (cuts[idx - 1] > value)) { idx--; } } else { while ((idx < cuts.length) && (cuts[idx] <= value)) { idx++; } } retur...
java
public char num2char(double value, double[] cuts) { int idx = 0; if (value >= 0) { idx = cuts.length; while ((idx > 0) && (cuts[idx - 1] > value)) { idx--; } } else { while ((idx < cuts.length) && (cuts[idx] <= value)) { idx++; } } retur...
[ "public", "char", "num2char", "(", "double", "value", ",", "double", "[", "]", "cuts", ")", "{", "int", "idx", "=", "0", ";", "if", "(", "value", ">=", "0", ")", "{", "idx", "=", "cuts", ".", "length", ";", "while", "(", "(", "idx", ">", "0", ...
Get mapping of a number to char. @param value the value to map. @param cuts the array of intervals. @return character corresponding to numeric value.
[ "Get", "mapping", "of", "a", "number", "to", "char", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L394-L408
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.num2index
public int num2index(double value, double[] cuts) { int count = 0; while ((count < cuts.length) && (cuts[count] <= value)) { count++; } return count; }
java
public int num2index(double value, double[] cuts) { int count = 0; while ((count < cuts.length) && (cuts[count] <= value)) { count++; } return count; }
[ "public", "int", "num2index", "(", "double", "value", ",", "double", "[", "]", "cuts", ")", "{", "int", "count", "=", "0", ";", "while", "(", "(", "count", "<", "cuts", ".", "length", ")", "&&", "(", "cuts", "[", "count", "]", "<=", "value", ")",...
Get mapping of number to cut index. @param value the value to map. @param cuts the array of intervals. @return character corresponding to numeric value.
[ "Get", "mapping", "of", "number", "to", "cut", "index", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L427-L433
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.subseriesByCopy
public double[] subseriesByCopy(double[] series, int start, int end) throws IndexOutOfBoundsException { if ((start > end) || (start < 0) || (end > series.length)) { throw new IndexOutOfBoundsException("Unable to extract subseries, series length: " + series.length + ", start: " + start + ",...
java
public double[] subseriesByCopy(double[] series, int start, int end) throws IndexOutOfBoundsException { if ((start > end) || (start < 0) || (end > series.length)) { throw new IndexOutOfBoundsException("Unable to extract subseries, series length: " + series.length + ", start: " + start + ",...
[ "public", "double", "[", "]", "subseriesByCopy", "(", "double", "[", "]", "series", ",", "int", "start", ",", "int", "end", ")", "throws", "IndexOutOfBoundsException", "{", "if", "(", "(", "start", ">", "end", ")", "||", "(", "start", "<", "0", ")", ...
Extract subseries out of series. @param series The series array. @param start the fragment start. @param end the fragment end. @return The subseries. @throws IndexOutOfBoundsException If error occurs.
[ "Extract", "subseries", "out", "of", "series", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L444-L451
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.seriesToString
public String seriesToString(double[] series, NumberFormat df) { StringBuffer sb = new StringBuffer(); sb.append('['); for (double d : series) { sb.append(df.format(d)).append(','); } sb.delete(sb.length() - 2, sb.length() - 1).append("]"); return sb.toString(); }
java
public String seriesToString(double[] series, NumberFormat df) { StringBuffer sb = new StringBuffer(); sb.append('['); for (double d : series) { sb.append(df.format(d)).append(','); } sb.delete(sb.length() - 2, sb.length() - 1).append("]"); return sb.toString(); }
[ "public", "String", "seriesToString", "(", "double", "[", "]", "series", ",", "NumberFormat", "df", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "for", "(", "double", "d", ":...
Prettyfies the timeseries for screen output. @param series the data. @param df the number format to use. @return The timeseries formatted for screen output.
[ "Prettyfies", "the", "timeseries", "for", "screen", "output", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L461-L469
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.normOne
public double[] normOne(double[] data) { double[] res = new double[data.length]; double max = max(data); for (int i = 0; i < data.length; i++) { res[i] = data[i] / max; } return res; }
java
public double[] normOne(double[] data) { double[] res = new double[data.length]; double max = max(data); for (int i = 0; i < data.length; i++) { res[i] = data[i] / max; } return res; }
[ "public", "double", "[", "]", "normOne", "(", "double", "[", "]", "data", ")", "{", "double", "[", "]", "res", "=", "new", "double", "[", "data", ".", "length", "]", ";", "double", "max", "=", "max", "(", "data", ")", ";", "for", "(", "int", "i...
Normalizes data in interval 0-1. @param data the dataset. @return normalized dataset.
[ "Normalizes", "data", "in", "interval", "0", "-", "1", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L477-L484
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/discord/DiscordRecords.java
DiscordRecords.getTopHits
public List<DiscordRecord> getTopHits(Integer num) { if (num >= this.discords.size()) { return this.discords; } List<DiscordRecord> res = this.discords.subList(this.discords.size() - num, this.discords.size()); return res; }
java
public List<DiscordRecord> getTopHits(Integer num) { if (num >= this.discords.size()) { return this.discords; } List<DiscordRecord> res = this.discords.subList(this.discords.size() - num, this.discords.size()); return res; }
[ "public", "List", "<", "DiscordRecord", ">", "getTopHits", "(", "Integer", "num", ")", "{", "if", "(", "num", ">=", "this", ".", "discords", ".", "size", "(", ")", ")", "{", "return", "this", ".", "discords", ";", "}", "List", "<", "DiscordRecord", "...
Returns the number of the top hits. @param num The number of instances to return. If the number larger than the storage size - returns the storage as is. @return the top discord hits.
[ "Returns", "the", "number", "of", "the", "top", "hits", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/discord/DiscordRecords.java#L41-L48
train
jMotif/SAX
src/main/java/net/seninp/util/HeatChart.java
HeatChart.setZValues
public void setZValues(double[][] zValues, double low, double high) { this.zValues = zValues; this.lowValue = low; this.highValue = high; }
java
public void setZValues(double[][] zValues, double low, double high) { this.zValues = zValues; this.lowValue = low; this.highValue = high; }
[ "public", "void", "setZValues", "(", "double", "[", "]", "[", "]", "zValues", ",", "double", "low", ",", "double", "high", ")", "{", "this", ".", "zValues", "=", "zValues", ";", "this", ".", "lowValue", "=", "low", ";", "this", ".", "highValue", "=",...
Replaces the z-values array. The number of elements should match the number of y-values, with each element containing a double array with an equal number of elements that matches the number of x-values. Use this method where the minimum and maximum values possible are not contained within the dataset. @param zValues t...
[ "Replaces", "the", "z", "-", "values", "array", ".", "The", "number", "of", "elements", "should", "match", "the", "number", "of", "y", "-", "values", "with", "each", "element", "containing", "a", "double", "array", "with", "an", "equal", "number", "of", ...
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L341-L345
train
jMotif/SAX
src/main/java/net/seninp/util/HeatChart.java
HeatChart.setBackgroundColour
public void setBackgroundColour(Color backgroundColour) { if (backgroundColour == null) { backgroundColour = Color.WHITE; } this.backgroundColour = backgroundColour; }
java
public void setBackgroundColour(Color backgroundColour) { if (backgroundColour == null) { backgroundColour = Color.WHITE; } this.backgroundColour = backgroundColour; }
[ "public", "void", "setBackgroundColour", "(", "Color", "backgroundColour", ")", "{", "if", "(", "backgroundColour", "==", "null", ")", "{", "backgroundColour", "=", "Color", ".", "WHITE", ";", "}", "this", ".", "backgroundColour", "=", "backgroundColour", ";", ...
Sets the colour to be used on the background of the chart. A transparent background can be set by setting a background colour with an alpha value. The transparency will only be effective when the image is saved as a png or gif. <p> Defaults to <code>Color.WHITE</code>. @param backgroundColour the new colour to be set...
[ "Sets", "the", "colour", "to", "be", "used", "on", "the", "background", "of", "the", "chart", ".", "A", "transparent", "background", "can", "be", "set", "by", "setting", "a", "background", "colour", "with", "an", "alpha", "value", ".", "The", "transparency...
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L736-L742
train
jMotif/SAX
src/main/java/net/seninp/util/HeatChart.java
HeatChart.max
public static double max(double[][] values) { double max = 0; for (int i = 0; i < values.length; i++) { for (int j = 0; j < values[i].length; j++) { max = (values[i][j] > max) ? values[i][j] : max; } } return max; }
java
public static double max(double[][] values) { double max = 0; for (int i = 0; i < values.length; i++) { for (int j = 0; j < values[i].length; j++) { max = (values[i][j] > max) ? values[i][j] : max; } } return max; }
[ "public", "static", "double", "max", "(", "double", "[", "]", "[", "]", "values", ")", "{", "double", "max", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "for", "(", "int",...
Finds and returns the maximum value in a 2-dimensional array of doubles. @param values the data to use. @return the largest value in the array.
[ "Finds", "and", "returns", "the", "maximum", "value", "in", "a", "2", "-", "dimensional", "array", "of", "doubles", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L1697-L1705
train
jMotif/SAX
src/main/java/net/seninp/util/HeatChart.java
HeatChart.min
public static double min(double[][] values) { double min = Double.MAX_VALUE; for (int i = 0; i < values.length; i++) { for (int j = 0; j < values[i].length; j++) { min = (values[i][j] < min) ? values[i][j] : min; } } return min; }
java
public static double min(double[][] values) { double min = Double.MAX_VALUE; for (int i = 0; i < values.length; i++) { for (int j = 0; j < values[i].length; j++) { min = (values[i][j] < min) ? values[i][j] : min; } } return min; }
[ "public", "static", "double", "min", "(", "double", "[", "]", "[", "]", "values", ")", "{", "double", "min", "=", "Double", ".", "MAX_VALUE", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{...
Finds and returns the minimum value in a 2-dimensional array of doubles. @param values the data to use. @return the smallest value in the array.
[ "Finds", "and", "returns", "the", "minimum", "value", "in", "a", "2", "-", "dimensional", "array", "of", "doubles", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L1714-L1722
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/discord/DiscordRecord.java
DiscordRecord.compareTo
@Override public int compareTo(DiscordRecord other) { if (null == other) { throw new NullPointerException("Unable compare to null!"); } return Double.compare(other.getNNDistance(), this.nnDistance); }
java
@Override public int compareTo(DiscordRecord other) { if (null == other) { throw new NullPointerException("Unable compare to null!"); } return Double.compare(other.getNNDistance(), this.nnDistance); }
[ "@", "Override", "public", "int", "compareTo", "(", "DiscordRecord", "other", ")", "{", "if", "(", "null", "==", "other", ")", "{", "throw", "new", "NullPointerException", "(", "\"Unable compare to null!\"", ")", ";", "}", "return", "Double", ".", "compare", ...
The simple comparator based on the distance. Note that discord is "better" if the NN distance is greater. @param other The discord record this one is compared to. @return True if equals.
[ "The", "simple", "comparator", "based", "on", "the", "distance", ".", "Note", "that", "discord", "is", "better", "if", "the", "NN", "distance", "is", "greater", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/discord/DiscordRecord.java#L160-L166
train
jMotif/SAX
src/main/java/net/seninp/util/StdRandom.java
StdRandom.gaussian
public static double gaussian() { // use the polar form of the Box-Muller transform double r, x, y; do { x = uniform(-1.0, 1.0); y = uniform(-1.0, 1.0); r = x * x + y * y; } while (r >= 1 || r == 0); return x * Math.sqrt(-2 * Math.log(r) / r); // Remark: y * Math.sqrt(-2 *...
java
public static double gaussian() { // use the polar form of the Box-Muller transform double r, x, y; do { x = uniform(-1.0, 1.0); y = uniform(-1.0, 1.0); r = x * x + y * y; } while (r >= 1 || r == 0); return x * Math.sqrt(-2 * Math.log(r) / r); // Remark: y * Math.sqrt(-2 *...
[ "public", "static", "double", "gaussian", "(", ")", "{", "// use the polar form of the Box-Muller transform", "double", "r", ",", "x", ",", "y", ";", "do", "{", "x", "=", "uniform", "(", "-", "1.0", ",", "1.0", ")", ";", "y", "=", "uniform", "(", "-", ...
Returns a real number with a standard Gaussian distribution. @return the random value.
[ "Returns", "a", "real", "number", "with", "a", "standard", "Gaussian", "distribution", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/StdRandom.java#L192-L205
train
jMotif/SAX
src/main/java/net/seninp/util/StdRandom.java
StdRandom.shuffle
public static void shuffle(double[] a) { int N = a.length; for (int i = 0; i < N; i++) { int r = i + uniform(N - i); // between i and N-1 double temp = a[i]; a[i] = a[r]; a[r] = temp; } }
java
public static void shuffle(double[] a) { int N = a.length; for (int i = 0; i < N; i++) { int r = i + uniform(N - i); // between i and N-1 double temp = a[i]; a[i] = a[r]; a[r] = temp; } }
[ "public", "static", "void", "shuffle", "(", "double", "[", "]", "a", ")", "{", "int", "N", "=", "a", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "N", ";", "i", "++", ")", "{", "int", "r", "=", "i", "+", "uniform", ...
Rearrange the elements of a double array in random order. @param a the array to shuffle.
[ "Rearrange", "the", "elements", "of", "a", "double", "array", "in", "random", "order", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/StdRandom.java#L345-L353
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.dropByIndex
public void dropByIndex(int idx) { SAXRecord entry = realTSindex.get(idx); if (null != entry) { realTSindex.remove(idx); entry.removeIndex(idx); if (entry.getIndexes().isEmpty()) { records.remove(String.valueOf(entry.getPayload())); } } }
java
public void dropByIndex(int idx) { SAXRecord entry = realTSindex.get(idx); if (null != entry) { realTSindex.remove(idx); entry.removeIndex(idx); if (entry.getIndexes().isEmpty()) { records.remove(String.valueOf(entry.getPayload())); } } }
[ "public", "void", "dropByIndex", "(", "int", "idx", ")", "{", "SAXRecord", "entry", "=", "realTSindex", ".", "get", "(", "idx", ")", ";", "if", "(", "null", "!=", "entry", ")", "{", "realTSindex", ".", "remove", "(", "idx", ")", ";", "entry", ".", ...
Drops a single entry. @param idx the index.
[ "Drops", "a", "single", "entry", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L101-L110
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.add
public void add(char[] str, int idx) { SAXRecord rr = records.get(String.valueOf(str)); if (null == rr) { rr = new SAXRecord(str, idx); this.records.put(String.valueOf(str), rr); } else { rr.addIndex(idx); } this.realTSindex.put(idx, rr); }
java
public void add(char[] str, int idx) { SAXRecord rr = records.get(String.valueOf(str)); if (null == rr) { rr = new SAXRecord(str, idx); this.records.put(String.valueOf(str), rr); } else { rr.addIndex(idx); } this.realTSindex.put(idx, rr); }
[ "public", "void", "add", "(", "char", "[", "]", "str", ",", "int", "idx", ")", "{", "SAXRecord", "rr", "=", "records", ".", "get", "(", "String", ".", "valueOf", "(", "str", ")", ")", ";", "if", "(", "null", "==", "rr", ")", "{", "rr", "=", "...
Adds a single string and index entry by creating a SAXRecord. @param str The string. @param idx The index.
[ "Adds", "a", "single", "string", "and", "index", "entry", "by", "creating", "a", "SAXRecord", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L118-L128
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.addAll
public void addAll(SAXRecords records) { for (SAXRecord record : records) { char[] payload = record.getPayload(); for (Integer i : record.getIndexes()) { this.add(payload, i); } } }
java
public void addAll(SAXRecords records) { for (SAXRecord record : records) { char[] payload = record.getPayload(); for (Integer i : record.getIndexes()) { this.add(payload, i); } } }
[ "public", "void", "addAll", "(", "SAXRecords", "records", ")", "{", "for", "(", "SAXRecord", "record", ":", "records", ")", "{", "char", "[", "]", "payload", "=", "record", ".", "getPayload", "(", ")", ";", "for", "(", "Integer", "i", ":", "record", ...
Adds all entries from the collection. @param records The collection.
[ "Adds", "all", "entries", "from", "the", "collection", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L135-L142
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.addAll
public void addAll(HashMap<Integer, char[]> records) { for (Entry<Integer, char[]> e : records.entrySet()) { this.add(e.getValue(), e.getKey()); } }
java
public void addAll(HashMap<Integer, char[]> records) { for (Entry<Integer, char[]> e : records.entrySet()) { this.add(e.getValue(), e.getKey()); } }
[ "public", "void", "addAll", "(", "HashMap", "<", "Integer", ",", "char", "[", "]", ">", "records", ")", "{", "for", "(", "Entry", "<", "Integer", ",", "char", "[", "]", ">", "e", ":", "records", ".", "entrySet", "(", ")", ")", "{", "this", ".", ...
This adds all to the internal store. Used by the parallel SAX conversion engine. @param records the data to add.
[ "This", "adds", "all", "to", "the", "internal", "store", ".", "Used", "by", "the", "parallel", "SAX", "conversion", "engine", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L149-L153
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.getSAXString
public String getSAXString(String separatorToken) { StringBuffer sb = new StringBuffer(); ArrayList<Integer> index = new ArrayList<Integer>(); index.addAll(this.realTSindex.keySet()); Collections.sort(index, new Comparator<Integer>() { public int compare(Integer int1, Integer int2) { retur...
java
public String getSAXString(String separatorToken) { StringBuffer sb = new StringBuffer(); ArrayList<Integer> index = new ArrayList<Integer>(); index.addAll(this.realTSindex.keySet()); Collections.sort(index, new Comparator<Integer>() { public int compare(Integer int1, Integer int2) { retur...
[ "public", "String", "getSAXString", "(", "String", "separatorToken", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "ArrayList", "<", "Integer", ">", "index", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "index",...
Get the SAX string of this whole collection. @param separatorToken The separator token to use for the string. @return The whole data as a string.
[ "Get", "the", "SAX", "string", "of", "this", "whole", "collection", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L198-L211
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.getAllIndices
public ArrayList<Integer> getAllIndices() { ArrayList<Integer> res = new ArrayList<Integer>(this.realTSindex.size()); res.addAll(this.realTSindex.keySet()); Collections.sort(res); return res; }
java
public ArrayList<Integer> getAllIndices() { ArrayList<Integer> res = new ArrayList<Integer>(this.realTSindex.size()); res.addAll(this.realTSindex.keySet()); Collections.sort(res); return res; }
[ "public", "ArrayList", "<", "Integer", ">", "getAllIndices", "(", ")", "{", "ArrayList", "<", "Integer", ">", "res", "=", "new", "ArrayList", "<", "Integer", ">", "(", "this", ".", "realTSindex", ".", "size", "(", ")", ")", ";", "res", ".", "addAll", ...
Get all indexes, sorted. @return all the indexes.
[ "Get", "all", "indexes", "sorted", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L218-L223
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.buildIndex
public void buildIndex() { this.stringPosToRealPos = new HashMap<Integer, Integer>(); int counter = 0; for (Integer idx : getAllIndices()) { this.stringPosToRealPos.put(counter, idx); counter++; } }
java
public void buildIndex() { this.stringPosToRealPos = new HashMap<Integer, Integer>(); int counter = 0; for (Integer idx : getAllIndices()) { this.stringPosToRealPos.put(counter, idx); counter++; } }
[ "public", "void", "buildIndex", "(", ")", "{", "this", ".", "stringPosToRealPos", "=", "new", "HashMap", "<", "Integer", ",", "Integer", ">", "(", ")", ";", "int", "counter", "=", "0", ";", "for", "(", "Integer", "idx", ":", "getAllIndices", "(", ")", ...
This builds an index that aids in mapping of a SAX word to the real timeseries index.
[ "This", "builds", "an", "index", "that", "aids", "in", "mapping", "of", "a", "SAX", "word", "to", "the", "real", "timeseries", "index", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L228-L235
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.excludePositions
public void excludePositions(ArrayList<Integer> positions) { for (Integer p : positions) { if (realTSindex.containsKey(p)) { SAXRecord rec = realTSindex.get(p); rec.removeIndex(p); if (rec.getIndexes().isEmpty()) { this.records.remove(String.valueOf(rec.getPayload())); ...
java
public void excludePositions(ArrayList<Integer> positions) { for (Integer p : positions) { if (realTSindex.containsKey(p)) { SAXRecord rec = realTSindex.get(p); rec.removeIndex(p); if (rec.getIndexes().isEmpty()) { this.records.remove(String.valueOf(rec.getPayload())); ...
[ "public", "void", "excludePositions", "(", "ArrayList", "<", "Integer", ">", "positions", ")", "{", "for", "(", "Integer", "p", ":", "positions", ")", "{", "if", "(", "realTSindex", ".", "containsKey", "(", "p", ")", ")", "{", "SAXRecord", "rec", "=", ...
Removes saxRecord occurrences that correspond to these positions. @param positions The positions to clear.
[ "Removes", "saxRecord", "occurrences", "that", "correspond", "to", "these", "positions", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L252-L263
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.getSimpleMotifs
public ArrayList<SAXRecord> getSimpleMotifs(int num) { ArrayList<SAXRecord> res = new ArrayList<SAXRecord>(num); DoublyLinkedSortedList<Entry<String, SAXRecord>> list = new DoublyLinkedSortedList<Entry<String, SAXRecord>>( num, new Comparator<Entry<String, SAXRecord>>() { @Override p...
java
public ArrayList<SAXRecord> getSimpleMotifs(int num) { ArrayList<SAXRecord> res = new ArrayList<SAXRecord>(num); DoublyLinkedSortedList<Entry<String, SAXRecord>> list = new DoublyLinkedSortedList<Entry<String, SAXRecord>>( num, new Comparator<Entry<String, SAXRecord>>() { @Override p...
[ "public", "ArrayList", "<", "SAXRecord", ">", "getSimpleMotifs", "(", "int", "num", ")", "{", "ArrayList", "<", "SAXRecord", ">", "res", "=", "new", "ArrayList", "<", "SAXRecord", ">", "(", "num", ")", ";", "DoublyLinkedSortedList", "<", "Entry", "<", "Str...
Get motifs. @param num how many motifs to report. @return the array of motif SAXRecords.
[ "Get", "motifs", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L271-L290
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/parallel/ParallelSAXImplementation.java
ParallelSAXImplementation.cancel
public void cancel() { try { executorService.shutdown(); if (!executorService.awaitTermination(30, TimeUnit.MINUTES)) { executorService.shutdownNow(); // Cancel currently executing tasks if (!executorService.awaitTermination(30, TimeUnit.MINUTES)) { LOGGER.error("Pool did not t...
java
public void cancel() { try { executorService.shutdown(); if (!executorService.awaitTermination(30, TimeUnit.MINUTES)) { executorService.shutdownNow(); // Cancel currently executing tasks if (!executorService.awaitTermination(30, TimeUnit.MINUTES)) { LOGGER.error("Pool did not t...
[ "public", "void", "cancel", "(", ")", "{", "try", "{", "executorService", ".", "shutdown", "(", ")", ";", "if", "(", "!", "executorService", ".", "awaitTermination", "(", "30", ",", "TimeUnit", ".", "MINUTES", ")", ")", "{", "executorService", ".", "shut...
Cancels the execution.
[ "Cancels", "the", "execution", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/parallel/ParallelSAXImplementation.java#L432-L453
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/tinker/MoviePrinter.java
MoviePrinter.main
public static void main(String[] args) throws Exception { SAXProcessor sp = new SAXProcessor(); // data // double[] dat = TSProcessor.readFileColumn(DAT_FNAME, 1, 0); // TSProcessor tp = new TSProcessor(); // double[] dat = tp.readTS("src/resources/dataset/asys40.txt", 0); // double[] dat ...
java
public static void main(String[] args) throws Exception { SAXProcessor sp = new SAXProcessor(); // data // double[] dat = TSProcessor.readFileColumn(DAT_FNAME, 1, 0); // TSProcessor tp = new TSProcessor(); // double[] dat = tp.readTS("src/resources/dataset/asys40.txt", 0); // double[] dat ...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "SAXProcessor", "sp", "=", "new", "SAXProcessor", "(", ")", ";", "// data", "//", "double", "[", "]", "dat", "=", "TSProcessor", ".", "readFileColumn", ...
-pix_fmt yuv420p daimler_man.mp4
[ "-", "pix_fmt", "yuv420p", "daimler_man", ".", "mp4" ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/tinker/MoviePrinter.java#L60-L126
train
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/bitmap/UCRdataBitmapPrinter.java
UCRdataBitmapPrinter.toDoubleAray
private static double[] toDoubleAray(Integer[] intArray, HashSet<Integer> skipIndex) { double[] res = new double[intArray.length - skipIndex.size()]; int skip = 0; for (int i = 0; i < intArray.length; i++) { if (skipIndex.contains(i)) { skip++; continue; } res[i - skip] = i...
java
private static double[] toDoubleAray(Integer[] intArray, HashSet<Integer> skipIndex) { double[] res = new double[intArray.length - skipIndex.size()]; int skip = 0; for (int i = 0; i < intArray.length; i++) { if (skipIndex.contains(i)) { skip++; continue; } res[i - skip] = i...
[ "private", "static", "double", "[", "]", "toDoubleAray", "(", "Integer", "[", "]", "intArray", ",", "HashSet", "<", "Integer", ">", "skipIndex", ")", "{", "double", "[", "]", "res", "=", "new", "double", "[", "intArray", ".", "length", "-", "skipIndex", ...
Converts an array into array of doubles skipping specified indeces. @param intArray the input array. @param skipIndex skip index list. @return array of doubles.
[ "Converts", "an", "array", "into", "array", "of", "doubles", "skipping", "specified", "indeces", "." ]
39ee07a69facaa330def5130b8790aeda85f1061
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/bitmap/UCRdataBitmapPrinter.java#L264-L275
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFileAssembly.java
VirtualFileAssembly.getFile
public VirtualFile getFile(VirtualFile mountPoint, VirtualFile target) { final String path = target.getPathNameRelativeTo(mountPoint); return rootNode.getFile(new Path(path), mountPoint); }
java
public VirtualFile getFile(VirtualFile mountPoint, VirtualFile target) { final String path = target.getPathNameRelativeTo(mountPoint); return rootNode.getFile(new Path(path), mountPoint); }
[ "public", "VirtualFile", "getFile", "(", "VirtualFile", "mountPoint", ",", "VirtualFile", "target", ")", "{", "final", "String", "path", "=", "target", ".", "getPathNameRelativeTo", "(", "mountPoint", ")", ";", "return", "rootNode", ".", "getFile", "(", "new", ...
Get the VirtualFile from the assembly. This will traverse VirtualFiles in assembly to find children if needed. @param mountPoint @param target @return @throws IOException
[ "Get", "the", "VirtualFile", "from", "the", "assembly", ".", "This", "will", "traverse", "VirtualFiles", "in", "assembly", "to", "find", "children", "if", "needed", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFileAssembly.java#L95-L98
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFileAssembly.java
VirtualFileAssembly.getChildNames
public List<String> getChildNames(VirtualFile mountPoint, VirtualFile target) { List<String> names = new LinkedList<String>(); AssemblyNode targetNode = null; if (mountPoint.equals(target)) { targetNode = rootNode; } else { targetNode = rootNode.find(target.getPat...
java
public List<String> getChildNames(VirtualFile mountPoint, VirtualFile target) { List<String> names = new LinkedList<String>(); AssemblyNode targetNode = null; if (mountPoint.equals(target)) { targetNode = rootNode; } else { targetNode = rootNode.find(target.getPat...
[ "public", "List", "<", "String", ">", "getChildNames", "(", "VirtualFile", "mountPoint", ",", "VirtualFile", "target", ")", "{", "List", "<", "String", ">", "names", "=", "new", "LinkedList", "<", "String", ">", "(", ")", ";", "AssemblyNode", "targetNode", ...
Returns a list of all the names of the children in the assembly. @return
[ "Returns", "a", "list", "of", "all", "the", "names", "of", "the", "children", "in", "the", "assembly", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFileAssembly.java#L105-L119
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/TempDir.java
TempDir.createFile
public File createFile(String relativePath, InputStream sourceData) throws IOException { final File tempFile = getFile(relativePath); boolean ok = false; try { final FileOutputStream fos = new FileOutputStream(tempFile); try { VFSUtils.copyStream(sourceDat...
java
public File createFile(String relativePath, InputStream sourceData) throws IOException { final File tempFile = getFile(relativePath); boolean ok = false; try { final FileOutputStream fos = new FileOutputStream(tempFile); try { VFSUtils.copyStream(sourceDat...
[ "public", "File", "createFile", "(", "String", "relativePath", ",", "InputStream", "sourceData", ")", "throws", "IOException", "{", "final", "File", "tempFile", "=", "getFile", "(", "relativePath", ")", ";", "boolean", "ok", "=", "false", ";", "try", "{", "f...
Create a file within this temporary directory, prepopulating the file from the given input stream. @param relativePath the relative path name @param sourceData the source input stream to use @return the file @throws IOException if the directory was closed at the time of this invocation or an error occurs
[ "Create", "a", "file", "within", "this", "temporary", "directory", "prepopulating", "the", "file", "from", "the", "given", "input", "stream", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/TempDir.java#L80-L100
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.init
private static void init() { String pkgs = System.getProperty("java.protocol.handler.pkgs"); if (pkgs == null || pkgs.trim().length() == 0) { pkgs = "org.jboss.net.protocol|org.jboss.vfs.protocol"; System.setProperty("java.protocol.handler.pkgs", pkgs); } else if (pkgs.co...
java
private static void init() { String pkgs = System.getProperty("java.protocol.handler.pkgs"); if (pkgs == null || pkgs.trim().length() == 0) { pkgs = "org.jboss.net.protocol|org.jboss.vfs.protocol"; System.setProperty("java.protocol.handler.pkgs", pkgs); } else if (pkgs.co...
[ "private", "static", "void", "init", "(", ")", "{", "String", "pkgs", "=", "System", ".", "getProperty", "(", "\"java.protocol.handler.pkgs\"", ")", ";", "if", "(", "pkgs", "==", "null", "||", "pkgs", ".", "trim", "(", ")", ".", "length", "(", ")", "==...
Initialize VFS protocol handlers package property.
[ "Initialize", "VFS", "protocol", "handlers", "package", "property", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L77-L87
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.mount
public static Closeable mount(VirtualFile mountPoint, FileSystem fileSystem) throws IOException { final VirtualFile parent = mountPoint.getParent(); if (parent == null) { throw VFSMessages.MESSAGES.rootFileSystemAlreadyMounted(); } final String name = mountPoint.getName(); ...
java
public static Closeable mount(VirtualFile mountPoint, FileSystem fileSystem) throws IOException { final VirtualFile parent = mountPoint.getParent(); if (parent == null) { throw VFSMessages.MESSAGES.rootFileSystemAlreadyMounted(); } final String name = mountPoint.getName(); ...
[ "public", "static", "Closeable", "mount", "(", "VirtualFile", "mountPoint", ",", "FileSystem", "fileSystem", ")", "throws", "IOException", "{", "final", "VirtualFile", "parent", "=", "mountPoint", ".", "getParent", "(", ")", ";", "if", "(", "parent", "==", "nu...
Mount a filesystem on a mount point in the VFS. The mount point is any valid file name, existent or non-existent. If a relative path is given, it will be treated as relative to the VFS root. @param mountPoint the mount point @param fileSystem the file system to mount @return a handle which can be used to unmount the ...
[ "Mount", "a", "filesystem", "on", "a", "mount", "point", "in", "the", "VFS", ".", "The", "mount", "point", "is", "any", "valid", "file", "name", "existent", "or", "non", "-", "existent", ".", "If", "a", "relative", "path", "is", "given", "it", "will", ...
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L98-L124
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.visit
protected static void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException { if (file == null) { throw VFSMessages.MESSAGES.nullArgument("file"); } visitor.visit(file); }
java
protected static void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException { if (file == null) { throw VFSMessages.MESSAGES.nullArgument("file"); } visitor.visit(file); }
[ "protected", "static", "void", "visit", "(", "VirtualFile", "file", ",", "VirtualFileVisitor", "visitor", ")", "throws", "IOException", "{", "if", "(", "file", "==", "null", ")", "{", "throw", "VFSMessages", ".", "MESSAGES", ".", "nullArgument", "(", "\"file\"...
Visit the virtual file system @param file the file @param visitor the visitor @throws IOException for any problem accessing the VFS @throws IllegalArgumentException if the file or visitor is null
[ "Visit", "the", "virtual", "file", "system" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L248-L253
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.getSubmounts
static Set<String> getSubmounts(VirtualFile virtualFile) { final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = VFS.mounts; final Map<String, Mount> mountMap = mounts.get(virtualFile); if (mountMap == null) { return emptyRemovableSet(); } return new HashSet<S...
java
static Set<String> getSubmounts(VirtualFile virtualFile) { final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = VFS.mounts; final Map<String, Mount> mountMap = mounts.get(virtualFile); if (mountMap == null) { return emptyRemovableSet(); } return new HashSet<S...
[ "static", "Set", "<", "String", ">", "getSubmounts", "(", "VirtualFile", "virtualFile", ")", "{", "final", "ConcurrentMap", "<", "VirtualFile", ",", "Map", "<", "String", ",", "Mount", ">", ">", "mounts", "=", "VFS", ".", "mounts", ";", "final", "Map", "...
Get all immediate submounts for a path. @param virtualFile the path @return the collection of present mount (simple) names
[ "Get", "all", "immediate", "submounts", "for", "a", "path", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L282-L289
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.mountReal
public static Closeable mountReal(File realRoot, VirtualFile mountPoint) throws IOException { return doMount(new RealFileSystem(realRoot), mountPoint); }
java
public static Closeable mountReal(File realRoot, VirtualFile mountPoint) throws IOException { return doMount(new RealFileSystem(realRoot), mountPoint); }
[ "public", "static", "Closeable", "mountReal", "(", "File", "realRoot", ",", "VirtualFile", "mountPoint", ")", "throws", "IOException", "{", "return", "doMount", "(", "new", "RealFileSystem", "(", "realRoot", ")", ",", "mountPoint", ")", ";", "}" ]
Create and mount a real file system, returning a single handle which will unmount and close the filesystem when closed. @param realRoot the real filesystem root @param mountPoint the point at which the filesystem should be mounted @return a handle @throws IOException if an error occurs
[ "Create", "and", "mount", "a", "real", "file", "system", "returning", "a", "single", "handle", "which", "will", "unmount", "and", "close", "the", "filesystem", "when", "closed", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L380-L382
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.mountTemp
public static Closeable mountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir("tmpfs"); try { final MountHandle handle = doMount(new RealFileSystem(tempDir.getRoot()), mount...
java
public static Closeable mountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir("tmpfs"); try { final MountHandle handle = doMount(new RealFileSystem(tempDir.getRoot()), mount...
[ "public", "static", "Closeable", "mountTemp", "(", "VirtualFile", "mountPoint", ",", "TempFileProvider", "tempFileProvider", ")", "throws", "IOException", "{", "boolean", "ok", "=", "false", ";", "final", "TempDir", "tempDir", "=", "tempFileProvider", ".", "createTe...
Create and mount a temporary file system, returning a single handle which will unmount and close the filesystem when closed. @param mountPoint the point at which the filesystem should be mounted @param tempFileProvider the temporary file provider @return a handle @throws IOException if an error occurs
[ "Create", "and", "mount", "a", "temporary", "file", "system", "returning", "a", "single", "handle", "which", "will", "unmount", "and", "close", "the", "filesystem", "when", "closed", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L393-L405
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.mountZipExpanded
public static Closeable mountZipExpanded(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName()); try { final File rootFile = tempDir.getRoot(); ...
java
public static Closeable mountZipExpanded(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName()); try { final File rootFile = tempDir.getRoot(); ...
[ "public", "static", "Closeable", "mountZipExpanded", "(", "File", "zipFile", ",", "VirtualFile", "mountPoint", ",", "TempFileProvider", "tempFileProvider", ")", "throws", "IOException", "{", "boolean", "ok", "=", "false", ";", "final", "TempDir", "tempDir", "=", "...
Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and close the filesystem when closed. @param zipFile the zip file to mount @param mountPoint the point at which the filesystem should be mounted @param tempFileProvider the temporary file provi...
[ "Create", "and", "mount", "an", "expanded", "zip", "file", "in", "a", "temporary", "file", "system", "returning", "a", "single", "handle", "which", "will", "unmount", "and", "close", "the", "filesystem", "when", "closed", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L417-L431
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.mountZipExpanded
public static Closeable mountZipExpanded(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { try { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir(zipName); try { final...
java
public static Closeable mountZipExpanded(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { try { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir(zipName); try { final...
[ "public", "static", "Closeable", "mountZipExpanded", "(", "InputStream", "zipData", ",", "String", "zipName", ",", "VirtualFile", "mountPoint", ",", "TempFileProvider", "tempFileProvider", ")", "throws", "IOException", "{", "try", "{", "boolean", "ok", "=", "false",...
Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and close the filesystem when closed. The given zip data stream is closed. @param zipData an input stream containing the zip data @param zipName the name of the archive @param mountPoint ...
[ "Create", "and", "mount", "an", "expanded", "zip", "file", "in", "a", "temporary", "file", "system", "returning", "a", "single", "handle", "which", "will", "unmount", "and", "close", "the", "filesystem", "when", "closed", ".", "The", "given", "zip", "data", ...
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L444-L478
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.mountAssembly
public static Closeable mountAssembly(VirtualFileAssembly assembly, VirtualFile mountPoint) throws IOException { return doMount(new AssemblyFileSystem(assembly), mountPoint); }
java
public static Closeable mountAssembly(VirtualFileAssembly assembly, VirtualFile mountPoint) throws IOException { return doMount(new AssemblyFileSystem(assembly), mountPoint); }
[ "public", "static", "Closeable", "mountAssembly", "(", "VirtualFileAssembly", "assembly", ",", "VirtualFile", "mountPoint", ")", "throws", "IOException", "{", "return", "doMount", "(", "new", "AssemblyFileSystem", "(", "assembly", ")", ",", "mountPoint", ")", ";", ...
Create and mount an assembly file system, returning a single handle which will unmount and close the filesystem when closed. @param assembly an {@link VirtualFileAssembly} to mount in the VFS @param mountPoint the point at which the filesystem should be mounted @return a handle @throws IOException if an error occurs
[ "Create", "and", "mount", "an", "assembly", "file", "system", "returning", "a", "single", "handle", "which", "will", "unmount", "and", "close", "the", "filesystem", "when", "closed", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L503-L505
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java
VirtualJarFileInputStream.closeCurrent
private void closeCurrent() throws IOException { virtualJarInputStream.closeEntry(); currentEntry.crc = crc.getValue(); crc.reset(); }
java
private void closeCurrent() throws IOException { virtualJarInputStream.closeEntry(); currentEntry.crc = crc.getValue(); crc.reset(); }
[ "private", "void", "closeCurrent", "(", ")", "throws", "IOException", "{", "virtualJarInputStream", ".", "closeEntry", "(", ")", ";", "currentEntry", ".", "crc", "=", "crc", ".", "getValue", "(", ")", ";", "crc", ".", "reset", "(", ")", ";", "}" ]
Close the current entry, and calculate the crc value. @throws IOException if any problems occur
[ "Close", "the", "current", "entry", "and", "calculate", "the", "crc", "value", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java#L108-L112
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java
VirtualJarFileInputStream.bufferLocalFileHeader
private boolean bufferLocalFileHeader() throws IOException { buffer.reset(); JarEntry jarEntry = virtualJarInputStream.getNextJarEntry(); if (jarEntry == null) { return false; } currentEntry = new ProcessedEntry(jarEntry, totalRead); processedEntries.add(currentEntry); ...
java
private boolean bufferLocalFileHeader() throws IOException { buffer.reset(); JarEntry jarEntry = virtualJarInputStream.getNextJarEntry(); if (jarEntry == null) { return false; } currentEntry = new ProcessedEntry(jarEntry, totalRead); processedEntries.add(currentEntry); ...
[ "private", "boolean", "bufferLocalFileHeader", "(", ")", "throws", "IOException", "{", "buffer", ".", "reset", "(", ")", ";", "JarEntry", "jarEntry", "=", "virtualJarInputStream", ".", "getNextJarEntry", "(", ")", ";", "if", "(", "jarEntry", "==", "null", ")",...
Buffer the content of the local file header for a single entry. @return true if the next local file header was buffered @throws IOException if any problems occur
[ "Buffer", "the", "content", "of", "the", "local", "file", "header", "for", "a", "single", "entry", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java#L120-L143
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java
VirtualJarFileInputStream.bufferNextCentralFileHeader
private boolean bufferNextCentralFileHeader() throws IOException { buffer.reset(); if (currentCentralEntryIdx == processedEntries.size()) { return false; } ProcessedEntry entry = processedEntries.get(currentCentralEntryIdx++); JarEntry jarEntry = entry.jarEntry; bufferInt(ZipE...
java
private boolean bufferNextCentralFileHeader() throws IOException { buffer.reset(); if (currentCentralEntryIdx == processedEntries.size()) { return false; } ProcessedEntry entry = processedEntries.get(currentCentralEntryIdx++); JarEntry jarEntry = entry.jarEntry; bufferInt(ZipE...
[ "private", "boolean", "bufferNextCentralFileHeader", "(", ")", "throws", "IOException", "{", "buffer", ".", "reset", "(", ")", ";", "if", "(", "currentCentralEntryIdx", "==", "processedEntries", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "...
Buffer the central file header record for a single entry. @return true if the next central file header was buffered @throws IOException if any problems occur
[ "Buffer", "the", "central", "file", "header", "record", "for", "a", "single", "entry", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java#L151-L178
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java
VirtualJarFileInputStream.bufferCentralDirectoryEnd
private void bufferCentralDirectoryEnd() throws IOException { buffer.reset(); long lengthOfCentral = totalRead - centralOffset; int count = processedEntries.size(); bufferInt(JarEntry.ENDSIG); // End of central directory signature bufferShort(0); // Number ...
java
private void bufferCentralDirectoryEnd() throws IOException { buffer.reset(); long lengthOfCentral = totalRead - centralOffset; int count = processedEntries.size(); bufferInt(JarEntry.ENDSIG); // End of central directory signature bufferShort(0); // Number ...
[ "private", "void", "bufferCentralDirectoryEnd", "(", ")", "throws", "IOException", "{", "buffer", ".", "reset", "(", ")", ";", "long", "lengthOfCentral", "=", "totalRead", "-", "centralOffset", ";", "int", "count", "=", "processedEntries", ".", "size", "(", ")...
Write the central file header records. This is repeated until all entries have been added to the central file header. @throws IOException if any problem occur
[ "Write", "the", "central", "file", "header", "records", ".", "This", "is", "repeated", "until", "all", "entries", "have", "been", "added", "to", "the", "central", "file", "header", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java#L186-L199
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java
VirtualJarFileInputStream.bufferInt
private void bufferInt(long i) { buffer((byte) (i & 0xff)); buffer((byte) ((i >>> 8) & 0xff)); buffer((byte) ((i >>> 16) & 0xff)); buffer((byte) ((i >>> 24) & 0xff)); }
java
private void bufferInt(long i) { buffer((byte) (i & 0xff)); buffer((byte) ((i >>> 8) & 0xff)); buffer((byte) ((i >>> 16) & 0xff)); buffer((byte) ((i >>> 24) & 0xff)); }
[ "private", "void", "bufferInt", "(", "long", "i", ")", "{", "buffer", "(", "(", "byte", ")", "(", "i", "&", "0xff", ")", ")", ";", "buffer", "(", "(", "byte", ")", "(", "(", "i", ">>>", "8", ")", "&", "0xff", ")", ")", ";", "buffer", "(", "...
Buffer a 32-bit integer in little-endian @param i A long representation of a 32 bit int
[ "Buffer", "a", "32", "-", "bit", "integer", "in", "little", "-", "endian" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java#L206-L211
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java
VirtualJarFileInputStream.buffer
private void buffer(byte b) { if (buffer.hasCapacity()) { buffer.put(b); } else { throw VFSMessages.MESSAGES.bufferDoesntHaveEnoughCapacity(); } }
java
private void buffer(byte b) { if (buffer.hasCapacity()) { buffer.put(b); } else { throw VFSMessages.MESSAGES.bufferDoesntHaveEnoughCapacity(); } }
[ "private", "void", "buffer", "(", "byte", "b", ")", "{", "if", "(", "buffer", ".", "hasCapacity", "(", ")", ")", "{", "buffer", ".", "put", "(", "b", ")", ";", "}", "else", "{", "throw", "VFSMessages", ".", "MESSAGES", ".", "bufferDoesntHaveEnoughCapac...
Buffer a single byte @param b The byte
[ "Buffer", "a", "single", "byte" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java#L228-L234
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.getPathName
String getPathName(boolean url) { if (pathName == null || pathName.isEmpty()) { VirtualFile[] path = getParentFiles(); final StringBuilder builder = new StringBuilder(path.length * 30 + 50); for (int i = path.length - 1; i > -1; i--) { final VirtualFile parent...
java
String getPathName(boolean url) { if (pathName == null || pathName.isEmpty()) { VirtualFile[] path = getParentFiles(); final StringBuilder builder = new StringBuilder(path.length * 30 + 50); for (int i = path.length - 1; i > -1; i--) { final VirtualFile parent...
[ "String", "getPathName", "(", "boolean", "url", ")", "{", "if", "(", "pathName", "==", "null", "||", "pathName", ".", "isEmpty", "(", ")", ")", "{", "VirtualFile", "[", "]", "path", "=", "getParentFiles", "(", ")", ";", "final", "StringBuilder", "builder...
Get the absolute VFS full path name. If this is a URL then directory entries will have a trailing slash. @param url whether or not this path is being used for a URL @return the VFS full path name
[ "Get", "the", "absolute", "VFS", "full", "path", "name", ".", "If", "this", "is", "a", "URL", "then", "directory", "entries", "will", "have", "a", "trailing", "slash", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L136-L155
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.getLastModified
public long getLastModified() { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new VirtualFilePermission(getPathName(), "read")); } final VFS.Mount mount = VFS.getMount(this); if (sm != null) { return AccessCon...
java
public long getLastModified() { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new VirtualFilePermission(getPathName(), "read")); } final VFS.Mount mount = VFS.getMount(this); if (sm != null) { return AccessCon...
[ "public", "long", "getLastModified", "(", ")", "{", "final", "SecurityManager", "sm", "=", "System", ".", "getSecurityManager", "(", ")", ";", "if", "(", "sm", "!=", "null", ")", "{", "sm", ".", "checkPermission", "(", "new", "VirtualFilePermission", "(", ...
When the file was last modified @return the last modified time
[ "When", "the", "file", "was", "last", "modified" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L162-L174
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.openStream
public InputStream openStream() throws IOException { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new VirtualFilePermission(getPathName(), "read")); } if (isDirectory()) { return new VirtualJarInputStream(this); ...
java
public InputStream openStream() throws IOException { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new VirtualFilePermission(getPathName(), "read")); } if (isDirectory()) { return new VirtualJarInputStream(this); ...
[ "public", "InputStream", "openStream", "(", ")", "throws", "IOException", "{", "final", "SecurityManager", "sm", "=", "System", ".", "getSecurityManager", "(", ")", ";", "if", "(", "sm", "!=", "null", ")", "{", "sm", ".", "checkPermission", "(", "new", "Vi...
Access the file contents. @return an InputStream for the file contents. @throws IOException for any error accessing the file system
[ "Access", "the", "file", "contents", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L280-L293
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.getPhysicalFile
public File getPhysicalFile() throws IOException { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new VirtualFilePermission(getPathName(), "getfile")); } final VFS.Mount mount = VFS.getMount(this); if (sm != null) { ...
java
public File getPhysicalFile() throws IOException { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new VirtualFilePermission(getPathName(), "getfile")); } final VFS.Mount mount = VFS.getMount(this); if (sm != null) { ...
[ "public", "File", "getPhysicalFile", "(", ")", "throws", "IOException", "{", "final", "SecurityManager", "sm", "=", "System", ".", "getSecurityManager", "(", ")", ";", "if", "(", "sm", "!=", "null", ")", "{", "sm", ".", "checkPermission", "(", "new", "Virt...
Get a physical file for this virtual file. Depending on the underlying file system type, this may simply return an already-existing file; it may create a copy of a file; or it may reuse a preexisting copy of the file. Furthermore, the returned file may or may not have any relationship to other files from the same or a...
[ "Get", "a", "physical", "file", "for", "this", "virtual", "file", ".", "Depending", "on", "the", "underlying", "file", "system", "type", "this", "may", "simply", "return", "an", "already", "-", "existing", "file", ";", "it", "may", "create", "a", "copy", ...
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L323-L333
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.getChildren
public List<VirtualFile> getChildren() { // isDirectory does the read security check if (!isDirectory()) { return Collections.emptyList(); } final VFS.Mount mount = VFS.getMount(this); final Set<String> submounts = VFS.getSubmounts(this); final List<String> names = mount.getFileS...
java
public List<VirtualFile> getChildren() { // isDirectory does the read security check if (!isDirectory()) { return Collections.emptyList(); } final VFS.Mount mount = VFS.getMount(this); final Set<String> submounts = VFS.getSubmounts(this); final List<String> names = mount.getFileS...
[ "public", "List", "<", "VirtualFile", ">", "getChildren", "(", ")", "{", "// isDirectory does the read security check", "if", "(", "!", "isDirectory", "(", ")", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "final", "VFS", ".", "Mo...
Get the children. This is the combined list of real children within this directory, as well as virtual children created by submounts. @return the children
[ "Get", "the", "children", ".", "This", "is", "the", "combined", "list", "of", "real", "children", "within", "this", "directory", "as", "well", "as", "virtual", "children", "created", "by", "submounts", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L395-L412
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.getChildren
public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException { // isDirectory does the read security check if (!isDirectory()) { return Collections.emptyList(); } if (filter == null) { filter = MatchAllVirtualFileFilter.INSTANCE; } FilterVirtualFileVisitor visitor = ...
java
public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException { // isDirectory does the read security check if (!isDirectory()) { return Collections.emptyList(); } if (filter == null) { filter = MatchAllVirtualFileFilter.INSTANCE; } FilterVirtualFileVisitor visitor = ...
[ "public", "List", "<", "VirtualFile", ">", "getChildren", "(", "VirtualFileFilter", "filter", ")", "throws", "IOException", "{", "// isDirectory does the read security check", "if", "(", "!", "isDirectory", "(", ")", ")", "{", "return", "Collections", ".", "emptyLis...
Get the children @param filter to filter the children @return the children @throws IOException for any problem accessing the virtual file system @throws IllegalStateException if the file is closed or it is a leaf node
[ "Get", "the", "children" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L422-L429
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.getChild
public VirtualFile getChild(String path) { if (path == null) { throw VFSMessages.MESSAGES.nullArgument("path"); } final List<String> pathParts = PathTokenizer.getTokens(path); VirtualFile current = this; for (String part : pathParts) { if (PathTokenizer.is...
java
public VirtualFile getChild(String path) { if (path == null) { throw VFSMessages.MESSAGES.nullArgument("path"); } final List<String> pathParts = PathTokenizer.getTokens(path); VirtualFile current = this; for (String part : pathParts) { if (PathTokenizer.is...
[ "public", "VirtualFile", "getChild", "(", "String", "path", ")", "{", "if", "(", "path", "==", "null", ")", "{", "throw", "VFSMessages", ".", "MESSAGES", ".", "nullArgument", "(", "\"path\"", ")", ";", "}", "final", "List", "<", "String", ">", "pathParts...
Get a child virtual file. The child may or may not exist in the virtual filesystem. @param path the path @return the child @throws IllegalArgumentException if the path is null
[ "Get", "a", "child", "virtual", "file", ".", "The", "child", "may", "or", "may", "not", "exist", "in", "the", "virtual", "filesystem", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L494-L509
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/PathTokenizer.java
PathTokenizer.getTokens
public static List<String> getTokens(String path) { if (path == null) { throw MESSAGES.nullArgument("path"); } List<String> list = new ArrayList<String>(); getTokens(list, path); return list; }
java
public static List<String> getTokens(String path) { if (path == null) { throw MESSAGES.nullArgument("path"); } List<String> list = new ArrayList<String>(); getTokens(list, path); return list; }
[ "public", "static", "List", "<", "String", ">", "getTokens", "(", "String", "path", ")", "{", "if", "(", "path", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"path\"", ")", ";", "}", "List", "<", "String", ">", "list", "="...
Get the tokens that comprise this path. @param path the path @return the tokens or null if the path is empty @throws IllegalArgumentException if the path is null
[ "Get", "the", "tokens", "that", "comprise", "this", "path", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/PathTokenizer.java#L93-L100
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/PathTokenizer.java
PathTokenizer.getTokens
public static void getTokens(List<String> list, String path) { int start = -1, length = path.length(), state = STATE_INITIAL; char ch; for (int index = 0; index < length; index++) { ch = path.charAt(index); switch (ch) { case '/': case '\\'...
java
public static void getTokens(List<String> list, String path) { int start = -1, length = path.length(), state = STATE_INITIAL; char ch; for (int index = 0; index < length; index++) { ch = path.charAt(index); switch (ch) { case '/': case '\\'...
[ "public", "static", "void", "getTokens", "(", "List", "<", "String", ">", "list", ",", "String", "path", ")", "{", "int", "start", "=", "-", "1", ",", "length", "=", "path", ".", "length", "(", ")", ",", "state", "=", "STATE_INITIAL", ";", "char", ...
Get the tokens that comprise this path and append them to the list. @param path the path @return the tokens or null if the path is empty @throws IllegalArgumentException if the path is null
[ "Get", "the", "tokens", "that", "comprise", "this", "path", "and", "append", "them", "to", "the", "list", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/PathTokenizer.java#L109-L199
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/PathTokenizer.java
PathTokenizer.applySpecialPaths
public static String applySpecialPaths(String path) throws IllegalArgumentException { List<String> tokens = getTokens(path); if (tokens == null) { return null; } int i = 0; for (int j = 0; j < tokens.size(); j++) { String token = tokens.get(j); if (isCurrentToken(...
java
public static String applySpecialPaths(String path) throws IllegalArgumentException { List<String> tokens = getTokens(path); if (tokens == null) { return null; } int i = 0; for (int j = 0; j < tokens.size(); j++) { String token = tokens.get(j); if (isCurrentToken(...
[ "public", "static", "String", "applySpecialPaths", "(", "String", "path", ")", "throws", "IllegalArgumentException", "{", "List", "<", "String", ">", "tokens", "=", "getTokens", "(", "path", ")", ";", "if", "(", "tokens", "==", "null", ")", "{", "return", ...
Apply any . or .. paths in the path param. @param path the path @return simple path, containing no . or .. paths
[ "Apply", "any", ".", "or", "..", "paths", "in", "the", "path", "param", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/PathTokenizer.java#L222-L234
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/PathTokenizer.java
PathTokenizer.applySpecialPaths
public static List<String> applySpecialPaths(List<String> pathTokens) throws IllegalArgumentException { final ArrayList<String> newTokens = new ArrayList<String>(); for (String pathToken : pathTokens) { if (isCurrentToken(pathToken)) { continue; } else if (isReverseToken(pathToken)) { ...
java
public static List<String> applySpecialPaths(List<String> pathTokens) throws IllegalArgumentException { final ArrayList<String> newTokens = new ArrayList<String>(); for (String pathToken : pathTokens) { if (isCurrentToken(pathToken)) { continue; } else if (isReverseToken(pathToken)) { ...
[ "public", "static", "List", "<", "String", ">", "applySpecialPaths", "(", "List", "<", "String", ">", "pathTokens", ")", "throws", "IllegalArgumentException", "{", "final", "ArrayList", "<", "String", ">", "newTokens", "=", "new", "ArrayList", "<", "String", "...
Apply any . or .. paths in the pathTokens parameter, returning the minimal token list. @param pathTokens the path tokens @return the simple path tokens @throws IllegalArgumentException if reverse path goes over the top path
[ "Apply", "any", ".", "or", "..", "paths", "in", "the", "pathTokens", "parameter", "returning", "the", "minimal", "token", "list", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/PathTokenizer.java#L243-L255
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.getPathsString
public static String getPathsString(Collection<VirtualFile> paths) { if (paths == null) { throw MESSAGES.nullArgument("paths"); } StringBuilder buffer = new StringBuilder(); boolean first = true; for (VirtualFile path : paths) { if (path == null) { throw n...
java
public static String getPathsString(Collection<VirtualFile> paths) { if (paths == null) { throw MESSAGES.nullArgument("paths"); } StringBuilder buffer = new StringBuilder(); boolean first = true; for (VirtualFile path : paths) { if (path == null) { throw n...
[ "public", "static", "String", "getPathsString", "(", "Collection", "<", "VirtualFile", ">", "paths", ")", "{", "if", "(", "paths", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"paths\"", ")", ";", "}", "StringBuilder", "buffer", ...
Get the paths string for a collection of virtual files @param paths the paths @return the string @throws IllegalArgumentException for null paths
[ "Get", "the", "paths", "string", "for", "a", "collection", "of", "virtual", "files" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L129-L148
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.addManifestLocations
public static void addManifestLocations(VirtualFile file, List<VirtualFile> paths) throws IOException { if (file == null) { throw MESSAGES.nullArgument("file"); } if (paths == null) { throw MESSAGES.nullArgument("paths"); } boolean trace = VFSLogger.ROOT_L...
java
public static void addManifestLocations(VirtualFile file, List<VirtualFile> paths) throws IOException { if (file == null) { throw MESSAGES.nullArgument("file"); } if (paths == null) { throw MESSAGES.nullArgument("paths"); } boolean trace = VFSLogger.ROOT_L...
[ "public", "static", "void", "addManifestLocations", "(", "VirtualFile", "file", ",", "List", "<", "VirtualFile", ">", "paths", ")", "throws", "IOException", "{", "if", "(", "file", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"fil...
Add manifest paths @param file the file @param paths the paths to add to @throws IOException if there is an error reading the manifest or the virtual file is closed @throws IllegalStateException if the file has no parent @throws IllegalArgumentException for a null file or paths
[ "Add", "manifest", "paths" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L159-L206
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.getManifest
public static Manifest getManifest(VirtualFile archive) throws IOException { if (archive == null) { throw MESSAGES.nullArgument("archive"); } VirtualFile manifest = archive.getChild(JarFile.MANIFEST_NAME); if (manifest == null || !manifest.exists()) { if (VFSLogge...
java
public static Manifest getManifest(VirtualFile archive) throws IOException { if (archive == null) { throw MESSAGES.nullArgument("archive"); } VirtualFile manifest = archive.getChild(JarFile.MANIFEST_NAME); if (manifest == null || !manifest.exists()) { if (VFSLogge...
[ "public", "static", "Manifest", "getManifest", "(", "VirtualFile", "archive", ")", "throws", "IOException", "{", "if", "(", "archive", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"archive\"", ")", ";", "}", "VirtualFile", "manifest...
Get a manifest from a virtual file, assuming the virtual file is the root of an archive @param archive the root the archive @return the manifest or null if not found @throws IOException if there is an error reading the manifest or the virtual file is closed @throws IllegalArgumentException for a null arch...
[ "Get", "a", "manifest", "from", "a", "virtual", "file", "assuming", "the", "virtual", "file", "is", "the", "root", "of", "an", "archive" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L216-L228
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.readManifest
public static Manifest readManifest(VirtualFile manifest) throws IOException { if (manifest == null) { throw MESSAGES.nullArgument("manifest file"); } InputStream stream = new PaddedManifestStream(manifest.openStream()); try { return new Manifest(stream); ...
java
public static Manifest readManifest(VirtualFile manifest) throws IOException { if (manifest == null) { throw MESSAGES.nullArgument("manifest file"); } InputStream stream = new PaddedManifestStream(manifest.openStream()); try { return new Manifest(stream); ...
[ "public", "static", "Manifest", "readManifest", "(", "VirtualFile", "manifest", ")", "throws", "IOException", "{", "if", "(", "manifest", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"manifest file\"", ")", ";", "}", "InputStream", ...
Read the manifest from given manifest VirtualFile. @param manifest the VF to read from @return JAR's manifest @throws IOException if problems while opening VF stream occur
[ "Read", "the", "manifest", "from", "given", "manifest", "VirtualFile", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L237-L247
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.decode
public static String decode(String path, String encoding) { try { return URLDecoder.decode(path, encoding); } catch (UnsupportedEncodingException e) { throw MESSAGES.cannotDecode(path,encoding,e); } }
java
public static String decode(String path, String encoding) { try { return URLDecoder.decode(path, encoding); } catch (UnsupportedEncodingException e) { throw MESSAGES.cannotDecode(path,encoding,e); } }
[ "public", "static", "String", "decode", "(", "String", "path", ",", "String", "encoding", ")", "{", "try", "{", "return", "URLDecoder", ".", "decode", "(", "path", ",", "encoding", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{",...
Decode the path. @param path the path to decode @param encoding the encoding @return decoded path
[ "Decode", "the", "path", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L283-L289
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.getName
public static String getName(URI uri) { if (uri == null) { throw MESSAGES.nullArgument("uri"); } String name = uri.getPath(); if (name != null) { // TODO: Not correct for certain uris like jar:...!/ int lastSlash = name.lastIndexOf('/'); if...
java
public static String getName(URI uri) { if (uri == null) { throw MESSAGES.nullArgument("uri"); } String name = uri.getPath(); if (name != null) { // TODO: Not correct for certain uris like jar:...!/ int lastSlash = name.lastIndexOf('/'); if...
[ "public", "static", "String", "getName", "(", "URI", "uri", ")", "{", "if", "(", "uri", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"uri\"", ")", ";", "}", "String", "name", "=", "uri", ".", "getPath", "(", ")", ";", "i...
Get the name. @param uri the uri @return name from uri's path
[ "Get", "the", "name", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L297-L308
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.toURI
public static URI toURI(URL url) throws URISyntaxException { if (url == null) { throw MESSAGES.nullArgument("url"); } try { return url.toURI(); } catch (URISyntaxException e) { String urispec = url.toExternalForm(); // Escape percent sign a...
java
public static URI toURI(URL url) throws URISyntaxException { if (url == null) { throw MESSAGES.nullArgument("url"); } try { return url.toURI(); } catch (URISyntaxException e) { String urispec = url.toExternalForm(); // Escape percent sign a...
[ "public", "static", "URI", "toURI", "(", "URL", "url", ")", "throws", "URISyntaxException", "{", "if", "(", "url", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"url\"", ")", ";", "}", "try", "{", "return", "url", ".", "toURI...
Deal with urls that may include spaces. @param url the url @return uri the uri @throws URISyntaxException for any error
[ "Deal", "with", "urls", "that", "may", "include", "spaces", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L318-L331
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.safeClose
public static void safeClose(final Iterable<? extends Closeable> ci) { if (ci != null) { for (Closeable closeable : ci) { safeClose(closeable); } } }
java
public static void safeClose(final Iterable<? extends Closeable> ci) { if (ci != null) { for (Closeable closeable : ci) { safeClose(closeable); } } }
[ "public", "static", "void", "safeClose", "(", "final", "Iterable", "<", "?", "extends", "Closeable", ">", "ci", ")", "{", "if", "(", "ci", "!=", "null", ")", "{", "for", "(", "Closeable", "closeable", ":", "ci", ")", "{", "safeClose", "(", "closeable",...
Safely close some resources without throwing an exception. Any exception will be logged at TRACE level. @param ci the resources
[ "Safely", "close", "some", "resources", "without", "throwing", "an", "exception", ".", "Any", "exception", "will", "be", "logged", "at", "TRACE", "level", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L616-L622
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.exists
public static boolean exists(File file) { try { boolean fileExists = file.exists(); if(!forceCaseSensitive || !fileExists) { return fileExists; } String absPath = canonicalize(file.getAbsolutePath()); String canPath = canonicalize(file...
java
public static boolean exists(File file) { try { boolean fileExists = file.exists(); if(!forceCaseSensitive || !fileExists) { return fileExists; } String absPath = canonicalize(file.getAbsolutePath()); String canPath = canonicalize(file...
[ "public", "static", "boolean", "exists", "(", "File", "file", ")", "{", "try", "{", "boolean", "fileExists", "=", "file", ".", "exists", "(", ")", ";", "if", "(", "!", "forceCaseSensitive", "||", "!", "fileExists", ")", "{", "return", "fileExists", ";", ...
In case the file system is not case sensitive we compare the canonical path with the absolute path of the file after normalized. @param file @return
[ "In", "case", "the", "file", "system", "is", "not", "case", "sensitive", "we", "compare", "the", "canonical", "path", "with", "the", "absolute", "path", "of", "the", "file", "after", "normalized", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L649-L662
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.recursiveDelete
public static boolean recursiveDelete(VirtualFile root) { boolean ok = true; if (root.isDirectory()) { final List<VirtualFile> files = root.getChildren(); for (VirtualFile file : files) { ok &= recursiveDelete(file); } return ok && (root.de...
java
public static boolean recursiveDelete(VirtualFile root) { boolean ok = true; if (root.isDirectory()) { final List<VirtualFile> files = root.getChildren(); for (VirtualFile file : files) { ok &= recursiveDelete(file); } return ok && (root.de...
[ "public", "static", "boolean", "recursiveDelete", "(", "VirtualFile", "root", ")", "{", "boolean", "ok", "=", "true", ";", "if", "(", "root", ".", "isDirectory", "(", ")", ")", "{", "final", "List", "<", "VirtualFile", ">", "files", "=", "root", ".", "...
Attempt to recursively delete a virtual file. @param root the virtual file to delete @return {@code true} if the file was deleted
[ "Attempt", "to", "recursively", "delete", "a", "virtual", "file", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L692-L704
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.recursiveCopy
public static void recursiveCopy(File original, File destDir) throws IOException { final String name = original.getName(); final File destFile = new File(destDir, name); if (original.isDirectory()) { destFile.mkdir(); for (File file : original.listFiles()) { ...
java
public static void recursiveCopy(File original, File destDir) throws IOException { final String name = original.getName(); final File destFile = new File(destDir, name); if (original.isDirectory()) { destFile.mkdir(); for (File file : original.listFiles()) { ...
[ "public", "static", "void", "recursiveCopy", "(", "File", "original", ",", "File", "destDir", ")", "throws", "IOException", "{", "final", "String", "name", "=", "original", ".", "getName", "(", ")", ";", "final", "File", "destFile", "=", "new", "File", "("...
Recursively copy a file or directory from one location to another. @param original the original file or directory @param destDir the destination directory @throws IOException if an I/O error occurs before the copy is complete
[ "Recursively", "copy", "a", "file", "or", "directory", "from", "one", "location", "to", "another", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L713-L731
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.unzip
public static void unzip(File zipFile, File destDir) throws IOException { final ZipFile zip = new ZipFile(zipFile); try { final Set<File> createdDirs = new HashSet<File>(); final Enumeration<? extends ZipEntry> entries = zip.entries(); FILES_LOOP: while (e...
java
public static void unzip(File zipFile, File destDir) throws IOException { final ZipFile zip = new ZipFile(zipFile); try { final Set<File> createdDirs = new HashSet<File>(); final Enumeration<? extends ZipEntry> entries = zip.entries(); FILES_LOOP: while (e...
[ "public", "static", "void", "unzip", "(", "File", "zipFile", ",", "File", "destDir", ")", "throws", "IOException", "{", "final", "ZipFile", "zip", "=", "new", "ZipFile", "(", "zipFile", ")", ";", "try", "{", "final", "Set", "<", "File", ">", "createdDirs...
Expand a zip file to a destination directory. The directory must exist. If an error occurs, the destination directory may contain a partially-extracted archive, so cleanup is up to the caller. @param zipFile the zip file @param destDir the destination directory @throws IOException if an error occurs
[ "Expand", "a", "zip", "file", "to", "a", "destination", "directory", ".", "The", "directory", "must", "exist", ".", "If", "an", "error", "occurs", "the", "destination", "directory", "may", "contain", "a", "partially", "-", "extracted", "archive", "so", "clea...
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L873-L919
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.getMountSource
public static File getMountSource(Closeable handle) { if (handle instanceof MountHandle) { return MountHandle.class.cast(handle).getMountSource(); } return null; }
java
public static File getMountSource(Closeable handle) { if (handle instanceof MountHandle) { return MountHandle.class.cast(handle).getMountSource(); } return null; }
[ "public", "static", "File", "getMountSource", "(", "Closeable", "handle", ")", "{", "if", "(", "handle", "instanceof", "MountHandle", ")", "{", "return", "MountHandle", ".", "class", ".", "cast", "(", "handle", ")", ".", "getMountSource", "(", ")", ";", "}...
Return the mount source File for a given mount handle. @param handle The handle to get the source for @return The mount source file or null if the handle does not have a source, or is not a MountHandle
[ "Return", "the", "mount", "source", "File", "for", "a", "given", "mount", "handle", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L927-L930
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/FilterVirtualFileVisitor.java
FilterVirtualFileVisitor.checkAttributes
private static VisitorAttributes checkAttributes(VirtualFileFilter filter, VisitorAttributes attributes) { if (filter == null) { throw MESSAGES.nullArgument("filter"); } // Specified if (attributes != null) { return attributes; } // From the filter if (filter ...
java
private static VisitorAttributes checkAttributes(VirtualFileFilter filter, VisitorAttributes attributes) { if (filter == null) { throw MESSAGES.nullArgument("filter"); } // Specified if (attributes != null) { return attributes; } // From the filter if (filter ...
[ "private", "static", "VisitorAttributes", "checkAttributes", "(", "VirtualFileFilter", "filter", ",", "VisitorAttributes", "attributes", ")", "{", "if", "(", "filter", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"filter\"", ")", ";", ...
Check the attributes @param filter the filter @param attributes the attributes @return the attributes @throws IllegalArgumentException for a null filter
[ "Check", "the", "attributes" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/FilterVirtualFileVisitor.java#L57-L67
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/FileNameVirtualFileFilter.java
FileNameVirtualFileFilter.getPathName
protected String getPathName(VirtualFile file) { try { // prefer the URI, as the pathName might // return an empty string for temp virtual files return file.toURI().toString(); } catch (Exception e) { return file.getPathName(); } }
java
protected String getPathName(VirtualFile file) { try { // prefer the URI, as the pathName might // return an empty string for temp virtual files return file.toURI().toString(); } catch (Exception e) { return file.getPathName(); } }
[ "protected", "String", "getPathName", "(", "VirtualFile", "file", ")", "{", "try", "{", "// prefer the URI, as the pathName might\r", "// return an empty string for temp virtual files\r", "return", "file", ".", "toURI", "(", ")", ".", "toString", "(", ")", ";", "}", "...
Get the path name for the VirtualFile. @param file the virtual file @return the path name
[ "Get", "the", "path", "name", "for", "the", "VirtualFile", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/FileNameVirtualFileFilter.java#L78-L86
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/automount/Automounter.java
Automounter.getMountConfig
private static MountConfig getMountConfig(MountOption[] mountOptions) { final MountConfig config = new MountConfig(); for (MountOption option : mountOptions) { option.applyTo(config); } return config; }
java
private static MountConfig getMountConfig(MountOption[] mountOptions) { final MountConfig config = new MountConfig(); for (MountOption option : mountOptions) { option.applyTo(config); } return config; }
[ "private", "static", "MountConfig", "getMountConfig", "(", "MountOption", "[", "]", "mountOptions", ")", "{", "final", "MountConfig", "config", "=", "new", "MountConfig", "(", ")", ";", "for", "(", "MountOption", "option", ":", "mountOptions", ")", "{", "optio...
Creates a MountConfig and applies the provided mount options @param mountOptions options to use for mounting @return a MountConfig
[ "Creates", "a", "MountConfig", "and", "applies", "the", "provided", "mount", "options" ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/automount/Automounter.java#L119-L125
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/automount/Automounter.java
Automounter.addHandle
public static boolean addHandle(VirtualFile owner, Closeable handle) { RegistryEntry entry = getEntry(owner); return entry.handles.add(handle); }
java
public static boolean addHandle(VirtualFile owner, Closeable handle) { RegistryEntry entry = getEntry(owner); return entry.handles.add(handle); }
[ "public", "static", "boolean", "addHandle", "(", "VirtualFile", "owner", ",", "Closeable", "handle", ")", "{", "RegistryEntry", "entry", "=", "getEntry", "(", "owner", ")", ";", "return", "entry", ".", "handles", ".", "add", "(", "handle", ")", ";", "}" ]
Add handle to owner, to be auto closed. @param owner the handle owner @param handle the handle @return add result
[ "Add", "handle", "to", "owner", "to", "be", "auto", "closed", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/automount/Automounter.java#L134-L137
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/automount/Automounter.java
Automounter.removeHandle
public static boolean removeHandle(VirtualFile owner, Closeable handle) { RegistryEntry entry = getEntry(owner); return entry.handles.remove(handle); }
java
public static boolean removeHandle(VirtualFile owner, Closeable handle) { RegistryEntry entry = getEntry(owner); return entry.handles.remove(handle); }
[ "public", "static", "boolean", "removeHandle", "(", "VirtualFile", "owner", ",", "Closeable", "handle", ")", "{", "RegistryEntry", "entry", "=", "getEntry", "(", "owner", ")", ";", "return", "entry", ".", "handles", ".", "remove", "(", "handle", ")", ";", ...
Remove handle from owner. @param owner the handle owner @param handle the handle @return remove result
[ "Remove", "handle", "from", "owner", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/automount/Automounter.java#L146-L149
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/automount/Automounter.java
Automounter.getEntry
static RegistryEntry getEntry(VirtualFile virtualFile) { if (virtualFile == null) { throw MESSAGES.nullArgument("VirutalFile"); } return rootEntry.find(virtualFile); }
java
static RegistryEntry getEntry(VirtualFile virtualFile) { if (virtualFile == null) { throw MESSAGES.nullArgument("VirutalFile"); } return rootEntry.find(virtualFile); }
[ "static", "RegistryEntry", "getEntry", "(", "VirtualFile", "virtualFile", ")", "{", "if", "(", "virtualFile", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"VirutalFile\"", ")", ";", "}", "return", "rootEntry", ".", "find", "(", "v...
Get the entry from the tree creating the entry if not present. @param virtualFile entry's owner file @return registry entry
[ "Get", "the", "entry", "from", "the", "tree", "creating", "the", "entry", "if", "not", "present", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/automount/Automounter.java#L200-L205
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/TempFileProvider.java
TempFileProvider.create
public static TempFileProvider create(final String providerType, final ScheduledExecutorService executor, final boolean cleanExisting) throws IOException { if (cleanExisting) { try { // The "clean existing" logic is as follows: // 1) Rename the root directory "foo" co...
java
public static TempFileProvider create(final String providerType, final ScheduledExecutorService executor, final boolean cleanExisting) throws IOException { if (cleanExisting) { try { // The "clean existing" logic is as follows: // 1) Rename the root directory "foo" co...
[ "public", "static", "TempFileProvider", "create", "(", "final", "String", "providerType", ",", "final", "ScheduledExecutorService", "executor", ",", "final", "boolean", "cleanExisting", ")", "throws", "IOException", "{", "if", "(", "cleanExisting", ")", "{", "try", ...
Create a temporary file provider for a given type. @param providerType The provider type string (used as a prefix in the temp file dir name) @param executor Executor which will be used to manage temp file provider tasks (like cleaning up/deleting the temp files when needed) @param cleanExisting If this is true, then t...
[ "Create", "a", "temporary", "file", "provider", "for", "a", "given", "type", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/TempFileProvider.java#L79-L110
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/TempFileProvider.java
TempFileProvider.createTempDir
public TempDir createTempDir(String originalName) throws IOException { if (!open.get()) { throw VFSMessages.MESSAGES.tempFileProviderClosed(); } final String name = createTempName(originalName + "-", ""); final File f = new File(providerRoot, name); for (int i = 0; i ...
java
public TempDir createTempDir(String originalName) throws IOException { if (!open.get()) { throw VFSMessages.MESSAGES.tempFileProviderClosed(); } final String name = createTempName(originalName + "-", ""); final File f = new File(providerRoot, name); for (int i = 0; i ...
[ "public", "TempDir", "createTempDir", "(", "String", "originalName", ")", "throws", "IOException", "{", "if", "(", "!", "open", ".", "get", "(", ")", ")", "{", "throw", "VFSMessages", ".", "MESSAGES", ".", "tempFileProviderClosed", "(", ")", ";", "}", "fin...
Create a temp directory, into which temporary files may be placed. @param originalName the original file name @return the temp directory @throws IOException for any error
[ "Create", "a", "temp", "directory", "into", "which", "temporary", "files", "may", "be", "placed", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/TempFileProvider.java#L131-L143
train
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualJarInputStream.java
VirtualJarInputStream.openCurrent
private void openCurrent(VirtualFile current) throws IOException { if (current.isDirectory()) { currentEntryStream = VFSUtils.emptyStream(); } else { currentEntryStream = current.openStream(); } }
java
private void openCurrent(VirtualFile current) throws IOException { if (current.isDirectory()) { currentEntryStream = VFSUtils.emptyStream(); } else { currentEntryStream = current.openStream(); } }
[ "private", "void", "openCurrent", "(", "VirtualFile", "current", ")", "throws", "IOException", "{", "if", "(", "current", ".", "isDirectory", "(", ")", ")", "{", "currentEntryStream", "=", "VFSUtils", ".", "emptyStream", "(", ")", ";", "}", "else", "{", "c...
Open the current virtual file as the current JarEntry stream. @param current @throws IOException
[ "Open", "the", "current", "virtual", "file", "as", "the", "current", "JarEntry", "stream", "." ]
420f4b896d6178ee5f6758f3421e9f350d2b8ab5
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualJarInputStream.java#L219-L225
train