repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/util/HasNode.java | HasNode.evaluate | public String evaluate(Features features, Set<String> discovered, boolean coerceUndefinedToFalse) {
if (feature != null && discovered != null) {
discovered.add(feature);
}
if (feature == null) {
return nodeName;
} else if (!coerceUndefinedToFalse && !features.contains(feature)) {
return null;
} else {
if (features.isFeature(feature)) {
return trueNode.evaluate(features, discovered, coerceUndefinedToFalse);
} else {
return falseNode.evaluate(features, discovered, coerceUndefinedToFalse);
}
}
} | java | public String evaluate(Features features, Set<String> discovered, boolean coerceUndefinedToFalse) {
if (feature != null && discovered != null) {
discovered.add(feature);
}
if (feature == null) {
return nodeName;
} else if (!coerceUndefinedToFalse && !features.contains(feature)) {
return null;
} else {
if (features.isFeature(feature)) {
return trueNode.evaluate(features, discovered, coerceUndefinedToFalse);
} else {
return falseNode.evaluate(features, discovered, coerceUndefinedToFalse);
}
}
} | [
"public",
"String",
"evaluate",
"(",
"Features",
"features",
",",
"Set",
"<",
"String",
">",
"discovered",
",",
"boolean",
"coerceUndefinedToFalse",
")",
"{",
"if",
"(",
"feature",
"!=",
"null",
"&&",
"discovered",
"!=",
"null",
")",
"{",
"discovered",
".",
... | Evaluate the has plugin for the given set of features.
@param features
The features passed to the aggregator.
@param discovered
A map in which all features encountered in the evaluation will
be placed. This will not necessarily contain all features in
the dependency expression. Only the ones in the evaluation
chain will be included.
@param coerceUndefinedToFalse
If true, then a feature not being defined will be treated the
same as if the feature were defined with a value of false.
@return The evaluated resource based on provided features. If a lack of
features prevents us from being able to determine the resource,
then null is returned. If the required features are provided
but the evaluation results in no module name, then the empty
string is returned. | [
"Evaluate",
"the",
"has",
"plugin",
"for",
"the",
"given",
"set",
"of",
"features",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/HasNode.java#L79-L94 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/util/HasNode.java | HasNode.replaceWith | public void replaceWith(HasNode node) {
feature = node.feature;
nodeName = node.nodeName;
trueNode = node.trueNode;
falseNode = node.falseNode;
} | java | public void replaceWith(HasNode node) {
feature = node.feature;
nodeName = node.nodeName;
trueNode = node.trueNode;
falseNode = node.falseNode;
} | [
"public",
"void",
"replaceWith",
"(",
"HasNode",
"node",
")",
"{",
"feature",
"=",
"node",
".",
"feature",
";",
"nodeName",
"=",
"node",
".",
"nodeName",
";",
"trueNode",
"=",
"node",
".",
"trueNode",
";",
"falseNode",
"=",
"node",
".",
"falseNode",
";",... | Replaces the properties of the current node with the properties of the specified node.
@param node
The node to replace this node with | [
"Replaces",
"the",
"properties",
"of",
"the",
"current",
"node",
"with",
"the",
"properties",
"of",
"the",
"specified",
"node",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/HasNode.java#L170-L175 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/util/HasNode.java | HasNode.replaceWith | public void replaceWith(String nodeName) {
feature = null;
this.nodeName = nodeName;
trueNode = falseNode = null;
} | java | public void replaceWith(String nodeName) {
feature = null;
this.nodeName = nodeName;
trueNode = falseNode = null;
} | [
"public",
"void",
"replaceWith",
"(",
"String",
"nodeName",
")",
"{",
"feature",
"=",
"null",
";",
"this",
".",
"nodeName",
"=",
"nodeName",
";",
"trueNode",
"=",
"falseNode",
"=",
"null",
";",
"}"
] | Replaces the properties of the current node with the specified node name, making this node
into an end point node.
@param nodeName
The name of the end point. | [
"Replaces",
"the",
"properties",
"of",
"the",
"current",
"node",
"with",
"the",
"specified",
"node",
"name",
"making",
"this",
"node",
"into",
"an",
"end",
"point",
"node",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/HasNode.java#L184-L188 | train |
OpenNTF/JavascriptAggregator | jaggr-blueprint/src/main/java/com/ibm/jaggr/blueprint/AbstractOsgiCommandSupport.java | AbstractOsgiCommandSupport.invoke | protected String invoke(CommandProvider provider, CommandInterpreterWrapper interpreter) throws Exception {
Method method = provider.getClass().getMethod("_aggregator", new Class[]{CommandInterpreter.class}); //$NON-NLS-1$
method.invoke(provider, new Object[]{interpreter});
return interpreter.getOutput();
} | java | protected String invoke(CommandProvider provider, CommandInterpreterWrapper interpreter) throws Exception {
Method method = provider.getClass().getMethod("_aggregator", new Class[]{CommandInterpreter.class}); //$NON-NLS-1$
method.invoke(provider, new Object[]{interpreter});
return interpreter.getOutput();
} | [
"protected",
"String",
"invoke",
"(",
"CommandProvider",
"provider",
",",
"CommandInterpreterWrapper",
"interpreter",
")",
"throws",
"Exception",
"{",
"Method",
"method",
"=",
"provider",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"_aggregator\"",
",",
"n... | Invokes the aggregator command processor using reflection in order avoid framework dependencies
on the aggregator classes.
@param provider an instance of the aggregator command processor
@param interpreter the command interpreter
@return the command response
@throws Exception | [
"Invokes",
"the",
"aggregator",
"command",
"processor",
"using",
"reflection",
"in",
"order",
"avoid",
"framework",
"dependencies",
"on",
"the",
"aggregator",
"classes",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-blueprint/src/main/java/com/ibm/jaggr/blueprint/AbstractOsgiCommandSupport.java#L77-L81 | train |
berkesa/datatree | src/main/java/io/datatree/dom/TreeWriterRegistry.java | TreeWriterRegistry.setWriter | public static final void setWriter(String format, TreeWriter writer) {
String key = format.toLowerCase();
writers.put(key, writer);
if (JSON.equals(key)) {
cachedJsonWriter = writer;
}
} | java | public static final void setWriter(String format, TreeWriter writer) {
String key = format.toLowerCase();
writers.put(key, writer);
if (JSON.equals(key)) {
cachedJsonWriter = writer;
}
} | [
"public",
"static",
"final",
"void",
"setWriter",
"(",
"String",
"format",
",",
"TreeWriter",
"writer",
")",
"{",
"String",
"key",
"=",
"format",
".",
"toLowerCase",
"(",
")",
";",
"writers",
".",
"put",
"(",
"key",
",",
"writer",
")",
";",
"if",
"(",
... | Binds the given TreeWriter instance to the specified data format.
@param format
name of the format (eg. "json", "xml", "csv", etc.)
@param writer
TreeWriter instance for generating the specified format | [
"Binds",
"the",
"given",
"TreeWriter",
"instance",
"to",
"the",
"specified",
"data",
"format",
"."
] | 79aea9b45c7b46ab28af0a09310bc01c421c6b3a | https://github.com/berkesa/datatree/blob/79aea9b45c7b46ab28af0a09310bc01c421c6b3a/src/main/java/io/datatree/dom/TreeWriterRegistry.java#L65-L71 | train |
protegeproject/jpaul | src/main/java/jpaul/Misc/Predicate.java | Predicate.TRUE | public static <T> Predicate<T> TRUE() {
return new Predicate<T>() {
public boolean check(T obj) { return true; }
};
} | java | public static <T> Predicate<T> TRUE() {
return new Predicate<T>() {
public boolean check(T obj) { return true; }
};
} | [
"public",
"static",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"TRUE",
"(",
")",
"{",
"return",
"new",
"Predicate",
"<",
"T",
">",
"(",
")",
"{",
"public",
"boolean",
"check",
"(",
"T",
"obj",
")",
"{",
"return",
"true",
";",
"}",
"}",
";",
"}"... | Returns an always-true predicate. | [
"Returns",
"an",
"always",
"-",
"true",
"predicate",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Misc/Predicate.java#L22-L26 | train |
protegeproject/jpaul | src/main/java/jpaul/Misc/Predicate.java | Predicate.FALSE | public static <T> Predicate<T> FALSE() {
return Predicate.<T>NOT(Predicate.<T>TRUE());
} | java | public static <T> Predicate<T> FALSE() {
return Predicate.<T>NOT(Predicate.<T>TRUE());
} | [
"public",
"static",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"FALSE",
"(",
")",
"{",
"return",
"Predicate",
".",
"<",
"T",
">",
"NOT",
"(",
"Predicate",
".",
"<",
"T",
">",
"TRUE",
"(",
")",
")",
";",
"}"
] | Returns an always-false predicate. | [
"Returns",
"an",
"always",
"-",
"false",
"predicate",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Misc/Predicate.java#L30-L32 | train |
protegeproject/jpaul | src/main/java/jpaul/Misc/Predicate.java | Predicate.NOT | public static <T> Predicate<T> NOT(final Predicate<T> pred) {
return new Predicate<T>() {
public boolean check(T obj) {
return !pred.check(obj);
}
};
} | java | public static <T> Predicate<T> NOT(final Predicate<T> pred) {
return new Predicate<T>() {
public boolean check(T obj) {
return !pred.check(obj);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"NOT",
"(",
"final",
"Predicate",
"<",
"T",
">",
"pred",
")",
"{",
"return",
"new",
"Predicate",
"<",
"T",
">",
"(",
")",
"{",
"public",
"boolean",
"check",
"(",
"T",
"obj",
")",
"{",... | Predicate negation.
@return A predicate that is true iff <code>pred</code> is
false. | [
"Predicate",
"negation",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Misc/Predicate.java#L39-L45 | train |
protegeproject/jpaul | src/main/java/jpaul/Misc/Predicate.java | Predicate.AND | public static <T> Predicate<T> AND(final Predicate<T> a, final Predicate<T> b) {
return new Predicate<T>() {
public boolean check(T obj) {
return a.check(obj) && b.check(obj);
}
};
} | java | public static <T> Predicate<T> AND(final Predicate<T> a, final Predicate<T> b) {
return new Predicate<T>() {
public boolean check(T obj) {
return a.check(obj) && b.check(obj);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"AND",
"(",
"final",
"Predicate",
"<",
"T",
">",
"a",
",",
"final",
"Predicate",
"<",
"T",
">",
"b",
")",
"{",
"return",
"new",
"Predicate",
"<",
"T",
">",
"(",
")",
"{",
"public",
... | Short-circuited AND operation.
@return A predicate that is true iff both <code>a</code> and
<code>b</code> are true. Evaluation stops as soon as the
final result is known. | [
"Short",
"-",
"circuited",
"AND",
"operation",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Misc/Predicate.java#L52-L58 | train |
protegeproject/jpaul | src/main/java/jpaul/Misc/Predicate.java | Predicate.OR | public static <T> Predicate<T> OR(final Predicate<T> a, final Predicate<T> b) {
return new Predicate<T>() {
public boolean check(T obj) {
return a.check(obj) || b.check(obj);
}
};
} | java | public static <T> Predicate<T> OR(final Predicate<T> a, final Predicate<T> b) {
return new Predicate<T>() {
public boolean check(T obj) {
return a.check(obj) || b.check(obj);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"OR",
"(",
"final",
"Predicate",
"<",
"T",
">",
"a",
",",
"final",
"Predicate",
"<",
"T",
">",
"b",
")",
"{",
"return",
"new",
"Predicate",
"<",
"T",
">",
"(",
")",
"{",
"public",
"... | Short-circuited OR operation.
@return A predicate that is false iff both <code>a</code> and
<code>b</code> are false. Evaluation stops as soon as the
final result is known. | [
"Short",
"-",
"circuited",
"OR",
"operation",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Misc/Predicate.java#L65-L71 | train |
btrplace/scheduler | split/src/main/java/org/btrplace/scheduler/runner/disjoint/model/SubMapping.java | SubMapping.fillVMIndex | public void fillVMIndex(TIntIntHashMap index, int p) {
for (Node n : scope) {
for (VM v : parent.getRunningVMs(n)) {
index.put(v.id(), p);
}
for (VM v : parent.getSleepingVMs(n)) {
index.put(v.id(), p);
}
}
for (VM v : ready) {
index.put(v.id(), p);
}
} | java | public void fillVMIndex(TIntIntHashMap index, int p) {
for (Node n : scope) {
for (VM v : parent.getRunningVMs(n)) {
index.put(v.id(), p);
}
for (VM v : parent.getSleepingVMs(n)) {
index.put(v.id(), p);
}
}
for (VM v : ready) {
index.put(v.id(), p);
}
} | [
"public",
"void",
"fillVMIndex",
"(",
"TIntIntHashMap",
"index",
",",
"int",
"p",
")",
"{",
"for",
"(",
"Node",
"n",
":",
"scope",
")",
"{",
"for",
"(",
"VM",
"v",
":",
"parent",
".",
"getRunningVMs",
"(",
"n",
")",
")",
"{",
"index",
".",
"put",
... | Fill an index with the VM presents in this mapping
@param index the index to fill
@param p the index value to use for each VM in the mapping | [
"Fill",
"an",
"index",
"with",
"the",
"VM",
"presents",
"in",
"this",
"mapping"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/split/src/main/java/org/btrplace/scheduler/runner/disjoint/model/SubMapping.java#L269-L281 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/deps/ModuleDepInfo.java | ModuleDepInfo.getIncludeStatus | public Boolean getIncludeStatus() {
if (formula.isTrue()) {
return Boolean.TRUE;
} else if (formula.isFalse()) {
return Boolean.FALSE;
}
return null;
} | java | public Boolean getIncludeStatus() {
if (formula.isTrue()) {
return Boolean.TRUE;
} else if (formula.isFalse()) {
return Boolean.FALSE;
}
return null;
} | [
"public",
"Boolean",
"getIncludeStatus",
"(",
")",
"{",
"if",
"(",
"formula",
".",
"isTrue",
"(",
")",
")",
"{",
"return",
"Boolean",
".",
"TRUE",
";",
"}",
"else",
"if",
"(",
"formula",
".",
"isFalse",
"(",
")",
")",
"{",
"return",
"Boolean",
".",
... | Returns a Boolean value indicating the value of the formula expression, or null if
the formula expression contains undefined features. The formula is NOT simplified
prior to returning the result for performance reasons, so some expressions that may
simplify to TRUE can return a null value.
@return the value of the formula or null. | [
"Returns",
"a",
"Boolean",
"value",
"indicating",
"the",
"value",
"of",
"the",
"formula",
"expression",
"or",
"null",
"if",
"the",
"formula",
"expression",
"contains",
"undefined",
"features",
".",
"The",
"formula",
"is",
"NOT",
"simplified",
"prior",
"to",
"r... | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/deps/ModuleDepInfo.java#L211-L218 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/deps/ModuleDepInfo.java | ModuleDepInfo.andWith | public ModuleDepInfo andWith(ModuleDepInfo other) {
if (other == null) {
return this;
}
formula.andWith(other.formula);
if (!isPluginNameDeclared && other.isPluginNameDeclared) {
pluginName = other.pluginName;
isPluginNameDeclared = true;
} else if (pluginName == null) {
pluginName = other.pluginName;
isPluginNameDeclared = other.isPluginNameDeclared;
}
return this;
} | java | public ModuleDepInfo andWith(ModuleDepInfo other) {
if (other == null) {
return this;
}
formula.andWith(other.formula);
if (!isPluginNameDeclared && other.isPluginNameDeclared) {
pluginName = other.pluginName;
isPluginNameDeclared = true;
} else if (pluginName == null) {
pluginName = other.pluginName;
isPluginNameDeclared = other.isPluginNameDeclared;
}
return this;
} | [
"public",
"ModuleDepInfo",
"andWith",
"(",
"ModuleDepInfo",
"other",
")",
"{",
"if",
"(",
"other",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"formula",
".",
"andWith",
"(",
"other",
".",
"formula",
")",
";",
"if",
"(",
"!",
"isPluginNameDeclare... | logically ands the provided terms with the formula belonging to this
object, updating this object with the result.
@param other
the {@link ModuleDepInfo} to and with this object.
@return this object | [
"logically",
"ands",
"the",
"provided",
"terms",
"with",
"the",
"formula",
"belonging",
"to",
"this",
"object",
"updating",
"this",
"object",
"with",
"the",
"result",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/deps/ModuleDepInfo.java#L269-L282 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/deps/ModuleDepInfo.java | ModuleDepInfo.add | public boolean add(ModuleDepInfo other) {
Boolean modified = false;
if (formula.isTrue()) {
// No terms added to a true formula will change the evaluation.
return false;
}
if (other.formula.isTrue()) {
// Adding true to this formula makes this formula true.
modified = !formula.isTrue();
formula = new BooleanFormula(true);
if (modified && other.comment != null && other.commentTermSize < commentTermSize) {
comment = other.comment;
commentTermSize = other.commentTermSize;
}
return modified;
}
// Add the terms
modified = formula.addAll(other.formula);
// Copy over plugin name if needed
if (!isPluginNameDeclared && other.isPluginNameDeclared) {
pluginName = other.pluginName;
isPluginNameDeclared = true;
modified = true;
}
// And comments...
if (other.comment != null && other.commentTermSize < commentTermSize) {
comment = other.comment;
commentTermSize = other.commentTermSize;
}
return modified;
} | java | public boolean add(ModuleDepInfo other) {
Boolean modified = false;
if (formula.isTrue()) {
// No terms added to a true formula will change the evaluation.
return false;
}
if (other.formula.isTrue()) {
// Adding true to this formula makes this formula true.
modified = !formula.isTrue();
formula = new BooleanFormula(true);
if (modified && other.comment != null && other.commentTermSize < commentTermSize) {
comment = other.comment;
commentTermSize = other.commentTermSize;
}
return modified;
}
// Add the terms
modified = formula.addAll(other.formula);
// Copy over plugin name if needed
if (!isPluginNameDeclared && other.isPluginNameDeclared) {
pluginName = other.pluginName;
isPluginNameDeclared = true;
modified = true;
}
// And comments...
if (other.comment != null && other.commentTermSize < commentTermSize) {
comment = other.comment;
commentTermSize = other.commentTermSize;
}
return modified;
} | [
"public",
"boolean",
"add",
"(",
"ModuleDepInfo",
"other",
")",
"{",
"Boolean",
"modified",
"=",
"false",
";",
"if",
"(",
"formula",
".",
"isTrue",
"(",
")",
")",
"{",
"// No terms added to a true formula will change the evaluation.\r",
"return",
"false",
";",
"}"... | Adds the terms and comments from the specified object to this object.
@param other
The object to add
@return True if this object was modified | [
"Adds",
"the",
"terms",
"and",
"comments",
"from",
"the",
"specified",
"object",
"to",
"this",
"object",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/deps/ModuleDepInfo.java#L301-L332 | train |
jMotif/GI | src/main/java/net/seninp/gi/logic/GrammarRuleRecord.java | GrammarRuleRecord.setMinMaxLength | public void setMinMaxLength(int[] lengths) {
Arrays.sort(lengths);
this.minLength = lengths[0];
this.maxLength = lengths[lengths.length - 1];
} | java | public void setMinMaxLength(int[] lengths) {
Arrays.sort(lengths);
this.minLength = lengths[0];
this.maxLength = lengths[lengths.length - 1];
} | [
"public",
"void",
"setMinMaxLength",
"(",
"int",
"[",
"]",
"lengths",
")",
"{",
"Arrays",
".",
"sort",
"(",
"lengths",
")",
";",
"this",
".",
"minLength",
"=",
"lengths",
"[",
"0",
"]",
";",
"this",
".",
"maxLength",
"=",
"lengths",
"[",
"lengths",
"... | Set min and max lengths.
@param lengths the lengths to set. | [
"Set",
"min",
"and",
"max",
"lengths",
"."
] | 381212dd4f193246a6df82bd46f0d2bcd04a68d6 | https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/logic/GrammarRuleRecord.java#L163-L167 | train |
m-m-m/util | reflect/src/main/java/net/sf/mmm/util/reflect/impl/GenericTypeImpl.java | GenericTypeImpl.create | @SuppressWarnings({ "rawtypes", "unchecked" })
protected AbstractGenericType<T> create(Type genericType, GenericType<?> genericDefiningType) {
return new GenericTypeImpl(genericType, genericDefiningType);
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
protected AbstractGenericType<T> create(Type genericType, GenericType<?> genericDefiningType) {
return new GenericTypeImpl(genericType, genericDefiningType);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"protected",
"AbstractGenericType",
"<",
"T",
">",
"create",
"(",
"Type",
"genericType",
",",
"GenericType",
"<",
"?",
">",
"genericDefiningType",
")",
"{",
"return",
"new",
"Ge... | This method creates a new instance of this class. It may be overridden to create the appropriate sub-type.
@param genericType is the {@link #getType() value-type}.
@param genericDefiningType is the {@link #getDefiningType() defining-type}.
@return a new {@link GenericType} instance. | [
"This",
"method",
"creates",
"a",
"new",
"instance",
"of",
"this",
"class",
".",
"It",
"may",
"be",
"overridden",
"to",
"create",
"the",
"appropriate",
"sub",
"-",
"type",
"."
] | f0e4e084448f8dfc83ca682a9e1618034a094ce6 | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/reflect/src/main/java/net/sf/mmm/util/reflect/impl/GenericTypeImpl.java#L155-L159 | train |
protegeproject/jpaul | src/main/java/jpaul/Graphs/BinTreeUtil.java | BinTreeUtil.inOrder | public static <T> void inOrder(T root, BinTreeNavigator<T> binTreeNav, Action<T> action) {
for(Iterator<T> it = inOrder(root, binTreeNav); it.hasNext(); ) {
T treeVertex = it.next();
action.action(treeVertex);
}
} | java | public static <T> void inOrder(T root, BinTreeNavigator<T> binTreeNav, Action<T> action) {
for(Iterator<T> it = inOrder(root, binTreeNav); it.hasNext(); ) {
T treeVertex = it.next();
action.action(treeVertex);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"inOrder",
"(",
"T",
"root",
",",
"BinTreeNavigator",
"<",
"T",
">",
"binTreeNav",
",",
"Action",
"<",
"T",
">",
"action",
")",
"{",
"for",
"(",
"Iterator",
"<",
"T",
">",
"it",
"=",
"inOrder",
"(",
"root"... | Executes an action on all nodes from a tree, in inorder. For
trees with sharing, the same tree node object will be visited
multiple times.
@param root Binary tree root.
@param binTreeNav Binary tree navigator.
@param action Action to execute on each tree node. | [
"Executes",
"an",
"action",
"on",
"all",
"nodes",
"from",
"a",
"tree",
"in",
"inorder",
".",
"For",
"trees",
"with",
"sharing",
"the",
"same",
"tree",
"node",
"object",
"will",
"be",
"visited",
"multiple",
"times",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Graphs/BinTreeUtil.java#L35-L40 | train |
btrplace/scheduler | api/src/main/java/org/btrplace/model/view/network/DefaultRouting.java | DefaultRouting.getFirstPhysicalPath | private Map<Link, Boolean> getFirstPhysicalPath(Map<Link, Boolean> currentPath, Switch sw, Node dst) {
// Iterate through the current switch's links
for (Link l : net.getConnectedLinks(sw)) {
// Wrong link
if (currentPath.containsKey(l)) {
continue;
}
/*
* Go through the link and track the direction for full-duplex purpose
* From switch to element => false : DownLink
* From element to switch => true : UpLink
*/
currentPath.put(l, !l.getSwitch().equals(sw));
// Check what is after
if (l.getElement() instanceof Node) {
// Node found, path complete
if (l.getElement().equals(dst)) {
return currentPath;
}
}
else {
// Go to the next switch
Map<Link, Boolean> recall = getFirstPhysicalPath(
currentPath, l.getSwitch().equals(sw) ? (Switch) l.getElement() : l.getSwitch(), dst);
// Return the complete path if found
if (!recall.isEmpty()) {
return recall;
}
}
// Wrong link, go back
currentPath.remove(l);
}
// No path found through this switch
return new LinkedHashMap<>();
} | java | private Map<Link, Boolean> getFirstPhysicalPath(Map<Link, Boolean> currentPath, Switch sw, Node dst) {
// Iterate through the current switch's links
for (Link l : net.getConnectedLinks(sw)) {
// Wrong link
if (currentPath.containsKey(l)) {
continue;
}
/*
* Go through the link and track the direction for full-duplex purpose
* From switch to element => false : DownLink
* From element to switch => true : UpLink
*/
currentPath.put(l, !l.getSwitch().equals(sw));
// Check what is after
if (l.getElement() instanceof Node) {
// Node found, path complete
if (l.getElement().equals(dst)) {
return currentPath;
}
}
else {
// Go to the next switch
Map<Link, Boolean> recall = getFirstPhysicalPath(
currentPath, l.getSwitch().equals(sw) ? (Switch) l.getElement() : l.getSwitch(), dst);
// Return the complete path if found
if (!recall.isEmpty()) {
return recall;
}
}
// Wrong link, go back
currentPath.remove(l);
}
// No path found through this switch
return new LinkedHashMap<>();
} | [
"private",
"Map",
"<",
"Link",
",",
"Boolean",
">",
"getFirstPhysicalPath",
"(",
"Map",
"<",
"Link",
",",
"Boolean",
">",
"currentPath",
",",
"Switch",
"sw",
",",
"Node",
"dst",
")",
"{",
"// Iterate through the current switch's links",
"for",
"(",
"Link",
"l"... | Recursive method to get the first physical path found from a switch to a destination node
@param currentPath the current or initial path containing the link(s) crossed
@param sw the current switch to browse
@param dst the destination node to reach
@return the ordered list of links that make the path to dst | [
"Recursive",
"method",
"to",
"get",
"the",
"first",
"physical",
"path",
"found",
"from",
"a",
"switch",
"to",
"a",
"destination",
"node"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/DefaultRouting.java#L45-L82 | train |
OpenNTF/JavascriptAggregator | jaggr-service/src/main/java/com/ibm/jaggr/service/util/FrameworkWiringBundleResolver.java | FrameworkWiringBundleResolver.getBundle | public Bundle getBundle(String symbolicName) {
final String sourceMethod = "getBundle"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(FrameworkWiringBundleResolver.class.getName(), sourceMethod, new Object[]{symbolicName});
}
Bundle[] candidates = Platform.getBundles(symbolicName, null);
if (isTraceLogging) {
log.finer("candidate bundles = " + Arrays.toString(candidates)); //$NON-NLS-1$
}
if (candidates == null || candidates.length == 0) {
if (isTraceLogging) {
log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, null);
}
return null;
}
if (candidates.length == 1) {
// Only one choice, so return it
if (isTraceLogging) {
log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, candidates[0]);
}
return candidates[0];
}
if (fw == null) {
if (isTraceLogging) {
log.finer("Framework wiring not available. Returning bundle with latest version"); //$NON-NLS-1$
log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, candidates[0]);
}
return candidates[0];
}
Bundle result = null;
// For each candidate bundle, check to see if it's wired, directly or indirectly, to the contributing bundle
for (Bundle candidate : candidates) {
Collection<Bundle> bundles = fw.getDependencyClosure(Arrays.asList(new Bundle[]{candidate}));
for (Bundle bundle : bundles) {
if (bundle.equals(contributingBundle)) {
// found wired bundle. Return the candidate.
result = candidate;
break;
}
}
if (result != null) {
break;
}
}
if (result == null) {
if (isTraceLogging) {
log.finer("No wired bundle found amoung candidates. Returning bundle with most recent version."); //$NON-NLS-1$
}
result = candidates[0];
}
if (isTraceLogging) {
log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, result);
}
return result;
} | java | public Bundle getBundle(String symbolicName) {
final String sourceMethod = "getBundle"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(FrameworkWiringBundleResolver.class.getName(), sourceMethod, new Object[]{symbolicName});
}
Bundle[] candidates = Platform.getBundles(symbolicName, null);
if (isTraceLogging) {
log.finer("candidate bundles = " + Arrays.toString(candidates)); //$NON-NLS-1$
}
if (candidates == null || candidates.length == 0) {
if (isTraceLogging) {
log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, null);
}
return null;
}
if (candidates.length == 1) {
// Only one choice, so return it
if (isTraceLogging) {
log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, candidates[0]);
}
return candidates[0];
}
if (fw == null) {
if (isTraceLogging) {
log.finer("Framework wiring not available. Returning bundle with latest version"); //$NON-NLS-1$
log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, candidates[0]);
}
return candidates[0];
}
Bundle result = null;
// For each candidate bundle, check to see if it's wired, directly or indirectly, to the contributing bundle
for (Bundle candidate : candidates) {
Collection<Bundle> bundles = fw.getDependencyClosure(Arrays.asList(new Bundle[]{candidate}));
for (Bundle bundle : bundles) {
if (bundle.equals(contributingBundle)) {
// found wired bundle. Return the candidate.
result = candidate;
break;
}
}
if (result != null) {
break;
}
}
if (result == null) {
if (isTraceLogging) {
log.finer("No wired bundle found amoung candidates. Returning bundle with most recent version."); //$NON-NLS-1$
}
result = candidates[0];
}
if (isTraceLogging) {
log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, result);
}
return result;
} | [
"public",
"Bundle",
"getBundle",
"(",
"String",
"symbolicName",
")",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"getBundle\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"isTraceLogging",
"=",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
";",
"if",
"... | Returns the bundle with the requested symbolic name that is wired to the contributing bundle,
or the bundle with the latest version if unable to determine wiring.
@param symbolicName
@return the requested bundle | [
"Returns",
"the",
"bundle",
"with",
"the",
"requested",
"symbolic",
"name",
"that",
"is",
"wired",
"to",
"the",
"contributing",
"bundle",
"or",
"the",
"bundle",
"with",
"the",
"latest",
"version",
"if",
"unable",
"to",
"determine",
"wiring",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-service/src/main/java/com/ibm/jaggr/service/util/FrameworkWiringBundleResolver.java#L99-L154 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerBuilder.java | LayerBuilder.getSourcesMappingEpilogue | protected String getSourcesMappingEpilogue() {
String root = ""; //$NON-NLS-1$
String contextPath = request.getRequestURI();
if (contextPath != null) {
// We may be re-building a layer for a source map request where the layer
// has been flushed from the cache. If that's the case, then the context
// path will already include the source map path component, so just remove it.
if (contextPath.endsWith(ILayer.SOURCEMAP_RESOURCE_PATH)) {
contextPath = contextPath.substring(0, contextPath.length()-(ILayer.SOURCEMAP_RESOURCE_PATHCOMP.length()+1));
}
// Because we're specifying a relative URL that is relative to the request for the
// layer and aggregator paths are assumed to NOT include a trailing '/', then we
// need to start the relative path with the last path component of the context
// path so that the relative URL will be resolved correctly by the browser. For
// more details, see refer to the behavior of URI.resolve();
int idx = contextPath.lastIndexOf("/"); //$NON-NLS-1$
root = contextPath.substring(idx!=-1 ? idx+1 : 0);
if (root.length() > 0 && !root.endsWith("/")) { //$NON-NLS-1$
root += "/"; //$NON-NLS-1$
}
}
StringBuffer sb = new StringBuffer();
sb.append("//# sourceMappingURL=") //$NON-NLS-1$
.append(root)
.append(ILayer.SOURCEMAP_RESOURCE_PATHCOMP);
String queryString = request.getQueryString();
if (queryString != null) {
sb.append("?").append(queryString); //$NON-NLS-1$
}
return sb.toString();
} | java | protected String getSourcesMappingEpilogue() {
String root = ""; //$NON-NLS-1$
String contextPath = request.getRequestURI();
if (contextPath != null) {
// We may be re-building a layer for a source map request where the layer
// has been flushed from the cache. If that's the case, then the context
// path will already include the source map path component, so just remove it.
if (contextPath.endsWith(ILayer.SOURCEMAP_RESOURCE_PATH)) {
contextPath = contextPath.substring(0, contextPath.length()-(ILayer.SOURCEMAP_RESOURCE_PATHCOMP.length()+1));
}
// Because we're specifying a relative URL that is relative to the request for the
// layer and aggregator paths are assumed to NOT include a trailing '/', then we
// need to start the relative path with the last path component of the context
// path so that the relative URL will be resolved correctly by the browser. For
// more details, see refer to the behavior of URI.resolve();
int idx = contextPath.lastIndexOf("/"); //$NON-NLS-1$
root = contextPath.substring(idx!=-1 ? idx+1 : 0);
if (root.length() > 0 && !root.endsWith("/")) { //$NON-NLS-1$
root += "/"; //$NON-NLS-1$
}
}
StringBuffer sb = new StringBuffer();
sb.append("//# sourceMappingURL=") //$NON-NLS-1$
.append(root)
.append(ILayer.SOURCEMAP_RESOURCE_PATHCOMP);
String queryString = request.getQueryString();
if (queryString != null) {
sb.append("?").append(queryString); //$NON-NLS-1$
}
return sb.toString();
} | [
"protected",
"String",
"getSourcesMappingEpilogue",
"(",
")",
"{",
"String",
"root",
"=",
"\"\"",
";",
"//$NON-NLS-1$\r",
"String",
"contextPath",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"if",
"(",
"contextPath",
"!=",
"null",
")",
"{",
"// We may... | Returns the source mapping epilogue for the layer that gets added to the end of the response.
@see <a
href="https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.lmz475t4mvbx">Source
Map Revision 3 Proposal - Linking generated code to source maps</a>
@return the source mapping eplilogue | [
"Returns",
"the",
"source",
"mapping",
"epilogue",
"for",
"the",
"layer",
"that",
"gets",
"added",
"to",
"the",
"end",
"of",
"the",
"response",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerBuilder.java#L256-L286 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerBuilder.java | LayerBuilder.collectFutures | protected List<ModuleBuildFuture> collectFutures(ModuleList moduleList, HttpServletRequest request)
throws IOException {
final String sourceMethod = "collectFutures"; //$NON-NLS-1$
final boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{moduleList, request});
}
IAggregator aggr = (IAggregator)request.getAttribute(IAggregator.AGGREGATOR_REQATTRNAME);
List<ModuleBuildFuture> futures = new ArrayList<ModuleBuildFuture>();
IModuleCache moduleCache = aggr.getCacheManager().getCache().getModules();
// For each source file, add a Future<IModule.ModuleReader> to the list
for(ModuleList.ModuleListEntry moduleListEntry : moduleList) {
IModule module = moduleListEntry.getModule();
Future<ModuleBuildReader> future = null;
try {
future = moduleCache.getBuild(request, module);
} catch (NotFoundException e) {
if (log.isLoggable(Level.FINER)) {
log.logp(Level.FINER, sourceClass, sourceMethod, moduleListEntry.getModule().getModuleId() + " not found."); //$NON-NLS-1$
}
future = new NotFoundModule(module.getModuleId(), module.getURI()).getBuild(request);
if (!moduleListEntry.isServerExpanded()) {
// Treat as error. Return error response, or if debug mode, then include
// the NotFoundModule in the response.
if (options.isDevelopmentMode() || options.isDebugMode()) {
// Don't cache responses containing error modules.
request.setAttribute(ILayer.NOCACHE_RESPONSE_REQATTRNAME, Boolean.TRUE);
} else {
// Rethrow the exception to return an error response
throw e;
}
} else {
// Not an error if we're doing server-side expansion, but if debug mode
// then get the error message from the completed future so that we can output
// a console warning in the browser.
if (options.isDevelopmentMode() || options.isDebugMode()) {
try {
nonErrorMessages.add(future.get().getErrorMessage());
} catch (Exception ex) {
// Sholdn't ever happen as this is a CompletedFuture
throw new RuntimeException(ex);
}
}
if (isTraceLogging) {
log.logp(Level.FINER, sourceClass, sourceMethod, "Ignoring exception for server expanded module " + e.getMessage(), e); //$NON-NLS-1$
}
// Don't add the future for the error module to the response.
continue;
}
} catch (UnsupportedOperationException ex) {
// Missing resource factory or module builder for this resource
if (moduleListEntry.isServerExpanded()) {
// ignore the error if it's a server expanded module
if (isTraceLogging) {
log.logp(Level.FINER, sourceClass, sourceMethod, "Ignoring exception for server expanded module " + ex.getMessage(), ex); //$NON-NLS-1$
}
continue;
} else {
// re-throw the exception
throw ex;
}
}
futures.add(new ModuleBuildFuture(
module,
future,
moduleListEntry.getSource()
));
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, futures);
}
return futures;
} | java | protected List<ModuleBuildFuture> collectFutures(ModuleList moduleList, HttpServletRequest request)
throws IOException {
final String sourceMethod = "collectFutures"; //$NON-NLS-1$
final boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{moduleList, request});
}
IAggregator aggr = (IAggregator)request.getAttribute(IAggregator.AGGREGATOR_REQATTRNAME);
List<ModuleBuildFuture> futures = new ArrayList<ModuleBuildFuture>();
IModuleCache moduleCache = aggr.getCacheManager().getCache().getModules();
// For each source file, add a Future<IModule.ModuleReader> to the list
for(ModuleList.ModuleListEntry moduleListEntry : moduleList) {
IModule module = moduleListEntry.getModule();
Future<ModuleBuildReader> future = null;
try {
future = moduleCache.getBuild(request, module);
} catch (NotFoundException e) {
if (log.isLoggable(Level.FINER)) {
log.logp(Level.FINER, sourceClass, sourceMethod, moduleListEntry.getModule().getModuleId() + " not found."); //$NON-NLS-1$
}
future = new NotFoundModule(module.getModuleId(), module.getURI()).getBuild(request);
if (!moduleListEntry.isServerExpanded()) {
// Treat as error. Return error response, or if debug mode, then include
// the NotFoundModule in the response.
if (options.isDevelopmentMode() || options.isDebugMode()) {
// Don't cache responses containing error modules.
request.setAttribute(ILayer.NOCACHE_RESPONSE_REQATTRNAME, Boolean.TRUE);
} else {
// Rethrow the exception to return an error response
throw e;
}
} else {
// Not an error if we're doing server-side expansion, but if debug mode
// then get the error message from the completed future so that we can output
// a console warning in the browser.
if (options.isDevelopmentMode() || options.isDebugMode()) {
try {
nonErrorMessages.add(future.get().getErrorMessage());
} catch (Exception ex) {
// Sholdn't ever happen as this is a CompletedFuture
throw new RuntimeException(ex);
}
}
if (isTraceLogging) {
log.logp(Level.FINER, sourceClass, sourceMethod, "Ignoring exception for server expanded module " + e.getMessage(), e); //$NON-NLS-1$
}
// Don't add the future for the error module to the response.
continue;
}
} catch (UnsupportedOperationException ex) {
// Missing resource factory or module builder for this resource
if (moduleListEntry.isServerExpanded()) {
// ignore the error if it's a server expanded module
if (isTraceLogging) {
log.logp(Level.FINER, sourceClass, sourceMethod, "Ignoring exception for server expanded module " + ex.getMessage(), ex); //$NON-NLS-1$
}
continue;
} else {
// re-throw the exception
throw ex;
}
}
futures.add(new ModuleBuildFuture(
module,
future,
moduleListEntry.getSource()
));
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, futures);
}
return futures;
} | [
"protected",
"List",
"<",
"ModuleBuildFuture",
">",
"collectFutures",
"(",
"ModuleList",
"moduleList",
",",
"HttpServletRequest",
"request",
")",
"throws",
"IOException",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"collectFutures\"",
";",
"//$NON-NLS-1$\r",
"final",... | Dispatch the modules specified in the request to the module builders and
collect the build futures returned by the builders into the returned
list.
@param moduleList
The list of modules in the layer
@param request
The request object
@return The list of {@link ModuleBuildFuture} objects.
@throws IOException | [
"Dispatch",
"the",
"modules",
"specified",
"in",
"the",
"request",
"to",
"the",
"module",
"builders",
"and",
"collect",
"the",
"build",
"futures",
"returned",
"by",
"the",
"builders",
"into",
"the",
"returned",
"list",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerBuilder.java#L407-L482 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerBuilder.java | LayerBuilder.notifyLayerListeners | protected String notifyLayerListeners(ILayerListener.EventType type, HttpServletRequest request, IModule module) throws IOException {
StringBuffer sb = new StringBuffer();
// notify any listeners that the config has been updated
List<IServiceReference> refs = null;
if(aggr.getPlatformServices() != null){
try {
IServiceReference[] ary = aggr.getPlatformServices().getServiceReferences(ILayerListener.class.getName(), "(name="+aggr.getName()+")"); //$NON-NLS-1$ //$NON-NLS-2$
if (ary != null) refs = Arrays.asList(ary);
} catch (PlatformServicesException e) {
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
}
if (refs != null) {
if (type == EventType.END_LAYER) {
// for END_LAYER, invoke the listeners in reverse order
refs = new ArrayList<IServiceReference>(refs);
Collections.reverse(refs);
}
for (IServiceReference ref : refs) {
ILayerListener listener = (ILayerListener)aggr.getPlatformServices().getService(ref);
try {
Set<String> depFeatures = new HashSet<String>();
String str = listener.layerBeginEndNotifier(type, request,
type == ILayerListener.EventType.BEGIN_MODULE ?
Arrays.asList(new IModule[]{module}) : umLayerListenerModuleList,
depFeatures);
dependentFeatures.addAll(depFeatures);
if (str != null) {
sb.append(str);
}
} finally {
aggr.getPlatformServices().ungetService(ref);
}
}
}
}
return sb.toString();
} | java | protected String notifyLayerListeners(ILayerListener.EventType type, HttpServletRequest request, IModule module) throws IOException {
StringBuffer sb = new StringBuffer();
// notify any listeners that the config has been updated
List<IServiceReference> refs = null;
if(aggr.getPlatformServices() != null){
try {
IServiceReference[] ary = aggr.getPlatformServices().getServiceReferences(ILayerListener.class.getName(), "(name="+aggr.getName()+")"); //$NON-NLS-1$ //$NON-NLS-2$
if (ary != null) refs = Arrays.asList(ary);
} catch (PlatformServicesException e) {
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
}
if (refs != null) {
if (type == EventType.END_LAYER) {
// for END_LAYER, invoke the listeners in reverse order
refs = new ArrayList<IServiceReference>(refs);
Collections.reverse(refs);
}
for (IServiceReference ref : refs) {
ILayerListener listener = (ILayerListener)aggr.getPlatformServices().getService(ref);
try {
Set<String> depFeatures = new HashSet<String>();
String str = listener.layerBeginEndNotifier(type, request,
type == ILayerListener.EventType.BEGIN_MODULE ?
Arrays.asList(new IModule[]{module}) : umLayerListenerModuleList,
depFeatures);
dependentFeatures.addAll(depFeatures);
if (str != null) {
sb.append(str);
}
} finally {
aggr.getPlatformServices().ungetService(ref);
}
}
}
}
return sb.toString();
} | [
"protected",
"String",
"notifyLayerListeners",
"(",
"ILayerListener",
".",
"EventType",
"type",
",",
"HttpServletRequest",
"request",
",",
"IModule",
"module",
")",
"throws",
"IOException",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"// ... | Calls the registered layer listeners.
@param type
The type of notification (begin or end)
@param request
The request object.
@param module
the associated module reference, depending on the value of {@code type}.
@return The string to include in the layer output
@throws IOException | [
"Calls",
"the",
"registered",
"layer",
"listeners",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerBuilder.java#L496-L535 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/util/PathUtil.java | PathUtil.getModuleName | public static String getModuleName(URI uri) {
String name = uri.getPath();
if (name.endsWith("/")) { //$NON-NLS-1$
name = name.substring(0, name.length()-1);
}
int idx = name.lastIndexOf("/"); //$NON-NLS-1$
if (idx != -1) {
name = name.substring(idx+1);
}
if (name.endsWith(".js")) { //$NON-NLS-1$
name = name.substring(0, name.length()-3);
}
return name;
} | java | public static String getModuleName(URI uri) {
String name = uri.getPath();
if (name.endsWith("/")) { //$NON-NLS-1$
name = name.substring(0, name.length()-1);
}
int idx = name.lastIndexOf("/"); //$NON-NLS-1$
if (idx != -1) {
name = name.substring(idx+1);
}
if (name.endsWith(".js")) { //$NON-NLS-1$
name = name.substring(0, name.length()-3);
}
return name;
} | [
"public",
"static",
"String",
"getModuleName",
"(",
"URI",
"uri",
")",
"{",
"String",
"name",
"=",
"uri",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"name",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"//$NON-NLS-1$\r",
"name",
"=",
"name",
".",
"su... | Returns the module name for the specified URI. This is the name part of
the URI with path information removed, and with the .js extension removed
if present.
@param uri
the uri to return the name for
@return the module name | [
"Returns",
"the",
"module",
"name",
"for",
"the",
"specified",
"URI",
".",
"This",
"is",
"the",
"name",
"part",
"of",
"the",
"URI",
"with",
"path",
"information",
"removed",
"and",
"with",
"the",
".",
"js",
"extension",
"removed",
"if",
"present",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/PathUtil.java#L128-L141 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/util/PathUtil.java | PathUtil.getExtension | public static String getExtension(String path) {
int idx = path.lastIndexOf("/"); //$NON-NLS-1$
String filename = idx == -1 ? path : path.substring(idx+1);
idx = filename.lastIndexOf("."); //$NON-NLS-1$
return idx == -1 ? "" : filename.substring(idx+1); //$NON-NLS-1$
} | java | public static String getExtension(String path) {
int idx = path.lastIndexOf("/"); //$NON-NLS-1$
String filename = idx == -1 ? path : path.substring(idx+1);
idx = filename.lastIndexOf("."); //$NON-NLS-1$
return idx == -1 ? "" : filename.substring(idx+1); //$NON-NLS-1$
} | [
"public",
"static",
"String",
"getExtension",
"(",
"String",
"path",
")",
"{",
"int",
"idx",
"=",
"path",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
";",
"//$NON-NLS-1$\r",
"String",
"filename",
"=",
"idx",
"==",
"-",
"1",
"?",
"path",
":",
"path",
".",
"s... | Returns the file extension part of the specified path
@param path the filname path of the file
@return the file extension | [
"Returns",
"the",
"file",
"extension",
"part",
"of",
"the",
"specified",
"path"
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/PathUtil.java#L192-L197 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/i18n/I18nModuleBuilder.java | I18nModuleBuilder.tryAddModule | private boolean tryAddModule(
IAggregator aggregator,
List<String> list,
String bundleRoot,
IResource bundleRootRes,
String locale,
String resource,
Collection<String> availableLocales)
throws IOException {
if (availableLocales != null && !availableLocales.contains(locale)) {
return false;
}
boolean result = false;
URI uri = bundleRootRes.getURI();
URI testUri = uri.resolve(locale + "/" + resource + ".js"); //$NON-NLS-1$ //$NON-NLS-2$
IResource testResource = aggregator.newResource(testUri);
if (availableLocales != null || testResource.exists()) {
String mid = bundleRoot+"/"+locale+"/"+resource; //$NON-NLS-1$ //$NON-NLS-2$
list.add(mid);
result = true;
}
return result;
} | java | private boolean tryAddModule(
IAggregator aggregator,
List<String> list,
String bundleRoot,
IResource bundleRootRes,
String locale,
String resource,
Collection<String> availableLocales)
throws IOException {
if (availableLocales != null && !availableLocales.contains(locale)) {
return false;
}
boolean result = false;
URI uri = bundleRootRes.getURI();
URI testUri = uri.resolve(locale + "/" + resource + ".js"); //$NON-NLS-1$ //$NON-NLS-2$
IResource testResource = aggregator.newResource(testUri);
if (availableLocales != null || testResource.exists()) {
String mid = bundleRoot+"/"+locale+"/"+resource; //$NON-NLS-1$ //$NON-NLS-2$
list.add(mid);
result = true;
}
return result;
} | [
"private",
"boolean",
"tryAddModule",
"(",
"IAggregator",
"aggregator",
",",
"List",
"<",
"String",
">",
"list",
",",
"String",
"bundleRoot",
",",
"IResource",
"bundleRootRes",
",",
"String",
"locale",
",",
"String",
"resource",
",",
"Collection",
"<",
"String",... | Adds the source for the locale specific i18n resource if it exists.
@param list
The list of source files to add the i18n resource to
@param bundleRoot
The module path for the bundle root (e.g. 'foo/nls')
@param bundleRootRes
The bundle root resource that was requested
@param localePath
The path relative to the bundle root for the locale specific
resource (e.g. 'en-us/bar')
@return True if the source file for for the locale specified resource was
added
@throws IOException | [
"Adds",
"the",
"source",
"for",
"the",
"locale",
"specific",
"i18n",
"resource",
"if",
"it",
"exists",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/i18n/I18nModuleBuilder.java#L272-L294 | train |
protegeproject/jpaul | src/main/java/jpaul/RegExps/RegExp.java | RegExp.unionNav | private static <A> ForwardNavigator<RegExp<A>> unionNav() {
return new ForwardNavigator<RegExp<A>>() {
private Visitor<A,List<RegExp<A>>> unionVis = new Visitor<A,List<RegExp<A>>>() {
public List<RegExp<A>> visit(Union<A> ure) {
return Arrays.<RegExp<A>>asList(ure.left, ure.right);
}
public List<RegExp<A>> visit(RegExp<A> re) {
return Collections.<RegExp<A>>emptyList();
}
};
public List<RegExp<A>> next(RegExp<A> re) {
return re.accept(unionVis);
}
};
} | java | private static <A> ForwardNavigator<RegExp<A>> unionNav() {
return new ForwardNavigator<RegExp<A>>() {
private Visitor<A,List<RegExp<A>>> unionVis = new Visitor<A,List<RegExp<A>>>() {
public List<RegExp<A>> visit(Union<A> ure) {
return Arrays.<RegExp<A>>asList(ure.left, ure.right);
}
public List<RegExp<A>> visit(RegExp<A> re) {
return Collections.<RegExp<A>>emptyList();
}
};
public List<RegExp<A>> next(RegExp<A> re) {
return re.accept(unionVis);
}
};
} | [
"private",
"static",
"<",
"A",
">",
"ForwardNavigator",
"<",
"RegExp",
"<",
"A",
">",
">",
"unionNav",
"(",
")",
"{",
"return",
"new",
"ForwardNavigator",
"<",
"RegExp",
"<",
"A",
">",
">",
"(",
")",
"{",
"private",
"Visitor",
"<",
"A",
",",
"List",
... | forward navigator through the sons of Union nodes. | [
"forward",
"navigator",
"through",
"the",
"sons",
"of",
"Union",
"nodes",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/RegExps/RegExp.java#L346-L360 | train |
protegeproject/jpaul | src/main/java/jpaul/RegExps/RegExp.java | RegExp.concatNav | private static <A> ForwardNavigator<RegExp<A>> concatNav() {
return new ForwardNavigator<RegExp<A>>() {
private Visitor<A,List<RegExp<A>>> concatVis = new Visitor<A,List<RegExp<A>>>() {
public List<RegExp<A>> visit(Concat<A> ure) {
return Arrays.<RegExp<A>>asList(ure.left, ure.right);
}
public List<RegExp<A>> visit(RegExp<A> re) {
return Collections.<RegExp<A>>emptyList();
}
};
public List<RegExp<A>> next(RegExp<A> re) {
return re.accept(concatVis);
}
};
} | java | private static <A> ForwardNavigator<RegExp<A>> concatNav() {
return new ForwardNavigator<RegExp<A>>() {
private Visitor<A,List<RegExp<A>>> concatVis = new Visitor<A,List<RegExp<A>>>() {
public List<RegExp<A>> visit(Concat<A> ure) {
return Arrays.<RegExp<A>>asList(ure.left, ure.right);
}
public List<RegExp<A>> visit(RegExp<A> re) {
return Collections.<RegExp<A>>emptyList();
}
};
public List<RegExp<A>> next(RegExp<A> re) {
return re.accept(concatVis);
}
};
} | [
"private",
"static",
"<",
"A",
">",
"ForwardNavigator",
"<",
"RegExp",
"<",
"A",
">",
">",
"concatNav",
"(",
")",
"{",
"return",
"new",
"ForwardNavigator",
"<",
"RegExp",
"<",
"A",
">",
">",
"(",
")",
"{",
"private",
"Visitor",
"<",
"A",
",",
"List",... | forward navigator through the sons of Concat nodes. | [
"forward",
"navigator",
"through",
"the",
"sons",
"of",
"Concat",
"nodes",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/RegExps/RegExp.java#L363-L377 | train |
m-m-m/util | xml/src/main/java/net/sf/mmm/util/xml/base/DomUtilImpl.java | DomUtilImpl.createTransformer | private Transformer createTransformer(boolean indent) {
try {
Transformer result = this.transformerFactory.newTransformer();
if (indent) {
result.setOutputProperty(OutputKeys.INDENT, "yes");
}
return result;
} catch (TransformerConfigurationException e) {
throw new IllegalStateException("XML Transformer misconfigured!" + " Probably your JVM does not support the required JAXP version!", e);
}
} | java | private Transformer createTransformer(boolean indent) {
try {
Transformer result = this.transformerFactory.newTransformer();
if (indent) {
result.setOutputProperty(OutputKeys.INDENT, "yes");
}
return result;
} catch (TransformerConfigurationException e) {
throw new IllegalStateException("XML Transformer misconfigured!" + " Probably your JVM does not support the required JAXP version!", e);
}
} | [
"private",
"Transformer",
"createTransformer",
"(",
"boolean",
"indent",
")",
"{",
"try",
"{",
"Transformer",
"result",
"=",
"this",
".",
"transformerFactory",
".",
"newTransformer",
"(",
")",
";",
"if",
"(",
"indent",
")",
"{",
"result",
".",
"setOutputProper... | This method creates a new transformer.
@param indent - {@code true} if the XML should be indented (automatically add linebreaks before opening
tags), {@code false} otherwise.
@return the new transformer. | [
"This",
"method",
"creates",
"a",
"new",
"transformer",
"."
] | f0e4e084448f8dfc83ca682a9e1618034a094ce6 | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/xml/src/main/java/net/sf/mmm/util/xml/base/DomUtilImpl.java#L176-L187 | train |
btrplace/scheduler | bench/src/main/java/org/btrplace/bench/Options.java | Options.parameters | public Parameters parameters() {
Parameters ps = new DefaultParameters()
.setTimeLimit(timeout)
.doRepair(repair)
.doOptimize(optimize);
if (single()) {
ps.setVerbosity(verbosity);
}
if (chunk) {
ps.setEnvironmentFactory(mo -> new EnvironmentBuilder().fromChunk().build());
}
return ps;
} | java | public Parameters parameters() {
Parameters ps = new DefaultParameters()
.setTimeLimit(timeout)
.doRepair(repair)
.doOptimize(optimize);
if (single()) {
ps.setVerbosity(verbosity);
}
if (chunk) {
ps.setEnvironmentFactory(mo -> new EnvironmentBuilder().fromChunk().build());
}
return ps;
} | [
"public",
"Parameters",
"parameters",
"(",
")",
"{",
"Parameters",
"ps",
"=",
"new",
"DefaultParameters",
"(",
")",
".",
"setTimeLimit",
"(",
"timeout",
")",
".",
"doRepair",
"(",
"repair",
")",
".",
"doOptimize",
"(",
"optimize",
")",
";",
"if",
"(",
"s... | Get the parameters from the options.
@return the resulting parameters | [
"Get",
"the",
"parameters",
"from",
"the",
"options",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/bench/src/main/java/org/btrplace/bench/Options.java#L72-L85 | train |
btrplace/scheduler | bench/src/main/java/org/btrplace/bench/Options.java | Options.instances | public Stream<LabelledInstance> instances() throws IOException {
if (single()) {
return Collections.singletonList(instance(new File(instance))).stream();
}
@SuppressWarnings("resource")
Stream<String> s = Files.lines(Paths.get(instances), StandardCharsets.UTF_8);
return s.map(x -> instance(new File(x)));
} | java | public Stream<LabelledInstance> instances() throws IOException {
if (single()) {
return Collections.singletonList(instance(new File(instance))).stream();
}
@SuppressWarnings("resource")
Stream<String> s = Files.lines(Paths.get(instances), StandardCharsets.UTF_8);
return s.map(x -> instance(new File(x)));
} | [
"public",
"Stream",
"<",
"LabelledInstance",
">",
"instances",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"single",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"singletonList",
"(",
"instance",
"(",
"new",
"File",
"(",
"instance",
")",
")",
... | List all the instances to solve.
@return a list of instances
@throws IOException if it was not possible to get all the instances | [
"List",
"all",
"the",
"instances",
"to",
"solve",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/bench/src/main/java/org/btrplace/bench/Options.java#L110-L118 | train |
btrplace/scheduler | bench/src/main/java/org/btrplace/bench/Options.java | Options.output | public File output() throws IOException {
File o = new File(output);
if (!o.exists() && !o.mkdirs()) {
throw new IOException("Unable to create output folder '" + output + "'");
}
return o;
} | java | public File output() throws IOException {
File o = new File(output);
if (!o.exists() && !o.mkdirs()) {
throw new IOException("Unable to create output folder '" + output + "'");
}
return o;
} | [
"public",
"File",
"output",
"(",
")",
"throws",
"IOException",
"{",
"File",
"o",
"=",
"new",
"File",
"(",
"output",
")",
";",
"if",
"(",
"!",
"o",
".",
"exists",
"(",
")",
"&&",
"!",
"o",
".",
"mkdirs",
"(",
")",
")",
"{",
"throw",
"new",
"IOEx... | Get the output directory.
@return an existing output directory
@throws IOException if the directory does not exists or was not created | [
"Get",
"the",
"output",
"directory",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/bench/src/main/java/org/btrplace/bench/Options.java#L126-L132 | train |
btrplace/scheduler | bench/src/main/java/org/btrplace/bench/Options.java | Options.instance | public static LabelledInstance instance(File f) {
String path = f.getAbsolutePath();
return new LabelledInstance(path, JSON.readInstance(f));
} | java | public static LabelledInstance instance(File f) {
String path = f.getAbsolutePath();
return new LabelledInstance(path, JSON.readInstance(f));
} | [
"public",
"static",
"LabelledInstance",
"instance",
"(",
"File",
"f",
")",
"{",
"String",
"path",
"=",
"f",
".",
"getAbsolutePath",
"(",
")",
";",
"return",
"new",
"LabelledInstance",
"(",
"path",
",",
"JSON",
".",
"readInstance",
"(",
"f",
")",
")",
";"... | Make an instance.
@param f the file that store the instance
@return the parsed instance. The instance label is the file name | [
"Make",
"an",
"instance",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/bench/src/main/java/org/btrplace/bench/Options.java#L139-L142 | train |
protegeproject/jpaul | src/main/java/jpaul/Misc/Function.java | Function.comp | public static <T1,T2,T3> Function<T1,T3> comp(final Function<T2,T3> func1, final Function<T1,T2> func2) {
return new Function<T1,T3>() {
public T3 f(T1 x) {
return func1.f(func2.f(x));
}
};
} | java | public static <T1,T2,T3> Function<T1,T3> comp(final Function<T2,T3> func1, final Function<T1,T2> func2) {
return new Function<T1,T3>() {
public T3 f(T1 x) {
return func1.f(func2.f(x));
}
};
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"Function",
"<",
"T1",
",",
"T3",
">",
"comp",
"(",
"final",
"Function",
"<",
"T2",
",",
"T3",
">",
"func1",
",",
"final",
"Function",
"<",
"T1",
",",
"T2",
">",
"func2",
")",
"{",
"retu... | Computes the composition of two functions. | [
"Computes",
"the",
"composition",
"of",
"two",
"functions",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Misc/Function.java#L20-L26 | train |
btrplace/scheduler | api/src/main/java/org/btrplace/model/constraint/Split.java | Split.getAssociatedVGroup | public Collection<VM> getAssociatedVGroup(VM u) {
for (Collection<VM> vGrp : sets) {
if (vGrp.contains(u)) {
return vGrp;
}
}
return Collections.emptySet();
} | java | public Collection<VM> getAssociatedVGroup(VM u) {
for (Collection<VM> vGrp : sets) {
if (vGrp.contains(u)) {
return vGrp;
}
}
return Collections.emptySet();
} | [
"public",
"Collection",
"<",
"VM",
">",
"getAssociatedVGroup",
"(",
"VM",
"u",
")",
"{",
"for",
"(",
"Collection",
"<",
"VM",
">",
"vGrp",
":",
"sets",
")",
"{",
"if",
"(",
"vGrp",
".",
"contains",
"(",
"u",
")",
")",
"{",
"return",
"vGrp",
";",
... | Get the group of VMs that contains the given VM.
@param u the VM identifier
@return the group of VM if exists, an empty collection otherwise | [
"Get",
"the",
"group",
"of",
"VMs",
"that",
"contains",
"the",
"given",
"VM",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/constraint/Split.java#L96-L103 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java | OptionsImpl.loadProps | protected Properties loadProps(Properties props) {
// try to load the properties file first from the user's home directory
File file = getPropsFile();
if (file != null) {
// Try to load the file from the user's home directory
if (file.exists()) {
try {
URL url = file.toURI().toURL();
loadFromUrl(props, url);
} catch (MalformedURLException ex) {
if (log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, ex.getMessage(), ex);
}
}
}
}
return props;
} | java | protected Properties loadProps(Properties props) {
// try to load the properties file first from the user's home directory
File file = getPropsFile();
if (file != null) {
// Try to load the file from the user's home directory
if (file.exists()) {
try {
URL url = file.toURI().toURL();
loadFromUrl(props, url);
} catch (MalformedURLException ex) {
if (log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, ex.getMessage(), ex);
}
}
}
}
return props;
} | [
"protected",
"Properties",
"loadProps",
"(",
"Properties",
"props",
")",
"{",
"// try to load the properties file first from the user's home directory\r",
"File",
"file",
"=",
"getPropsFile",
"(",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"// Try to load the ... | Loads the Options properties from the aggregator properties file
into the specified properties object. If the properties file
does not exist, then try to load from the bundle.
@param props
The properties object to load. May be initialized with default
values.
@return The properties file specified by {@code props}. | [
"Loads",
"the",
"Options",
"properties",
"from",
"the",
"aggregator",
"properties",
"file",
"into",
"the",
"specified",
"properties",
"object",
".",
"If",
"the",
"properties",
"file",
"does",
"not",
"exist",
"then",
"try",
"to",
"load",
"from",
"the",
"bundle"... | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java#L270-L288 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java | OptionsImpl.saveProps | protected void saveProps(Properties props) throws IOException {
if (loadFromPropertiesFile) {
// Persist the change to the properties file.
File file = getPropsFile();
if (file != null) {
FileWriter writer = new FileWriter(file);
try {
props.store(writer, null);
} finally {
writer.close();
}
}
}
} | java | protected void saveProps(Properties props) throws IOException {
if (loadFromPropertiesFile) {
// Persist the change to the properties file.
File file = getPropsFile();
if (file != null) {
FileWriter writer = new FileWriter(file);
try {
props.store(writer, null);
} finally {
writer.close();
}
}
}
} | [
"protected",
"void",
"saveProps",
"(",
"Properties",
"props",
")",
"throws",
"IOException",
"{",
"if",
"(",
"loadFromPropertiesFile",
")",
"{",
"// Persist the change to the properties file.\r",
"File",
"file",
"=",
"getPropsFile",
"(",
")",
";",
"if",
"(",
"file",
... | Saves the specified Options properties to the properties file for the
aggregator.
@param props
The properties to save
@throws IOException | [
"Saves",
"the",
"specified",
"Options",
"properties",
"to",
"the",
"properties",
"file",
"for",
"the",
"aggregator",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java#L298-L312 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java | OptionsImpl.updateNotify | protected void updateNotify (long sequence) {
IServiceReference[] refs = null;
try {
if(aggregator != null && aggregator.getPlatformServices() != null){
refs = aggregator.getPlatformServices().getServiceReferences(IOptionsListener.class.getName(),"(name=" + registrationName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
if (refs != null) {
for (IServiceReference ref : refs) {
IOptionsListener listener = (IOptionsListener)aggregator.getPlatformServices().getService(ref);
if (listener != null) {
try {
listener.optionsUpdated(this, sequence);
} catch (Throwable ignore) {
} finally {
aggregator.getPlatformServices().ungetService(ref);
}
}
}
}
}
} catch (PlatformServicesException e) {
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
}
} | java | protected void updateNotify (long sequence) {
IServiceReference[] refs = null;
try {
if(aggregator != null && aggregator.getPlatformServices() != null){
refs = aggregator.getPlatformServices().getServiceReferences(IOptionsListener.class.getName(),"(name=" + registrationName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
if (refs != null) {
for (IServiceReference ref : refs) {
IOptionsListener listener = (IOptionsListener)aggregator.getPlatformServices().getService(ref);
if (listener != null) {
try {
listener.optionsUpdated(this, sequence);
} catch (Throwable ignore) {
} finally {
aggregator.getPlatformServices().ungetService(ref);
}
}
}
}
}
} catch (PlatformServicesException e) {
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
}
} | [
"protected",
"void",
"updateNotify",
"(",
"long",
"sequence",
")",
"{",
"IServiceReference",
"[",
"]",
"refs",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"aggregator",
"!=",
"null",
"&&",
"aggregator",
".",
"getPlatformServices",
"(",
")",
"!=",
"null",
")",... | Notify options change listeners that Options have been updated
@param sequence The change sequence number. | [
"Notify",
"options",
"change",
"listeners",
"that",
"Options",
"have",
"been",
"updated"
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java#L319-L344 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java | OptionsImpl.propertiesFileUpdated | protected void propertiesFileUpdated(Properties updated, long sequence) {
Properties newProps = new Properties(getDefaultOptions());
Enumeration<?> propsEnum = updated.propertyNames();
while (propsEnum.hasMoreElements()) {
String name = (String)propsEnum.nextElement();
newProps.setProperty(name, updated.getProperty(name));
}
setProps(newProps);
updateNotify(sequence);
} | java | protected void propertiesFileUpdated(Properties updated, long sequence) {
Properties newProps = new Properties(getDefaultOptions());
Enumeration<?> propsEnum = updated.propertyNames();
while (propsEnum.hasMoreElements()) {
String name = (String)propsEnum.nextElement();
newProps.setProperty(name, updated.getProperty(name));
}
setProps(newProps);
updateNotify(sequence);
} | [
"protected",
"void",
"propertiesFileUpdated",
"(",
"Properties",
"updated",
",",
"long",
"sequence",
")",
"{",
"Properties",
"newProps",
"=",
"new",
"Properties",
"(",
"getDefaultOptions",
"(",
")",
")",
";",
"Enumeration",
"<",
"?",
">",
"propsEnum",
"=",
"up... | Listener method for being informed of changes to the properties file by another
instance of this class. Called by other instances of this class for instances
that use the same properties file when properties are saved.
@param updated
the updated properties
@param sequence
the update sequence number | [
"Listener",
"method",
"for",
"being",
"informed",
"of",
"changes",
"to",
"the",
"properties",
"file",
"by",
"another",
"instance",
"of",
"this",
"class",
".",
"Called",
"by",
"other",
"instances",
"of",
"this",
"class",
"for",
"instances",
"that",
"use",
"th... | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java#L356-L365 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java | OptionsImpl.propsFileUpdateNotify | protected void propsFileUpdateNotify(Properties updatedProps, long sequence) {
if(aggregator == null || aggregator.getPlatformServices() == null // unit tests?
|| !loadFromPropertiesFile) return;
IPlatformServices platformServices = aggregator.getPlatformServices();
try {
IServiceReference[] refs = platformServices.getServiceReferences(OptionsImpl.class.getName(),
"(propsFileName=" + getPropsFile().getAbsolutePath().replace("\\", "\\\\") + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
if (refs != null) {
for (IServiceReference ref : refs) {
String name = ref.getProperty("name"); //$NON-NLS-1$
if (!registrationName.equals(name)) {
OptionsImpl impl = (OptionsImpl)platformServices.getService(ref);
if (impl != null) {
try {
impl.propertiesFileUpdated(updatedProps, sequence);
} catch (Throwable ignore) {}
finally {
platformServices.ungetService(ref);
}
}
}
}
}
} catch (PlatformServicesException e) {
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
}
} | java | protected void propsFileUpdateNotify(Properties updatedProps, long sequence) {
if(aggregator == null || aggregator.getPlatformServices() == null // unit tests?
|| !loadFromPropertiesFile) return;
IPlatformServices platformServices = aggregator.getPlatformServices();
try {
IServiceReference[] refs = platformServices.getServiceReferences(OptionsImpl.class.getName(),
"(propsFileName=" + getPropsFile().getAbsolutePath().replace("\\", "\\\\") + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
if (refs != null) {
for (IServiceReference ref : refs) {
String name = ref.getProperty("name"); //$NON-NLS-1$
if (!registrationName.equals(name)) {
OptionsImpl impl = (OptionsImpl)platformServices.getService(ref);
if (impl != null) {
try {
impl.propertiesFileUpdated(updatedProps, sequence);
} catch (Throwable ignore) {}
finally {
platformServices.ungetService(ref);
}
}
}
}
}
} catch (PlatformServicesException e) {
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
}
} | [
"protected",
"void",
"propsFileUpdateNotify",
"(",
"Properties",
"updatedProps",
",",
"long",
"sequence",
")",
"{",
"if",
"(",
"aggregator",
"==",
"null",
"||",
"aggregator",
".",
"getPlatformServices",
"(",
")",
"==",
"null",
"// unit tests?\r",
"||",
"!",
"loa... | Notify implementations of this class that are listening for properties file updates
on the same properties file that the properties file has been updated.
@param updatedProps
the updated properties
@param sequence
the update sequence number | [
"Notify",
"implementations",
"of",
"this",
"class",
"that",
"are",
"listening",
"for",
"properties",
"file",
"updates",
"on",
"the",
"same",
"properties",
"file",
"that",
"the",
"properties",
"file",
"has",
"been",
"updated",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java#L391-L420 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java | OptionsImpl.initDefaultOptions | protected Properties initDefaultOptions() {
Properties defaultValues = new Properties();
defaultValues.putAll(defaults);
// See if there's an aggregator.properties in the class loader's root
ClassLoader cl = OptionsImpl.class.getClassLoader();
URL url = cl.getResource(getPropsFilename());
if (url != null) {
loadFromUrl(defaultValues, url);
}
// If the bundle defines properties, then load those too
if(aggregator != null){
url = aggregator.getPlatformServices().getResource(getPropsFilename());
if (url != null) {
loadFromUrl(defaultValues, url);
}
}
Map<String, String> map = new HashMap<String, String>();
for (String name : defaultValues.stringPropertyNames()) {
map.put(name, (String)defaultValues.getProperty(name));
}
defaultOptionsMap = Collections.unmodifiableMap(map);
return defaultValues;
} | java | protected Properties initDefaultOptions() {
Properties defaultValues = new Properties();
defaultValues.putAll(defaults);
// See if there's an aggregator.properties in the class loader's root
ClassLoader cl = OptionsImpl.class.getClassLoader();
URL url = cl.getResource(getPropsFilename());
if (url != null) {
loadFromUrl(defaultValues, url);
}
// If the bundle defines properties, then load those too
if(aggregator != null){
url = aggregator.getPlatformServices().getResource(getPropsFilename());
if (url != null) {
loadFromUrl(defaultValues, url);
}
}
Map<String, String> map = new HashMap<String, String>();
for (String name : defaultValues.stringPropertyNames()) {
map.put(name, (String)defaultValues.getProperty(name));
}
defaultOptionsMap = Collections.unmodifiableMap(map);
return defaultValues;
} | [
"protected",
"Properties",
"initDefaultOptions",
"(",
")",
"{",
"Properties",
"defaultValues",
"=",
"new",
"Properties",
"(",
")",
";",
"defaultValues",
".",
"putAll",
"(",
"defaults",
")",
";",
"// See if there's an aggregator.properties in the class loader's root\r",
"C... | Returns the default options for this the aggregator service.
@return The default options. | [
"Returns",
"the",
"default",
"options",
"for",
"this",
"the",
"aggregator",
"service",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/options/OptionsImpl.java#L460-L485 | train |
mapcode-foundation/mapcode-java | src/main/java/com/mapcode/MapcodeZone.java | MapcodeZone.setFromFractions | void setFromFractions(final double latFraction, final double lonFraction,
final double latFractionDelta, final double lonFractionDelta) {
assert (lonFractionDelta >= 0.0);
assert (latFractionDelta != 0.0);
lonFractionMin = lonFraction;
lonFractionMax = lonFraction + lonFractionDelta;
if (latFractionDelta < 0) {
latFractionMin = latFraction + 1 + latFractionDelta; // y + yDelta can NOT be represented.
latFractionMax = latFraction + 1; // y CAN be represented.
} else {
latFractionMin = latFraction;
latFractionMax = latFraction + latFractionDelta;
}
} | java | void setFromFractions(final double latFraction, final double lonFraction,
final double latFractionDelta, final double lonFractionDelta) {
assert (lonFractionDelta >= 0.0);
assert (latFractionDelta != 0.0);
lonFractionMin = lonFraction;
lonFractionMax = lonFraction + lonFractionDelta;
if (latFractionDelta < 0) {
latFractionMin = latFraction + 1 + latFractionDelta; // y + yDelta can NOT be represented.
latFractionMax = latFraction + 1; // y CAN be represented.
} else {
latFractionMin = latFraction;
latFractionMax = latFraction + latFractionDelta;
}
} | [
"void",
"setFromFractions",
"(",
"final",
"double",
"latFraction",
",",
"final",
"double",
"lonFraction",
",",
"final",
"double",
"latFractionDelta",
",",
"final",
"double",
"lonFractionDelta",
")",
"{",
"assert",
"(",
"lonFractionDelta",
">=",
"0.0",
")",
";",
... | Generate upper and lower limits based on x and y, and delta's. | [
"Generate",
"upper",
"and",
"lower",
"limits",
"based",
"on",
"x",
"and",
"y",
"and",
"delta",
"s",
"."
] | f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8 | https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/MapcodeZone.java#L89-L102 | train |
btrplace/scheduler | api/src/main/java/org/btrplace/plan/event/ShutdownNode.java | ShutdownNode.applyAction | @Override
public boolean applyAction(Model c) {
Mapping map = c.getMapping();
return !map.isOffline(node) && map.addOfflineNode(node);
} | java | @Override
public boolean applyAction(Model c) {
Mapping map = c.getMapping();
return !map.isOffline(node) && map.addOfflineNode(node);
} | [
"@",
"Override",
"public",
"boolean",
"applyAction",
"(",
"Model",
"c",
")",
"{",
"Mapping",
"map",
"=",
"c",
".",
"getMapping",
"(",
")",
";",
"return",
"!",
"map",
".",
"isOffline",
"(",
"node",
")",
"&&",
"map",
".",
"addOfflineNode",
"(",
"node",
... | Put the node offline on a model
@param c the model
@return {@code true} if the node was online and is set offline. {@code false} otherwise | [
"Put",
"the",
"node",
"offline",
"on",
"a",
"model"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/plan/event/ShutdownNode.java#L86-L90 | train |
jMotif/GI | src/main/java/net/seninp/gi/sequitur/SAXSymbol.java | SAXSymbol.join | public static void join(SAXSymbol left, SAXSymbol right) {
// System.out.println(" performing the join of " + getPayload(left) + " and "
// + getPayload(right));
// check for an OLD digram existence - i.e. left must have a next symbol
// if .n exists then we are joining TERMINAL symbols within the string, and must clean-up the
// old digram
if (left.n != null) {
// System.out.println(" " + getPayload(left)
// + " use to be in the digram table, cleaning up");
left.deleteDigram();
}
// re-link left and right
left.n = right;
right.p = left;
} | java | public static void join(SAXSymbol left, SAXSymbol right) {
// System.out.println(" performing the join of " + getPayload(left) + " and "
// + getPayload(right));
// check for an OLD digram existence - i.e. left must have a next symbol
// if .n exists then we are joining TERMINAL symbols within the string, and must clean-up the
// old digram
if (left.n != null) {
// System.out.println(" " + getPayload(left)
// + " use to be in the digram table, cleaning up");
left.deleteDigram();
}
// re-link left and right
left.n = right;
right.p = left;
} | [
"public",
"static",
"void",
"join",
"(",
"SAXSymbol",
"left",
",",
"SAXSymbol",
"right",
")",
"{",
"// System.out.println(\" performing the join of \" + getPayload(left) + \" and \"\r",
"// + getPayload(right));\r",
"// check for an OLD digram existence - i.e. left must have a next symbo... | Links left and right symbols together, i.e. removes this symbol from the string, also removing
any old digram from the hash table.
@param left the left symbol.
@param right the right symbol. | [
"Links",
"left",
"and",
"right",
"symbols",
"together",
"i",
".",
"e",
".",
"removes",
"this",
"symbol",
"from",
"the",
"string",
"also",
"removing",
"any",
"old",
"digram",
"from",
"the",
"hash",
"table",
"."
] | 381212dd4f193246a6df82bd46f0d2bcd04a68d6 | https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SAXSymbol.java#L66-L83 | train |
jMotif/GI | src/main/java/net/seninp/gi/sequitur/SAXSymbol.java | SAXSymbol.substitute | public void substitute(SAXRule r) {
// System.out.println("[sequitur debug] *substitute* " + this.value + " with rule "
// + r.asDebugLine());
// clean up this place and the next
// here we keep the original position in the input string
//
r.addIndex(this.originalPosition);
this.cleanUp();
this.n.cleanUp();
// link the rule instead of digram
SAXNonTerminal nt = new SAXNonTerminal(r);
nt.originalPosition = this.originalPosition;
this.p.insertAfter(nt);
// do p check
//
// TODO: not getting this
if (!p.check()) {
p.n.check();
}
} | java | public void substitute(SAXRule r) {
// System.out.println("[sequitur debug] *substitute* " + this.value + " with rule "
// + r.asDebugLine());
// clean up this place and the next
// here we keep the original position in the input string
//
r.addIndex(this.originalPosition);
this.cleanUp();
this.n.cleanUp();
// link the rule instead of digram
SAXNonTerminal nt = new SAXNonTerminal(r);
nt.originalPosition = this.originalPosition;
this.p.insertAfter(nt);
// do p check
//
// TODO: not getting this
if (!p.check()) {
p.n.check();
}
} | [
"public",
"void",
"substitute",
"(",
"SAXRule",
"r",
")",
"{",
"// System.out.println(\"[sequitur debug] *substitute* \" + this.value + \" with rule \"\r",
"// + r.asDebugLine());\r",
"// clean up this place and the next\r",
"// here we keep the original position in the input string\r",
"//\... | Replace a digram with a non-terminal.
@param r a rule to use. | [
"Replace",
"a",
"digram",
"with",
"a",
"non",
"-",
"terminal",
"."
] | 381212dd4f193246a6df82bd46f0d2bcd04a68d6 | https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SAXSymbol.java#L217-L238 | train |
jMotif/GI | src/main/java/net/seninp/gi/sequitur/SAXSymbol.java | SAXSymbol.match | public void match(SAXSymbol theDigram, SAXSymbol matchingDigram) {
SAXRule rule;
SAXSymbol first, second;
// System.out.println("[sequitur debug] *match* newDigram [" + newDigram.value + ","
// + newDigram.n.value + "], old matching one [" + matchingDigram.value + ","
// + matchingDigram.n.value + "]");
// if previous of matching digram is a guard
if (matchingDigram.p.isGuard() && matchingDigram.n.n.isGuard()) {
// reuse an existing rule
rule = ((SAXGuard) matchingDigram.p).r;
theDigram.substitute(rule);
}
else {
// well, here we create a new rule because there are two matching digrams
rule = new SAXRule();
try {
// tie the digram's links together within the new rule
// this uses copies of objects, so they do not get cut out of S
first = (SAXSymbol) theDigram.clone();
second = (SAXSymbol) theDigram.n.clone();
rule.theGuard.n = first;
first.p = rule.theGuard;
first.n = second;
second.p = first;
second.n = rule.theGuard;
rule.theGuard.p = second;
// System.out.println("[sequitur debug] *newRule...* \n" + rule.getRules());
// put this digram into the hash
// this effectively erases the OLD MATCHING digram with the new DIGRAM (symbol is wrapped
// into Guard)
theDigrams.put(first, first);
// substitute the matching (old) digram with this rule in S
// System.out.println("[sequitur debug] *newRule...* substitute OLD digram first.");
matchingDigram.substitute(rule);
// substitute the new digram with this rule in S
// System.out.println("[sequitur debug] *newRule...* substitute NEW digram last.");
theDigram.substitute(rule);
// rule.assignLevel();
// System.out.println(" *** Digrams now: " + makeDigramsTable());
}
catch (CloneNotSupportedException c) {
c.printStackTrace();
}
}
// Check for an underused rule.
if (rule.first().isNonTerminal() && (((SAXNonTerminal) rule.first()).r.count == 1))
((SAXNonTerminal) rule.first()).expand();
rule.assignLevel();
} | java | public void match(SAXSymbol theDigram, SAXSymbol matchingDigram) {
SAXRule rule;
SAXSymbol first, second;
// System.out.println("[sequitur debug] *match* newDigram [" + newDigram.value + ","
// + newDigram.n.value + "], old matching one [" + matchingDigram.value + ","
// + matchingDigram.n.value + "]");
// if previous of matching digram is a guard
if (matchingDigram.p.isGuard() && matchingDigram.n.n.isGuard()) {
// reuse an existing rule
rule = ((SAXGuard) matchingDigram.p).r;
theDigram.substitute(rule);
}
else {
// well, here we create a new rule because there are two matching digrams
rule = new SAXRule();
try {
// tie the digram's links together within the new rule
// this uses copies of objects, so they do not get cut out of S
first = (SAXSymbol) theDigram.clone();
second = (SAXSymbol) theDigram.n.clone();
rule.theGuard.n = first;
first.p = rule.theGuard;
first.n = second;
second.p = first;
second.n = rule.theGuard;
rule.theGuard.p = second;
// System.out.println("[sequitur debug] *newRule...* \n" + rule.getRules());
// put this digram into the hash
// this effectively erases the OLD MATCHING digram with the new DIGRAM (symbol is wrapped
// into Guard)
theDigrams.put(first, first);
// substitute the matching (old) digram with this rule in S
// System.out.println("[sequitur debug] *newRule...* substitute OLD digram first.");
matchingDigram.substitute(rule);
// substitute the new digram with this rule in S
// System.out.println("[sequitur debug] *newRule...* substitute NEW digram last.");
theDigram.substitute(rule);
// rule.assignLevel();
// System.out.println(" *** Digrams now: " + makeDigramsTable());
}
catch (CloneNotSupportedException c) {
c.printStackTrace();
}
}
// Check for an underused rule.
if (rule.first().isNonTerminal() && (((SAXNonTerminal) rule.first()).r.count == 1))
((SAXNonTerminal) rule.first()).expand();
rule.assignLevel();
} | [
"public",
"void",
"match",
"(",
"SAXSymbol",
"theDigram",
",",
"SAXSymbol",
"matchingDigram",
")",
"{",
"SAXRule",
"rule",
";",
"SAXSymbol",
"first",
",",
"second",
";",
"// System.out.println(\"[sequitur debug] *match* newDigram [\" + newDigram.value + \",\"\r",
"// + newDig... | Deals with a matching digram.
@param theDigram the first matching digram.
@param matchingDigram the second matching digram. | [
"Deals",
"with",
"a",
"matching",
"digram",
"."
] | 381212dd4f193246a6df82bd46f0d2bcd04a68d6 | https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SAXSymbol.java#L246-L309 | train |
jMotif/GI | src/main/java/net/seninp/gi/sequitur/SAXSymbol.java | SAXSymbol.getPayload | protected static String getPayload(SAXSymbol symbol) {
if (symbol.isGuard()) {
return "guard of the rule " + ((SAXGuard) symbol).r.ruleIndex;
}
else if (symbol.isNonTerminal()) {
return "nonterminal " + ((SAXNonTerminal) symbol).value;
}
return "symbol " + symbol.value;
} | java | protected static String getPayload(SAXSymbol symbol) {
if (symbol.isGuard()) {
return "guard of the rule " + ((SAXGuard) symbol).r.ruleIndex;
}
else if (symbol.isNonTerminal()) {
return "nonterminal " + ((SAXNonTerminal) symbol).value;
}
return "symbol " + symbol.value;
} | [
"protected",
"static",
"String",
"getPayload",
"(",
"SAXSymbol",
"symbol",
")",
"{",
"if",
"(",
"symbol",
".",
"isGuard",
"(",
")",
")",
"{",
"return",
"\"guard of the rule \"",
"+",
"(",
"(",
"SAXGuard",
")",
"symbol",
")",
".",
"r",
".",
"ruleIndex",
"... | This routine is used for the debugging.
@param symbol the symbol we looking into.
@return symbol's payload. | [
"This",
"routine",
"is",
"used",
"for",
"the",
"debugging",
"."
] | 381212dd4f193246a6df82bd46f0d2bcd04a68d6 | https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SAXSymbol.java#L394-L402 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/modulebuilder/ModuleBuild.java | ModuleBuild.getExtraModules | public List<String> getExtraModules() {
return extraModules == null ? Collections.<String>emptyList() : Collections.unmodifiableList(extraModules);
} | java | public List<String> getExtraModules() {
return extraModules == null ? Collections.<String>emptyList() : Collections.unmodifiableList(extraModules);
} | [
"public",
"List",
"<",
"String",
">",
"getExtraModules",
"(",
")",
"{",
"return",
"extraModules",
"==",
"null",
"?",
"Collections",
".",
"<",
"String",
">",
"emptyList",
"(",
")",
":",
"Collections",
".",
"unmodifiableList",
"(",
"extraModules",
")",
";",
... | Returns the list of additional modules that should be included ahead
of this module build in the layer
@return The list of before modules. | [
"Returns",
"the",
"list",
"of",
"additional",
"modules",
"that",
"should",
"be",
"included",
"ahead",
"of",
"this",
"module",
"build",
"in",
"the",
"layer"
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/modulebuilder/ModuleBuild.java#L134-L136 | train |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/DefaultReconfigurationProblemBuilder.java | DefaultReconfigurationProblemBuilder.setNextVMsStates | public DefaultReconfigurationProblemBuilder setNextVMsStates(Set<VM> ready,
Set<VM> running,
Set<VM> sleeping,
Set<VM> killed) {
runs = running;
waits = ready;
sleep = sleeping;
over = killed;
return this;
} | java | public DefaultReconfigurationProblemBuilder setNextVMsStates(Set<VM> ready,
Set<VM> running,
Set<VM> sleeping,
Set<VM> killed) {
runs = running;
waits = ready;
sleep = sleeping;
over = killed;
return this;
} | [
"public",
"DefaultReconfigurationProblemBuilder",
"setNextVMsStates",
"(",
"Set",
"<",
"VM",
">",
"ready",
",",
"Set",
"<",
"VM",
">",
"running",
",",
"Set",
"<",
"VM",
">",
"sleeping",
",",
"Set",
"<",
"VM",
">",
"killed",
")",
"{",
"runs",
"=",
"runnin... | Set the next state of the VMs.
Sets must be disjoint
@param ready the future VMs in the ready state
@param running the future VMs in the running state
@param sleeping the future VMs in the sleeping state
@param killed the VMs to kill
@return the current builder | [
"Set",
"the",
"next",
"state",
"of",
"the",
"VMs",
".",
"Sets",
"must",
"be",
"disjoint"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/DefaultReconfigurationProblemBuilder.java#L86-L95 | train |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/DefaultReconfigurationProblemBuilder.java | DefaultReconfigurationProblemBuilder.build | public DefaultReconfigurationProblem build() throws SchedulerException {
if (runs == null) {
//The others are supposed to be null too as they are set using the same method
Mapping map = model.getMapping();
runs = new HashSet<>();
sleep = new HashSet<>();
for (Node n : map.getOnlineNodes()) {
runs.addAll(map.getRunningVMs(n));
sleep.addAll(map.getSleepingVMs(n));
}
waits = map.getReadyVMs();
over = Collections.emptySet();
}
if (manageable == null) {
manageable = new HashSet<>();
manageable.addAll(model.getMapping().getSleepingVMs());
manageable.addAll(model.getMapping().getRunningVMs());
manageable.addAll(model.getMapping().getReadyVMs());
}
if (ps == null) {
ps = new DefaultParameters();
}
return new DefaultReconfigurationProblem(model, ps, waits, runs, sleep, over, manageable);
} | java | public DefaultReconfigurationProblem build() throws SchedulerException {
if (runs == null) {
//The others are supposed to be null too as they are set using the same method
Mapping map = model.getMapping();
runs = new HashSet<>();
sleep = new HashSet<>();
for (Node n : map.getOnlineNodes()) {
runs.addAll(map.getRunningVMs(n));
sleep.addAll(map.getSleepingVMs(n));
}
waits = map.getReadyVMs();
over = Collections.emptySet();
}
if (manageable == null) {
manageable = new HashSet<>();
manageable.addAll(model.getMapping().getSleepingVMs());
manageable.addAll(model.getMapping().getRunningVMs());
manageable.addAll(model.getMapping().getReadyVMs());
}
if (ps == null) {
ps = new DefaultParameters();
}
return new DefaultReconfigurationProblem(model, ps, waits, runs, sleep, over, manageable);
} | [
"public",
"DefaultReconfigurationProblem",
"build",
"(",
")",
"throws",
"SchedulerException",
"{",
"if",
"(",
"runs",
"==",
"null",
")",
"{",
"//The others are supposed to be null too as they are set using the same method",
"Mapping",
"map",
"=",
"model",
".",
"getMapping",... | Build the problem
@return the builder problem
@throws org.btrplace.scheduler.SchedulerException if an error occurred | [
"Build",
"the",
"problem"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/DefaultReconfigurationProblemBuilder.java#L114-L140 | train |
smallnest/fastjson-jaxrs-json-provider | src/main/java/com/colobu/fastjson/IOUtils.java | IOUtils.inputStreamToString | public static String inputStreamToString(InputStream in) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
String line;
while ((line = br.readLine()) != null) {
buffer.append(line);
}
return buffer.toString();
} | java | public static String inputStreamToString(InputStream in) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
String line;
while ((line = br.readLine()) != null) {
buffer.append(line);
}
return buffer.toString();
} | [
"public",
"static",
"String",
"inputStreamToString",
"(",
"InputStream",
"in",
")",
"throws",
"Exception",
"{",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"in",
")",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",... | read a String from an InputStream object.
@param in InputStream
@return String
@throws Exception | [
"read",
"a",
"String",
"from",
"an",
"InputStream",
"object",
"."
] | bbdb2e3d101069bf62c026976ff9d00967671ec0 | https://github.com/smallnest/fastjson-jaxrs-json-provider/blob/bbdb2e3d101069bf62c026976ff9d00967671ec0/src/main/java/com/colobu/fastjson/IOUtils.java#L15-L23 | train |
jMotif/GI | src/main/java/net/seninp/gi/repair/RepairDigramRecord.java | RepairDigramRecord.compareTo | @Override
public int compareTo(RepairDigramRecord o) {
if (this.freq > o.freq) {
return 1;
}
else if (this.freq < o.freq) {
return -1;
}
return 0;
} | java | @Override
public int compareTo(RepairDigramRecord o) {
if (this.freq > o.freq) {
return 1;
}
else if (this.freq < o.freq) {
return -1;
}
return 0;
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"RepairDigramRecord",
"o",
")",
"{",
"if",
"(",
"this",
".",
"freq",
">",
"o",
".",
"freq",
")",
"{",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"this",
".",
"freq",
"<",
"o",
".",
"freq",
")",... | A comparator built upon occurrence frequency only. | [
"A",
"comparator",
"built",
"upon",
"occurrence",
"frequency",
"only",
"."
] | 381212dd4f193246a6df82bd46f0d2bcd04a68d6 | https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/repair/RepairDigramRecord.java#L31-L40 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/resource/FileResourceFactory.java | FileResourceFactory.getNIOFileResourceClass | protected Class<?> getNIOFileResourceClass() {
final String method = "getNIOFileResourceClass"; //$NON-NLS-1$
if (tryNIO && nioFileResourceClass == null) {
try {
nioFileResourceClass = classLoader
.loadClass("com.ibm.jaggr.core.impl.resource.NIOFileResource"); //$NON-NLS-1$
} catch (ClassNotFoundException e) {
tryNIO = false; // Don't try this again.
if (log.isLoggable(Level.WARNING)) {
log.logp(Level.WARNING, CLAZZ, method, e.getMessage());
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
} catch (UnsupportedClassVersionError e) {
tryNIO = false; // Don't try this again.
if (log.isLoggable(Level.WARNING)) {
log.logp(Level.WARNING, CLAZZ, method, e.getMessage());
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
}
}
return nioFileResourceClass;
} | java | protected Class<?> getNIOFileResourceClass() {
final String method = "getNIOFileResourceClass"; //$NON-NLS-1$
if (tryNIO && nioFileResourceClass == null) {
try {
nioFileResourceClass = classLoader
.loadClass("com.ibm.jaggr.core.impl.resource.NIOFileResource"); //$NON-NLS-1$
} catch (ClassNotFoundException e) {
tryNIO = false; // Don't try this again.
if (log.isLoggable(Level.WARNING)) {
log.logp(Level.WARNING, CLAZZ, method, e.getMessage());
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
} catch (UnsupportedClassVersionError e) {
tryNIO = false; // Don't try this again.
if (log.isLoggable(Level.WARNING)) {
log.logp(Level.WARNING, CLAZZ, method, e.getMessage());
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
}
}
return nioFileResourceClass;
} | [
"protected",
"Class",
"<",
"?",
">",
"getNIOFileResourceClass",
"(",
")",
"{",
"final",
"String",
"method",
"=",
"\"getNIOFileResourceClass\"",
";",
"//$NON-NLS-1$\r",
"if",
"(",
"tryNIO",
"&&",
"nioFileResourceClass",
"==",
"null",
")",
"{",
"try",
"{",
"nioFil... | Utility method for acquiring a reference to the NIOFileResource class without
asking the class loader every single time after we know it's not there.
@return the NIO class object | [
"Utility",
"method",
"for",
"acquiring",
"a",
"reference",
"to",
"the",
"NIOFileResource",
"class",
"without",
"asking",
"the",
"class",
"loader",
"every",
"single",
"time",
"after",
"we",
"know",
"it",
"s",
"not",
"there",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/resource/FileResourceFactory.java#L93-L115 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/resource/FileResourceFactory.java | FileResourceFactory.getNIOFileResourceConstructor | protected Constructor<?> getNIOFileResourceConstructor(Class<?>... args) {
final String method = "getNIOFileResourceConstructor"; //$NON-NLS-1$
if (tryNIO && nioFileResourceConstructor == null) {
try {
Class<?> clazz = getNIOFileResourceClass();
if (clazz != null)
nioFileResourceConstructor = clazz.getConstructor(args);
} catch (NoSuchMethodException e) {
tryNIO = false; // Don't try this again.
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
if (log.isLoggable(Level.WARNING))
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
} catch (SecurityException e) {
tryNIO = false; // Don't try this again.
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
if (log.isLoggable(Level.WARNING))
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
}
return nioFileResourceConstructor;
} | java | protected Constructor<?> getNIOFileResourceConstructor(Class<?>... args) {
final String method = "getNIOFileResourceConstructor"; //$NON-NLS-1$
if (tryNIO && nioFileResourceConstructor == null) {
try {
Class<?> clazz = getNIOFileResourceClass();
if (clazz != null)
nioFileResourceConstructor = clazz.getConstructor(args);
} catch (NoSuchMethodException e) {
tryNIO = false; // Don't try this again.
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
if (log.isLoggable(Level.WARNING))
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
} catch (SecurityException e) {
tryNIO = false; // Don't try this again.
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
if (log.isLoggable(Level.WARNING))
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
}
return nioFileResourceConstructor;
} | [
"protected",
"Constructor",
"<",
"?",
">",
"getNIOFileResourceConstructor",
"(",
"Class",
"<",
"?",
">",
"...",
"args",
")",
"{",
"final",
"String",
"method",
"=",
"\"getNIOFileResourceConstructor\"",
";",
"//$NON-NLS-1$\r",
"if",
"(",
"tryNIO",
"&&",
"nioFileReso... | Utility method for acquiring a reference to the NIOFileResource class constructor
without asking the class loader every single time after we know it's not there.
@param args
The constructor argument types
@return the constructor object | [
"Utility",
"method",
"for",
"acquiring",
"a",
"reference",
"to",
"the",
"NIOFileResource",
"class",
"constructor",
"without",
"asking",
"the",
"class",
"loader",
"every",
"single",
"time",
"after",
"we",
"know",
"it",
"s",
"not",
"there",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/resource/FileResourceFactory.java#L125-L150 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/resource/FileResourceFactory.java | FileResourceFactory.getNIOInstance | protected Object getNIOInstance(Constructor<?> constructor, Object... args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
final String method = "getInstance"; //$NON-NLS-1$
Object ret = null;
if (tryNIO) {
if (constructor != null) {
try {
ret = (IResource)constructor.newInstance(args);
} catch (NoClassDefFoundError e) {
if (log.isLoggable(Level.WARNING)) {
log.logp(Level.WARNING, CLAZZ, method, e.getMessage());
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
tryNIO = false;
} catch (UnsupportedClassVersionError e) {
if (log.isLoggable(Level.WARNING)) {
log.logp(Level.WARNING, CLAZZ, method, e.getMessage());
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
tryNIO = false;
}
}
}
return ret;
} | java | protected Object getNIOInstance(Constructor<?> constructor, Object... args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
final String method = "getInstance"; //$NON-NLS-1$
Object ret = null;
if (tryNIO) {
if (constructor != null) {
try {
ret = (IResource)constructor.newInstance(args);
} catch (NoClassDefFoundError e) {
if (log.isLoggable(Level.WARNING)) {
log.logp(Level.WARNING, CLAZZ, method, e.getMessage());
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
tryNIO = false;
} catch (UnsupportedClassVersionError e) {
if (log.isLoggable(Level.WARNING)) {
log.logp(Level.WARNING, CLAZZ, method, e.getMessage());
log.logp(Level.WARNING, CLAZZ, method, WARN_MESSAGE);
}
tryNIO = false;
}
}
}
return ret;
} | [
"protected",
"Object",
"getNIOInstance",
"(",
"Constructor",
"<",
"?",
">",
"constructor",
",",
"Object",
"...",
"args",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
",",
"IllegalArgumentException",
",",
"InvocationTargetException",
"{",
"fina... | Utility method to catch class loading issues and prevent repeated attempts to use reflection.
@param constructor The constructor to invoke
@param args The args to pass the constructor
@return The instance.
@throws InstantiationException
@throws IllegalAccessException
@throws IllegalArgumentException
@throws InvocationTargetException | [
"Utility",
"method",
"to",
"catch",
"class",
"loading",
"issues",
"and",
"prevent",
"repeated",
"attempts",
"to",
"use",
"reflection",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/resource/FileResourceFactory.java#L164-L188 | train |
m-m-m/util | validation/src/main/java/net/sf/mmm/util/validation/base/jsr303/ConstraintContext.java | ConstraintContext.complete | @SuppressWarnings({ "rawtypes", "unchecked" })
void complete() {
if (this.range != null) {
AbstractValidatorRange validator = null;
if (this.valueType != null) {
Class<?> valueClass = this.valueType.getAssignmentClass();
if (this.valueType.isCollection()) {
validator = new ValidatorCollectionSize(this.range);
} else if (this.valueType.isMap()) {
validator = new ValidatorMapSize(this.range);
} else if (this.valueType.getComponentType() != null) {
validator = new ValidatorArrayLength(this.range);
} else if (this.mathUtil.getNumberType(valueClass) != null) {
validator = new ValidatorRange<>(this.range);
}
}
if (validator == null) {
validator = new ValidatorRangeGeneric<>(this.range);
}
this.validatorRegistry.add(validator);
}
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
void complete() {
if (this.range != null) {
AbstractValidatorRange validator = null;
if (this.valueType != null) {
Class<?> valueClass = this.valueType.getAssignmentClass();
if (this.valueType.isCollection()) {
validator = new ValidatorCollectionSize(this.range);
} else if (this.valueType.isMap()) {
validator = new ValidatorMapSize(this.range);
} else if (this.valueType.getComponentType() != null) {
validator = new ValidatorArrayLength(this.range);
} else if (this.mathUtil.getNumberType(valueClass) != null) {
validator = new ValidatorRange<>(this.range);
}
}
if (validator == null) {
validator = new ValidatorRangeGeneric<>(this.range);
}
this.validatorRegistry.add(validator);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"void",
"complete",
"(",
")",
"{",
"if",
"(",
"this",
".",
"range",
"!=",
"null",
")",
"{",
"AbstractValidatorRange",
"validator",
"=",
"null",
";",
"if",
"(",
"this",
"."... | Has to be called at the end to complete the processing. | [
"Has",
"to",
"be",
"called",
"at",
"the",
"end",
"to",
"complete",
"the",
"processing",
"."
] | f0e4e084448f8dfc83ca682a9e1618034a094ce6 | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/validation/src/main/java/net/sf/mmm/util/validation/base/jsr303/ConstraintContext.java#L131-L153 | train |
m-m-m/util | value/src/main/java/net/sf/mmm/util/value/impl/AbstractValueConverterToCompatiblePojo.java | AbstractValueConverterToCompatiblePojo.handleNoGetterForSetter | protected void handleNoGetterForSetter(PojoPropertyAccessorOneArg setter, Class<?> targetClass, Object sourceObject, Class<?> sourceClass) {
throw new PojoPropertyNotFoundException(sourceClass, setter.getName());
} | java | protected void handleNoGetterForSetter(PojoPropertyAccessorOneArg setter, Class<?> targetClass, Object sourceObject, Class<?> sourceClass) {
throw new PojoPropertyNotFoundException(sourceClass, setter.getName());
} | [
"protected",
"void",
"handleNoGetterForSetter",
"(",
"PojoPropertyAccessorOneArg",
"setter",
",",
"Class",
"<",
"?",
">",
"targetClass",
",",
"Object",
"sourceObject",
",",
"Class",
"<",
"?",
">",
"sourceClass",
")",
"{",
"throw",
"new",
"PojoPropertyNotFoundExcepti... | Called if the target object of the conversion has a setter that has no corresponding getter in the source
object to convert.
@param setter is the existing setter.
@param targetClass is the {@link Class} reflecting the target object to convert to.
@param sourceObject is the source object to convert that has no corresponding getter.
@param sourceClass is the {@link Class} reflecting the source object. | [
"Called",
"if",
"the",
"target",
"object",
"of",
"the",
"conversion",
"has",
"a",
"setter",
"that",
"has",
"no",
"corresponding",
"getter",
"in",
"the",
"source",
"object",
"to",
"convert",
"."
] | f0e4e084448f8dfc83ca682a9e1618034a094ce6 | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/value/src/main/java/net/sf/mmm/util/value/impl/AbstractValueConverterToCompatiblePojo.java#L115-L118 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPass.java | RequireExpansionCompilerPass.appendConsoleLogging | private void appendConsoleLogging(Node root) {
if (logDebug && consoleDebugOutput.size() > 0) {
// Emit code to call console.log on the client
Node node = root;
if (node.getType() == Token.BLOCK) {
node = node.getFirstChild();
}
if (node.getType() == Token.SCRIPT) {
if (source == null) {
// This is non-source build. Modify the AST
Node firstNode = node.getFirstChild();
for (List<String> entry : consoleDebugOutput) {
Node call = new Node(Token.CALL,
new Node(Token.GETPROP,
Node.newString(Token.NAME, "console"), //$NON-NLS-1$
Node.newString(Token.STRING, "log") //$NON-NLS-1$
)
);
for (String str : entry) {
call.addChildToBack(Node.newString(str));
}
node.addChildAfter(new Node(Token.EXPR_RESULT, call), firstNode);
}
} else {
// Non-source build. Modify the AST
for (List<String> entry : consoleDebugOutput) {
StringBuffer sb = new StringBuffer("console.log("); //$NON-NLS-1$
int i = 0;
for (String str : entry) {
sb.append((i++ == 0 ? "" : ",") + "\"" + StringUtil.escapeForJavaScript(str) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
sb.append(");\n"); //$NON-NLS-1$
source.appendln(sb.toString());
}
}
}
}
} | java | private void appendConsoleLogging(Node root) {
if (logDebug && consoleDebugOutput.size() > 0) {
// Emit code to call console.log on the client
Node node = root;
if (node.getType() == Token.BLOCK) {
node = node.getFirstChild();
}
if (node.getType() == Token.SCRIPT) {
if (source == null) {
// This is non-source build. Modify the AST
Node firstNode = node.getFirstChild();
for (List<String> entry : consoleDebugOutput) {
Node call = new Node(Token.CALL,
new Node(Token.GETPROP,
Node.newString(Token.NAME, "console"), //$NON-NLS-1$
Node.newString(Token.STRING, "log") //$NON-NLS-1$
)
);
for (String str : entry) {
call.addChildToBack(Node.newString(str));
}
node.addChildAfter(new Node(Token.EXPR_RESULT, call), firstNode);
}
} else {
// Non-source build. Modify the AST
for (List<String> entry : consoleDebugOutput) {
StringBuffer sb = new StringBuffer("console.log("); //$NON-NLS-1$
int i = 0;
for (String str : entry) {
sb.append((i++ == 0 ? "" : ",") + "\"" + StringUtil.escapeForJavaScript(str) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
sb.append(");\n"); //$NON-NLS-1$
source.appendln(sb.toString());
}
}
}
}
} | [
"private",
"void",
"appendConsoleLogging",
"(",
"Node",
"root",
")",
"{",
"if",
"(",
"logDebug",
"&&",
"consoleDebugOutput",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"// Emit code to call console.log on the client\r",
"Node",
"node",
"=",
"root",
";",
"if",
... | Appends the console log output, if any, to the end of the module
@param root
the root node for the module | [
"Appends",
"the",
"console",
"log",
"output",
"if",
"any",
"to",
"the",
"end",
"of",
"the",
"module"
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPass.java#L513-L550 | train |
ept/warc-hadoop | src/main/java/com/martinkl/warc/WARCFileReader.java | WARCFileReader.close | public void close() throws IOException {
if (dataStream != null) dataStream.close();
byteStream = null;
dataStream = null;
} | java | public void close() throws IOException {
if (dataStream != null) dataStream.close();
byteStream = null;
dataStream = null;
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"dataStream",
"!=",
"null",
")",
"dataStream",
".",
"close",
"(",
")",
";",
"byteStream",
"=",
"null",
";",
"dataStream",
"=",
"null",
";",
"}"
] | Closes the file. No more reading is possible after the file has been closed.
@throws IOException | [
"Closes",
"the",
"file",
".",
"No",
"more",
"reading",
"is",
"possible",
"after",
"the",
"file",
"has",
"been",
"closed",
"."
] | f41cbb8002c29053eed9206e50ab9787de7da67f | https://github.com/ept/warc-hadoop/blob/f41cbb8002c29053eed9206e50ab9787de7da67f/src/main/java/com/martinkl/warc/WARCFileReader.java#L63-L67 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java | AbstractHttpTransport.getRequestedLocales | protected Collection<String> getRequestedLocales(HttpServletRequest request) {
final String sourceMethod = "getRequestedLocales"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString()});
}
String[] locales;
String sLocales = getParameter(request, REQUESTEDLOCALES_REQPARAMS);
if (sLocales != null) {
locales = sLocales.split(","); //$NON-NLS-1$
} else {
locales = new String[0];
}
Collection<String> result = Collections.unmodifiableCollection(Arrays.asList(locales));
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | java | protected Collection<String> getRequestedLocales(HttpServletRequest request) {
final String sourceMethod = "getRequestedLocales"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString()});
}
String[] locales;
String sLocales = getParameter(request, REQUESTEDLOCALES_REQPARAMS);
if (sLocales != null) {
locales = sLocales.split(","); //$NON-NLS-1$
} else {
locales = new String[0];
}
Collection<String> result = Collections.unmodifiableCollection(Arrays.asList(locales));
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | [
"protected",
"Collection",
"<",
"String",
">",
"getRequestedLocales",
"(",
"HttpServletRequest",
"request",
")",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"getRequestedLocales\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"isTraceLogging",
"=",
"log",
".",
"isLoggable",
... | Returns the requested locales as a collection of locale strings
@param request the request object
@return the locale strings | [
"Returns",
"the",
"requested",
"locales",
"as",
"a",
"collection",
"of",
"locale",
"strings"
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L357-L375 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java | AbstractHttpTransport.getHasConditionsFromRequest | protected String getHasConditionsFromRequest(HttpServletRequest request) throws IOException {
final String sourceMethod = "getHasConditionsFromRequest"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request});
}
String ret = null;
if (request.getParameter(FEATUREMAPHASH_REQPARAM) != null) {
// The cookie called 'has' contains the has conditions
if (isTraceLogging) {
log.finer("has hash = " + request.getParameter(FEATUREMAPHASH_REQPARAM)); //$NON-NLS-1$
}
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (int i = 0; ret == null && i < cookies.length; i++) {
Cookie cookie = cookies[i];
if (cookie.getName().equals(FEATUREMAP_REQPARAM) && cookie.getValue() != null) {
if (isTraceLogging) {
log.finer("has cookie = " + cookie.getValue()); //$NON-NLS-1$
}
ret = URLDecoder.decode(cookie.getValue(), "US-ASCII"); //$NON-NLS-1$
break;
}
}
}
if (ret == null) {
if (log.isLoggable(Level.WARNING)) {
StringBuffer url = request.getRequestURL();
if (url != null) { // might be null if using mock request for unit testing
url.append("?").append(request.getQueryString()).toString(); //$NON-NLS-1$
log.warning(MessageFormat.format(
Messages.AbstractHttpTransport_0,
new Object[]{url, request.getHeader("User-Agent")})); //$NON-NLS-1$
}
}
}
}
else {
ret = request.getParameter(FEATUREMAP_REQPARAM);
if (isTraceLogging) {
log.finer("reading features from has query arg"); //$NON-NLS-1$
}
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, ret);
}
return ret;
} | java | protected String getHasConditionsFromRequest(HttpServletRequest request) throws IOException {
final String sourceMethod = "getHasConditionsFromRequest"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request});
}
String ret = null;
if (request.getParameter(FEATUREMAPHASH_REQPARAM) != null) {
// The cookie called 'has' contains the has conditions
if (isTraceLogging) {
log.finer("has hash = " + request.getParameter(FEATUREMAPHASH_REQPARAM)); //$NON-NLS-1$
}
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (int i = 0; ret == null && i < cookies.length; i++) {
Cookie cookie = cookies[i];
if (cookie.getName().equals(FEATUREMAP_REQPARAM) && cookie.getValue() != null) {
if (isTraceLogging) {
log.finer("has cookie = " + cookie.getValue()); //$NON-NLS-1$
}
ret = URLDecoder.decode(cookie.getValue(), "US-ASCII"); //$NON-NLS-1$
break;
}
}
}
if (ret == null) {
if (log.isLoggable(Level.WARNING)) {
StringBuffer url = request.getRequestURL();
if (url != null) { // might be null if using mock request for unit testing
url.append("?").append(request.getQueryString()).toString(); //$NON-NLS-1$
log.warning(MessageFormat.format(
Messages.AbstractHttpTransport_0,
new Object[]{url, request.getHeader("User-Agent")})); //$NON-NLS-1$
}
}
}
}
else {
ret = request.getParameter(FEATUREMAP_REQPARAM);
if (isTraceLogging) {
log.finer("reading features from has query arg"); //$NON-NLS-1$
}
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, ret);
}
return ret;
} | [
"protected",
"String",
"getHasConditionsFromRequest",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"IOException",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"getHasConditionsFromRequest\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"isTraceLogging",
"=",
"log",
".",
... | This method checks the request for the has conditions which may either be contained in URL
query arguments or in a cookie sent from the client.
@param request
the request object
@return The has conditions from the request.
@throws IOException
@throws UnsupportedEncodingException | [
"This",
"method",
"checks",
"the",
"request",
"for",
"the",
"has",
"conditions",
"which",
"may",
"either",
"be",
"contained",
"in",
"URL",
"query",
"arguments",
"or",
"in",
"a",
"cookie",
"sent",
"from",
"the",
"client",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L446-L494 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java | AbstractHttpTransport.getParameter | protected static String getParameter(HttpServletRequest request, String[] aliases) {
final String sourceMethod = "getParameter"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString(), Arrays.asList(aliases)});
}
Map<String, String[]> params = request.getParameterMap();
String result = null;
for (Map.Entry<String, String[]> entry : params.entrySet()) {
String name = entry.getKey();
for (String alias : aliases) {
if (alias.equalsIgnoreCase(name)) {
String[] values = entry.getValue();
result = values[values.length-1]; // return last value in array
}
}
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | java | protected static String getParameter(HttpServletRequest request, String[] aliases) {
final String sourceMethod = "getParameter"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString(), Arrays.asList(aliases)});
}
Map<String, String[]> params = request.getParameterMap();
String result = null;
for (Map.Entry<String, String[]> entry : params.entrySet()) {
String name = entry.getKey();
for (String alias : aliases) {
if (alias.equalsIgnoreCase(name)) {
String[] values = entry.getValue();
result = values[values.length-1]; // return last value in array
}
}
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | [
"protected",
"static",
"String",
"getParameter",
"(",
"HttpServletRequest",
"request",
",",
"String",
"[",
"]",
"aliases",
")",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"getParameter\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"isTraceLogging",
"=",
"log",
".",
"... | Returns the value of the requested parameter from the request, or null
@param request
the request object
@param aliases
array of query arg names by which the request may be specified
@return the value of the param, or null if it is not specified under the
specified names | [
"Returns",
"the",
"value",
"of",
"the",
"requested",
"parameter",
"from",
"the",
"request",
"or",
"null"
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L506-L527 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java | AbstractHttpTransport.getOptimizationLevelFromRequest | protected OptimizationLevel getOptimizationLevelFromRequest(HttpServletRequest request) {
final String sourceMethod = "getOptimizationLevelFromRequest"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString()});
}
// Get the optimization level specified in the request and set the ComilationLevel
String optimize = getParameter(request, OPTIMIZATIONLEVEL_REQPARAMS);
OptimizationLevel level = OptimizationLevel.SIMPLE;
if (optimize != null && !optimize.equals("")) { //$NON-NLS-1$
if (optimize.equalsIgnoreCase("whitespace")) //$NON-NLS-1$
level = OptimizationLevel.WHITESPACE;
else if (optimize.equalsIgnoreCase("advanced")) //$NON-NLS-1$
level = OptimizationLevel.ADVANCED;
else if (optimize.equalsIgnoreCase("none")) //$NON-NLS-1$
level = OptimizationLevel.NONE;
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, level);
}
return level;
} | java | protected OptimizationLevel getOptimizationLevelFromRequest(HttpServletRequest request) {
final String sourceMethod = "getOptimizationLevelFromRequest"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString()});
}
// Get the optimization level specified in the request and set the ComilationLevel
String optimize = getParameter(request, OPTIMIZATIONLEVEL_REQPARAMS);
OptimizationLevel level = OptimizationLevel.SIMPLE;
if (optimize != null && !optimize.equals("")) { //$NON-NLS-1$
if (optimize.equalsIgnoreCase("whitespace")) //$NON-NLS-1$
level = OptimizationLevel.WHITESPACE;
else if (optimize.equalsIgnoreCase("advanced")) //$NON-NLS-1$
level = OptimizationLevel.ADVANCED;
else if (optimize.equalsIgnoreCase("none")) //$NON-NLS-1$
level = OptimizationLevel.NONE;
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, level);
}
return level;
} | [
"protected",
"OptimizationLevel",
"getOptimizationLevelFromRequest",
"(",
"HttpServletRequest",
"request",
")",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"getOptimizationLevelFromRequest\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"isTraceLogging",
"=",
"log",
".",
"isLoggabl... | Returns the requested optimization level from the request.
@param request the request object
@return the optimization level specified in the request | [
"Returns",
"the",
"requested",
"optimization",
"level",
"from",
"the",
"request",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L535-L556 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java | AbstractHttpTransport.getDynamicLoaderExtensionJavaScript | protected String getDynamicLoaderExtensionJavaScript(HttpServletRequest request) {
final String sourceMethod = "getDynamicLoaderExtensionJavaScript"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod);
}
StringBuffer sb = new StringBuffer();
for (String contribution : getExtensionContributions()) {
sb.append(contribution).append("\r\n"); //$NON-NLS-1$
}
String cacheBust = AggregatorUtil.getCacheBust(getAggregator());
if (cacheBust != null && cacheBust.length() > 0) {
sb.append("if (!require.combo.cacheBust){require.combo.cacheBust = '") //$NON-NLS-1$
.append(cacheBust).append("';}\r\n"); //$NON-NLS-1$
}
contributeBootLayerDeps(sb, request);
if (moduleIdListHash != null) {
sb.append("require.combo.reg(null, ["); //$NON-NLS-1$
for (int i = 0; i < moduleIdListHash.length; i++) {
sb.append(i == 0 ? "" : ", ").append(((int)moduleIdListHash[i])&0xFF); //$NON-NLS-1$ //$NON-NLS-2$
}
sb.append("]);\r\n"); //$NON-NLS-1$
}
sb.append(clientRegisterSyntheticModules());
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, sb.toString());
}
return sb.toString();
} | java | protected String getDynamicLoaderExtensionJavaScript(HttpServletRequest request) {
final String sourceMethod = "getDynamicLoaderExtensionJavaScript"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod);
}
StringBuffer sb = new StringBuffer();
for (String contribution : getExtensionContributions()) {
sb.append(contribution).append("\r\n"); //$NON-NLS-1$
}
String cacheBust = AggregatorUtil.getCacheBust(getAggregator());
if (cacheBust != null && cacheBust.length() > 0) {
sb.append("if (!require.combo.cacheBust){require.combo.cacheBust = '") //$NON-NLS-1$
.append(cacheBust).append("';}\r\n"); //$NON-NLS-1$
}
contributeBootLayerDeps(sb, request);
if (moduleIdListHash != null) {
sb.append("require.combo.reg(null, ["); //$NON-NLS-1$
for (int i = 0; i < moduleIdListHash.length; i++) {
sb.append(i == 0 ? "" : ", ").append(((int)moduleIdListHash[i])&0xFF); //$NON-NLS-1$ //$NON-NLS-2$
}
sb.append("]);\r\n"); //$NON-NLS-1$
}
sb.append(clientRegisterSyntheticModules());
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, sb.toString());
}
return sb.toString();
} | [
"protected",
"String",
"getDynamicLoaderExtensionJavaScript",
"(",
"HttpServletRequest",
"request",
")",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"getDynamicLoaderExtensionJavaScript\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"isTraceLogging",
"=",
"log",
".",
"isLoggable",... | Returns the dynamic portion of the loader extension javascript for this transport. This
includes all registered extension contributions.
@param request
The http request object
@return the dynamic portion of the loader extension javascript | [
"Returns",
"the",
"dynamic",
"portion",
"of",
"the",
"loader",
"extension",
"javascript",
"for",
"this",
"transport",
".",
"This",
"includes",
"all",
"registered",
"extension",
"contributions",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L784-L812 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java | AbstractHttpTransport.newFeatureListResourceFactory | protected FeatureListResourceFactory newFeatureListResourceFactory(URI resourceUri) {
final String methodName = "newFeatureMapJSResourceFactory"; //$NON-NLS-1$
boolean traceLogging = log.isLoggable(Level.FINER);
if (traceLogging) {
log.entering(sourceClass, methodName, new Object[]{resourceUri});
}
FeatureListResourceFactory factory = new FeatureListResourceFactory(resourceUri);
if (traceLogging) {
log.exiting(sourceClass, methodName);
}
return factory;
} | java | protected FeatureListResourceFactory newFeatureListResourceFactory(URI resourceUri) {
final String methodName = "newFeatureMapJSResourceFactory"; //$NON-NLS-1$
boolean traceLogging = log.isLoggable(Level.FINER);
if (traceLogging) {
log.entering(sourceClass, methodName, new Object[]{resourceUri});
}
FeatureListResourceFactory factory = new FeatureListResourceFactory(resourceUri);
if (traceLogging) {
log.exiting(sourceClass, methodName);
}
return factory;
} | [
"protected",
"FeatureListResourceFactory",
"newFeatureListResourceFactory",
"(",
"URI",
"resourceUri",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"newFeatureMapJSResourceFactory\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"traceLogging",
"=",
"log",
".",
"isLoggable",
"("... | Returns an instance of a FeatureMapJSResourceFactory.
@param resourceUri
the resource {@link URI}
@return a new factory object | [
"Returns",
"an",
"instance",
"of",
"a",
"FeatureMapJSResourceFactory",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L1004-L1015 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java | AbstractHttpTransport.clientRegisterSyntheticModules | protected String clientRegisterSyntheticModules() {
final String methodName = "clientRegisterSyntheticModules"; //$NON-NLS-1$
boolean traceLogging = log.isLoggable(Level.FINER);
if (traceLogging) {
log.entering(sourceClass, methodName);
}
StringBuffer sb = new StringBuffer();
Map<String, Integer> map = getModuleIdMap();
if (map != null && getModuleIdRegFunctionName() != null) {
Collection<String> names = getSyntheticModuleNames();
if (names != null && names.size() > 0) {
// register the text plugin name (combo/text) and name id with the client
sb.append(getModuleIdRegFunctionName()).append("([[["); //$NON-NLS-1$
int i = 0;
for (String name : names) {
if (map.get(name) != null) {
sb.append(i++==0 ?"":",").append("\"").append(name).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
sb.append("]],[["); //$NON-NLS-1$
i = 0;
for (String name : names) {
Integer id = map.get(name);
if (id != null) {
sb.append(i++==0?"":",").append(id.intValue()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
sb.append("]]]);"); //$NON-NLS-1$
}
}
if (traceLogging) {
log.exiting(sourceClass, methodName, sb.toString());
}
return sb.toString();
} | java | protected String clientRegisterSyntheticModules() {
final String methodName = "clientRegisterSyntheticModules"; //$NON-NLS-1$
boolean traceLogging = log.isLoggable(Level.FINER);
if (traceLogging) {
log.entering(sourceClass, methodName);
}
StringBuffer sb = new StringBuffer();
Map<String, Integer> map = getModuleIdMap();
if (map != null && getModuleIdRegFunctionName() != null) {
Collection<String> names = getSyntheticModuleNames();
if (names != null && names.size() > 0) {
// register the text plugin name (combo/text) and name id with the client
sb.append(getModuleIdRegFunctionName()).append("([[["); //$NON-NLS-1$
int i = 0;
for (String name : names) {
if (map.get(name) != null) {
sb.append(i++==0 ?"":",").append("\"").append(name).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
sb.append("]],[["); //$NON-NLS-1$
i = 0;
for (String name : names) {
Integer id = map.get(name);
if (id != null) {
sb.append(i++==0?"":",").append(id.intValue()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
sb.append("]]]);"); //$NON-NLS-1$
}
}
if (traceLogging) {
log.exiting(sourceClass, methodName, sb.toString());
}
return sb.toString();
} | [
"protected",
"String",
"clientRegisterSyntheticModules",
"(",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"clientRegisterSyntheticModules\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"traceLogging",
"=",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
";",
... | Returns the JavaScript code for calling the client-side module name id registration function
to register name ids for the transport synthetic modules.
@return the registration JavaScript or an empty string if no synthetic modules. | [
"Returns",
"the",
"JavaScript",
"code",
"for",
"calling",
"the",
"client",
"-",
"side",
"module",
"name",
"id",
"registration",
"function",
"to",
"register",
"name",
"ids",
"for",
"the",
"transport",
"synthetic",
"modules",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L1169-L1203 | train |
protegeproject/jpaul | src/main/java/jpaul/Version.java | Version.main | public static void main(String[] args) {
System.out.println(LONG_NAME + " - Release " + RELEASE);
System.out.println();
System.out.println(" " + CREDO);
System.out.println();
System.out.println("Project maintainer: " + MAINTAINER);
System.out.println("Javadoc accessible from the official website on SourceForge:\n\t" + WEBSITE);
System.out.println("Submit bug reports / feature requests on the website.");
} | java | public static void main(String[] args) {
System.out.println(LONG_NAME + " - Release " + RELEASE);
System.out.println();
System.out.println(" " + CREDO);
System.out.println();
System.out.println("Project maintainer: " + MAINTAINER);
System.out.println("Javadoc accessible from the official website on SourceForge:\n\t" + WEBSITE);
System.out.println("Submit bug reports / feature requests on the website.");
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"LONG_NAME",
"+",
"\" - Release \"",
"+",
"RELEASE",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"System",
".... | Prints a small informative message about the current release. | [
"Prints",
"a",
"small",
"informative",
"message",
"about",
"the",
"current",
"release",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/Version.java#L37-L45 | train |
jMotif/GI | src/main/java/net/seninp/gi/rulepruner/RulePrunerPrinter.java | RulePrunerPrinter.toBoundaries | private static int[] toBoundaries(String str) {
int[] res = new int[9];
String[] split = str.split("\\s+");
for (int i = 0; i < 9; i++) {
res[i] = Integer.valueOf(split[i]).intValue();
}
return res;
} | java | private static int[] toBoundaries(String str) {
int[] res = new int[9];
String[] split = str.split("\\s+");
for (int i = 0; i < 9; i++) {
res[i] = Integer.valueOf(split[i]).intValue();
}
return res;
} | [
"private",
"static",
"int",
"[",
"]",
"toBoundaries",
"(",
"String",
"str",
")",
"{",
"int",
"[",
"]",
"res",
"=",
"new",
"int",
"[",
"9",
"]",
";",
"String",
"[",
"]",
"split",
"=",
"str",
".",
"split",
"(",
"\"\\\\s+\"",
")",
";",
"for",
"(",
... | Converts a param string to boundaries array.
@param str
@return | [
"Converts",
"a",
"param",
"string",
"to",
"boundaries",
"array",
"."
] | 381212dd4f193246a6df82bd46f0d2bcd04a68d6 | https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/rulepruner/RulePrunerPrinter.java#L155-L162 | train |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/SliceBuilder.java | SliceBuilder.build | public Slice build() throws SchedulerException {
if (hoster == null) {
hoster = rp.makeHostVariable(lblPrefix, "_hoster");
}
if (start == null) {
start = rp.getStart();
}
if (end == null) {
end = rp.getEnd();
}
if (duration == null) {
duration = makeDuration();
}
//UB for the time variables
if (!start.isInstantiatedTo(0)) {
//enforces start <= end, duration <= end, start + duration == end
TaskMonitor.build(start, duration, end);
}
//start == 0 --> start <= end. duration = end enforced by TaskScheduler
return new Slice(vm, start, end, duration, hoster);
} | java | public Slice build() throws SchedulerException {
if (hoster == null) {
hoster = rp.makeHostVariable(lblPrefix, "_hoster");
}
if (start == null) {
start = rp.getStart();
}
if (end == null) {
end = rp.getEnd();
}
if (duration == null) {
duration = makeDuration();
}
//UB for the time variables
if (!start.isInstantiatedTo(0)) {
//enforces start <= end, duration <= end, start + duration == end
TaskMonitor.build(start, duration, end);
}
//start == 0 --> start <= end. duration = end enforced by TaskScheduler
return new Slice(vm, start, end, duration, hoster);
} | [
"public",
"Slice",
"build",
"(",
")",
"throws",
"SchedulerException",
"{",
"if",
"(",
"hoster",
"==",
"null",
")",
"{",
"hoster",
"=",
"rp",
".",
"makeHostVariable",
"(",
"lblPrefix",
",",
"\"_hoster\"",
")",
";",
"}",
"if",
"(",
"start",
"==",
"null",
... | Build the slice.
@return the resulting slice
@throws org.btrplace.scheduler.SchedulerException if an error occurred | [
"Build",
"the",
"slice",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/SliceBuilder.java#L68-L89 | train |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/SliceBuilder.java | SliceBuilder.makeDuration | private IntVar makeDuration() throws SchedulerException {
if (start.isInstantiated() && end.isInstantiated()) {
int d = end.getValue() - start.getValue();
return rp.makeDuration(d, d, lblPrefix, "_duration");
} else if (start.isInstantiated()) {
if (start.isInstantiatedTo(0)) {
return end;
}
return rp.getModel().intOffsetView(end, -start.getValue());
}
int inf = end.getLB() - start.getUB();
if (inf < 0) {
inf = 0;
}
int sup = end.getUB() - start.getLB();
return rp.makeDuration(sup, inf, lblPrefix, "_duration");
} | java | private IntVar makeDuration() throws SchedulerException {
if (start.isInstantiated() && end.isInstantiated()) {
int d = end.getValue() - start.getValue();
return rp.makeDuration(d, d, lblPrefix, "_duration");
} else if (start.isInstantiated()) {
if (start.isInstantiatedTo(0)) {
return end;
}
return rp.getModel().intOffsetView(end, -start.getValue());
}
int inf = end.getLB() - start.getUB();
if (inf < 0) {
inf = 0;
}
int sup = end.getUB() - start.getLB();
return rp.makeDuration(sup, inf, lblPrefix, "_duration");
} | [
"private",
"IntVar",
"makeDuration",
"(",
")",
"throws",
"SchedulerException",
"{",
"if",
"(",
"start",
".",
"isInstantiated",
"(",
")",
"&&",
"end",
".",
"isInstantiated",
"(",
")",
")",
"{",
"int",
"d",
"=",
"end",
".",
"getValue",
"(",
")",
"-",
"st... | Make the duration variable depending on the others. | [
"Make",
"the",
"duration",
"variable",
"depending",
"on",
"the",
"others",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/SliceBuilder.java#L94-L110 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/IdentitySourceMapGenerator.java | IdentitySourceMapGenerator.generateSourceMap | public String generateSourceMap() throws IOException {
final String sourceMethod = "generateSourceMap"; //$NON-NLS-1$
final boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{name});
}
String result = null;
lineLengths = getLineLengths();
Compiler compiler = new Compiler();
sgen = new SourceMapGeneratorV3();
compiler.initOptions(compiler_options);
currentLine = currentChar = 0;
Node node = compiler.parse(JSSourceFile.fromCode(name, source));
if (compiler.hasErrors()) {
if (log.isLoggable(Level.WARNING)) {
JSError[] errors = compiler.getErrors();
for (JSError error : errors) {
log.logp(Level.WARNING, sourceClass, sourceMethod, error.toString());
}
}
}
if (node != null) {
processNode(node);
StringWriter writer = new StringWriter();
sgen.appendTo(writer, name);
result = writer.toString();
}
sgen = null;
lineLengths = null;
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | java | public String generateSourceMap() throws IOException {
final String sourceMethod = "generateSourceMap"; //$NON-NLS-1$
final boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{name});
}
String result = null;
lineLengths = getLineLengths();
Compiler compiler = new Compiler();
sgen = new SourceMapGeneratorV3();
compiler.initOptions(compiler_options);
currentLine = currentChar = 0;
Node node = compiler.parse(JSSourceFile.fromCode(name, source));
if (compiler.hasErrors()) {
if (log.isLoggable(Level.WARNING)) {
JSError[] errors = compiler.getErrors();
for (JSError error : errors) {
log.logp(Level.WARNING, sourceClass, sourceMethod, error.toString());
}
}
}
if (node != null) {
processNode(node);
StringWriter writer = new StringWriter();
sgen.appendTo(writer, name);
result = writer.toString();
}
sgen = null;
lineLengths = null;
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | [
"public",
"String",
"generateSourceMap",
"(",
")",
"throws",
"IOException",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"generateSourceMap\"",
";",
"//$NON-NLS-1$\r",
"final",
"boolean",
"isTraceLogging",
"=",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",... | Generate the identity source map and return the result.
@return the identity source map
@throws IOException | [
"Generate",
"the",
"identity",
"source",
"map",
"and",
"return",
"the",
"result",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/IdentitySourceMapGenerator.java#L63-L96 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/IdentitySourceMapGenerator.java | IdentitySourceMapGenerator.processNode | private void processNode(Node node) throws IOException {
for (Node cursor = node.getFirstChild(); cursor != null; cursor = cursor.getNext()) {
int lineno = cursor.getLineno()-1; // adjust for rhino line numbers being 1 based
int charno = cursor.getCharno();
if (lineno > currentLine || lineno == currentLine && charno > currentChar) {
currentLine = lineno;
currentChar = charno;
}
FilePosition endPosition = getEndPosition(cursor);
sgen.addMapping(name, null,
new FilePosition(currentLine, currentChar),
new FilePosition(currentLine, currentChar),
endPosition);
if (cursor.hasChildren()) {
processNode(cursor);
}
}
} | java | private void processNode(Node node) throws IOException {
for (Node cursor = node.getFirstChild(); cursor != null; cursor = cursor.getNext()) {
int lineno = cursor.getLineno()-1; // adjust for rhino line numbers being 1 based
int charno = cursor.getCharno();
if (lineno > currentLine || lineno == currentLine && charno > currentChar) {
currentLine = lineno;
currentChar = charno;
}
FilePosition endPosition = getEndPosition(cursor);
sgen.addMapping(name, null,
new FilePosition(currentLine, currentChar),
new FilePosition(currentLine, currentChar),
endPosition);
if (cursor.hasChildren()) {
processNode(cursor);
}
}
} | [
"private",
"void",
"processNode",
"(",
"Node",
"node",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Node",
"cursor",
"=",
"node",
".",
"getFirstChild",
"(",
")",
";",
"cursor",
"!=",
"null",
";",
"cursor",
"=",
"cursor",
".",
"getNext",
"(",
")",
")... | Recursively processes the input node, adding a mapping for the node to the source map
generator.
@param node
the node to map
@throws IOException | [
"Recursively",
"processes",
"the",
"input",
"node",
"adding",
"a",
"mapping",
"for",
"the",
"node",
"to",
"the",
"source",
"map",
"generator",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/IdentitySourceMapGenerator.java#L106-L123 | train |
m-m-m/util | event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java | AbstractEventBus.dispatchEvents | protected void dispatchEvents() {
while (true) {
Object event = this.eventQueue.poll();
if (event == null) {
return;
}
Collection<Throwable> errors = new LinkedList<>();
dispatchEvent(event, errors);
if (!errors.isEmpty()) {
handleErrors(errors, event);
}
}
} | java | protected void dispatchEvents() {
while (true) {
Object event = this.eventQueue.poll();
if (event == null) {
return;
}
Collection<Throwable> errors = new LinkedList<>();
dispatchEvent(event, errors);
if (!errors.isEmpty()) {
handleErrors(errors, event);
}
}
} | [
"protected",
"void",
"dispatchEvents",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"Object",
"event",
"=",
"this",
".",
"eventQueue",
".",
"poll",
"(",
")",
";",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Collection",
"<",
... | Dispatches all events in the event queue. | [
"Dispatches",
"all",
"events",
"in",
"the",
"event",
"queue",
"."
] | f0e4e084448f8dfc83ca682a9e1618034a094ce6 | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java#L107-L121 | train |
m-m-m/util | event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java | AbstractEventBus.handleErrors | protected void handleErrors(Collection<Throwable> errors, Object event) {
if (this.globalExceptionHandler == null) {
for (Throwable error : errors) {
LOG.error("Failed to dispatch event {}", event, error);
}
} else {
this.globalExceptionHandler.handleErrors(event, errors.toArray(new Throwable[errors.size()]));
}
} | java | protected void handleErrors(Collection<Throwable> errors, Object event) {
if (this.globalExceptionHandler == null) {
for (Throwable error : errors) {
LOG.error("Failed to dispatch event {}", event, error);
}
} else {
this.globalExceptionHandler.handleErrors(event, errors.toArray(new Throwable[errors.size()]));
}
} | [
"protected",
"void",
"handleErrors",
"(",
"Collection",
"<",
"Throwable",
">",
"errors",
",",
"Object",
"event",
")",
"{",
"if",
"(",
"this",
".",
"globalExceptionHandler",
"==",
"null",
")",
"{",
"for",
"(",
"Throwable",
"error",
":",
"errors",
")",
"{",
... | This method is called if errors occurred while dispatching events.
@param errors is the {@link Collection} with the errors. Will NOT be {@link Collection#isEmpty() empty}.
@param event is the event that has been send and caused the errors. | [
"This",
"method",
"is",
"called",
"if",
"errors",
"occurred",
"while",
"dispatching",
"events",
"."
] | f0e4e084448f8dfc83ca682a9e1618034a094ce6 | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java#L161-L170 | train |
btrplace/scheduler | btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java | BtrPlaceTree.go | public BtrpOperand go(BtrPlaceTree parent) {
append(token, "Unhandled token " + token.getText() + " (type=" + token.getType() + ")");
return IgnorableOperand.getInstance();
} | java | public BtrpOperand go(BtrPlaceTree parent) {
append(token, "Unhandled token " + token.getText() + " (type=" + token.getType() + ")");
return IgnorableOperand.getInstance();
} | [
"public",
"BtrpOperand",
"go",
"(",
"BtrPlaceTree",
"parent",
")",
"{",
"append",
"(",
"token",
",",
"\"Unhandled token \"",
"+",
"token",
".",
"getText",
"(",
")",
"+",
"\" (type=\"",
"+",
"token",
".",
"getType",
"(",
")",
"+",
"\")\"",
")",
";",
"retu... | Parse the root of the tree.
@param parent the parent of the root
@return a content | [
"Parse",
"the",
"root",
"of",
"the",
"tree",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java#L57-L60 | train |
btrplace/scheduler | btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java | BtrPlaceTree.ignoreError | public IgnorableOperand ignoreError(Exception e) {
append(token, e.getMessage());
return IgnorableOperand.getInstance();
} | java | public IgnorableOperand ignoreError(Exception e) {
append(token, e.getMessage());
return IgnorableOperand.getInstance();
} | [
"public",
"IgnorableOperand",
"ignoreError",
"(",
"Exception",
"e",
")",
"{",
"append",
"(",
"token",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"return",
"IgnorableOperand",
".",
"getInstance",
"(",
")",
";",
"}"
] | Report an error from an exception for the current token
@param e the exception
@return an empty operand | [
"Report",
"an",
"error",
"from",
"an",
"exception",
"for",
"the",
"current",
"token"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java#L79-L82 | train |
btrplace/scheduler | btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java | BtrPlaceTree.ignoreErrors | public IgnorableOperand ignoreErrors(ErrorReporter err) {
errors.getErrors().addAll(err.getErrors());
return IgnorableOperand.getInstance();
} | java | public IgnorableOperand ignoreErrors(ErrorReporter err) {
errors.getErrors().addAll(err.getErrors());
return IgnorableOperand.getInstance();
} | [
"public",
"IgnorableOperand",
"ignoreErrors",
"(",
"ErrorReporter",
"err",
")",
"{",
"errors",
".",
"getErrors",
"(",
")",
".",
"addAll",
"(",
"err",
".",
"getErrors",
"(",
")",
")",
";",
"return",
"IgnorableOperand",
".",
"getInstance",
"(",
")",
";",
"}"... | Add all the error messages included in a reporter.
@param err the error reporter
@return {@link IgnorableOperand} to indicate to skip the operand | [
"Add",
"all",
"the",
"error",
"messages",
"included",
"in",
"a",
"reporter",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java#L90-L93 | train |
btrplace/scheduler | btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java | BtrPlaceTree.ignoreError | public IgnorableOperand ignoreError(Token t, String msg) {
append(t, msg);
return IgnorableOperand.getInstance();
} | java | public IgnorableOperand ignoreError(Token t, String msg) {
append(t, msg);
return IgnorableOperand.getInstance();
} | [
"public",
"IgnorableOperand",
"ignoreError",
"(",
"Token",
"t",
",",
"String",
"msg",
")",
"{",
"append",
"(",
"t",
",",
"msg",
")",
";",
"return",
"IgnorableOperand",
".",
"getInstance",
"(",
")",
";",
"}"
] | Add an error message to a given error
@param t the token that points to the error
@param msg the error message
@return {@link IgnorableOperand} to indicate to skip the operand | [
"Add",
"an",
"error",
"message",
"to",
"a",
"given",
"error"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java#L102-L105 | train |
btrplace/scheduler | btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java | BtrPlaceTree.append | public void append(Token t, String msg) {
errors.append(t.getLine(), t.getCharPositionInLine(), msg);
} | java | public void append(Token t, String msg) {
errors.append(t.getLine(), t.getCharPositionInLine(), msg);
} | [
"public",
"void",
"append",
"(",
"Token",
"t",
",",
"String",
"msg",
")",
"{",
"errors",
".",
"append",
"(",
"t",
".",
"getLine",
"(",
")",
",",
"t",
".",
"getCharPositionInLine",
"(",
")",
",",
"msg",
")",
";",
"}"
] | Add an error message related to a given token
@param t the token that points to the error
@param msg the error message | [
"Add",
"an",
"error",
"message",
"related",
"to",
"a",
"given",
"token"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java#L113-L115 | train |
nikolavp/approval | approval-core/src/main/java/com/github/approval/utils/CrossPlatformCommand.java | CrossPlatformCommand.execute | public T execute() {
if (isWindows()) {
return onWindows();
} else if (isMac()) {
return onMac();
} else if (isUnix()) {
return onUnix();
} else if (isSolaris()) {
return onSolaris();
} else {
throw new IllegalStateException("Invalid operating system " + os);
}
} | java | public T execute() {
if (isWindows()) {
return onWindows();
} else if (isMac()) {
return onMac();
} else if (isUnix()) {
return onUnix();
} else if (isSolaris()) {
return onSolaris();
} else {
throw new IllegalStateException("Invalid operating system " + os);
}
} | [
"public",
"T",
"execute",
"(",
")",
"{",
"if",
"(",
"isWindows",
"(",
")",
")",
"{",
"return",
"onWindows",
"(",
")",
";",
"}",
"else",
"if",
"(",
"isMac",
"(",
")",
")",
"{",
"return",
"onMac",
"(",
")",
";",
"}",
"else",
"if",
"(",
"isUnix",
... | Main method that should be executed. This will return the proper result depending on your platform.
@return the result | [
"Main",
"method",
"that",
"should",
"be",
"executed",
".",
"This",
"will",
"return",
"the",
"proper",
"result",
"depending",
"on",
"your",
"platform",
"."
] | 5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8 | https://github.com/nikolavp/approval/blob/5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8/approval-core/src/main/java/com/github/approval/utils/CrossPlatformCommand.java#L96-L108 | train |
btrplace/scheduler | btrpsl/src/main/java/org/btrplace/btrpsl/tree/EnumVar.java | EnumVar.expand | public BtrpOperand expand() {
String head = getChild(0).getText().substring(0, getChild(0).getText().length() - 1);
String tail = getChild(getChildCount() - 1).getText().substring(1);
BtrpSet res = new BtrpSet(1, BtrpOperand.Type.STRING);
for (int i = 1; i < getChildCount() - 1; i++) {
BtrpOperand op = getChild(i).go(this);
if (op == IgnorableOperand.getInstance()) {
return op;
}
BtrpSet s = (BtrpSet) op;
for (BtrpOperand o : s.getValues()) {
//Compose
res.getValues().add(new BtrpString(head + o.toString() + tail));
}
}
return res;
} | java | public BtrpOperand expand() {
String head = getChild(0).getText().substring(0, getChild(0).getText().length() - 1);
String tail = getChild(getChildCount() - 1).getText().substring(1);
BtrpSet res = new BtrpSet(1, BtrpOperand.Type.STRING);
for (int i = 1; i < getChildCount() - 1; i++) {
BtrpOperand op = getChild(i).go(this);
if (op == IgnorableOperand.getInstance()) {
return op;
}
BtrpSet s = (BtrpSet) op;
for (BtrpOperand o : s.getValues()) {
//Compose
res.getValues().add(new BtrpString(head + o.toString() + tail));
}
}
return res;
} | [
"public",
"BtrpOperand",
"expand",
"(",
")",
"{",
"String",
"head",
"=",
"getChild",
"(",
"0",
")",
".",
"getText",
"(",
")",
".",
"substring",
"(",
"0",
",",
"getChild",
"(",
"0",
")",
".",
"getText",
"(",
")",
".",
"length",
"(",
")",
"-",
"1",... | Expand the enumeration.
Variables are not evaluated nor checked
@return a set of string or an error | [
"Expand",
"the",
"enumeration",
".",
"Variables",
"are",
"not",
"evaluated",
"nor",
"checked"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/tree/EnumVar.java#L56-L73 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.add | public void add(DepTreeNode child) {
if (children == null) {
children = new HashMap<String, DepTreeNode>();
}
children.put(child.getName(), child);
child.setParent(this);
} | java | public void add(DepTreeNode child) {
if (children == null) {
children = new HashMap<String, DepTreeNode>();
}
children.put(child.getName(), child);
child.setParent(this);
} | [
"public",
"void",
"add",
"(",
"DepTreeNode",
"child",
")",
"{",
"if",
"(",
"children",
"==",
"null",
")",
"{",
"children",
"=",
"new",
"HashMap",
"<",
"String",
",",
"DepTreeNode",
">",
"(",
")",
";",
"}",
"children",
".",
"put",
"(",
"child",
".",
... | Add the specified node to this node's children.
@param child
The node to add to this node's children | [
"Add",
"the",
"specified",
"node",
"to",
"this",
"node",
"s",
"children",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L255-L261 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.overlay | public void overlay(DepTreeNode node) {
if (node.defineDependencies != null || node.requireDependencies != null) {
setDependencies(node.defineDependencies, node.requireDependencies, node.dependentFeatures, node.lastModified(), node.lastModifiedDep());
}
node.uri = uri;
if (node.getChildren() == null) {
return;
}
for(Map.Entry<String, DepTreeNode> entry : node.getChildren().entrySet()) {
DepTreeNode existing = getChild(entry.getKey());
if (existing == null) {
add(entry.getValue());
} else {
existing.overlay(entry.getValue());
}
}
} | java | public void overlay(DepTreeNode node) {
if (node.defineDependencies != null || node.requireDependencies != null) {
setDependencies(node.defineDependencies, node.requireDependencies, node.dependentFeatures, node.lastModified(), node.lastModifiedDep());
}
node.uri = uri;
if (node.getChildren() == null) {
return;
}
for(Map.Entry<String, DepTreeNode> entry : node.getChildren().entrySet()) {
DepTreeNode existing = getChild(entry.getKey());
if (existing == null) {
add(entry.getValue());
} else {
existing.overlay(entry.getValue());
}
}
} | [
"public",
"void",
"overlay",
"(",
"DepTreeNode",
"node",
")",
"{",
"if",
"(",
"node",
".",
"defineDependencies",
"!=",
"null",
"||",
"node",
".",
"requireDependencies",
"!=",
"null",
")",
"{",
"setDependencies",
"(",
"node",
".",
"defineDependencies",
",",
"... | Overlay the specified node and its descendants over this node. The
specified node will be merged with this node, with the dependencies
of any nodes from the specified node replacing the dependencies of
the corresponding node in this node's tree.
@param node | [
"Overlay",
"the",
"specified",
"node",
"and",
"its",
"descendants",
"over",
"this",
"node",
".",
"The",
"specified",
"node",
"will",
"be",
"merged",
"with",
"this",
"node",
"with",
"the",
"dependencies",
"of",
"any",
"nodes",
"from",
"the",
"specified",
"nod... | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L271-L287 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.createOrGet | public DepTreeNode createOrGet(String path, URI uri) {
if (path.startsWith("/")) { //$NON-NLS-1$
throw new IllegalArgumentException(path);
}
if (path.length() == 0)
return this;
String[] pathComps = path.split("/"); //$NON-NLS-1$
DepTreeNode node = this;
int i = 0;
for (String comp : pathComps) {
DepTreeNode childNode = node.getChild(comp);
if (childNode == null) {
childNode = new DepTreeNode(comp, i == pathComps.length-1 ? uri : null);
node.add(childNode);
}
node = childNode;
i++;
}
return node;
} | java | public DepTreeNode createOrGet(String path, URI uri) {
if (path.startsWith("/")) { //$NON-NLS-1$
throw new IllegalArgumentException(path);
}
if (path.length() == 0)
return this;
String[] pathComps = path.split("/"); //$NON-NLS-1$
DepTreeNode node = this;
int i = 0;
for (String comp : pathComps) {
DepTreeNode childNode = node.getChild(comp);
if (childNode == null) {
childNode = new DepTreeNode(comp, i == pathComps.length-1 ? uri : null);
node.add(childNode);
}
node = childNode;
i++;
}
return node;
} | [
"public",
"DepTreeNode",
"createOrGet",
"(",
"String",
"path",
",",
"URI",
"uri",
")",
"{",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"//$NON-NLS-1$\r",
"throw",
"new",
"IllegalArgumentException",
"(",
"path",
")",
";",
"}",
"if",
... | Returns the node at the specified path location within the tree, or
creates it if it is not already in the tree. Will create any required
parent nodes.
@param path
The path name, relative to this node, of the node to return.
@param uri
the source URI
@return The node at the specified path. | [
"Returns",
"the",
"node",
"at",
"the",
"specified",
"path",
"location",
"within",
"the",
"tree",
"or",
"creates",
"it",
"if",
"it",
"is",
"not",
"already",
"in",
"the",
"tree",
".",
"Will",
"create",
"any",
"required",
"parent",
"nodes",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L306-L326 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.remove | public void remove(DepTreeNode child) {
if (children != null) {
DepTreeNode node = children.get(child.getName());
if (node == child) {
children.remove(child.getName());
}
}
child.setParent(null);
} | java | public void remove(DepTreeNode child) {
if (children != null) {
DepTreeNode node = children.get(child.getName());
if (node == child) {
children.remove(child.getName());
}
}
child.setParent(null);
} | [
"public",
"void",
"remove",
"(",
"DepTreeNode",
"child",
")",
"{",
"if",
"(",
"children",
"!=",
"null",
")",
"{",
"DepTreeNode",
"node",
"=",
"children",
".",
"get",
"(",
"child",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"node",
"==",
"child",
... | Removes the specified child node
@param child
The node to remove | [
"Removes",
"the",
"specified",
"child",
"node"
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L367-L375 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.prune | public void prune() {
if (children != null) {
List<String> removeList = new ArrayList<String>();
for (Entry<String, DepTreeNode> entry : children.entrySet()) {
DepTreeNode child = entry.getValue();
child.prune();
if ((child.defineDependencies == null && child.requireDependencies == null && child.uri == null)
&& (child.children == null || child.children.isEmpty())) {
removeList.add(entry.getKey());
}
}
for (String key : removeList) {
children.remove(key);
}
}
} | java | public void prune() {
if (children != null) {
List<String> removeList = new ArrayList<String>();
for (Entry<String, DepTreeNode> entry : children.entrySet()) {
DepTreeNode child = entry.getValue();
child.prune();
if ((child.defineDependencies == null && child.requireDependencies == null && child.uri == null)
&& (child.children == null || child.children.isEmpty())) {
removeList.add(entry.getKey());
}
}
for (String key : removeList) {
children.remove(key);
}
}
} | [
"public",
"void",
"prune",
"(",
")",
"{",
"if",
"(",
"children",
"!=",
"null",
")",
"{",
"List",
"<",
"String",
">",
"removeList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"DepTreeNode",
"... | Recursively walks the node tree removing folder nodes that have not children. | [
"Recursively",
"walks",
"the",
"node",
"tree",
"removing",
"folder",
"nodes",
"that",
"have",
"not",
"children",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L412-L427 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.setDependencies | public void setDependencies(String[] defineDependencies, String[] requireDependencies, String[] dependentFeatures, long lastModifiedFile, long lastModifiedDep) {
this.defineDependencies = defineDependencies;
this.requireDependencies = requireDependencies;
this.dependentFeatures = dependentFeatures;
this.lastModified = lastModifiedFile;
this.lastModifiedDep = lastModifiedDep;
} | java | public void setDependencies(String[] defineDependencies, String[] requireDependencies, String[] dependentFeatures, long lastModifiedFile, long lastModifiedDep) {
this.defineDependencies = defineDependencies;
this.requireDependencies = requireDependencies;
this.dependentFeatures = dependentFeatures;
this.lastModified = lastModifiedFile;
this.lastModifiedDep = lastModifiedDep;
} | [
"public",
"void",
"setDependencies",
"(",
"String",
"[",
"]",
"defineDependencies",
",",
"String",
"[",
"]",
"requireDependencies",
",",
"String",
"[",
"]",
"dependentFeatures",
",",
"long",
"lastModifiedFile",
",",
"long",
"lastModifiedDep",
")",
"{",
"this",
"... | Specifies the dependency list of modules for the module named by this
node, along with the last modified date of the javascript file that the
dependency list was obtained from.
@param defineDependencies
The define() dependency list of module names
@param requireDependencies
The require() dependency list of module names
@param dependentFeatures
The dependent features for the module
@param lastModifiedFile
The last modified date of the javascript source file
@param lastModifiedDep
The last modified date of the dependency list. See
{@link #lastModifiedDep()} | [
"Specifies",
"the",
"dependency",
"list",
"of",
"modules",
"for",
"the",
"module",
"named",
"by",
"this",
"node",
"along",
"with",
"the",
"last",
"modified",
"date",
"of",
"the",
"javascript",
"file",
"that",
"the",
"dependency",
"list",
"was",
"obtained",
"... | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L446-L452 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.lastModifiedDepTree | private long lastModifiedDepTree(long lm) {
long result = (defineDependencies == null && requireDependencies == null) ? lm : Math.max(lm, this.lastModifiedDep);
if (children != null) {
for (Entry<String, DepTreeNode> entry : this.children.entrySet()) {
result = entry.getValue().lastModifiedDepTree(result);
}
}
return result;
} | java | private long lastModifiedDepTree(long lm) {
long result = (defineDependencies == null && requireDependencies == null) ? lm : Math.max(lm, this.lastModifiedDep);
if (children != null) {
for (Entry<String, DepTreeNode> entry : this.children.entrySet()) {
result = entry.getValue().lastModifiedDepTree(result);
}
}
return result;
} | [
"private",
"long",
"lastModifiedDepTree",
"(",
"long",
"lm",
")",
"{",
"long",
"result",
"=",
"(",
"defineDependencies",
"==",
"null",
"&&",
"requireDependencies",
"==",
"null",
")",
"?",
"lm",
":",
"Math",
".",
"max",
"(",
"lm",
",",
"this",
".",
"lastM... | Returns the most recent last modified date for all the dependencies that
are descendants of this node, including this node.
@param lm
The most recent last modified date so far
@return The most recent last modified date including this node and it
descendants | [
"Returns",
"the",
"most",
"recent",
"last",
"modified",
"date",
"for",
"all",
"the",
"dependencies",
"that",
"are",
"descendants",
"of",
"this",
"node",
"including",
"this",
"node",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L550-L558 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.populateDepMap | void populateDepMap(Map<String, DependencyInfo> depMap) {
if (uri != null) {
depMap.put(getFullPathName(), new DependencyInfo(defineDependencies, requireDependencies, dependentFeatures, uri));
}
if (children != null) {
for (Entry<String, DepTreeNode> entry : children.entrySet()) {
entry.getValue().populateDepMap(depMap);
}
}
} | java | void populateDepMap(Map<String, DependencyInfo> depMap) {
if (uri != null) {
depMap.put(getFullPathName(), new DependencyInfo(defineDependencies, requireDependencies, dependentFeatures, uri));
}
if (children != null) {
for (Entry<String, DepTreeNode> entry : children.entrySet()) {
entry.getValue().populateDepMap(depMap);
}
}
} | [
"void",
"populateDepMap",
"(",
"Map",
"<",
"String",
",",
"DependencyInfo",
">",
"depMap",
")",
"{",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"depMap",
".",
"put",
"(",
"getFullPathName",
"(",
")",
",",
"new",
"DependencyInfo",
"(",
"defineDependencies",
... | Populates the provided map with the dependencies, keyed by
full path name. This is done to facilitate more efficient
lookups of the dependencies.
@param depMap | [
"Populates",
"the",
"provided",
"map",
"with",
"the",
"dependencies",
"keyed",
"by",
"full",
"path",
"name",
".",
"This",
"is",
"done",
"to",
"facilitate",
"more",
"efficient",
"lookups",
"of",
"the",
"dependencies",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L612-L621 | train |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.readObject | private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
// Call the default implementation to de-serialize our object
in.defaultReadObject();
parent = new WeakReference<DepTreeNode>(null);
// restore parent reference on all children
if (children != null) {
for (Entry<String, DepTreeNode> entry : children.entrySet()) {
entry.getValue().setParent(this);
}
}
} | java | private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
// Call the default implementation to de-serialize our object
in.defaultReadObject();
parent = new WeakReference<DepTreeNode>(null);
// restore parent reference on all children
if (children != null) {
for (Entry<String, DepTreeNode> entry : children.entrySet()) {
entry.getValue().setParent(this);
}
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"// Call the default implementation to de-serialize our object\r",
"in",
".",
"defaultReadObject",
"(",
")",
";",
"parent",
"=",
"new",
"Weak... | Method called when this object is de-serialized
@param in The {@link ObjectInputStream} to read from
@throws IOException
@throws ClassNotFoundException | [
"Method",
"called",
"when",
"this",
"object",
"is",
"de",
"-",
"serialized"
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L630-L644 | train |
OpenNTF/JavascriptAggregator | jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java | AggregatorImpl.getOptionsServiceTracker | protected ServiceTracker<IOptions, ?> getOptionsServiceTracker(BundleContext bundleContext) throws InvalidSyntaxException {
ServiceTracker<IOptions, ?> tracker = new ServiceTracker<IOptions, Object>(
bundleContext,
bundleContext.createFilter(
"(&(" + Constants.OBJECTCLASS + "=" + IOptions.class.getName() + //$NON-NLS-1$ //$NON-NLS-2$
")(name=" + getServletBundleName() + "))"), //$NON-NLS-1$ //$NON-NLS-2$
null);
tracker.open();
return tracker;
} | java | protected ServiceTracker<IOptions, ?> getOptionsServiceTracker(BundleContext bundleContext) throws InvalidSyntaxException {
ServiceTracker<IOptions, ?> tracker = new ServiceTracker<IOptions, Object>(
bundleContext,
bundleContext.createFilter(
"(&(" + Constants.OBJECTCLASS + "=" + IOptions.class.getName() + //$NON-NLS-1$ //$NON-NLS-2$
")(name=" + getServletBundleName() + "))"), //$NON-NLS-1$ //$NON-NLS-2$
null);
tracker.open();
return tracker;
} | [
"protected",
"ServiceTracker",
"<",
"IOptions",
",",
"?",
">",
"getOptionsServiceTracker",
"(",
"BundleContext",
"bundleContext",
")",
"throws",
"InvalidSyntaxException",
"{",
"ServiceTracker",
"<",
"IOptions",
",",
"?",
">",
"tracker",
"=",
"new",
"ServiceTracker",
... | Returns an opened ServiceTracker for the Aggregator options. Aggregator options
are created by the bundle activator and are shared by all Aggregator instances
created from the same bundle.
@param bundleContext The contributing bundle context
@return The opened service tracker
@throws InvalidSyntaxException | [
"Returns",
"an",
"opened",
"ServiceTracker",
"for",
"the",
"Aggregator",
"options",
".",
"Aggregator",
"options",
"are",
"created",
"by",
"the",
"bundle",
"activator",
"and",
"are",
"shared",
"by",
"all",
"Aggregator",
"instances",
"created",
"from",
"the",
"sam... | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java#L405-L414 | train |
OpenNTF/JavascriptAggregator | jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java | AggregatorImpl.getExecutorsServiceTracker | protected ServiceTracker<IExecutors, ?> getExecutorsServiceTracker(BundleContext bundleContext) throws InvalidSyntaxException {
ServiceTracker<IExecutors, ?> tracker = new ServiceTracker<IExecutors, Object>(
bundleContext,
bundleContext.createFilter(
"(&(" + Constants.OBJECTCLASS + "=" + IExecutors.class.getName() + //$NON-NLS-1$ //$NON-NLS-2$
")(name=" + getServletBundleName() + "))"), //$NON-NLS-1$ //$NON-NLS-2$
null);
tracker.open();
return tracker;
} | java | protected ServiceTracker<IExecutors, ?> getExecutorsServiceTracker(BundleContext bundleContext) throws InvalidSyntaxException {
ServiceTracker<IExecutors, ?> tracker = new ServiceTracker<IExecutors, Object>(
bundleContext,
bundleContext.createFilter(
"(&(" + Constants.OBJECTCLASS + "=" + IExecutors.class.getName() + //$NON-NLS-1$ //$NON-NLS-2$
")(name=" + getServletBundleName() + "))"), //$NON-NLS-1$ //$NON-NLS-2$
null);
tracker.open();
return tracker;
} | [
"protected",
"ServiceTracker",
"<",
"IExecutors",
",",
"?",
">",
"getExecutorsServiceTracker",
"(",
"BundleContext",
"bundleContext",
")",
"throws",
"InvalidSyntaxException",
"{",
"ServiceTracker",
"<",
"IExecutors",
",",
"?",
">",
"tracker",
"=",
"new",
"ServiceTrack... | Returns an opened ServiceTracker for the Aggregator exectors provider.
The executors provider is are created by the bundle activator and is
shared by all Aggregator instances created from the same bundle.
@param bundleContext
The contributing bundle context
@return The opened service tracker
@throws InvalidSyntaxException | [
"Returns",
"an",
"opened",
"ServiceTracker",
"for",
"the",
"Aggregator",
"exectors",
"provider",
".",
"The",
"executors",
"provider",
"is",
"are",
"created",
"by",
"the",
"bundle",
"activator",
"and",
"is",
"shared",
"by",
"all",
"Aggregator",
"instances",
"crea... | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java#L426-L435 | train |
OpenNTF/JavascriptAggregator | jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java | AggregatorImpl.createCacheBundle | public String createCacheBundle(String bundleSymbolicName, String bundleFileName) throws IOException {
final String sourceMethod = "createCacheBundle"; //$NON-NLS-1$
final boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{bundleSymbolicName, bundleFileName});
}
// Serialize the cache
getCacheManager().serializeCache();
// De-serialize the control file to obtain the cache control data
File controlFile = new File(getWorkingDirectory(), CacheControl.CONTROL_SERIALIZATION_FILENAME);
CacheControl control = null;
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(controlFile));;
try {
control = (CacheControl)ois.readObject();
} catch (Exception ex) {
throw new IOException(ex);
} finally {
IOUtils.closeQuietly(ois);
}
if (control.getInitStamp() != 0) {
return Messages.AggregatorImpl_3;
}
// create the bundle manifest
InputStream is = AggregatorImpl.class.getClassLoader().getResourceAsStream(MANIFEST_TEMPLATE);
StringWriter writer = new StringWriter();
CopyUtil.copy(is, writer);
String template = writer.toString();
String manifest = MessageFormat.format(template, new Object[]{
Long.toString(new Date().getTime()),
getContributingBundle().getHeaders().get("Bundle-Version"), //$NON-NLS-1$
bundleSymbolicName,
AggregatorUtil.getCacheBust(this)
});
// create the jar
File bundleFile = new File(bundleFileName);
ZipUtil.Packer packer = new ZipUtil.Packer();
packer.open(bundleFile);
try {
packer.packEntryFromStream("META-INF/MANIFEST.MF", new ByteArrayInputStream(manifest.getBytes("UTF-8")), new Date().getTime()); //$NON-NLS-1$ //$NON-NLS-2$
packer.packDirectory(getWorkingDirectory(), JAGGR_CACHE_DIRECTORY);
} finally {
packer.close();
}
String result = bundleFile.getCanonicalPath();
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | java | public String createCacheBundle(String bundleSymbolicName, String bundleFileName) throws IOException {
final String sourceMethod = "createCacheBundle"; //$NON-NLS-1$
final boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{bundleSymbolicName, bundleFileName});
}
// Serialize the cache
getCacheManager().serializeCache();
// De-serialize the control file to obtain the cache control data
File controlFile = new File(getWorkingDirectory(), CacheControl.CONTROL_SERIALIZATION_FILENAME);
CacheControl control = null;
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(controlFile));;
try {
control = (CacheControl)ois.readObject();
} catch (Exception ex) {
throw new IOException(ex);
} finally {
IOUtils.closeQuietly(ois);
}
if (control.getInitStamp() != 0) {
return Messages.AggregatorImpl_3;
}
// create the bundle manifest
InputStream is = AggregatorImpl.class.getClassLoader().getResourceAsStream(MANIFEST_TEMPLATE);
StringWriter writer = new StringWriter();
CopyUtil.copy(is, writer);
String template = writer.toString();
String manifest = MessageFormat.format(template, new Object[]{
Long.toString(new Date().getTime()),
getContributingBundle().getHeaders().get("Bundle-Version"), //$NON-NLS-1$
bundleSymbolicName,
AggregatorUtil.getCacheBust(this)
});
// create the jar
File bundleFile = new File(bundleFileName);
ZipUtil.Packer packer = new ZipUtil.Packer();
packer.open(bundleFile);
try {
packer.packEntryFromStream("META-INF/MANIFEST.MF", new ByteArrayInputStream(manifest.getBytes("UTF-8")), new Date().getTime()); //$NON-NLS-1$ //$NON-NLS-2$
packer.packDirectory(getWorkingDirectory(), JAGGR_CACHE_DIRECTORY);
} finally {
packer.close();
}
String result = bundleFile.getCanonicalPath();
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, result);
}
return result;
} | [
"public",
"String",
"createCacheBundle",
"(",
"String",
"bundleSymbolicName",
",",
"String",
"bundleFileName",
")",
"throws",
"IOException",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"createCacheBundle\"",
";",
"//$NON-NLS-1$\r",
"final",
"boolean",
"isTraceLogging",... | Command handler to create a cache primer bundle containing the contents of the cache
directory.
@param bundleSymbolicName
the symbolic name of the bundle to be created
@param bundleFileName
the filename of the bundle to be created
@return the string to be displayed in the console (the fully qualified filename of the
bundle if successful or an error message otherwise)
@throws IOException | [
"Command",
"handler",
"to",
"create",
"a",
"cache",
"primer",
"bundle",
"containing",
"the",
"contents",
"of",
"the",
"cache",
"directory",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java#L783-L833 | train |
OpenNTF/JavascriptAggregator | jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java | AggregatorImpl.processRequestUrl | public String processRequestUrl(String requestUrl) throws IOException, ServletException {
ConsoleHttpServletRequest req = new ConsoleHttpServletRequest(getServletConfig().getServletContext(), requestUrl);
OutputStream nulOutputStream = new OutputStream() {
@Override public void write(int b) throws IOException {}
};
ConsoleHttpServletResponse resp = new ConsoleHttpServletResponse(nulOutputStream);
doGet(req, resp);
return Integer.toString(resp.getStatus());
} | java | public String processRequestUrl(String requestUrl) throws IOException, ServletException {
ConsoleHttpServletRequest req = new ConsoleHttpServletRequest(getServletConfig().getServletContext(), requestUrl);
OutputStream nulOutputStream = new OutputStream() {
@Override public void write(int b) throws IOException {}
};
ConsoleHttpServletResponse resp = new ConsoleHttpServletResponse(nulOutputStream);
doGet(req, resp);
return Integer.toString(resp.getStatus());
} | [
"public",
"String",
"processRequestUrl",
"(",
"String",
"requestUrl",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"ConsoleHttpServletRequest",
"req",
"=",
"new",
"ConsoleHttpServletRequest",
"(",
"getServletConfig",
"(",
")",
".",
"getServletContext",
"(... | Implementation of eponymous console command. Provided to allow cache priming requests to be
issued via the server console by automation scripts.
@param requestUrl
the URL to process
@return the status code as a string
@throws IOException
@throws ServletException | [
"Implementation",
"of",
"eponymous",
"console",
"command",
".",
"Provided",
"to",
"allow",
"cache",
"priming",
"requests",
"to",
"be",
"issued",
"via",
"the",
"server",
"console",
"by",
"automation",
"scripts",
"."
] | 9f47a96d778251638b1df9a368462176216d5b29 | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java#L845-L853 | train |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java | TransitionFactory.add | public void add(VMTransitionBuilder b) {
Map<VMState, VMTransitionBuilder> m = vmAMB2.get(b.getDestinationState());
for (VMState src : b.getSourceStates()) {
m.put(src, b);
}
} | java | public void add(VMTransitionBuilder b) {
Map<VMState, VMTransitionBuilder> m = vmAMB2.get(b.getDestinationState());
for (VMState src : b.getSourceStates()) {
m.put(src, b);
}
} | [
"public",
"void",
"add",
"(",
"VMTransitionBuilder",
"b",
")",
"{",
"Map",
"<",
"VMState",
",",
"VMTransitionBuilder",
">",
"m",
"=",
"vmAMB2",
".",
"get",
"(",
"b",
".",
"getDestinationState",
"(",
")",
")",
";",
"for",
"(",
"VMState",
"src",
":",
"b"... | Add a builder for a VM.
Every builder that supports the same transition will be replaced.
@param b the builder to add | [
"Add",
"a",
"builder",
"for",
"a",
"VM",
".",
"Every",
"builder",
"that",
"supports",
"the",
"same",
"transition",
"will",
"be",
"replaced",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java#L61-L66 | train |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java | TransitionFactory.remove | public boolean remove(VMTransitionBuilder b) {
Map<VMState, VMTransitionBuilder> m = vmAMB2.get(b.getDestinationState());
for (VMState src : b.getSourceStates()) {
m.remove(src);
}
return true;
} | java | public boolean remove(VMTransitionBuilder b) {
Map<VMState, VMTransitionBuilder> m = vmAMB2.get(b.getDestinationState());
for (VMState src : b.getSourceStates()) {
m.remove(src);
}
return true;
} | [
"public",
"boolean",
"remove",
"(",
"VMTransitionBuilder",
"b",
")",
"{",
"Map",
"<",
"VMState",
",",
"VMTransitionBuilder",
">",
"m",
"=",
"vmAMB2",
".",
"get",
"(",
"b",
".",
"getDestinationState",
"(",
")",
")",
";",
"for",
"(",
"VMState",
"src",
":",... | Remove a builder for an action on a VM.
@param b the builder to remove
@return {@code true} if it has been removed | [
"Remove",
"a",
"builder",
"for",
"an",
"action",
"on",
"a",
"VM",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java#L74-L80 | train |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java | TransitionFactory.getBuilder | public VMTransitionBuilder getBuilder(VMState srcState, VMState dstState) {
Map<VMState, VMTransitionBuilder> dstCompliant = vmAMB2.get(dstState);
if (dstCompliant == null) {
return null;
}
return dstCompliant.get(srcState);
} | java | public VMTransitionBuilder getBuilder(VMState srcState, VMState dstState) {
Map<VMState, VMTransitionBuilder> dstCompliant = vmAMB2.get(dstState);
if (dstCompliant == null) {
return null;
}
return dstCompliant.get(srcState);
} | [
"public",
"VMTransitionBuilder",
"getBuilder",
"(",
"VMState",
"srcState",
",",
"VMState",
"dstState",
")",
"{",
"Map",
"<",
"VMState",
",",
"VMTransitionBuilder",
">",
"dstCompliant",
"=",
"vmAMB2",
".",
"get",
"(",
"dstState",
")",
";",
"if",
"(",
"dstCompli... | Get the model builder for a given transition
@param srcState the current VM state
@param dstState the current VM state
@return the list of possible transitions. {@code null} if no transition is available | [
"Get",
"the",
"model",
"builder",
"for",
"a",
"given",
"transition"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java#L108-L114 | train |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java | TransitionFactory.newBundle | public static TransitionFactory newBundle() {
TransitionFactory f = new TransitionFactory();
f.add(new BootVM.Builder());
f.add(new ShutdownVM.Builder());
f.add(new SuspendVM.Builder());
f.add(new ResumeVM.Builder());
f.add(new KillVM.Builder());
f.add(new RelocatableVM.Builder());
f.add(new ForgeVM.Builder());
f.add(new StayAwayVM.BuilderReady());
f.add(new StayAwayVM.BuilderSleeping());
f.add(new StayAwayVM.BuilderInit());
f.add(new BootableNode.Builder());
f.add(new ShutdownableNode.Builder());
return f;
} | java | public static TransitionFactory newBundle() {
TransitionFactory f = new TransitionFactory();
f.add(new BootVM.Builder());
f.add(new ShutdownVM.Builder());
f.add(new SuspendVM.Builder());
f.add(new ResumeVM.Builder());
f.add(new KillVM.Builder());
f.add(new RelocatableVM.Builder());
f.add(new ForgeVM.Builder());
f.add(new StayAwayVM.BuilderReady());
f.add(new StayAwayVM.BuilderSleeping());
f.add(new StayAwayVM.BuilderInit());
f.add(new BootableNode.Builder());
f.add(new ShutdownableNode.Builder());
return f;
} | [
"public",
"static",
"TransitionFactory",
"newBundle",
"(",
")",
"{",
"TransitionFactory",
"f",
"=",
"new",
"TransitionFactory",
"(",
")",
";",
"f",
".",
"add",
"(",
"new",
"BootVM",
".",
"Builder",
"(",
")",
")",
";",
"f",
".",
"add",
"(",
"new",
"Shut... | a new factory that embeds the default builders.
@return a viable factory | [
"a",
"new",
"factory",
"that",
"embeds",
"the",
"default",
"builders",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java#L131-L146 | train |
btrplace/scheduler | api/src/main/java/org/btrplace/model/view/network/Routing.java | Routing.getMaxBW | public int getMaxBW(Node n1, Node n2) {
int max = Integer.MAX_VALUE;
for (Link inf : getPath(n1, n2)) {
if (inf.getCapacity() < max) {
max = inf.getCapacity();
}
Switch sw = inf.getSwitch();
if (sw.getCapacity() >= 0 && sw.getCapacity() < max) {
//The >= 0 stays for historical reasons
max = sw.getCapacity();
}
}
return max;
} | java | public int getMaxBW(Node n1, Node n2) {
int max = Integer.MAX_VALUE;
for (Link inf : getPath(n1, n2)) {
if (inf.getCapacity() < max) {
max = inf.getCapacity();
}
Switch sw = inf.getSwitch();
if (sw.getCapacity() >= 0 && sw.getCapacity() < max) {
//The >= 0 stays for historical reasons
max = sw.getCapacity();
}
}
return max;
} | [
"public",
"int",
"getMaxBW",
"(",
"Node",
"n1",
",",
"Node",
"n2",
")",
"{",
"int",
"max",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"for",
"(",
"Link",
"inf",
":",
"getPath",
"(",
"n1",
",",
"n2",
")",
")",
"{",
"if",
"(",
"inf",
".",
"getCapacity"... | Get the maximal bandwidth available between two nodes.
@param n1 the source node
@param n2 the destination node
@return the bandwidth | [
"Get",
"the",
"maximal",
"bandwidth",
"available",
"between",
"two",
"nodes",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/Routing.java#L89-L103 | train |
btrplace/scheduler | api/src/main/java/org/btrplace/model/view/network/Routing.java | Routing.getFirstPhysicalPath | protected List<Link> getFirstPhysicalPath(List<Link> currentPath, Switch sw, Node dst) {
// Iterate through the current switch's links
for (Link l : net.getConnectedLinks(sw)) {
// Wrong link
if (currentPath.contains(l)) {
continue;
}
// Go through the link
currentPath.add(l);
// Check what is after
if (l.getElement() instanceof Node) {
// Node found, path complete
if (l.getElement().equals(dst)) {
return currentPath;
}
} else {
// Go to the next switch
List<Link> recall = getFirstPhysicalPath(
currentPath, l.getSwitch().equals(sw) ? (Switch) l.getElement() : l.getSwitch(), dst);
// Return the complete path if found
if (!recall.isEmpty()) {
return recall;
}
}
// Wrong link, go back
currentPath.remove(currentPath.size() - 1);
}
// No path found through this switch
return Collections.emptyList();
} | java | protected List<Link> getFirstPhysicalPath(List<Link> currentPath, Switch sw, Node dst) {
// Iterate through the current switch's links
for (Link l : net.getConnectedLinks(sw)) {
// Wrong link
if (currentPath.contains(l)) {
continue;
}
// Go through the link
currentPath.add(l);
// Check what is after
if (l.getElement() instanceof Node) {
// Node found, path complete
if (l.getElement().equals(dst)) {
return currentPath;
}
} else {
// Go to the next switch
List<Link> recall = getFirstPhysicalPath(
currentPath, l.getSwitch().equals(sw) ? (Switch) l.getElement() : l.getSwitch(), dst);
// Return the complete path if found
if (!recall.isEmpty()) {
return recall;
}
}
// Wrong link, go back
currentPath.remove(currentPath.size() - 1);
}
// No path found through this switch
return Collections.emptyList();
} | [
"protected",
"List",
"<",
"Link",
">",
"getFirstPhysicalPath",
"(",
"List",
"<",
"Link",
">",
"currentPath",
",",
"Switch",
"sw",
",",
"Node",
"dst",
")",
"{",
"// Iterate through the current switch's links",
"for",
"(",
"Link",
"l",
":",
"net",
".",
"getConne... | Recursive method to get the first physical path found from a switch to a destination node.
@param currentPath the current or initial path containing the link(s) crossed
@param sw the current switch to browse
@param dst the destination node to reach
@return the ordered list of links that make the path to dst | [
"Recursive",
"method",
"to",
"get",
"the",
"first",
"physical",
"path",
"found",
"from",
"a",
"switch",
"to",
"a",
"destination",
"node",
"."
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/Routing.java#L123-L153 | train |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingHeapDecorator.java | VectorPackingHeapDecorator.loadSlack | private int loadSlack(int dim, int bin) {
return p.loads[dim][bin].getUB() - p.loads[dim][bin].getLB();
} | java | private int loadSlack(int dim, int bin) {
return p.loads[dim][bin].getUB() - p.loads[dim][bin].getLB();
} | [
"private",
"int",
"loadSlack",
"(",
"int",
"dim",
",",
"int",
"bin",
")",
"{",
"return",
"p",
".",
"loads",
"[",
"dim",
"]",
"[",
"bin",
"]",
".",
"getUB",
"(",
")",
"-",
"p",
".",
"loads",
"[",
"dim",
"]",
"[",
"bin",
"]",
".",
"getLB",
"(",... | compute the load slack of a bin
@param dim the dimension
@param bin the bin
@return the load slack of bin on dimension bin | [
"compute",
"the",
"load",
"slack",
"of",
"a",
"bin"
] | 611063aad0b47a016e57ebf36fa4dfdf24de09e8 | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingHeapDecorator.java#L65-L67 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.