id
int32
0
165k
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
45,000
xedin/disruptor_thrift_server
src/main/java/com/thinkaurelius/thrift/Message.java
Message.invoke
public void invoke() { assert state == State.READ_FRAME_COMPLETE : "Invoke called in invalid state: " + state; TTransport inTrans = getInputTransport(); TProtocol inProt = thriftFactories.inputProtocolFactory.getProtocol(inTrans); TProtocol outProt = thriftFactories.outputProtocolFa...
java
public void invoke() { assert state == State.READ_FRAME_COMPLETE : "Invoke called in invalid state: " + state; TTransport inTrans = getInputTransport(); TProtocol inProt = thriftFactories.inputProtocolFactory.getProtocol(inTrans); TProtocol outProt = thriftFactories.outputProtocolFa...
[ "public", "void", "invoke", "(", ")", "{", "assert", "state", "==", "State", ".", "READ_FRAME_COMPLETE", ":", "\"Invoke called in invalid state: \"", "+", "state", ";", "TTransport", "inTrans", "=", "getInputTransport", "(", ")", ";", "TProtocol", "inProt", "=", ...
Actually invoke the method signified by this Message.
[ "Actually", "invoke", "the", "method", "signified", "by", "this", "Message", "." ]
5bf0c3d6968e1ea79f5ea939dde7b8ced3d91a2c
https://github.com/xedin/disruptor_thrift_server/blob/5bf0c3d6968e1ea79f5ea939dde7b8ced3d91a2c/src/main/java/com/thinkaurelius/thrift/Message.java#L348-L374
45,001
xedin/disruptor_thrift_server
src/main/java/com/thinkaurelius/thrift/Message.java
Message.internalRead
private boolean internalRead(Buffer buffer) { try { return !(buffer.readFrom(transport) < 0); } catch (IOException e) { logger.warn("Got an IOException in internalRead!", e); return false; } }
java
private boolean internalRead(Buffer buffer) { try { return !(buffer.readFrom(transport) < 0); } catch (IOException e) { logger.warn("Got an IOException in internalRead!", e); return false; } }
[ "private", "boolean", "internalRead", "(", "Buffer", "buffer", ")", "{", "try", "{", "return", "!", "(", "buffer", ".", "readFrom", "(", "transport", ")", "<", "0", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "warn", "("...
Perform a read into dataBuffer. @return true if the read succeeded, false if there was an error or the connection closed.
[ "Perform", "a", "read", "into", "dataBuffer", "." ]
5bf0c3d6968e1ea79f5ea939dde7b8ced3d91a2c
https://github.com/xedin/disruptor_thrift_server/blob/5bf0c3d6968e1ea79f5ea939dde7b8ced3d91a2c/src/main/java/com/thinkaurelius/thrift/Message.java#L400-L411
45,002
xedin/disruptor_thrift_server
src/main/java/com/thinkaurelius/thrift/Message.java
Message.close
public void close() { freeDataBuffer(); frameSizeBuffer.free(); transport.close(); if (response != null) response.close(); }
java
public void close() { freeDataBuffer(); frameSizeBuffer.free(); transport.close(); if (response != null) response.close(); }
[ "public", "void", "close", "(", ")", "{", "freeDataBuffer", "(", ")", ";", "frameSizeBuffer", ".", "free", "(", ")", ";", "transport", ".", "close", "(", ")", ";", "if", "(", "response", "!=", "null", ")", "response", ".", "close", "(", ")", ";", "...
Shut the connection down.
[ "Shut", "the", "connection", "down", "." ]
5bf0c3d6968e1ea79f5ea939dde7b8ced3d91a2c
https://github.com/xedin/disruptor_thrift_server/blob/5bf0c3d6968e1ea79f5ea939dde7b8ced3d91a2c/src/main/java/com/thinkaurelius/thrift/Message.java#L475-L483
45,003
jMotif/GI
src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java
RuleOrganizer.classifyMotifs
public ArrayList<SameLengthMotifs> classifyMotifs(double lengthThreshold, GrammarRules grammarRules) { // reset vars ArrayList<SameLengthMotifs> allClassifiedMotifs = new ArrayList<SameLengthMotifs>(); // down to business ArrayList<SAXMotif> allMotifs = getAllMotifs(grammarRules); ...
java
public ArrayList<SameLengthMotifs> classifyMotifs(double lengthThreshold, GrammarRules grammarRules) { // reset vars ArrayList<SameLengthMotifs> allClassifiedMotifs = new ArrayList<SameLengthMotifs>(); // down to business ArrayList<SAXMotif> allMotifs = getAllMotifs(grammarRules); ...
[ "public", "ArrayList", "<", "SameLengthMotifs", ">", "classifyMotifs", "(", "double", "lengthThreshold", ",", "GrammarRules", "grammarRules", ")", "{", "// reset vars\r", "ArrayList", "<", "SameLengthMotifs", ">", "allClassifiedMotifs", "=", "new", "ArrayList", "<", "...
Classify the motifs based on their length. It calls "getAllMotifs()" to get all the sub-sequences that were generated by Sequitur rules in ascending order. Then bins all the sub-sequences by length based on the length of the first sub-sequence in each class, that is, the shortest sub-sequence in each class. @param le...
[ "Classify", "the", "motifs", "based", "on", "their", "length", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java#L30-L90
45,004
jMotif/GI
src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java
RuleOrganizer.getAllMotifs
protected ArrayList<SAXMotif> getAllMotifs(GrammarRules grammarRules) { // result ArrayList<SAXMotif> allMotifs = new ArrayList<SAXMotif>(); int ruleNumber = grammarRules.size(); // iterate over all rules for (int i = 0; i < ruleNumber; i++) { // iterate over all segments/motifs/...
java
protected ArrayList<SAXMotif> getAllMotifs(GrammarRules grammarRules) { // result ArrayList<SAXMotif> allMotifs = new ArrayList<SAXMotif>(); int ruleNumber = grammarRules.size(); // iterate over all rules for (int i = 0; i < ruleNumber; i++) { // iterate over all segments/motifs/...
[ "protected", "ArrayList", "<", "SAXMotif", ">", "getAllMotifs", "(", "GrammarRules", "grammarRules", ")", "{", "// result\r", "ArrayList", "<", "SAXMotif", ">", "allMotifs", "=", "new", "ArrayList", "<", "SAXMotif", ">", "(", ")", ";", "int", "ruleNumber", "="...
Stores all the sub-sequences that generated by Sequitur rules into an array list sorted by sub-sequence length in ascending order. @param grammarRules the set of grammar rules. @return the list of all sub-sequences sorted by length in ascending order.
[ "Stores", "all", "the", "sub", "-", "sequences", "that", "generated", "by", "Sequitur", "rules", "into", "an", "array", "list", "sorted", "by", "sub", "-", "sequence", "length", "in", "ascending", "order", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java#L99-L125
45,005
jMotif/GI
src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java
RuleOrganizer.removeOverlappingInSimiliar
protected ArrayList<SameLengthMotifs> removeOverlappingInSimiliar( ArrayList<SameLengthMotifs> allClassifiedMotifs, GrammarRules grammarRules, double[] ts, double thresouldCom) { ArrayList<SAXMotif> motifsBeDeleted = new ArrayList<SAXMotif>(); SAXPointsNumber[] pointsNumberRemoveStrategy = c...
java
protected ArrayList<SameLengthMotifs> removeOverlappingInSimiliar( ArrayList<SameLengthMotifs> allClassifiedMotifs, GrammarRules grammarRules, double[] ts, double thresouldCom) { ArrayList<SAXMotif> motifsBeDeleted = new ArrayList<SAXMotif>(); SAXPointsNumber[] pointsNumberRemoveStrategy = c...
[ "protected", "ArrayList", "<", "SameLengthMotifs", ">", "removeOverlappingInSimiliar", "(", "ArrayList", "<", "SameLengthMotifs", ">", "allClassifiedMotifs", ",", "GrammarRules", "grammarRules", ",", "double", "[", "]", "ts", ",", "double", "thresouldCom", ")", "{", ...
Removes overlapping rules in similar rule set. @param allClassifiedMotifs the set of motifs classified as the same. @param grammarRules the grammar. @param ts the input time series. @param thresouldCom the threshold. @return a reduced set of the same length rules.
[ "Removes", "overlapping", "rules", "in", "similar", "rule", "set", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java#L136-L204
45,006
jMotif/GI
src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java
RuleOrganizer.decideRemove
protected boolean decideRemove(SAXMotif motif1, SAXMotif motif2, SAXPointsNumber[] pointsNumberRemoveStrategy) { // motif1 details int motif1Start = motif1.getPos().getStart(); int motif1End = motif1.getPos().getEnd() - 1; int length1 = motif1End - motif1Start; // motif2 details ...
java
protected boolean decideRemove(SAXMotif motif1, SAXMotif motif2, SAXPointsNumber[] pointsNumberRemoveStrategy) { // motif1 details int motif1Start = motif1.getPos().getStart(); int motif1End = motif1.getPos().getEnd() - 1; int length1 = motif1End - motif1Start; // motif2 details ...
[ "protected", "boolean", "decideRemove", "(", "SAXMotif", "motif1", ",", "SAXMotif", "motif2", ",", "SAXPointsNumber", "[", "]", "pointsNumberRemoveStrategy", ")", "{", "// motif1 details\r", "int", "motif1Start", "=", "motif1", ".", "getPos", "(", ")", ".", "getSt...
Decide which one from overlapping subsequences should be removed. The decision rule is that each sub-sequence has a weight, the one with the smaller weight should be removed. The weight is S/(A * L). S is the sum of occurrence time of all data points in that sub-sequence, A is the average weight of the whole time seri...
[ "Decide", "which", "one", "from", "overlapping", "subsequences", "should", "be", "removed", ".", "The", "decision", "rule", "is", "that", "each", "sub", "-", "sequence", "has", "a", "weight", "the", "one", "with", "the", "smaller", "weight", "should", "be", ...
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java#L252-L295
45,007
jMotif/GI
src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java
RuleOrganizer.refinePatternsByClustering
protected ArrayList<SameLengthMotifs> refinePatternsByClustering(GrammarRules grammarRules, double[] ts, ArrayList<SameLengthMotifs> allClassifiedMotifs, double fractionTopDist) { DistanceComputation dc = new DistanceComputation(); double[] origTS = ts; ArrayList<SameLengthMotifs> newAllClassified...
java
protected ArrayList<SameLengthMotifs> refinePatternsByClustering(GrammarRules grammarRules, double[] ts, ArrayList<SameLengthMotifs> allClassifiedMotifs, double fractionTopDist) { DistanceComputation dc = new DistanceComputation(); double[] origTS = ts; ArrayList<SameLengthMotifs> newAllClassified...
[ "protected", "ArrayList", "<", "SameLengthMotifs", ">", "refinePatternsByClustering", "(", "GrammarRules", "grammarRules", ",", "double", "[", "]", "ts", ",", "ArrayList", "<", "SameLengthMotifs", ">", "allClassifiedMotifs", ",", "double", "fractionTopDist", ")", "{",...
Refines patterns by clustering. @param grammarRules the set of grammar rules. @param ts the input time series. @param allClassifiedMotifs all the motifs in groups. @param fractionTopDist the fraction threshold. @return refined set of patterns.
[ "Refines", "patterns", "by", "clustering", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java#L352-L433
45,008
jMotif/GI
src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java
RuleOrganizer.findCluster
private ArrayList<String[]> findCluster(Cluster cluster, double cutDist, int minPatternPerCls) { ArrayList<String[]> clusterTSIdx = new ArrayList<String[]>(); if (cluster.getDistance() != null) { // if (cluster.getDistance() > cutDist) { if (cluster.getDistanceValue() > cutDist) { i...
java
private ArrayList<String[]> findCluster(Cluster cluster, double cutDist, int minPatternPerCls) { ArrayList<String[]> clusterTSIdx = new ArrayList<String[]>(); if (cluster.getDistance() != null) { // if (cluster.getDistance() > cutDist) { if (cluster.getDistanceValue() > cutDist) { i...
[ "private", "ArrayList", "<", "String", "[", "]", ">", "findCluster", "(", "Cluster", "cluster", ",", "double", "cutDist", ",", "int", "minPatternPerCls", ")", "{", "ArrayList", "<", "String", "[", "]", ">", "clusterTSIdx", "=", "new", "ArrayList", "<", "St...
Finds clusters. @param cluster the Cluster. @param cutDist the cut distance threshold. @param minPatternPerCls the minimal patterns threshold. @return the clusters.
[ "Finds", "clusters", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java#L443-L466
45,009
jMotif/GI
src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java
RuleOrganizer.getNameInCluster
private ArrayList<String> getNameInCluster(Cluster cluster) { ArrayList<String> itemsInCluster = new ArrayList<String>(); String nodeName; if (cluster.isLeaf()) { nodeName = cluster.getName(); itemsInCluster.add(nodeName); } else { // String[] clusterName = cluster.getNam...
java
private ArrayList<String> getNameInCluster(Cluster cluster) { ArrayList<String> itemsInCluster = new ArrayList<String>(); String nodeName; if (cluster.isLeaf()) { nodeName = cluster.getName(); itemsInCluster.add(nodeName); } else { // String[] clusterName = cluster.getNam...
[ "private", "ArrayList", "<", "String", ">", "getNameInCluster", "(", "Cluster", "cluster", ")", "{", "ArrayList", "<", "String", ">", "itemsInCluster", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "String", "nodeName", ";", "if", "(", "clust...
Finds out cluster names. @param cluster the cluster. @return pattern names.
[ "Finds", "out", "cluster", "names", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java#L474-L492
45,010
jMotif/GI
src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java
RuleOrganizer.SeparateMotifsByClustering
private ArrayList<SameLengthMotifs> SeparateMotifsByClustering(ArrayList<String[]> clusterTSIdx, SameLengthMotifs sameLenMotifs) { ArrayList<SameLengthMotifs> newResult = new ArrayList<SameLengthMotifs>(); if (clusterTSIdx.size() > 1) { ArrayList<SAXMotif> subsequences = sameLenMotifs.getSameLen...
java
private ArrayList<SameLengthMotifs> SeparateMotifsByClustering(ArrayList<String[]> clusterTSIdx, SameLengthMotifs sameLenMotifs) { ArrayList<SameLengthMotifs> newResult = new ArrayList<SameLengthMotifs>(); if (clusterTSIdx.size() > 1) { ArrayList<SAXMotif> subsequences = sameLenMotifs.getSameLen...
[ "private", "ArrayList", "<", "SameLengthMotifs", ">", "SeparateMotifsByClustering", "(", "ArrayList", "<", "String", "[", "]", ">", "clusterTSIdx", ",", "SameLengthMotifs", "sameLenMotifs", ")", "{", "ArrayList", "<", "SameLengthMotifs", ">", "newResult", "=", "new"...
Separates motifs via clustering. @param clusterTSIdx The index. @param sameLenMotifs the motif groups. @return same length motifs.
[ "Separates", "motifs", "via", "clustering", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/RuleOrganizer.java#L501-L535
45,011
btrplace/scheduler
btrpsl/src/main/java/org/btrplace/btrpsl/tree/ConstraintStatement.java
ConstraintStatement.go
@Override public BtrpOperand go(BtrPlaceTree parent) { String cname = getText(); if (catalog == null) { return ignoreError("No constraints available"); } SatConstraintBuilder b = catalog.getConstraint(cname); if (b == null) { ignoreError("Unknown cons...
java
@Override public BtrpOperand go(BtrPlaceTree parent) { String cname = getText(); if (catalog == null) { return ignoreError("No constraints available"); } SatConstraintBuilder b = catalog.getConstraint(cname); if (b == null) { ignoreError("Unknown cons...
[ "@", "Override", "public", "BtrpOperand", "go", "(", "BtrPlaceTree", "parent", ")", "{", "String", "cname", "=", "getText", "(", ")", ";", "if", "(", "catalog", "==", "null", ")", "{", "return", "ignoreError", "(", "\"No constraints available\"", ")", ";", ...
Build the constraint. The constraint is built if it exists in the catalog and if the parameters are compatible with the constraint signature. @param parent the parent of the root @return {@code Content.empty} if the constraint is successfully built. {@code Content.ignore} if an error occurred (the error is already rep...
[ "Build", "the", "constraint", ".", "The", "constraint", "is", "built", "if", "it", "exists", "in", "the", "catalog", "and", "if", "the", "parameters", "are", "compatible", "with", "the", "constraint", "signature", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/tree/ConstraintStatement.java#L67-L107
45,012
nikolavp/approval
approval-core/src/main/java/com/github/approval/reporters/ExecutableDifferenceReporter.java
ExecutableDifferenceReporter.runProcess
public static Process runProcess(String... cmdParts) throws IOException { return new ProcessBuilder(buildCommandline(cmdParts)) .inheritIO() .start(); }
java
public static Process runProcess(String... cmdParts) throws IOException { return new ProcessBuilder(buildCommandline(cmdParts)) .inheritIO() .start(); }
[ "public", "static", "Process", "runProcess", "(", "String", "...", "cmdParts", ")", "throws", "IOException", "{", "return", "new", "ProcessBuilder", "(", "buildCommandline", "(", "cmdParts", ")", ")", ".", "inheritIO", "(", ")", ".", "start", "(", ")", ";", ...
Execute a command with the following arguments. @param cmdParts the command parts @return the process for the command that was started @throws IOException if there were any I/O errors
[ "Execute", "a", "command", "with", "the", "following", "arguments", "." ]
5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8
https://github.com/nikolavp/approval/blob/5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8/approval-core/src/main/java/com/github/approval/reporters/ExecutableDifferenceReporter.java#L125-L129
45,013
nabedge/mixer2
src/main/java/org/mixer2/util/XMLStringUtil.java
XMLStringUtil.getXMLValidString
public static String getXMLValidString(final String input, final boolean replace, final char replacement) { if (input == null) { return null; } if ("".equals(input)) { return ""; } StringBuilder sb = new StringBuilder(); for (char c :...
java
public static String getXMLValidString(final String input, final boolean replace, final char replacement) { if (input == null) { return null; } if ("".equals(input)) { return ""; } StringBuilder sb = new StringBuilder(); for (char c :...
[ "public", "static", "String", "getXMLValidString", "(", "final", "String", "input", ",", "final", "boolean", "replace", ",", "final", "char", "replacement", ")", "{", "if", "(", "input", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "\"\...
Remove or replace XML invalid chars from input. @param input @param replace Whether or not to replace invalid characters by replacement @param replacement The character to replace any invalid character found @return The String that is cleaned from the invalid in XML characters. @see #isXMLValid(char)
[ "Remove", "or", "replace", "XML", "invalid", "chars", "from", "input", "." ]
8c2db27cfcd65bf0b1e0242ef9362ebd8033777c
https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/util/XMLStringUtil.java#L28-L47
45,014
m-m-m/util
io/src/main/java/net/sf/mmm/util/io/impl/PooledByteArray.java
PooledByteArray.release
public boolean release() { if (this.released) { // already (marked as) released... return false; } this.released = true; if (this.childCount == 0) { if (this.parent == null) { return true; } else { assert (this.parent.childCount > 0); this.par...
java
public boolean release() { if (this.released) { // already (marked as) released... return false; } this.released = true; if (this.childCount == 0) { if (this.parent == null) { return true; } else { assert (this.parent.childCount > 0); this.par...
[ "public", "boolean", "release", "(", ")", "{", "if", "(", "this", ".", "released", ")", "{", "// already (marked as) released...\r", "return", "false", ";", "}", "this", ".", "released", "=", "true", ";", "if", "(", "this", ".", "childCount", "==", "0", ...
This method marks this array to be released. @return {@code true} if this array can be released, {@code false} if there are references left that have to be released before.
[ "This", "method", "marks", "this", "array", "to", "be", "released", "." ]
f0e4e084448f8dfc83ca682a9e1618034a094ce6
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/io/src/main/java/net/sf/mmm/util/io/impl/PooledByteArray.java#L87-L106
45,015
nikolavp/approval
approval-core/src/main/java/com/github/approval/Approval.java
Approval.of
@Nonnull public static <T> ApprovalBuilder<T> of(Class<T> clazz) { return new ApprovalBuilder<T>(clazz); }
java
@Nonnull public static <T> ApprovalBuilder<T> of(Class<T> clazz) { return new ApprovalBuilder<T>(clazz); }
[ "@", "Nonnull", "public", "static", "<", "T", ">", "ApprovalBuilder", "<", "T", ">", "of", "(", "Class", "<", "T", ">", "clazz", ")", "{", "return", "new", "ApprovalBuilder", "<", "T", ">", "(", "clazz", ")", ";", "}" ]
Create a new approval builder that will be able to approve objects from the specified class type. @param clazz the class object for the things you will be approving @param <T> the type of the objects you will be approving @return an approval builder that will be able to construct an {@link Approval} for your objects
[ "Create", "a", "new", "approval", "builder", "that", "will", "be", "able", "to", "approve", "objects", "from", "the", "specified", "class", "type", "." ]
5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8
https://github.com/nikolavp/approval/blob/5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8/approval-core/src/main/java/com/github/approval/Approval.java#L78-L81
45,016
nikolavp/approval
approval-core/src/main/java/com/github/approval/Approval.java
Approval.getApprovalPath
@Nonnull public static Path getApprovalPath(Path filePath) { Pre.notNull(filePath, "filePath"); String s = filePath.toString(); int extensionIndex = s.lastIndexOf('.'); if (extensionIndex == -1) { return Paths.get(s + FOR_APPROVAL_EXTENSION); } int last...
java
@Nonnull public static Path getApprovalPath(Path filePath) { Pre.notNull(filePath, "filePath"); String s = filePath.toString(); int extensionIndex = s.lastIndexOf('.'); if (extensionIndex == -1) { return Paths.get(s + FOR_APPROVAL_EXTENSION); } int last...
[ "@", "Nonnull", "public", "static", "Path", "getApprovalPath", "(", "Path", "filePath", ")", "{", "Pre", ".", "notNull", "(", "filePath", ",", "\"filePath\"", ")", ";", "String", "s", "=", "filePath", ".", "toString", "(", ")", ";", "int", "extensionIndex"...
Get the path for approval from the original file path. @param filePath the original path to value @return the path for approval
[ "Get", "the", "path", "for", "approval", "from", "the", "original", "file", "path", "." ]
5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8
https://github.com/nikolavp/approval/blob/5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8/approval-core/src/main/java/com/github/approval/Approval.java#L89-L111
45,017
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/Point.java
Point.fromUniformlyDistributedRandomPoints
@Nonnull public static Point fromUniformlyDistributedRandomPoints(@Nonnull final Random randomGenerator) { checkNonnull("randomGenerator", randomGenerator); // Calculate uniformly distributed 3D point on sphere (radius = 1.0): // http://mathproofs.blogspot.co.il/2005/04/uniform-random-distr...
java
@Nonnull public static Point fromUniformlyDistributedRandomPoints(@Nonnull final Random randomGenerator) { checkNonnull("randomGenerator", randomGenerator); // Calculate uniformly distributed 3D point on sphere (radius = 1.0): // http://mathproofs.blogspot.co.il/2005/04/uniform-random-distr...
[ "@", "Nonnull", "public", "static", "Point", "fromUniformlyDistributedRandomPoints", "(", "@", "Nonnull", "final", "Random", "randomGenerator", ")", "{", "checkNonnull", "(", "\"randomGenerator\"", ",", "randomGenerator", ")", ";", "// Calculate uniformly distributed 3D poi...
Create a random point, uniformly distributed over the surface of the Earth. @param randomGenerator Random generator used to create a point. @return Random point with uniform distribution over the sphere.
[ "Create", "a", "random", "point", "uniformly", "distributed", "over", "the", "surface", "of", "the", "Earth", "." ]
f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Point.java#L138-L163
45,018
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/Point.java
Point.distanceInMeters
public static double distanceInMeters(@Nonnull final Point p1, @Nonnull final Point p2) { checkNonnull("p1", p1); checkNonnull("p2", p2); final Point from; final Point to; if (p1.getLonDeg() <= p2.getLonDeg()) { from = p1; to = p2; } else { ...
java
public static double distanceInMeters(@Nonnull final Point p1, @Nonnull final Point p2) { checkNonnull("p1", p1); checkNonnull("p2", p2); final Point from; final Point to; if (p1.getLonDeg() <= p2.getLonDeg()) { from = p1; to = p2; } else { ...
[ "public", "static", "double", "distanceInMeters", "(", "@", "Nonnull", "final", "Point", "p1", ",", "@", "Nonnull", "final", "Point", "p2", ")", "{", "checkNonnull", "(", "\"p1\"", ",", "p1", ")", ";", "checkNonnull", "(", "\"p2\"", ",", "p2", ")", ";", ...
Calculate the distance between two points. This algorithm does not take the curvature of the Earth into account, so it only works for small distance up to, say 200 km, and not too close to the poles. @param p1 Point 1. @param p2 Point 2. @return Straight distance between p1 and p2. Only accurate for small distances up...
[ "Calculate", "the", "distance", "between", "two", "points", ".", "This", "algorithm", "does", "not", "take", "the", "curvature", "of", "the", "Earth", "into", "account", "so", "it", "only", "works", "for", "small", "distance", "up", "to", "say", "200", "km...
f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Point.java#L173-L201
45,019
btrplace/scheduler
btrpsl/src/main/java/org/btrplace/btrpsl/constraint/migration/BeforeBuilder.java
BeforeBuilder.buildConstraint
@Override public List<? extends SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) { if (!checkConformance(t, args)) { return Collections.emptyList(); } // Get the first parameter @SuppressWarnings("unchecked") List<VM> s = (List<VM>) params[...
java
@Override public List<? extends SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) { if (!checkConformance(t, args)) { return Collections.emptyList(); } // Get the first parameter @SuppressWarnings("unchecked") List<VM> s = (List<VM>) params[...
[ "@", "Override", "public", "List", "<", "?", "extends", "SatConstraint", ">", "buildConstraint", "(", "BtrPlaceTree", "t", ",", "List", "<", "BtrpOperand", ">", "args", ")", "{", "if", "(", "!", "checkConformance", "(", "t", ",", "args", ")", ")", "{", ...
Build a precedence constraint. @param t the current tree @param args can be a non-empty set of vms ({@see Precedence} constraint) or a timestamp string ({@see Deadline} constraint) @return a constraint
[ "Build", "a", "precedence", "constraint", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/constraint/migration/BeforeBuilder.java#L61-L98
45,020
m-m-m/util
collection/src/main/java/net/sf/mmm/util/collection/base/BasicDoubleLinkedNode.java
BasicDoubleLinkedNode.remove
public void remove() { BasicDoubleLinkedNode<V> next = getNext(); if (next != null) { next.previous = this.previous; } if (this.previous != null) { this.previous.setNext(next); } }
java
public void remove() { BasicDoubleLinkedNode<V> next = getNext(); if (next != null) { next.previous = this.previous; } if (this.previous != null) { this.previous.setNext(next); } }
[ "public", "void", "remove", "(", ")", "{", "BasicDoubleLinkedNode", "<", "V", ">", "next", "=", "getNext", "(", ")", ";", "if", "(", "next", "!=", "null", ")", "{", "next", ".", "previous", "=", "this", ".", "previous", ";", "}", "if", "(", "this",...
This method removes this node from the double linked list.
[ "This", "method", "removes", "this", "node", "from", "the", "double", "linked", "list", "." ]
f0e4e084448f8dfc83ca682a9e1618034a094ce6
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/collection/src/main/java/net/sf/mmm/util/collection/base/BasicDoubleLinkedNode.java#L141-L150
45,021
btrplace/scheduler
api/src/main/java/org/btrplace/plan/event/MigrateVM.java
MigrateVM.applyAction
@Override public boolean applyAction(Model i) { Mapping c = i.getMapping(); return c.isRunning(vm) && c.getVMLocation(vm).equals(src) && !src.equals(dst) && c.addRunningVM(vm, dst); }
java
@Override public boolean applyAction(Model i) { Mapping c = i.getMapping(); return c.isRunning(vm) && c.getVMLocation(vm).equals(src) && !src.equals(dst) && c.addRunningVM(vm, dst); }
[ "@", "Override", "public", "boolean", "applyAction", "(", "Model", "i", ")", "{", "Mapping", "c", "=", "i", ".", "getMapping", "(", ")", ";", "return", "c", ".", "isRunning", "(", "vm", ")", "&&", "c", ".", "getVMLocation", "(", "vm", ")", ".", "eq...
Make the VM running on the destination node in the given model. @param i the model to alter with the action @return {@code true} iff the VM is running on the destination node
[ "Make", "the", "VM", "running", "on", "the", "destination", "node", "in", "the", "given", "model", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/plan/event/MigrateVM.java#L111-L118
45,022
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.resetCaches
public static void resetCaches(int size) { nodesCache = new LinkedHashMap<String, List<Node>>() { @Override protected boolean removeEldestEntry(Map.Entry<String, List<Node>> foo) { return size() == size; } }; vmsCache = new LinkedHashMap<Strin...
java
public static void resetCaches(int size) { nodesCache = new LinkedHashMap<String, List<Node>>() { @Override protected boolean removeEldestEntry(Map.Entry<String, List<Node>> foo) { return size() == size; } }; vmsCache = new LinkedHashMap<Strin...
[ "public", "static", "void", "resetCaches", "(", "int", "size", ")", "{", "nodesCache", "=", "new", "LinkedHashMap", "<", "String", ",", "List", "<", "Node", ">", ">", "(", ")", "{", "@", "Override", "protected", "boolean", "removeEldestEntry", "(", "Map", ...
Reset the cache of element sets. @param size the new cache size
[ "Reset", "the", "cache", "of", "element", "sets", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L68-L82
45,023
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredInt
public static int requiredInt(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return (Integer) o.get(id); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a int from string '" + id + "'", e); } ...
java
public static int requiredInt(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return (Integer) o.get(id); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a int from string '" + id + "'", e); } ...
[ "public", "static", "int", "requiredInt", "(", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "try", "{", "return", "(", "Integer", ")", "o", ".", "get", "(", "id", ")",...
Read an expected integer. @param o the object to parse @param id the key in the map that points to an integer @return the int @throws JSONConverterException if the key does not point to a int
[ "Read", "an", "expected", "integer", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L92-L99
45,024
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.optInt
public static int optInt(JSONObject o, String id, int def) throws JSONConverterException { if (o.containsKey(id)) { try { return (Integer) o.get(id); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a int from string '" + i...
java
public static int optInt(JSONObject o, String id, int def) throws JSONConverterException { if (o.containsKey(id)) { try { return (Integer) o.get(id); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a int from string '" + i...
[ "public", "static", "int", "optInt", "(", "JSONObject", "o", ",", "String", "id", ",", "int", "def", ")", "throws", "JSONConverterException", "{", "if", "(", "o", ".", "containsKey", "(", "id", ")", ")", "{", "try", "{", "return", "(", "Integer", ")", ...
Read an optional integer. @param o the object to parse @param id the key in the map that points to an integer @param def the default integer value if the key is absent @return the resulting integer @throws JSONConverterException if the key does not point to a int
[ "Read", "an", "optional", "integer", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L110-L119
45,025
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.checkKeys
public static void checkKeys(JSONObject o, String... keys) throws JSONConverterException { for (String k : keys) { if (!o.containsKey(k)) { throw new JSONConverterException("Missing key '" + k + "'"); } } }
java
public static void checkKeys(JSONObject o, String... keys) throws JSONConverterException { for (String k : keys) { if (!o.containsKey(k)) { throw new JSONConverterException("Missing key '" + k + "'"); } } }
[ "public", "static", "void", "checkKeys", "(", "JSONObject", "o", ",", "String", "...", "keys", ")", "throws", "JSONConverterException", "{", "for", "(", "String", "k", ":", "keys", ")", "{", "if", "(", "!", "o", ".", "containsKey", "(", "k", ")", ")", ...
Check if some keys are present. @param o the object to parse @param keys the keys to check @throws JSONConverterException when at least a key is missing
[ "Check", "if", "some", "keys", "are", "present", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L128-L134
45,026
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredString
public static String requiredString(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); return x.toString(); }
java
public static String requiredString(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); return x.toString(); }
[ "public", "static", "String", "requiredString", "(", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "Object", "x", "=", "o", ".", "get", "(", "id", ")", ";", "return", "...
Read an expected string. @param o the object to parse @param id the key in the map that points to the string @return the string @throws JSONConverterException if the key does not point to a string
[ "Read", "an", "expected", "string", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L144-L148
45,027
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredDouble
public static double requiredDouble(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof Number)) { throw new JSONConverterException("Number expected at key '" + id + "' but was '" + x.getClass() + "'."); } ...
java
public static double requiredDouble(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof Number)) { throw new JSONConverterException("Number expected at key '" + id + "' but was '" + x.getClass() + "'."); } ...
[ "public", "static", "double", "requiredDouble", "(", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "Object", "x", "=", "o", ".", "get", "(", "id", ")", ";", "if", "(", ...
Read an expected double. @param o the object to parse @param id the key in the map that points to the double @return the double @throws JSONConverterException if the key does not point to a double
[ "Read", "an", "expected", "double", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L158-L165
45,028
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredBoolean
public static boolean requiredBoolean(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof Boolean)) { throw new JSONConverterException("Boolean expected at key '" + id + "' but was '" + x.getClass() + "'."); } ...
java
public static boolean requiredBoolean(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof Boolean)) { throw new JSONConverterException("Boolean expected at key '" + id + "' but was '" + x.getClass() + "'."); } ...
[ "public", "static", "boolean", "requiredBoolean", "(", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "Object", "x", "=", "o", ".", "get", "(", "id", ")", ";", "if", "("...
Read an expected boolean. @param o the object to parse @param id the id in the map that should point to the boolean @return the boolean @throws org.btrplace.json.JSONConverterException if the key does not point to a boolean
[ "Read", "an", "expected", "boolean", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L175-L182
45,029
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.vmsFromJSON
public static List<VM> vmsFromJSON(Model mo, JSONArray a) throws JSONConverterException { String json = a.toJSONString(); List<VM> s = vmsCache.get(json); if (s != null) { return s; } s = new ArrayList<>(a.size()); for (Object o : a) { s.add(getVM(...
java
public static List<VM> vmsFromJSON(Model mo, JSONArray a) throws JSONConverterException { String json = a.toJSONString(); List<VM> s = vmsCache.get(json); if (s != null) { return s; } s = new ArrayList<>(a.size()); for (Object o : a) { s.add(getVM(...
[ "public", "static", "List", "<", "VM", ">", "vmsFromJSON", "(", "Model", "mo", ",", "JSONArray", "a", ")", "throws", "JSONConverterException", "{", "String", "json", "=", "a", ".", "toJSONString", "(", ")", ";", "List", "<", "VM", ">", "s", "=", "vmsCa...
Convert an array of VM identifiers to a set of VMs. This operation uses a cache of previously converted set of VMs. @param mo the associated model to browse @param a the json array @return the set of VMs
[ "Convert", "an", "array", "of", "VM", "identifiers", "to", "a", "set", "of", "VMs", ".", "This", "operation", "uses", "a", "cache", "of", "previously", "converted", "set", "of", "VMs", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L191-L203
45,030
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.nodesFromJSON
public static List<Node> nodesFromJSON(Model mo, JSONArray a) throws JSONConverterException { String json = a.toJSONString(); List<Node> s = nodesCache.get(json); if (s != null) { return s; } s = new ArrayList<>(a.size()); for (Object o : a) { s.ad...
java
public static List<Node> nodesFromJSON(Model mo, JSONArray a) throws JSONConverterException { String json = a.toJSONString(); List<Node> s = nodesCache.get(json); if (s != null) { return s; } s = new ArrayList<>(a.size()); for (Object o : a) { s.ad...
[ "public", "static", "List", "<", "Node", ">", "nodesFromJSON", "(", "Model", "mo", ",", "JSONArray", "a", ")", "throws", "JSONConverterException", "{", "String", "json", "=", "a", ".", "toJSONString", "(", ")", ";", "List", "<", "Node", ">", "s", "=", ...
Convert an array of VM identifiers to a set of VMs. This operation uses a cache of previously converted set of nodes. @param mo the associated model to browse @param a the json array @return the set of nodes
[ "Convert", "an", "array", "of", "VM", "identifiers", "to", "a", "set", "of", "VMs", ".", "This", "operation", "uses", "a", "cache", "of", "previously", "converted", "set", "of", "nodes", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L212-L224
45,031
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.vmsToJSON
public static JSONArray vmsToJSON(Collection<VM> s) { JSONArray a = new JSONArray(); for (Element e : s) { a.add(e.id()); } return a; }
java
public static JSONArray vmsToJSON(Collection<VM> s) { JSONArray a = new JSONArray(); for (Element e : s) { a.add(e.id()); } return a; }
[ "public", "static", "JSONArray", "vmsToJSON", "(", "Collection", "<", "VM", ">", "s", ")", "{", "JSONArray", "a", "=", "new", "JSONArray", "(", ")", ";", "for", "(", "Element", "e", ":", "s", ")", "{", "a", ".", "add", "(", "e", ".", "id", "(", ...
Convert a collection of VMs to an array of VM identifiers. @param s the VMs @return a json formatted array of integers
[ "Convert", "a", "collection", "of", "VMs", "to", "an", "array", "of", "VM", "identifiers", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L232-L238
45,032
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.nodesToJSON
public static JSONArray nodesToJSON(Collection<Node> s) { JSONArray a = new JSONArray(); for (Element e : s) { a.add(e.id()); } return a; }
java
public static JSONArray nodesToJSON(Collection<Node> s) { JSONArray a = new JSONArray(); for (Element e : s) { a.add(e.id()); } return a; }
[ "public", "static", "JSONArray", "nodesToJSON", "(", "Collection", "<", "Node", ">", "s", ")", "{", "JSONArray", "a", "=", "new", "JSONArray", "(", ")", ";", "for", "(", "Element", "e", ":", "s", ")", "{", "a", ".", "add", "(", "e", ".", "id", "(...
Convert a collection nodes to an array of nodes identifiers. @param s the VMs @return a json formatted array of integers
[ "Convert", "a", "collection", "nodes", "to", "an", "array", "of", "nodes", "identifiers", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L246-L252
45,033
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredVMs
public static List<VM> requiredVMs(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("integers expected at key '" + id + "'"); } return vmsFromJS...
java
public static List<VM> requiredVMs(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("integers expected at key '" + id + "'"); } return vmsFromJS...
[ "public", "static", "List", "<", "VM", ">", "requiredVMs", "(", "Model", "mo", ",", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "Object", "x", "=", "o", ".", "get", ...
Read an expected list of VMs. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the list @return the parsed list @throws JSONConverterException if the key does not point to a list of VM identifiers
[ "Read", "an", "expected", "list", "of", "VMs", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L263-L270
45,034
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredNodes
public static List<Node> requiredNodes(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("integers expected at key '" + id + "'"); } return nodes...
java
public static List<Node> requiredNodes(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("integers expected at key '" + id + "'"); } return nodes...
[ "public", "static", "List", "<", "Node", ">", "requiredNodes", "(", "Model", "mo", ",", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "Object", "x", "=", "o", ".", "get...
Read an expected list of nodes. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the list @return the parsed list @throws JSONConverterException if the key does not point to a list of nodes identifiers
[ "Read", "an", "expected", "list", "of", "nodes", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L281-L288
45,035
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredVMPart
public static Set<Collection<VM>> requiredVMPart(Model mo, JSONObject o, String id) throws JSONConverterException { Set<Collection<VM>> vms = new HashSet<>(); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("Set of identifiers sets expected at ...
java
public static Set<Collection<VM>> requiredVMPart(Model mo, JSONObject o, String id) throws JSONConverterException { Set<Collection<VM>> vms = new HashSet<>(); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("Set of identifiers sets expected at ...
[ "public", "static", "Set", "<", "Collection", "<", "VM", ">", ">", "requiredVMPart", "(", "Model", "mo", ",", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "Set", "<", "Collection", "<", "VM", ">>", "vms", "=", "ne...
Read partitions of VMs. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the partitions @return the parsed partition @throws JSONConverterException if the key does not point to partitions of VMs
[ "Read", "partitions", "of", "VMs", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L299-L309
45,036
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredNodePart
public static Set<Collection<Node>> requiredNodePart(Model mo, JSONObject o, String id) throws JSONConverterException { Set<Collection<Node>> nodes = new HashSet<>(); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("Set of identifiers sets expe...
java
public static Set<Collection<Node>> requiredNodePart(Model mo, JSONObject o, String id) throws JSONConverterException { Set<Collection<Node>> nodes = new HashSet<>(); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("Set of identifiers sets expe...
[ "public", "static", "Set", "<", "Collection", "<", "Node", ">", ">", "requiredNodePart", "(", "Model", "mo", ",", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "Set", "<", "Collection", "<", "Node", ">>", "nodes", "=...
Read partitions of nodes. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the partitions @return the parsed partition @throws JSONConverterException if the key does not point to partitions of nodes
[ "Read", "partitions", "of", "nodes", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L320-L330
45,037
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredVM
public static VM requiredVM(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return getVM(mo, (Integer) o.get(id)); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a VM identifier from string at k...
java
public static VM requiredVM(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return getVM(mo, (Integer) o.get(id)); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a VM identifier from string at k...
[ "public", "static", "VM", "requiredVM", "(", "Model", "mo", ",", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "try", "{", "return", "getVM", "(", "mo", ",", "(", "Inte...
Read an expected VM. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the VM identifier @return the VM @throws JSONConverterException if the key does not point to a VM identifier
[ "Read", "an", "expected", "VM", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L341-L348
45,038
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredNode
public static Node requiredNode(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return getNode(mo, (Integer) o.get(id)); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a Node identifier from str...
java
public static Node requiredNode(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return getNode(mo, (Integer) o.get(id)); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a Node identifier from str...
[ "public", "static", "Node", "requiredNode", "(", "Model", "mo", ",", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "try", "{", "return", "getNode", "(", "mo", ",", "(", ...
Read an expected node. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the node identifier @return the node @throws JSONConverterException if the key does not point to a node identifier
[ "Read", "an", "expected", "node", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L359-L366
45,039
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.getVM
public static VM getVM(Model mo, int vmID) throws JSONConverterException { VM vm = new VM(vmID); if (!mo.contains(vm)) { throw new JSONConverterException("Undeclared vm '" + vmID + "'"); } return vm; }
java
public static VM getVM(Model mo, int vmID) throws JSONConverterException { VM vm = new VM(vmID); if (!mo.contains(vm)) { throw new JSONConverterException("Undeclared vm '" + vmID + "'"); } return vm; }
[ "public", "static", "VM", "getVM", "(", "Model", "mo", ",", "int", "vmID", ")", "throws", "JSONConverterException", "{", "VM", "vm", "=", "new", "VM", "(", "vmID", ")", ";", "if", "(", "!", "mo", ".", "contains", "(", "vm", ")", ")", "{", "throw", ...
Get a VM from its identifier. The VM is already a part of the model. @param mo the associated model to browse @param vmID the node identifier @return the resulting VM @throws JSONConverterException if there is no model, or if the VM is unknown.
[ "Get", "a", "VM", "from", "its", "identifier", ".", "The", "VM", "is", "already", "a", "part", "of", "the", "model", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L377-L383
45,040
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.getNode
public static Node getNode(Model mo, int nodeID) throws JSONConverterException { Node n = new Node(nodeID); if (!mo.contains(n)) { throw new JSONConverterException("Undeclared node '" + nodeID + "'"); } return n; }
java
public static Node getNode(Model mo, int nodeID) throws JSONConverterException { Node n = new Node(nodeID); if (!mo.contains(n)) { throw new JSONConverterException("Undeclared node '" + nodeID + "'"); } return n; }
[ "public", "static", "Node", "getNode", "(", "Model", "mo", ",", "int", "nodeID", ")", "throws", "JSONConverterException", "{", "Node", "n", "=", "new", "Node", "(", "nodeID", ")", ";", "if", "(", "!", "mo", ".", "contains", "(", "n", ")", ")", "{", ...
Get a node from its identifier. The node is already a part of the model @param mo the associated model to browse @param nodeID the node identifier @return the resulting node @throws JSONConverterException if there is no model, or if the node is unknown.
[ "Get", "a", "node", "from", "its", "identifier", ".", "The", "node", "is", "already", "a", "part", "of", "the", "model" ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L394-L400
45,041
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/CMinMTTR.java
CMinMTTR.postCostConstraints
@Override public void postCostConstraints() { if (!costActivated) { costActivated = true; rp.getLogger().debug("Post the cost-oriented constraints"); List<IntVar> mttrs = Stream.concat(rp.getVMActions().stream(), rp.getNodeActions().stream()) .map(Tran...
java
@Override public void postCostConstraints() { if (!costActivated) { costActivated = true; rp.getLogger().debug("Post the cost-oriented constraints"); List<IntVar> mttrs = Stream.concat(rp.getVMActions().stream(), rp.getNodeActions().stream()) .map(Tran...
[ "@", "Override", "public", "void", "postCostConstraints", "(", ")", "{", "if", "(", "!", "costActivated", ")", "{", "costActivated", "=", "true", ";", "rp", ".", "getLogger", "(", ")", ".", "debug", "(", "\"Post the cost-oriented constraints\"", ")", ";", "L...
Post the constraints related to the objective.
[ "Post", "the", "constraints", "related", "to", "the", "objective", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/CMinMTTR.java#L205-L215
45,042
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/DataModel.java
DataModel.getDataFirstRecord
@SuppressWarnings("PointlessArithmeticExpression") int getDataFirstRecord(final int territoryNumber) { assert (0 <= territoryNumber) && (territoryNumber <= Territory.AAA.getNumber()); return index[territoryNumber + POS_INDEX_FIRST_RECORD]; }
java
@SuppressWarnings("PointlessArithmeticExpression") int getDataFirstRecord(final int territoryNumber) { assert (0 <= territoryNumber) && (territoryNumber <= Territory.AAA.getNumber()); return index[territoryNumber + POS_INDEX_FIRST_RECORD]; }
[ "@", "SuppressWarnings", "(", "\"PointlessArithmeticExpression\"", ")", "int", "getDataFirstRecord", "(", "final", "int", "territoryNumber", ")", "{", "assert", "(", "0", "<=", "territoryNumber", ")", "&&", "(", "territoryNumber", "<=", "Territory", ".", "AAA", "....
Low-level routines for data access.
[ "Low", "-", "level", "routines", "for", "data", "access", "." ]
f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/DataModel.java#L235-L239
45,043
btrplace/scheduler
btrpsl/src/main/java/org/btrplace/btrpsl/includes/PathBasedIncludes.java
PathBasedIncludes.getScripts
@Override public List<Script> getScripts(String name) throws ScriptBuilderException { List<Script> scripts = new ArrayList<>(); if (!name.endsWith(".*")) { String toSearch = name.replaceAll("\\.", File.separator) + Script.EXTENSION; for (File path : paths) { ...
java
@Override public List<Script> getScripts(String name) throws ScriptBuilderException { List<Script> scripts = new ArrayList<>(); if (!name.endsWith(".*")) { String toSearch = name.replaceAll("\\.", File.separator) + Script.EXTENSION; for (File path : paths) { ...
[ "@", "Override", "public", "List", "<", "Script", ">", "getScripts", "(", "String", "name", ")", "throws", "ScriptBuilderException", "{", "List", "<", "Script", ">", "scripts", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "!", "name", ".", ...
Get the script associated to a given identifier by browsing the given paths. The first script having a matching identifier is selected, whatever the parsing process result will be @param name the identifier of the script @return the script if found @throws org.btrplace.btrpsl.ScriptBuilderException if the builder was ...
[ "Get", "the", "script", "associated", "to", "a", "given", "identifier", "by", "browsing", "the", "given", "paths", ".", "The", "first", "script", "having", "a", "matching", "identifier", "is", "selected", "whatever", "the", "parsing", "process", "result", "wil...
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/includes/PathBasedIncludes.java#L67-L111
45,044
btrplace/scheduler
api/src/main/java/org/btrplace/model/view/VMConsumptionComparator.java
VMConsumptionComparator.append
public VMConsumptionComparator append(ShareableResource r, boolean asc) { rcs.add(r); ascs.add(asc ? 1 : -1); return this; }
java
public VMConsumptionComparator append(ShareableResource r, boolean asc) { rcs.add(r); ascs.add(asc ? 1 : -1); return this; }
[ "public", "VMConsumptionComparator", "append", "(", "ShareableResource", "r", ",", "boolean", "asc", ")", "{", "rcs", ".", "add", "(", "r", ")", ";", "ascs", ".", "add", "(", "asc", "?", "1", ":", "-", "1", ")", ";", "return", "this", ";", "}" ]
Append a new resource to use to make the comparison @param r the resource to add @param asc {@code true} for an ascending comparison @return the current comparator
[ "Append", "a", "new", "resource", "to", "use", "to", "make", "the", "comparison" ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/VMConsumptionComparator.java#L77-L81
45,045
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.register
public void register(RoutingConverter<? extends Routing> r) { java2json.put(r.getSupportedRouting(), r); json2java.put(r.getJSONId(), r); }
java
public void register(RoutingConverter<? extends Routing> r) { java2json.put(r.getSupportedRouting(), r); json2java.put(r.getJSONId(), r); }
[ "public", "void", "register", "(", "RoutingConverter", "<", "?", "extends", "Routing", ">", "r", ")", "{", "java2json", ".", "put", "(", "r", ".", "getSupportedRouting", "(", ")", ",", "r", ")", ";", "json2java", ".", "put", "(", "r", ".", "getJSONId",...
Register a routing converter. @param r the converter to register
[ "Register", "a", "routing", "converter", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L82-L85
45,046
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.switchToJSON
public JSONObject switchToJSON(Switch s) { JSONObject o = new JSONObject(); o.put("id", s.id()); o.put(CAPACITY_LABEL, s.getCapacity()); return o; }
java
public JSONObject switchToJSON(Switch s) { JSONObject o = new JSONObject(); o.put("id", s.id()); o.put(CAPACITY_LABEL, s.getCapacity()); return o; }
[ "public", "JSONObject", "switchToJSON", "(", "Switch", "s", ")", "{", "JSONObject", "o", "=", "new", "JSONObject", "(", ")", ";", "o", ".", "put", "(", "\"id\"", ",", "s", ".", "id", "(", ")", ")", ";", "o", ".", "put", "(", "CAPACITY_LABEL", ",", ...
Convert a Switch to a JSON object. @param s the switch to convert @return the JSON object
[ "Convert", "a", "Switch", "to", "a", "JSON", "object", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L124-L129
45,047
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.switchesToJSON
public JSONArray switchesToJSON(Collection<Switch> c) { JSONArray a = new JSONArray(); for (Switch s : c) { a.add(switchToJSON(s)); } return a; }
java
public JSONArray switchesToJSON(Collection<Switch> c) { JSONArray a = new JSONArray(); for (Switch s : c) { a.add(switchToJSON(s)); } return a; }
[ "public", "JSONArray", "switchesToJSON", "(", "Collection", "<", "Switch", ">", "c", ")", "{", "JSONArray", "a", "=", "new", "JSONArray", "(", ")", ";", "for", "(", "Switch", "s", ":", "c", ")", "{", "a", ".", "add", "(", "switchToJSON", "(", "s", ...
Convert a collection of switches to an array of JSON switches objects. @param c the collection of Switches @return a json formatted array of Switches
[ "Convert", "a", "collection", "of", "switches", "to", "an", "array", "of", "JSON", "switches", "objects", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L137-L143
45,048
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.physicalElementToJSON
public JSONObject physicalElementToJSON(PhysicalElement pe) { JSONObject o = new JSONObject(); if (pe instanceof Node) { o.put("type", NODE_LABEL); o.put("id", ((Node) pe).id()); } else if (pe instanceof Switch) { o.put("type", SWITCH_LABEL); o.put...
java
public JSONObject physicalElementToJSON(PhysicalElement pe) { JSONObject o = new JSONObject(); if (pe instanceof Node) { o.put("type", NODE_LABEL); o.put("id", ((Node) pe).id()); } else if (pe instanceof Switch) { o.put("type", SWITCH_LABEL); o.put...
[ "public", "JSONObject", "physicalElementToJSON", "(", "PhysicalElement", "pe", ")", "{", "JSONObject", "o", "=", "new", "JSONObject", "(", ")", ";", "if", "(", "pe", "instanceof", "Node", ")", "{", "o", ".", "put", "(", "\"type\"", ",", "NODE_LABEL", ")", ...
Convert a PhysicalElement to a JSON object. @param pe the physical element to convert @return the JSON object @throws IllegalArgumentException if the physical element is not supported
[ "Convert", "a", "PhysicalElement", "to", "a", "JSON", "object", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L152-L164
45,049
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.linkToJSON
public JSONObject linkToJSON(Link s) { JSONObject o = new JSONObject(); o.put("id", s.id()); o.put(CAPACITY_LABEL, s.getCapacity()); o.put(SWITCH_LABEL, s.getSwitch().id()); o.put("physicalElement", physicalElementToJSON(s.getElement())); return o; }
java
public JSONObject linkToJSON(Link s) { JSONObject o = new JSONObject(); o.put("id", s.id()); o.put(CAPACITY_LABEL, s.getCapacity()); o.put(SWITCH_LABEL, s.getSwitch().id()); o.put("physicalElement", physicalElementToJSON(s.getElement())); return o; }
[ "public", "JSONObject", "linkToJSON", "(", "Link", "s", ")", "{", "JSONObject", "o", "=", "new", "JSONObject", "(", ")", ";", "o", ".", "put", "(", "\"id\"", ",", "s", ".", "id", "(", ")", ")", ";", "o", ".", "put", "(", "CAPACITY_LABEL", ",", "s...
Convert a Link to a JSON object. @param s the switch to convert @return the JSON object
[ "Convert", "a", "Link", "to", "a", "JSON", "object", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L172-L179
45,050
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.linksToJSON
public JSONArray linksToJSON(Collection<Link> c) { JSONArray a = new JSONArray(); for (Link l : c) { a.add(linkToJSON(l)); } return a; }
java
public JSONArray linksToJSON(Collection<Link> c) { JSONArray a = new JSONArray(); for (Link l : c) { a.add(linkToJSON(l)); } return a; }
[ "public", "JSONArray", "linksToJSON", "(", "Collection", "<", "Link", ">", "c", ")", "{", "JSONArray", "a", "=", "new", "JSONArray", "(", ")", ";", "for", "(", "Link", "l", ":", "c", ")", "{", "a", ".", "add", "(", "linkToJSON", "(", "l", ")", ")...
Convert a collection of links to an array of JSON links objects. @param c the collection of Links @return a JSON formatted array of Links
[ "Convert", "a", "collection", "of", "links", "to", "an", "array", "of", "JSON", "links", "objects", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L187-L193
45,051
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.routingFromJSON
public Routing routingFromJSON(Model mo, JSONObject o) throws JSONConverterException { String type = requiredString(o, "type"); RoutingConverter<? extends Routing> c = json2java.get(type); if (c == null) { throw new JSONConverterException("No converter available for a routing of typ...
java
public Routing routingFromJSON(Model mo, JSONObject o) throws JSONConverterException { String type = requiredString(o, "type"); RoutingConverter<? extends Routing> c = json2java.get(type); if (c == null) { throw new JSONConverterException("No converter available for a routing of typ...
[ "public", "Routing", "routingFromJSON", "(", "Model", "mo", ",", "JSONObject", "o", ")", "throws", "JSONConverterException", "{", "String", "type", "=", "requiredString", "(", "o", ",", "\"type\"", ")", ";", "RoutingConverter", "<", "?", "extends", "Routing", ...
Convert a JSON routing object into the corresponding java Routing implementation. @param o the JSON object to convert @throws JSONConverterException if the Routing implementation is not known
[ "Convert", "a", "JSON", "routing", "object", "into", "the", "corresponding", "java", "Routing", "implementation", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L217-L225
45,052
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.switchFromJSON
public Switch switchFromJSON(JSONObject o) throws JSONConverterException { return new Switch(requiredInt(o, "id"), readCapacity(o)); }
java
public Switch switchFromJSON(JSONObject o) throws JSONConverterException { return new Switch(requiredInt(o, "id"), readCapacity(o)); }
[ "public", "Switch", "switchFromJSON", "(", "JSONObject", "o", ")", "throws", "JSONConverterException", "{", "return", "new", "Switch", "(", "requiredInt", "(", "o", ",", "\"id\"", ")", ",", "readCapacity", "(", "o", ")", ")", ";", "}" ]
Convert a JSON switch object to a Switch. @param o the json object @return the Switch
[ "Convert", "a", "JSON", "switch", "object", "to", "a", "Switch", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L233-L235
45,053
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.switchesFromJSON
public void switchesFromJSON(Network net, JSONArray a) throws JSONConverterException { for (Object o : a) { net.newSwitch(requiredInt((JSONObject) o, "id"), readCapacity((JSONObject) o)); } }
java
public void switchesFromJSON(Network net, JSONArray a) throws JSONConverterException { for (Object o : a) { net.newSwitch(requiredInt((JSONObject) o, "id"), readCapacity((JSONObject) o)); } }
[ "public", "void", "switchesFromJSON", "(", "Network", "net", ",", "JSONArray", "a", ")", "throws", "JSONConverterException", "{", "for", "(", "Object", "o", ":", "a", ")", "{", "net", ".", "newSwitch", "(", "requiredInt", "(", "(", "JSONObject", ")", "o", ...
Convert a JSON array of switches to a Java List of switches. @param net the network to populate @param a the json array
[ "Convert", "a", "JSON", "array", "of", "switches", "to", "a", "Java", "List", "of", "switches", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L242-L246
45,054
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.physicalElementFromJSON
public PhysicalElement physicalElementFromJSON(Model mo, Network net, JSONObject o) throws JSONConverterException { String type = requiredString(o, "type"); switch (type) { case NODE_LABEL: return requiredNode(mo, o, "id"); case SWITCH_LABEL: retur...
java
public PhysicalElement physicalElementFromJSON(Model mo, Network net, JSONObject o) throws JSONConverterException { String type = requiredString(o, "type"); switch (type) { case NODE_LABEL: return requiredNode(mo, o, "id"); case SWITCH_LABEL: retur...
[ "public", "PhysicalElement", "physicalElementFromJSON", "(", "Model", "mo", ",", "Network", "net", ",", "JSONObject", "o", ")", "throws", "JSONConverterException", "{", "String", "type", "=", "requiredString", "(", "o", ",", "\"type\"", ")", ";", "switch", "(", ...
Convert a JSON physical element object to a Java PhysicalElement object. @param o the JSON object to convert the physical element to convert @return the PhysicalElement
[ "Convert", "a", "JSON", "physical", "element", "object", "to", "a", "Java", "PhysicalElement", "object", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L262-L272
45,055
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.linkFromJSON
public void linkFromJSON(Model mo, Network net, JSONObject o) throws JSONConverterException { net.connect(requiredInt(o, "id"), readCapacity(o), getSwitch(net, requiredInt(o, SWITCH_LABEL)), physicalElementFromJSON(mo, net, (JSONObject) o.get("physicalElement")) ...
java
public void linkFromJSON(Model mo, Network net, JSONObject o) throws JSONConverterException { net.connect(requiredInt(o, "id"), readCapacity(o), getSwitch(net, requiredInt(o, SWITCH_LABEL)), physicalElementFromJSON(mo, net, (JSONObject) o.get("physicalElement")) ...
[ "public", "void", "linkFromJSON", "(", "Model", "mo", ",", "Network", "net", ",", "JSONObject", "o", ")", "throws", "JSONConverterException", "{", "net", ".", "connect", "(", "requiredInt", "(", "o", ",", "\"id\"", ")", ",", "readCapacity", "(", "o", ")", ...
Convert a JSON link object into a Java Link object. @param net the network to populate @param o the JSON object to convert
[ "Convert", "a", "JSON", "link", "object", "into", "a", "Java", "Link", "object", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L288-L294
45,056
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java
NetworkConverter.linksFromJSON
public void linksFromJSON(Model mo, Network net, JSONArray a) throws JSONConverterException { for (Object o : a) { linkFromJSON(mo, net, (JSONObject) o); } }
java
public void linksFromJSON(Model mo, Network net, JSONArray a) throws JSONConverterException { for (Object o : a) { linkFromJSON(mo, net, (JSONObject) o); } }
[ "public", "void", "linksFromJSON", "(", "Model", "mo", ",", "Network", "net", ",", "JSONArray", "a", ")", "throws", "JSONConverterException", "{", "for", "(", "Object", "o", ":", "a", ")", "{", "linkFromJSON", "(", "mo", ",", "net", ",", "(", "JSONObject...
Convert a JSON array of links to a Java List of links. @param net the network to populate @param a the json array
[ "Convert", "a", "JSON", "array", "of", "links", "to", "a", "Java", "List", "of", "links", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L302-L306
45,057
btrplace/scheduler
examples/src/main/java/org/btrplace/examples/GettingStarted.java
GettingStarted.makeConstraints
public List<SatConstraint> makeConstraints() { List<SatConstraint> cstrs = new ArrayList<>(); //VM1 and VM2 must be running on distinct nodes cstrs.add(new Spread(new HashSet<>(Arrays.asList(vms.get(1), vms.get(2))))); //VM0 must have at least 3 virtual CPU dedicated to it cstrs...
java
public List<SatConstraint> makeConstraints() { List<SatConstraint> cstrs = new ArrayList<>(); //VM1 and VM2 must be running on distinct nodes cstrs.add(new Spread(new HashSet<>(Arrays.asList(vms.get(1), vms.get(2))))); //VM0 must have at least 3 virtual CPU dedicated to it cstrs...
[ "public", "List", "<", "SatConstraint", ">", "makeConstraints", "(", ")", "{", "List", "<", "SatConstraint", ">", "cstrs", "=", "new", "ArrayList", "<>", "(", ")", ";", "//VM1 and VM2 must be running on distinct nodes", "cstrs", ".", "add", "(", "new", "Spread",...
Declare some constraints.
[ "Declare", "some", "constraints", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/examples/src/main/java/org/btrplace/examples/GettingStarted.java#L105-L124
45,058
m-m-m/util
text/src/main/java/net/sf/mmm/util/text/base/DefaultLineWrapper.java
DefaultLineWrapper.verifyWithOfColumns
private boolean verifyWithOfColumns(ColumnState[] columnStates, TextTableInfo tableInfo) { int tableWidth = tableInfo.getWidth(); if (tableWidth != TextColumnInfo.WIDTH_AUTO_ADJUST) { int calculatedWidth = 0; for (ColumnState columnState : columnStates) { if (columnState.width < 0) { ...
java
private boolean verifyWithOfColumns(ColumnState[] columnStates, TextTableInfo tableInfo) { int tableWidth = tableInfo.getWidth(); if (tableWidth != TextColumnInfo.WIDTH_AUTO_ADJUST) { int calculatedWidth = 0; for (ColumnState columnState : columnStates) { if (columnState.width < 0) { ...
[ "private", "boolean", "verifyWithOfColumns", "(", "ColumnState", "[", "]", "columnStates", ",", "TextTableInfo", "tableInfo", ")", "{", "int", "tableWidth", "=", "tableInfo", ".", "getWidth", "(", ")", ";", "if", "(", "tableWidth", "!=", "TextColumnInfo", ".", ...
This method verifies that the width of the columns are sane. @param columnStates are the {@link ColumnState}s. @param tableInfo is the {@link TextTableInfo}. @return {@code true} if the width is sane, {@code false} otherwise.
[ "This", "method", "verifies", "that", "the", "width", "of", "the", "columns", "are", "sane", "." ]
f0e4e084448f8dfc83ca682a9e1618034a094ce6
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/text/src/main/java/net/sf/mmm/util/text/base/DefaultLineWrapper.java#L258-L276
45,059
btrplace/scheduler
api/src/main/java/org/btrplace/model/view/network/Network.java
Network.newSwitch
public Switch newSwitch(int id, int capacity) { Switch s = swBuilder.newSwitch(id, capacity); switches.add(s); return s; }
java
public Switch newSwitch(int id, int capacity) { Switch s = swBuilder.newSwitch(id, capacity); switches.add(s); return s; }
[ "public", "Switch", "newSwitch", "(", "int", "id", ",", "int", "capacity", ")", "{", "Switch", "s", "=", "swBuilder", ".", "newSwitch", "(", "id", ",", "capacity", ")", ";", "switches", ".", "add", "(", "s", ")", ";", "return", "s", ";", "}" ]
Create a new switch with a specific identifier and a given maximal capacity @param id the switch identifier @param capacity the switch maximal capacity (put a nul or negative number for non-blocking switch) @return the switch
[ "Create", "a", "new", "switch", "with", "a", "specific", "identifier", "and", "a", "given", "maximal", "capacity" ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/Network.java#L140-L144
45,060
btrplace/scheduler
api/src/main/java/org/btrplace/model/view/network/Network.java
Network.connect
public List<Link> connect(int bandwidth, Switch sw, Node... nodes) { List<Link> l = new ArrayList<>(); for (Node n : nodes) { l.add(connect(bandwidth, sw, n)); } return l; }
java
public List<Link> connect(int bandwidth, Switch sw, Node... nodes) { List<Link> l = new ArrayList<>(); for (Node n : nodes) { l.add(connect(bandwidth, sw, n)); } return l; }
[ "public", "List", "<", "Link", ">", "connect", "(", "int", "bandwidth", ",", "Switch", "sw", ",", "Node", "...", "nodes", ")", "{", "List", "<", "Link", ">", "l", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Node", "n", ":", "nodes"...
Create connections between a single switch and multiple nodes @param bandwidth the maximal bandwidth for the connection @param sw the switch to connect @param nodes a list of nodes to connect @return a list of links
[ "Create", "connections", "between", "a", "single", "switch", "and", "multiple", "nodes" ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/Network.java#L236-L242
45,061
btrplace/scheduler
api/src/main/java/org/btrplace/model/view/network/Network.java
Network.getConnectedLinks
public List<Link> getConnectedLinks(PhysicalElement pe) { List<Link> myLinks = new ArrayList<>(); for (Link l : this.links) { if (l.getElement().equals(pe)) { myLinks.add(l); } else if (l.getSwitch().equals(pe)) { myLinks.add(l); } ...
java
public List<Link> getConnectedLinks(PhysicalElement pe) { List<Link> myLinks = new ArrayList<>(); for (Link l : this.links) { if (l.getElement().equals(pe)) { myLinks.add(l); } else if (l.getSwitch().equals(pe)) { myLinks.add(l); } ...
[ "public", "List", "<", "Link", ">", "getConnectedLinks", "(", "PhysicalElement", "pe", ")", "{", "List", "<", "Link", ">", "myLinks", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Link", "l", ":", "this", ".", "links", ")", "{", "if", ...
Get the list of links connected to a given physical element @param pe the physical element @return the list of links
[ "Get", "the", "list", "of", "links", "connected", "to", "a", "given", "physical", "element" ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/Network.java#L277-L287
45,062
btrplace/scheduler
api/src/main/java/org/btrplace/model/view/network/Network.java
Network.getConnectedNodes
public List<Node> getConnectedNodes() { List<Node> nodes = new ArrayList<>(); for (Link l : links) { if (l.getElement() instanceof Node) { nodes.add((Node) l.getElement()); } } return nodes; }
java
public List<Node> getConnectedNodes() { List<Node> nodes = new ArrayList<>(); for (Link l : links) { if (l.getElement() instanceof Node) { nodes.add((Node) l.getElement()); } } return nodes; }
[ "public", "List", "<", "Node", ">", "getConnectedNodes", "(", ")", "{", "List", "<", "Node", ">", "nodes", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Link", "l", ":", "links", ")", "{", "if", "(", "l", ".", "getElement", "(", ")",...
Get the full list of nodes that have been connected into the network @return the list of nodes
[ "Get", "the", "full", "list", "of", "nodes", "that", "have", "been", "connected", "into", "the", "network" ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/Network.java#L294-L302
45,063
protegeproject/jpaul
src/main/java/jpaul/Constraints/SetConstraints/SetConstraints.java
SetConstraints.addInclusion
public void addInclusion(SVar<T> s1, SVar<T> s2) { this.add(new LtConstraint<SVar<T>,Set<T>>(s1, s2)); }
java
public void addInclusion(SVar<T> s1, SVar<T> s2) { this.add(new LtConstraint<SVar<T>,Set<T>>(s1, s2)); }
[ "public", "void", "addInclusion", "(", "SVar", "<", "T", ">", "s1", ",", "SVar", "<", "T", ">", "s2", ")", "{", "this", ".", "add", "(", "new", "LtConstraint", "<", "SVar", "<", "T", ">", ",", "Set", "<", "T", ">", ">", "(", "s1", ",", "s2", ...
Adds an inclusion constraints between two sets.
[ "Adds", "an", "inclusion", "constraints", "between", "two", "sets", "." ]
db579ffb16faaa4b0c577ec82c246f7349427714
https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Constraints/SetConstraints/SetConstraints.java#L26-L28
45,064
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/RandomVMPlacement.java
RandomVMPlacement.randomWithRankedValues
private int randomWithRankedValues(IntVar x) { TIntArrayList[] values = new TIntArrayList[ranks.length]; DisposableValueIterator ite = x.getValueIterator(true); try { while (ite.hasNext()) { int v = ite.next(); int i; for (i = 0; i < ...
java
private int randomWithRankedValues(IntVar x) { TIntArrayList[] values = new TIntArrayList[ranks.length]; DisposableValueIterator ite = x.getValueIterator(true); try { while (ite.hasNext()) { int v = ite.next(); int i; for (i = 0; i < ...
[ "private", "int", "randomWithRankedValues", "(", "IntVar", "x", ")", "{", "TIntArrayList", "[", "]", "values", "=", "new", "TIntArrayList", "[", "ranks", ".", "length", "]", ";", "DisposableValueIterator", "ite", "=", "x", ".", "getValueIterator", "(", "true",...
Random value but that consider the rank of nodes. So values are picked up from the first rank possible.
[ "Random", "value", "but", "that", "consider", "the", "rank", "of", "nodes", ".", "So", "values", "are", "picked", "up", "from", "the", "first", "rank", "possible", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/RandomVMPlacement.java#L121-L151
45,065
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/RandomVMPlacement.java
RandomVMPlacement.randomValue
private int randomValue(IntVar x) { int i = rnd.nextInt(x.getDomainSize()); DisposableValueIterator ite = x.getValueIterator(true); int pos = -1; try { while (i >= 0) { pos = ite.next(); i--; } } finally { ite.di...
java
private int randomValue(IntVar x) { int i = rnd.nextInt(x.getDomainSize()); DisposableValueIterator ite = x.getValueIterator(true); int pos = -1; try { while (i >= 0) { pos = ite.next(); i--; } } finally { ite.di...
[ "private", "int", "randomValue", "(", "IntVar", "x", ")", "{", "int", "i", "=", "rnd", ".", "nextInt", "(", "x", ".", "getDomainSize", "(", ")", ")", ";", "DisposableValueIterator", "ite", "=", "x", ".", "getValueIterator", "(", "true", ")", ";", "int"...
Pick a random value inside the variable domain.
[ "Pick", "a", "random", "value", "inside", "the", "variable", "domain", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/RandomVMPlacement.java#L156-L169
45,066
jMotif/GI
src/main/java/net/seninp/gi/sequitur/SequiturFactory.java
SequiturFactory.runSequitur
public static SAXRule runSequitur(String inputString) throws Exception { LOGGER.trace("digesting the string " + inputString); // clear global collections // SAXRule.numRules = new AtomicInteger(0); SAXRule.theRules.clear(); SAXSymbol.theDigrams.clear(); SAXSymbol.theSubstituteTable.clear()...
java
public static SAXRule runSequitur(String inputString) throws Exception { LOGGER.trace("digesting the string " + inputString); // clear global collections // SAXRule.numRules = new AtomicInteger(0); SAXRule.theRules.clear(); SAXSymbol.theDigrams.clear(); SAXSymbol.theSubstituteTable.clear()...
[ "public", "static", "SAXRule", "runSequitur", "(", "String", "inputString", ")", "throws", "Exception", "{", "LOGGER", ".", "trace", "(", "\"digesting the string \"", "+", "inputString", ")", ";", "// clear global collections", "//", "SAXRule", ".", "numRules", "=",...
Digests a string of terminals separated by a space. @param inputString the string to digest. @return The top rule handler (i.e. R0). @throws Exception if error occurs.
[ "Digests", "a", "string", "of", "terminals", "separated", "by", "a", "space", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SequiturFactory.java#L49-L97
45,067
jMotif/GI
src/main/java/net/seninp/gi/sequitur/SequiturFactory.java
SequiturFactory.series2SequiturRules
public static GrammarRules series2SequiturRules(double[] timeseries, int saxWindowSize, int saxPAASize, int saxAlphabetSize, NumerosityReductionStrategy numerosityReductionStrategy, double normalizationThreshold) throws Exception, IOException { LOGGER.debug("Discretizing time series..."); SAXRecor...
java
public static GrammarRules series2SequiturRules(double[] timeseries, int saxWindowSize, int saxPAASize, int saxAlphabetSize, NumerosityReductionStrategy numerosityReductionStrategy, double normalizationThreshold) throws Exception, IOException { LOGGER.debug("Discretizing time series..."); SAXRecor...
[ "public", "static", "GrammarRules", "series2SequiturRules", "(", "double", "[", "]", "timeseries", ",", "int", "saxWindowSize", ",", "int", "saxPAASize", ",", "int", "saxAlphabetSize", ",", "NumerosityReductionStrategy", "numerosityReductionStrategy", ",", "double", "no...
Takes a time series and returns a grammar. @param timeseries the input time series. @param saxWindowSize the sliding window size. @param saxPAASize the PAA num. @param saxAlphabetSize the SAX alphabet size. @param numerosityReductionStrategy the SAX Numerosity Reduction strategy. @param normalizationThreshold the SAX ...
[ "Takes", "a", "time", "series", "and", "returns", "a", "grammar", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SequiturFactory.java#L112-L155
45,068
jMotif/GI
src/main/java/net/seninp/gi/sequitur/SequiturFactory.java
SequiturFactory.getRulePositionsByRuleNum
public static ArrayList<RuleInterval> getRulePositionsByRuleNum(int ruleIdx, SAXRule grammar, SAXRecords saxFrequencyData, double[] originalTimeSeries, int saxWindowSize) { // this will be the result ArrayList<RuleInterval> resultIntervals = new ArrayList<RuleInterval>(); // the rule container G...
java
public static ArrayList<RuleInterval> getRulePositionsByRuleNum(int ruleIdx, SAXRule grammar, SAXRecords saxFrequencyData, double[] originalTimeSeries, int saxWindowSize) { // this will be the result ArrayList<RuleInterval> resultIntervals = new ArrayList<RuleInterval>(); // the rule container G...
[ "public", "static", "ArrayList", "<", "RuleInterval", ">", "getRulePositionsByRuleNum", "(", "int", "ruleIdx", ",", "SAXRule", "grammar", ",", "SAXRecords", "saxFrequencyData", ",", "double", "[", "]", "originalTimeSeries", ",", "int", "saxWindowSize", ")", "{", "...
Recovers start and stop coordinates of a rule subsequences. @param ruleIdx The rule index. @param grammar The grammar to analyze. @param saxFrequencyData the SAX frquency data used for the grammar construction. @param originalTimeSeries the original time series. @param saxWindowSize the SAX sliding window size. @retur...
[ "Recovers", "start", "and", "stop", "coordinates", "of", "a", "rule", "subsequences", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SequiturFactory.java#L236-L285
45,069
btrplace/scheduler
api/src/main/java/org/btrplace/model/constraint/Preserve.java
Preserve.newPreserve
public static List<Preserve> newPreserve(Collection<VM> vms, String r, int q) { return vms.stream().map(v -> new Preserve(v, r, q)).collect(Collectors.toList()); }
java
public static List<Preserve> newPreserve(Collection<VM> vms, String r, int q) { return vms.stream().map(v -> new Preserve(v, r, q)).collect(Collectors.toList()); }
[ "public", "static", "List", "<", "Preserve", ">", "newPreserve", "(", "Collection", "<", "VM", ">", "vms", ",", "String", "r", ",", "int", "q", ")", "{", "return", "vms", ".", "stream", "(", ")", ".", "map", "(", "v", "->", "new", "Preserve", "(", ...
Make multiple constraints @param vms the VMs involved in the constraints @param r the resource identifier @param q the the minimum amount of resources to allocate to each VM. >= 0 @return a list of constraints
[ "Make", "multiple", "constraints" ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/constraint/Preserve.java#L133-L135
45,070
protegeproject/jpaul
src/main/java/jpaul/DataStructs/UnionFind.java
UnionFind._link
private Node<E> _link(Node<E> node1, Node<E> node2) { // maybe there is no real unification here if(node1 == node2) return node2; // from now on, we know that we unify really disjoint trees if(node1.rank > node2.rank) { node2.parent = node1; node1.nbElems += node2.nbElems; return node1; } else { ...
java
private Node<E> _link(Node<E> node1, Node<E> node2) { // maybe there is no real unification here if(node1 == node2) return node2; // from now on, we know that we unify really disjoint trees if(node1.rank > node2.rank) { node2.parent = node1; node1.nbElems += node2.nbElems; return node1; } else { ...
[ "private", "Node", "<", "E", ">", "_link", "(", "Node", "<", "E", ">", "node1", ",", "Node", "<", "E", ">", "node2", ")", "{", "// maybe there is no real unification here", "if", "(", "node1", "==", "node2", ")", "return", "node2", ";", "// from now on, we...
Unifies the tree rooted in node1 with the tree rooted in node2, by making one of them the subtree of the other one; returns the root of the new tree.
[ "Unifies", "the", "tree", "rooted", "in", "node1", "with", "the", "tree", "rooted", "in", "node2", "by", "making", "one", "of", "them", "the", "subtree", "of", "the", "other", "one", ";", "returns", "the", "root", "of", "the", "new", "tree", "." ]
db579ffb16faaa4b0c577ec82c246f7349427714
https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/UnionFind.java#L125-L142
45,071
jMotif/GI
src/main/java/net/seninp/gi/sequitur/SAXRule.java
SAXRule.reset
public static void reset() { SAXRule.numRules = new AtomicInteger(0); SAXSymbol.theDigrams.clear(); SAXSymbol.theSubstituteTable.clear(); SAXRule.arrRuleRecords = new ArrayList<GrammarRuleRecord>(); }
java
public static void reset() { SAXRule.numRules = new AtomicInteger(0); SAXSymbol.theDigrams.clear(); SAXSymbol.theSubstituteTable.clear(); SAXRule.arrRuleRecords = new ArrayList<GrammarRuleRecord>(); }
[ "public", "static", "void", "reset", "(", ")", "{", "SAXRule", ".", "numRules", "=", "new", "AtomicInteger", "(", "0", ")", ";", "SAXSymbol", ".", "theDigrams", ".", "clear", "(", ")", ";", "SAXSymbol", ".", "theSubstituteTable", ".", "clear", "(", ")", ...
Cleans up data structures.
[ "Cleans", "up", "data", "structures", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SAXRule.java#L190-L195
45,072
jMotif/GI
src/main/java/net/seninp/gi/sequitur/SAXRule.java
SAXRule.assignLevel
protected void assignLevel() { int lvl = Integer.MAX_VALUE; SAXSymbol sym; for (sym = this.first(); (!sym.isGuard()); sym = sym.n) { if (sym.isNonTerminal()) { SAXRule referedTo = ((SAXNonTerminal) sym).r; lvl = Math.min(referedTo.level + 1, lvl); } else { ...
java
protected void assignLevel() { int lvl = Integer.MAX_VALUE; SAXSymbol sym; for (sym = this.first(); (!sym.isGuard()); sym = sym.n) { if (sym.isNonTerminal()) { SAXRule referedTo = ((SAXNonTerminal) sym).r; lvl = Math.min(referedTo.level + 1, lvl); } else { ...
[ "protected", "void", "assignLevel", "(", ")", "{", "int", "lvl", "=", "Integer", ".", "MAX_VALUE", ";", "SAXSymbol", "sym", ";", "for", "(", "sym", "=", "this", ".", "first", "(", ")", ";", "(", "!", "sym", ".", "isGuard", "(", ")", ")", ";", "sy...
This traces the rule level.
[ "This", "traces", "the", "rule", "level", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SAXRule.java#L265-L285
45,073
jMotif/GI
src/main/java/net/seninp/gi/sequitur/SAXRule.java
SAXRule.expandRules
private static void expandRules() { // long start = System.currentTimeMillis(); // iterate over all SAX containers // ArrayList<SAXMapEntry<Integer, Integer>> recs = new ArrayList<SAXMapEntry<Integer, Integer>>( // arrRuleRecords.size()); // // for (GrammarRuleRecord ruleRecord : arrRu...
java
private static void expandRules() { // long start = System.currentTimeMillis(); // iterate over all SAX containers // ArrayList<SAXMapEntry<Integer, Integer>> recs = new ArrayList<SAXMapEntry<Integer, Integer>>( // arrRuleRecords.size()); // // for (GrammarRuleRecord ruleRecord : arrRu...
[ "private", "static", "void", "expandRules", "(", ")", "{", "// long start = System.currentTimeMillis();\r", "// iterate over all SAX containers\r", "// ArrayList<SAXMapEntry<Integer, Integer>> recs = new ArrayList<SAXMapEntry<Integer, Integer>>(\r", "// arrRuleRecords.size());\r", "//\r", "/...
Manfred's cool trick to get out all expanded rules. Expands the rule of each SAX container into SAX words string. Can be rewritten recursively though.
[ "Manfred", "s", "cool", "trick", "to", "get", "out", "all", "expanded", "rules", ".", "Expands", "the", "rule", "of", "each", "SAX", "container", "into", "SAX", "words", "string", ".", "Can", "be", "rewritten", "recursively", "though", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SAXRule.java#L295-L362
45,074
jMotif/GI
src/main/java/net/seninp/gi/sequitur/SAXRule.java
SAXRule.getIndexes
private int[] getIndexes() { int[] res = new int[this.indexes.size()]; int i = 0; for (Integer idx : this.indexes) { res[i] = idx; i++; } return res; }
java
private int[] getIndexes() { int[] res = new int[this.indexes.size()]; int i = 0; for (Integer idx : this.indexes) { res[i] = idx; i++; } return res; }
[ "private", "int", "[", "]", "getIndexes", "(", ")", "{", "int", "[", "]", "res", "=", "new", "int", "[", "this", ".", "indexes", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "Integer", "idx", ":", "this", ".", "inde...
Get all the rule occurrences. @return all the rule occurrences.
[ "Get", "all", "the", "rule", "occurrences", "." ]
381212dd4f193246a6df82bd46f0d2bcd04a68d6
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SAXRule.java#L421-L429
45,075
btrplace/scheduler
json/src/main/java/org/btrplace/json/plan/ActionConverter.java
ActionConverter.fromJSON
public Action fromJSON(JSONObject in) throws JSONConverterException { String id = requiredString(in, ACTION_ID_LABEL); Action a; switch (id) { case "bootVM": a = bootVMFromJSON(in); break; case "shutdownVM": a = shutdownVMF...
java
public Action fromJSON(JSONObject in) throws JSONConverterException { String id = requiredString(in, ACTION_ID_LABEL); Action a; switch (id) { case "bootVM": a = bootVMFromJSON(in); break; case "shutdownVM": a = shutdownVMF...
[ "public", "Action", "fromJSON", "(", "JSONObject", "in", ")", "throws", "JSONConverterException", "{", "String", "id", "=", "requiredString", "(", "in", ",", "ACTION_ID_LABEL", ")", ";", "Action", "a", ";", "switch", "(", "id", ")", "{", "case", "\"bootVM\""...
decode a json-encoded action. @param in the action to decode @return the resulting action @throws JSONConverterException if the conversion failed
[ "decode", "a", "json", "-", "encoded", "action", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/plan/ActionConverter.java#L113-L154
45,076
btrplace/scheduler
json/src/main/java/org/btrplace/json/plan/ActionConverter.java
ActionConverter.attachEvents
private void attachEvents(Action a, JSONObject in) throws JSONConverterException { if (in.containsKey(HOOK_LABEL)) { JSONObject hooks = (JSONObject) in.get(HOOK_LABEL); for (Map.Entry<String, Object> e : hooks.entrySet()) { String k = e.getKey(); try { ...
java
private void attachEvents(Action a, JSONObject in) throws JSONConverterException { if (in.containsKey(HOOK_LABEL)) { JSONObject hooks = (JSONObject) in.get(HOOK_LABEL); for (Map.Entry<String, Object> e : hooks.entrySet()) { String k = e.getKey(); try { ...
[ "private", "void", "attachEvents", "(", "Action", "a", ",", "JSONObject", "in", ")", "throws", "JSONConverterException", "{", "if", "(", "in", ".", "containsKey", "(", "HOOK_LABEL", ")", ")", "{", "JSONObject", "hooks", "=", "(", "JSONObject", ")", "in", "...
Decorate the action with optional events. @param a the action to decorate @param in the JSON message containing the event at the "hook" key @throws JSONConverterException in case of error
[ "Decorate", "the", "action", "with", "optional", "events", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/plan/ActionConverter.java#L163-L178
45,077
btrplace/scheduler
json/src/main/java/org/btrplace/json/plan/ActionConverter.java
ActionConverter.makeActionSkeleton
private JSONObject makeActionSkeleton(Action a) { JSONObject o = new JSONObject(); o.put(START_LABEL, a.getStart()); o.put(END_LABEL, a.getEnd()); JSONObject hooks = new JSONObject(); for (Action.Hook k : Action.Hook.values()) { JSONArray arr = new JSONArray(); ...
java
private JSONObject makeActionSkeleton(Action a) { JSONObject o = new JSONObject(); o.put(START_LABEL, a.getStart()); o.put(END_LABEL, a.getEnd()); JSONObject hooks = new JSONObject(); for (Action.Hook k : Action.Hook.values()) { JSONArray arr = new JSONArray(); ...
[ "private", "JSONObject", "makeActionSkeleton", "(", "Action", "a", ")", "{", "JSONObject", "o", "=", "new", "JSONObject", "(", ")", ";", "o", ".", "put", "(", "START_LABEL", ",", "a", ".", "getStart", "(", ")", ")", ";", "o", ".", "put", "(", "END_LA...
Just create the JSONObject and set the consume and the end attribute. @param a the action to convert @return a skeleton JSONObject
[ "Just", "create", "the", "JSONObject", "and", "set", "the", "consume", "and", "the", "end", "attribute", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/plan/ActionConverter.java#L410-L424
45,078
btrplace/scheduler
json/src/main/java/org/btrplace/json/plan/ActionConverter.java
ActionConverter.listFromJSON
public List<Action> listFromJSON(JSONArray in) throws JSONConverterException { List<Action> l = new ArrayList<>(in.size()); for (Object o : in) { if (!(o instanceof JSONObject)) { throw new JSONConverterException("Expected an array of JSONObject but got an array of " + o.getC...
java
public List<Action> listFromJSON(JSONArray in) throws JSONConverterException { List<Action> l = new ArrayList<>(in.size()); for (Object o : in) { if (!(o instanceof JSONObject)) { throw new JSONConverterException("Expected an array of JSONObject but got an array of " + o.getC...
[ "public", "List", "<", "Action", ">", "listFromJSON", "(", "JSONArray", "in", ")", "throws", "JSONConverterException", "{", "List", "<", "Action", ">", "l", "=", "new", "ArrayList", "<>", "(", "in", ".", "size", "(", ")", ")", ";", "for", "(", "Object"...
Convert a list of json-encoded actions. @param in the list to decode @return the action list. Might be empty @throws JSONConverterException if the conversion failed
[ "Convert", "a", "list", "of", "json", "-", "encoded", "actions", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/plan/ActionConverter.java#L437-L446
45,079
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/Decoder.java
Decoder.decodeUTF16
@Nonnull static String decodeUTF16(@Nonnull final String mapcode) { String result; final StringBuilder asciiBuf = new StringBuilder(); for (final char ch : mapcode.toCharArray()) { if (ch == '.') { asciiBuf.append(ch); } else if ((ch >= 1) && (ch <= 'z...
java
@Nonnull static String decodeUTF16(@Nonnull final String mapcode) { String result; final StringBuilder asciiBuf = new StringBuilder(); for (final char ch : mapcode.toCharArray()) { if (ch == '.') { asciiBuf.append(ch); } else if ((ch >= 1) && (ch <= 'z...
[ "@", "Nonnull", "static", "String", "decodeUTF16", "(", "@", "Nonnull", "final", "String", "mapcode", ")", "{", "String", "result", ";", "final", "StringBuilder", "asciiBuf", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "final", "char", "ch", ":...
This method decodes a Unicode string to ASCII. Package private for access by other modules. @param mapcode Unicode string. @return ASCII string.
[ "This", "method", "decodes", "a", "Unicode", "string", "to", "ASCII", ".", "Package", "private", "for", "access", "by", "other", "modules", "." ]
f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Decoder.java#L699-L741
45,080
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/Decoder.java
Decoder.decodeBase31
private static int decodeBase31(@Nonnull final String code) { int value = 0; for (final char c : code.toCharArray()) { if (c == '.') { return value; } if (DECODE_CHARS[c] < 0) { return -1; } value = (value * 31) ...
java
private static int decodeBase31(@Nonnull final String code) { int value = 0; for (final char c : code.toCharArray()) { if (c == '.') { return value; } if (DECODE_CHARS[c] < 0) { return -1; } value = (value * 31) ...
[ "private", "static", "int", "decodeBase31", "(", "@", "Nonnull", "final", "String", "code", ")", "{", "int", "value", "=", "0", ";", "for", "(", "final", "char", "c", ":", "code", ".", "toCharArray", "(", ")", ")", "{", "if", "(", "c", "==", "'", ...
returns negative in case of error
[ "returns", "negative", "in", "case", "of", "error" ]
f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Decoder.java#L817-L829
45,081
btrplace/scheduler
btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java
SymbolsTable.declareImmutable
public boolean declareImmutable(String label, BtrpOperand t) { if (isDeclared(label)) { return false; } level.put(label, -1); type.put(label, t); return true; }
java
public boolean declareImmutable(String label, BtrpOperand t) { if (isDeclared(label)) { return false; } level.put(label, -1); type.put(label, t); return true; }
[ "public", "boolean", "declareImmutable", "(", "String", "label", ",", "BtrpOperand", "t", ")", "{", "if", "(", "isDeclared", "(", "label", ")", ")", "{", "return", "false", ";", "}", "level", ".", "put", "(", "label", ",", "-", "1", ")", ";", "type",...
Declare an immutable variable. The variable must not has been already declared. @param label the identifier of the variable @param t the operand associated to the identifier @return {@code true} if the variable as been declared. {@code false} otherwise
[ "Declare", "an", "immutable", "variable", ".", "The", "variable", "must", "not", "has", "been", "already", "declared", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java#L73-L80
45,082
btrplace/scheduler
btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java
SymbolsTable.remove
public boolean remove(String label) { if (!isDeclared(label)) { return false; } level.remove(label); type.remove(label); return true; }
java
public boolean remove(String label) { if (!isDeclared(label)) { return false; } level.remove(label); type.remove(label); return true; }
[ "public", "boolean", "remove", "(", "String", "label", ")", "{", "if", "(", "!", "isDeclared", "(", "label", ")", ")", "{", "return", "false", ";", "}", "level", ".", "remove", "(", "label", ")", ";", "type", ".", "remove", "(", "label", ")", ";", ...
Remove a symbol from the table. @param label the symbol to remove @return {@code true} if the symbol was present then removed. {@code false} otherwise
[ "Remove", "a", "symbol", "from", "the", "table", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java#L88-L95
45,083
btrplace/scheduler
btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java
SymbolsTable.declare
public final boolean declare(String label, BtrpOperand t) { if (isDeclared(label) && level.get(label) < 0) { //Disallow immutable value return false; } if (!isDeclared(label)) { level.put(label, currentLevel); } type.put(label, t); return true; ...
java
public final boolean declare(String label, BtrpOperand t) { if (isDeclared(label) && level.get(label) < 0) { //Disallow immutable value return false; } if (!isDeclared(label)) { level.put(label, currentLevel); } type.put(label, t); return true; ...
[ "public", "final", "boolean", "declare", "(", "String", "label", ",", "BtrpOperand", "t", ")", "{", "if", "(", "isDeclared", "(", "label", ")", "&&", "level", ".", "get", "(", "label", ")", "<", "0", ")", "{", "//Disallow immutable value", "return", "fal...
Declare a new variable. The variable is inserted into the current script. @param label the label of the variable @param t the content of the variable @return {@code true} if the declaration succeeds, {@code false} otherwise
[ "Declare", "a", "new", "variable", ".", "The", "variable", "is", "inserted", "into", "the", "current", "script", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java#L115-L124
45,084
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/JavaScriptModuleBuilder.java
JavaScriptModuleBuilder.getJSSource
protected List<JSSourceFile> getJSSource(String mid, IResource resource, HttpServletRequest request, List<ICacheKeyGenerator> keyGens) throws IOException { List<JSSourceFile> result = new ArrayList<JSSourceFile>(1); InputStream in = resource.getInputStream(); JSSourceFile sf = JSSourceFile.fromInputStream(m...
java
protected List<JSSourceFile> getJSSource(String mid, IResource resource, HttpServletRequest request, List<ICacheKeyGenerator> keyGens) throws IOException { List<JSSourceFile> result = new ArrayList<JSSourceFile>(1); InputStream in = resource.getInputStream(); JSSourceFile sf = JSSourceFile.fromInputStream(m...
[ "protected", "List", "<", "JSSourceFile", ">", "getJSSource", "(", "String", "mid", ",", "IResource", "resource", ",", "HttpServletRequest", "request", ",", "List", "<", "ICacheKeyGenerator", ">", "keyGens", ")", "throws", "IOException", "{", "List", "<", "JSSou...
Overrideable method for getting the source modules to compile @param mid the module id @param resource the resource @param request the request object @param keyGens the list of cache key generators @return the list of source files @throws IOException
[ "Overrideable", "method", "for", "getting", "the", "source", "modules", "to", "compile" ]
9f47a96d778251638b1df9a368462176216d5b29
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/JavaScriptModuleBuilder.java#L555-L564
45,085
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/JavaScriptModuleBuilder.java
JavaScriptModuleBuilder.moduleNameIdEncodingBeginLayer
protected String moduleNameIdEncodingBeginLayer(HttpServletRequest request) { StringBuffer sb = new StringBuffer(); if (request.getParameter(AbstractHttpTransport.SCRIPTS_REQPARAM) != null) { // This is a request for a bootstrap layer with non-AMD script modules. // Define the deps variable in global scop...
java
protected String moduleNameIdEncodingBeginLayer(HttpServletRequest request) { StringBuffer sb = new StringBuffer(); if (request.getParameter(AbstractHttpTransport.SCRIPTS_REQPARAM) != null) { // This is a request for a bootstrap layer with non-AMD script modules. // Define the deps variable in global scop...
[ "protected", "String", "moduleNameIdEncodingBeginLayer", "(", "HttpServletRequest", "request", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "request", ".", "getParameter", "(", "AbstractHttpTransport", ".", "SCRIPTS_REQPARAM", ...
Returns the text to be included at the beginning of the layer if module name id encoding is enabled. @param request the http request object @return the string to include at the beginning of the layer
[ "Returns", "the", "text", "to", "be", "included", "at", "the", "beginning", "of", "the", "layer", "if", "module", "name", "id", "encoding", "is", "enabled", "." ]
9f47a96d778251638b1df9a368462176216d5b29
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/JavaScriptModuleBuilder.java#L591-L600
45,086
m-m-m/util
scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java
CharSequenceScanner.getTail
protected String getTail() { String tail = ""; if (this.offset < this.limit) { tail = new String(this.buffer, this.offset, this.limit - this.offset + 1); } return tail; }
java
protected String getTail() { String tail = ""; if (this.offset < this.limit) { tail = new String(this.buffer, this.offset, this.limit - this.offset + 1); } return tail; }
[ "protected", "String", "getTail", "(", ")", "{", "String", "tail", "=", "\"\"", ";", "if", "(", "this", ".", "offset", "<", "this", ".", "limit", ")", "{", "tail", "=", "new", "String", "(", "this", ".", "buffer", ",", "this", ".", "offset", ",", ...
This method gets the tail of this scanner without changing the state. @return the tail of this scanner.
[ "This", "method", "gets", "the", "tail", "of", "this", "scanner", "without", "changing", "the", "state", "." ]
f0e4e084448f8dfc83ca682a9e1618034a094ce6
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java#L335-L342
45,087
m-m-m/util
scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java
CharSequenceScanner.getOriginalString
public String getOriginalString() { if (this.string != null) { this.string = new String(this.buffer, this.initialOffset, getLength()); } return this.string; }
java
public String getOriginalString() { if (this.string != null) { this.string = new String(this.buffer, this.initialOffset, getLength()); } return this.string; }
[ "public", "String", "getOriginalString", "(", ")", "{", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "this", ".", "string", "=", "new", "String", "(", "this", ".", "buffer", ",", "this", ".", "initialOffset", ",", "getLength", "(", ")", ...
This method gets the original string to parse. @see CharSequenceScanner#CharSequenceScanner(String) @return the original string.
[ "This", "method", "gets", "the", "original", "string", "to", "parse", "." ]
f0e4e084448f8dfc83ca682a9e1618034a094ce6
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java#L391-L397
45,088
btrplace/scheduler
api/src/main/java/org/btrplace/plan/event/SuspendVM.java
SuspendVM.applyAction
@Override public boolean applyAction(Model m) { Mapping map = m.getMapping(); return map.isRunning(vm) && map.getVMLocation(vm).equals(src) && map.addSleepingVM(vm, dst); }
java
@Override public boolean applyAction(Model m) { Mapping map = m.getMapping(); return map.isRunning(vm) && map.getVMLocation(vm).equals(src) && map.addSleepingVM(vm, dst); }
[ "@", "Override", "public", "boolean", "applyAction", "(", "Model", "m", ")", "{", "Mapping", "map", "=", "m", ".", "getMapping", "(", ")", ";", "return", "map", ".", "isRunning", "(", "vm", ")", "&&", "map", ".", "getVMLocation", "(", "vm", ")", ".",...
Apply the action by putting the VM into the sleeping state on its destination node in a given model @param m the model to alter @return {@code true} iff the VM is now sleeping on the destination node
[ "Apply", "the", "action", "by", "putting", "the", "VM", "into", "the", "sleeping", "state", "on", "its", "destination", "node", "in", "a", "given", "model" ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/plan/event/SuspendVM.java#L67-L73
45,089
btrplace/scheduler
json/src/main/java/org/btrplace/json/model/view/network/StaticRoutingConverter.java
StaticRoutingConverter.nodesMapFromJSON
public StaticRouting.NodesMap nodesMapFromJSON(Model mo, JSONObject o) throws JSONConverterException { return new StaticRouting.NodesMap(requiredNode(mo, o, "src"), requiredNode(mo, o, "dst")); }
java
public StaticRouting.NodesMap nodesMapFromJSON(Model mo, JSONObject o) throws JSONConverterException { return new StaticRouting.NodesMap(requiredNode(mo, o, "src"), requiredNode(mo, o, "dst")); }
[ "public", "StaticRouting", ".", "NodesMap", "nodesMapFromJSON", "(", "Model", "mo", ",", "JSONObject", "o", ")", "throws", "JSONConverterException", "{", "return", "new", "StaticRouting", ".", "NodesMap", "(", "requiredNode", "(", "mo", ",", "o", ",", "\"src\"",...
Convert a JSON nodes map object into a Java NodesMap object @param o the JSON object to convert @return the nodes map
[ "Convert", "a", "JSON", "nodes", "map", "object", "into", "a", "Java", "NodesMap", "object" ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/StaticRoutingConverter.java#L90-L92
45,090
btrplace/scheduler
split/src/main/java/org/btrplace/scheduler/runner/disjoint/splitter/ConstraintSplitterMapper.java
ConstraintSplitterMapper.newBundle
public static ConstraintSplitterMapper newBundle() { ConstraintSplitterMapper mapper = new ConstraintSplitterMapper(); mapper.register(new AmongSplitter()); mapper.register(new BanSplitter()); mapper.register(new FenceSplitter()); mapper.register(new GatherSplitter()); m...
java
public static ConstraintSplitterMapper newBundle() { ConstraintSplitterMapper mapper = new ConstraintSplitterMapper(); mapper.register(new AmongSplitter()); mapper.register(new BanSplitter()); mapper.register(new FenceSplitter()); mapper.register(new GatherSplitter()); m...
[ "public", "static", "ConstraintSplitterMapper", "newBundle", "(", ")", "{", "ConstraintSplitterMapper", "mapper", "=", "new", "ConstraintSplitterMapper", "(", ")", ";", "mapper", ".", "register", "(", "new", "AmongSplitter", "(", ")", ")", ";", "mapper", ".", "r...
Make a new bridge and register every splitters supported by default. @return the fulfilled bridge.
[ "Make", "a", "new", "bridge", "and", "register", "every", "splitters", "supported", "by", "default", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/split/src/main/java/org/btrplace/scheduler/runner/disjoint/splitter/ConstraintSplitterMapper.java#L52-L75
45,091
btrplace/scheduler
split/src/main/java/org/btrplace/scheduler/runner/disjoint/splitter/ConstraintSplitterMapper.java
ConstraintSplitterMapper.register
public boolean register(ConstraintSplitter<? extends Constraint> ccb) { return builders.put(ccb.getKey(), ccb) == null; }
java
public boolean register(ConstraintSplitter<? extends Constraint> ccb) { return builders.put(ccb.getKey(), ccb) == null; }
[ "public", "boolean", "register", "(", "ConstraintSplitter", "<", "?", "extends", "Constraint", ">", "ccb", ")", "{", "return", "builders", ".", "put", "(", "ccb", ".", "getKey", "(", ")", ",", "ccb", ")", "==", "null", ";", "}" ]
Register a splitter. @param ccb the splitter to register @return {@code true} if no splitter previously registered for the given constraint was deleted
[ "Register", "a", "splitter", "." ]
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/split/src/main/java/org/btrplace/scheduler/runner/disjoint/splitter/ConstraintSplitterMapper.java#L83-L85
45,092
m-m-m/util
gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java
AbstractIncrementalGenerator.generateDefaultConstructor
protected void generateDefaultConstructor(SourceWriter sourceWriter, String simpleName) { generateSourcePublicConstructorDeclaration(sourceWriter, simpleName); sourceWriter.println("super();"); generateSourceCloseBlock(sourceWriter); }
java
protected void generateDefaultConstructor(SourceWriter sourceWriter, String simpleName) { generateSourcePublicConstructorDeclaration(sourceWriter, simpleName); sourceWriter.println("super();"); generateSourceCloseBlock(sourceWriter); }
[ "protected", "void", "generateDefaultConstructor", "(", "SourceWriter", "sourceWriter", ",", "String", "simpleName", ")", "{", "generateSourcePublicConstructorDeclaration", "(", "sourceWriter", ",", "simpleName", ")", ";", "sourceWriter", ".", "println", "(", "\"super();\...
Generates the the default constructor. @param sourceWriter is the {@link SourceWriter}. @param simpleName is the {@link Class#getSimpleName() simple name}.
[ "Generates", "the", "the", "default", "constructor", "." ]
f0e4e084448f8dfc83ca682a9e1618034a094ce6
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java#L167-L172
45,093
m-m-m/util
gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java
AbstractIncrementalGenerator.generateSourcePublicMethodDeclaration
protected final void generateSourcePublicMethodDeclaration(SourceWriter sourceWriter, JMethod method) { StringBuilder arguments = new StringBuilder(); for (JParameter parameter : method.getParameters()) { if (arguments.length() > 0) { arguments.append(", "); } arguments.append(paramet...
java
protected final void generateSourcePublicMethodDeclaration(SourceWriter sourceWriter, JMethod method) { StringBuilder arguments = new StringBuilder(); for (JParameter parameter : method.getParameters()) { if (arguments.length() > 0) { arguments.append(", "); } arguments.append(paramet...
[ "protected", "final", "void", "generateSourcePublicMethodDeclaration", "(", "SourceWriter", "sourceWriter", ",", "JMethod", "method", ")", "{", "StringBuilder", "arguments", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "JParameter", "parameter", ":", "met...
This method generates the source code for a public method declaration including the opening brace and indentation. @param sourceWriter is the {@link SourceWriter}. @param method is the {@link JMethod} to implement.
[ "This", "method", "generates", "the", "source", "code", "for", "a", "public", "method", "declaration", "including", "the", "opening", "brace", "and", "indentation", "." ]
f0e4e084448f8dfc83ca682a9e1618034a094ce6
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java#L193-L206
45,094
m-m-m/util
gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java
AbstractIncrementalGenerator.generateSourcePublicMethodDeclaration
protected final void generateSourcePublicMethodDeclaration(SourceWriter sourceWriter, String returnType, String methodName, String arguments, boolean override) { if (override) { sourceWriter.println("@Override"); } sourceWriter.print("public "); if (returnType != null) { sourceWriter....
java
protected final void generateSourcePublicMethodDeclaration(SourceWriter sourceWriter, String returnType, String methodName, String arguments, boolean override) { if (override) { sourceWriter.println("@Override"); } sourceWriter.print("public "); if (returnType != null) { sourceWriter....
[ "protected", "final", "void", "generateSourcePublicMethodDeclaration", "(", "SourceWriter", "sourceWriter", ",", "String", "returnType", ",", "String", "methodName", ",", "String", "arguments", ",", "boolean", "override", ")", "{", "if", "(", "override", ")", "{", ...
This method generates the source code for a public method or constructor including the opening brace and indentation. @param sourceWriter is the {@link SourceWriter}. @param returnType is the return type of the method. @param methodName is the name of the method (or the {@link Class#getSimpleName() simple class name} ...
[ "This", "method", "generates", "the", "source", "code", "for", "a", "public", "method", "or", "constructor", "including", "the", "opening", "brace", "and", "indentation", "." ]
f0e4e084448f8dfc83ca682a9e1618034a094ce6
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java#L219-L235
45,095
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/cache/CacheManagerImpl.java
CacheManagerImpl.notifyInit
protected void notifyInit () { final String sourceMethod = "notifyInit"; //$NON-NLS-1$ IServiceReference[] refs = null; try { if(_aggregator != null && _aggregator.getPlatformServices() != null){ refs = _aggregator.getPlatformServices().getServiceReferences(ICacheManagerListener.class.getName(),"(name...
java
protected void notifyInit () { final String sourceMethod = "notifyInit"; //$NON-NLS-1$ IServiceReference[] refs = null; try { if(_aggregator != null && _aggregator.getPlatformServices() != null){ refs = _aggregator.getPlatformServices().getServiceReferences(ICacheManagerListener.class.getName(),"(name...
[ "protected", "void", "notifyInit", "(", ")", "{", "final", "String", "sourceMethod", "=", "\"notifyInit\"", ";", "//$NON-NLS-1$\r", "IServiceReference", "[", "]", "refs", "=", "null", ";", "try", "{", "if", "(", "_aggregator", "!=", "null", "&&", "_aggregator"...
Notify listeners that the cache manager is initialized.
[ "Notify", "listeners", "that", "the", "cache", "manager", "is", "initialized", "." ]
9f47a96d778251638b1df9a368462176216d5b29
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/cache/CacheManagerImpl.java#L594-L622
45,096
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/ForcedErrorResponse.java
ForcedErrorResponse.getStatus
public int getStatus() { int result = status; if (status > 0) { if (skip.getAndDecrement() <= 0) { if (count.getAndDecrement() <= 0) { result = status = -1; } } else { result = 0; } } return result; }
java
public int getStatus() { int result = status; if (status > 0) { if (skip.getAndDecrement() <= 0) { if (count.getAndDecrement() <= 0) { result = status = -1; } } else { result = 0; } } return result; }
[ "public", "int", "getStatus", "(", ")", "{", "int", "result", "=", "status", ";", "if", "(", "status", ">", "0", ")", "{", "if", "(", "skip", ".", "getAndDecrement", "(", ")", "<=", "0", ")", "{", "if", "(", "count", ".", "getAndDecrement", "(", ...
Returns the error response status that should be returned for the current response. If the value is zero, then the normal response should be returned and this method should be called again for the next response. If the value is less than 0, then this error response status object is spent and may be discarded. @retur...
[ "Returns", "the", "error", "response", "status", "that", "should", "be", "returned", "for", "the", "current", "response", ".", "If", "the", "value", "is", "zero", "then", "the", "normal", "response", "should", "be", "returned", "and", "this", "method", "shou...
9f47a96d778251638b1df9a368462176216d5b29
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/ForcedErrorResponse.java#L86-L98
45,097
InsightLab/graphast
core/src/main/java/br/ufc/insightlab/graphast/serialization/SerializationUtils.java
SerializationUtils.deleteMMapGraph
public static boolean deleteMMapGraph(String path) { String directory = ensureDirectory(path); File f = new File(directory); boolean ok = true; if (f.exists()) { ok = new File(directory + "nodes.mmap").delete(); ok = new File(directory + "edges.mmap").delete() && ok; ok = new File(directory + "tree...
java
public static boolean deleteMMapGraph(String path) { String directory = ensureDirectory(path); File f = new File(directory); boolean ok = true; if (f.exists()) { ok = new File(directory + "nodes.mmap").delete(); ok = new File(directory + "edges.mmap").delete() && ok; ok = new File(directory + "tree...
[ "public", "static", "boolean", "deleteMMapGraph", "(", "String", "path", ")", "{", "String", "directory", "=", "ensureDirectory", "(", "path", ")", ";", "File", "f", "=", "new", "File", "(", "directory", ")", ";", "boolean", "ok", "=", "true", ";", "if",...
Delete a graph from the given path. @param path to search the file that contains the graph that will be deleted. @return true if the MMap Graph was deleted without problems, false otherwise.
[ "Delete", "a", "graph", "from", "the", "given", "path", "." ]
b81d10c1ea8378e1fb9fcb545dd75d5e6308fd24
https://github.com/InsightLab/graphast/blob/b81d10c1ea8378e1fb9fcb545dd75d5e6308fd24/core/src/main/java/br/ufc/insightlab/graphast/serialization/SerializationUtils.java#L49-L63
45,098
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/constraint/ChocoMapper.java
ChocoMapper.mapConstraint
public void mapConstraint(Class<? extends Constraint> c, Class<? extends ChocoConstraint> cc) { constraints.put(c, cc); }
java
public void mapConstraint(Class<? extends Constraint> c, Class<? extends ChocoConstraint> cc) { constraints.put(c, cc); }
[ "public", "void", "mapConstraint", "(", "Class", "<", "?", "extends", "Constraint", ">", "c", ",", "Class", "<", "?", "extends", "ChocoConstraint", ">", "cc", ")", "{", "constraints", ".", "put", "(", "c", ",", "cc", ")", ";", "}" ]
Register a mapping between an api-side constraint and its choco implementation. It is expected from the implementation to exhibit a constructor that takes the api-side constraint as argument. @param c the api-side constraint @param cc the choco implementation @throws IllegalArgumentException if there is no suitable c...
[ "Register", "a", "mapping", "between", "an", "api", "-", "side", "constraint", "and", "its", "choco", "implementation", ".", "It", "is", "expected", "from", "the", "implementation", "to", "exhibit", "a", "constructor", "that", "takes", "the", "api", "-", "si...
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/constraint/ChocoMapper.java#L140-L142
45,099
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/constraint/ChocoMapper.java
ChocoMapper.mapView
public void mapView(Class<? extends ModelView> c, Class<? extends ChocoView> cc) { views.put(c, cc); }
java
public void mapView(Class<? extends ModelView> c, Class<? extends ChocoView> cc) { views.put(c, cc); }
[ "public", "void", "mapView", "(", "Class", "<", "?", "extends", "ModelView", ">", "c", ",", "Class", "<", "?", "extends", "ChocoView", ">", "cc", ")", "{", "views", ".", "put", "(", "c", ",", "cc", ")", ";", "}" ]
Register a mapping between an api-side view and its choco implementation. It is expected from the implementation to exhibit a constructor that takes the api-side constraint as argument. @param c the api-side view @param cc the choco implementation @throws IllegalArgumentException if there is no suitable constructor f...
[ "Register", "a", "mapping", "between", "an", "api", "-", "side", "view", "and", "its", "choco", "implementation", ".", "It", "is", "expected", "from", "the", "implementation", "to", "exhibit", "a", "constructor", "that", "takes", "the", "api", "-", "side", ...
611063aad0b47a016e57ebf36fa4dfdf24de09e8
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/constraint/ChocoMapper.java#L152-L154