repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
unbescape/unbescape | src/main/java/org/unbescape/xml/XmlEscape.java | XmlEscape.escapeXml11AttributeMinimal | public static void escapeXml11AttributeMinimal(final Reader reader, final Writer writer)
throws IOException {
"""
<p>
Perform an XML 1.1 level 1 (only markup-significant chars) <strong>escape</strong> operation
on a <tt>Reader</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 1</em> means this method will only escape the five markup-significant characters which
are <em>predefined</em> as Character Entity References in XML:
<tt><</tt>, <tt>></tt>, <tt>&</tt>, <tt>"</tt> and <tt>'</tt>.
</p>
<p>
Besides, being an attribute value also <tt>\t</tt>, <tt>\n</tt> and <tt>\r</tt> will
be escaped to avoid white-space normalization from removing line feeds (turning them into white
spaces) during future parsing operations.
</p>
<p>
This method calls {@link #escapeXml11(Reader, Writer, XmlEscapeType, XmlEscapeLevel)} with the following
preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li>
<li><tt>level</tt>:
{@link org.unbescape.xml.XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.5
"""
escapeXml(reader, writer, XmlEscapeSymbols.XML11_ATTRIBUTE_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | java | public static void escapeXml11AttributeMinimal(final Reader reader, final Writer writer)
throws IOException {
escapeXml(reader, writer, XmlEscapeSymbols.XML11_ATTRIBUTE_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | [
"public",
"static",
"void",
"escapeXml11AttributeMinimal",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeXml",
"(",
"reader",
",",
"writer",
",",
"XmlEscapeSymbols",
".",
"XML11_ATTRIBUTE_SYMBOLS",
",",... | <p>
Perform an XML 1.1 level 1 (only markup-significant chars) <strong>escape</strong> operation
on a <tt>Reader</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 1</em> means this method will only escape the five markup-significant characters which
are <em>predefined</em> as Character Entity References in XML:
<tt><</tt>, <tt>></tt>, <tt>&</tt>, <tt>"</tt> and <tt>'</tt>.
</p>
<p>
Besides, being an attribute value also <tt>\t</tt>, <tt>\n</tt> and <tt>\r</tt> will
be escaped to avoid white-space normalization from removing line feeds (turning them into white
spaces) during future parsing operations.
</p>
<p>
This method calls {@link #escapeXml11(Reader, Writer, XmlEscapeType, XmlEscapeLevel)} with the following
preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li>
<li><tt>level</tt>:
{@link org.unbescape.xml.XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.5 | [
"<p",
">",
"Perform",
"an",
"XML",
"1",
".",
"1",
"level",
"1",
"(",
"only",
"markup",
"-",
"significant",
"chars",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"meant",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1356-L1361 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java | ShanksAgentBayesianReasoningCapability.addEvidence | public static void addEvidence(ProbabilisticNetwork bn, String nodeName,
String status) throws ShanksException {
"""
Add information to the Bayesian network to reason with it.
@param bn
@param nodeName
@param status
@throws ShanksException
"""
ProbabilisticNode node = ShanksAgentBayesianReasoningCapability
.getNode(bn, nodeName);
if (node.hasEvidence()) {
ShanksAgentBayesianReasoningCapability.clearEvidence(bn, node);
}
int states = node.getStatesSize();
for (int i = 0; i < states; i++) {
if (status.equals(node.getStateAt(i))) {
node.addFinding(i);
try {
bn.updateEvidences();
} catch (Exception e) {
throw new ShanksException(e);
}
return;
}
}
throw new UnknowkNodeStateException(bn, nodeName, status);
} | java | public static void addEvidence(ProbabilisticNetwork bn, String nodeName,
String status) throws ShanksException {
ProbabilisticNode node = ShanksAgentBayesianReasoningCapability
.getNode(bn, nodeName);
if (node.hasEvidence()) {
ShanksAgentBayesianReasoningCapability.clearEvidence(bn, node);
}
int states = node.getStatesSize();
for (int i = 0; i < states; i++) {
if (status.equals(node.getStateAt(i))) {
node.addFinding(i);
try {
bn.updateEvidences();
} catch (Exception e) {
throw new ShanksException(e);
}
return;
}
}
throw new UnknowkNodeStateException(bn, nodeName, status);
} | [
"public",
"static",
"void",
"addEvidence",
"(",
"ProbabilisticNetwork",
"bn",
",",
"String",
"nodeName",
",",
"String",
"status",
")",
"throws",
"ShanksException",
"{",
"ProbabilisticNode",
"node",
"=",
"ShanksAgentBayesianReasoningCapability",
".",
"getNode",
"(",
"b... | Add information to the Bayesian network to reason with it.
@param bn
@param nodeName
@param status
@throws ShanksException | [
"Add",
"information",
"to",
"the",
"Bayesian",
"network",
"to",
"reason",
"with",
"it",
"."
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java#L114-L134 |
apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/TypeCheckingExtension.java | TypeCheckingExtension.buildMapType | public ClassNode buildMapType(ClassNode keyType, ClassNode valueType) {
"""
Builds a parametrized class node representing the Map<keyType,valueType> type.
@param keyType the classnode type of the key
@param valueType the classnode type of the value
@return a class node for Map<keyType,valueType>
@since 2.2.0
"""
return parameterizedType(ClassHelper.MAP_TYPE, keyType, valueType);
} | java | public ClassNode buildMapType(ClassNode keyType, ClassNode valueType) {
return parameterizedType(ClassHelper.MAP_TYPE, keyType, valueType);
} | [
"public",
"ClassNode",
"buildMapType",
"(",
"ClassNode",
"keyType",
",",
"ClassNode",
"valueType",
")",
"{",
"return",
"parameterizedType",
"(",
"ClassHelper",
".",
"MAP_TYPE",
",",
"keyType",
",",
"valueType",
")",
";",
"}"
] | Builds a parametrized class node representing the Map<keyType,valueType> type.
@param keyType the classnode type of the key
@param valueType the classnode type of the value
@return a class node for Map<keyType,valueType>
@since 2.2.0 | [
"Builds",
"a",
"parametrized",
"class",
"node",
"representing",
"the",
"Map<",
";",
"keyType",
"valueType>",
";",
"type",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/TypeCheckingExtension.java#L361-L363 |
Netflix/Hystrix | hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java | MethodProvider.getMethod | public static Optional<Method> getMethod(Class<?> type, String name, Class<?>... parameterTypes) {
"""
Gets method by name and parameters types using reflection,
if the given type doesn't contain required method then continue applying this method for all super classes up to Object class.
@param type the type to search method
@param name the method name
@param parameterTypes the parameters types
@return Some if method exists otherwise None
"""
Method[] methods = type.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals(name) && Arrays.equals(method.getParameterTypes(), parameterTypes)) {
return Optional.of(method);
}
}
Class<?> superClass = type.getSuperclass();
if (superClass != null && !superClass.equals(Object.class)) {
return getMethod(superClass, name, parameterTypes);
} else {
return Optional.absent();
}
} | java | public static Optional<Method> getMethod(Class<?> type, String name, Class<?>... parameterTypes) {
Method[] methods = type.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals(name) && Arrays.equals(method.getParameterTypes(), parameterTypes)) {
return Optional.of(method);
}
}
Class<?> superClass = type.getSuperclass();
if (superClass != null && !superClass.equals(Object.class)) {
return getMethod(superClass, name, parameterTypes);
} else {
return Optional.absent();
}
} | [
"public",
"static",
"Optional",
"<",
"Method",
">",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"Method",
"[",
"]",
"methods",
"=",
"type",
".",
"getDeclaredMe... | Gets method by name and parameters types using reflection,
if the given type doesn't contain required method then continue applying this method for all super classes up to Object class.
@param type the type to search method
@param name the method name
@param parameterTypes the parameters types
@return Some if method exists otherwise None | [
"Gets",
"method",
"by",
"name",
"and",
"parameters",
"types",
"using",
"reflection",
"if",
"the",
"given",
"type",
"doesn",
"t",
"contain",
"required",
"method",
"then",
"continue",
"applying",
"this",
"method",
"for",
"all",
"super",
"classes",
"up",
"to",
... | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java#L207-L220 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ObjectUtils.java | ObjectUtils.compare | public static <T extends Comparable<? super T>> int compare(final T c1, final T c2) {
"""
<p>Null safe comparison of Comparables.
{@code null} is assumed to be less than a non-{@code null} value.</p>
@param <T> type of the values processed by this method
@param c1 the first comparable, may be null
@param c2 the second comparable, may be null
@return a negative value if c1 < c2, zero if c1 = c2
and a positive value if c1 > c2
"""
return compare(c1, c2, false);
} | java | public static <T extends Comparable<? super T>> int compare(final T c1, final T c2) {
return compare(c1, c2, false);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"int",
"compare",
"(",
"final",
"T",
"c1",
",",
"final",
"T",
"c2",
")",
"{",
"return",
"compare",
"(",
"c1",
",",
"c2",
",",
"false",
")",
";",
"}"
] | <p>Null safe comparison of Comparables.
{@code null} is assumed to be less than a non-{@code null} value.</p>
@param <T> type of the values processed by this method
@param c1 the first comparable, may be null
@param c2 the second comparable, may be null
@return a negative value if c1 < c2, zero if c1 = c2
and a positive value if c1 > c2 | [
"<p",
">",
"Null",
"safe",
"comparison",
"of",
"Comparables",
".",
"{",
"@code",
"null",
"}",
"is",
"assumed",
"to",
"be",
"less",
"than",
"a",
"non",
"-",
"{",
"@code",
"null",
"}",
"value",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ObjectUtils.java#L550-L552 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/metadata/statistics/StatMgr.java | StatMgr.getTableStatInfo | public synchronized TableStatInfo getTableStatInfo(TableInfo ti,
Transaction tx) {
"""
Returns the statistical information about the specified table.
@param ti
the table's metadata
@param tx
the calling transaction
@return the statistical information about the table
"""
if (isRefreshStatOn) {
Integer c = updateCounts.get(ti.tableName());
if (c != null && c > REFRESH_THRESHOLD)
VanillaDb.taskMgr().runTask(
new StatisticsRefreshTask(tx, ti.tableName()));
}
TableStatInfo tsi = tableStats.get(ti.tableName());
if (tsi == null) {
tsi = calcTableStats(ti, tx);
tableStats.put(ti.tableName(), tsi);
}
return tsi;
} | java | public synchronized TableStatInfo getTableStatInfo(TableInfo ti,
Transaction tx) {
if (isRefreshStatOn) {
Integer c = updateCounts.get(ti.tableName());
if (c != null && c > REFRESH_THRESHOLD)
VanillaDb.taskMgr().runTask(
new StatisticsRefreshTask(tx, ti.tableName()));
}
TableStatInfo tsi = tableStats.get(ti.tableName());
if (tsi == null) {
tsi = calcTableStats(ti, tx);
tableStats.put(ti.tableName(), tsi);
}
return tsi;
} | [
"public",
"synchronized",
"TableStatInfo",
"getTableStatInfo",
"(",
"TableInfo",
"ti",
",",
"Transaction",
"tx",
")",
"{",
"if",
"(",
"isRefreshStatOn",
")",
"{",
"Integer",
"c",
"=",
"updateCounts",
".",
"get",
"(",
"ti",
".",
"tableName",
"(",
")",
")",
... | Returns the statistical information about the specified table.
@param ti
the table's metadata
@param tx
the calling transaction
@return the statistical information about the table | [
"Returns",
"the",
"statistical",
"information",
"about",
"the",
"specified",
"table",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/statistics/StatMgr.java#L79-L94 |
ReactiveX/RxJavaComputationExpressions | src/main/java/rx/Statement.java | Statement.switchCase | public static <K, R> Observable<R> switchCase(Func0<? extends K> caseSelector,
Map<? super K, ? extends Observable<? extends R>> mapOfCases) {
"""
Return a particular one of several possible Observables based on a case
selector.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/switchCase.png" alt="">
@param <K>
the case key type
@param <R>
the result value type
@param caseSelector
the function that produces a case key when an
Observer subscribes
@param mapOfCases
a map that maps a case key to an Observable
@return a particular Observable chosen by key from the map of
Observables, or an empty Observable if no Observable matches the
key
"""
return switchCase(caseSelector, mapOfCases, Observable.<R> empty());
} | java | public static <K, R> Observable<R> switchCase(Func0<? extends K> caseSelector,
Map<? super K, ? extends Observable<? extends R>> mapOfCases) {
return switchCase(caseSelector, mapOfCases, Observable.<R> empty());
} | [
"public",
"static",
"<",
"K",
",",
"R",
">",
"Observable",
"<",
"R",
">",
"switchCase",
"(",
"Func0",
"<",
"?",
"extends",
"K",
">",
"caseSelector",
",",
"Map",
"<",
"?",
"super",
"K",
",",
"?",
"extends",
"Observable",
"<",
"?",
"extends",
"R",
">... | Return a particular one of several possible Observables based on a case
selector.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/switchCase.png" alt="">
@param <K>
the case key type
@param <R>
the result value type
@param caseSelector
the function that produces a case key when an
Observer subscribes
@param mapOfCases
a map that maps a case key to an Observable
@return a particular Observable chosen by key from the map of
Observables, or an empty Observable if no Observable matches the
key | [
"Return",
"a",
"particular",
"one",
"of",
"several",
"possible",
"Observables",
"based",
"on",
"a",
"case",
"selector",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"... | train | https://github.com/ReactiveX/RxJavaComputationExpressions/blob/f9d04ab762223b36fad47402ac36ce7969320d69/src/main/java/rx/Statement.java#L49-L52 |
aboutsip/pkts | pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java | SipParser.couldBeSipMessage | public static boolean couldBeSipMessage(final Buffer data) throws IOException {
"""
Helper function that checks whether or not the data could be a SIP message. It is a very
basic check but if it doesn't go through it definitely is not a SIP message.
@param data
@return
"""
final byte a = data.getByte(0);
final byte b = data.getByte(1);
final byte c = data.getByte(2);
return couldBeSipMessage(a, b, c);
} | java | public static boolean couldBeSipMessage(final Buffer data) throws IOException {
final byte a = data.getByte(0);
final byte b = data.getByte(1);
final byte c = data.getByte(2);
return couldBeSipMessage(a, b, c);
} | [
"public",
"static",
"boolean",
"couldBeSipMessage",
"(",
"final",
"Buffer",
"data",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"a",
"=",
"data",
".",
"getByte",
"(",
"0",
")",
";",
"final",
"byte",
"b",
"=",
"data",
".",
"getByte",
"(",
"1",
"... | Helper function that checks whether or not the data could be a SIP message. It is a very
basic check but if it doesn't go through it definitely is not a SIP message.
@param data
@return | [
"Helper",
"function",
"that",
"checks",
"whether",
"or",
"not",
"the",
"data",
"could",
"be",
"a",
"SIP",
"message",
".",
"It",
"is",
"a",
"very",
"basic",
"check",
"but",
"if",
"it",
"doesn",
"t",
"go",
"through",
"it",
"definitely",
"is",
"not",
"a",... | train | https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java#L2285-L2290 |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/AnySAMInputFormat.java | AnySAMInputFormat.isSplitable | @Override public boolean isSplitable(JobContext job, Path path) {
"""
Defers to {@link BAMInputFormat}, {@link CRAMInputFormat}, or
{@link SAMInputFormat} as appropriate for the given path.
"""
if (this.conf == null)
this.conf = job.getConfiguration();
try {
final SAMFormat fmt = getFormat(path);
if (fmt == null)
return super.isSplitable(job, path);
switch (fmt) {
case SAM: return samIF.isSplitable(job, path);
case BAM: return bamIF.isSplitable(job, path);
case CRAM: return cramIF.isSplitable(job, path);
default: assert false; return false;
}
} catch (PathNotFoundException e) {
return super.isSplitable(job, path);
}
} | java | @Override public boolean isSplitable(JobContext job, Path path) {
if (this.conf == null)
this.conf = job.getConfiguration();
try {
final SAMFormat fmt = getFormat(path);
if (fmt == null)
return super.isSplitable(job, path);
switch (fmt) {
case SAM: return samIF.isSplitable(job, path);
case BAM: return bamIF.isSplitable(job, path);
case CRAM: return cramIF.isSplitable(job, path);
default: assert false; return false;
}
} catch (PathNotFoundException e) {
return super.isSplitable(job, path);
}
} | [
"@",
"Override",
"public",
"boolean",
"isSplitable",
"(",
"JobContext",
"job",
",",
"Path",
"path",
")",
"{",
"if",
"(",
"this",
".",
"conf",
"==",
"null",
")",
"this",
".",
"conf",
"=",
"job",
".",
"getConfiguration",
"(",
")",
";",
"try",
"{",
"fin... | Defers to {@link BAMInputFormat}, {@link CRAMInputFormat}, or
{@link SAMInputFormat} as appropriate for the given path. | [
"Defers",
"to",
"{"
] | train | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/AnySAMInputFormat.java#L199-L217 |
headius/invokebinder | src/main/java/com/headius/invokebinder/SmartHandle.java | SmartHandle.findStaticQuiet | public static SmartHandle findStaticQuiet(Lookup lookup, Class<?> target, String name, Signature signature) {
"""
Create a new SmartHandle by performing a lookup on the given target class
for the given method name with the given signature.
@param lookup the MethodHandles.Lookup object to use
@param target the class where the method is located
@param name the name of the method
@param signature the signature of the method
@return a new SmartHandle based on the signature and looked-up MethodHandle
"""
try {
return new SmartHandle(signature, lookup.findStatic(target, name, signature.type()));
} catch (NoSuchMethodException | IllegalAccessException e) {
throw new RuntimeException(e);
}
} | java | public static SmartHandle findStaticQuiet(Lookup lookup, Class<?> target, String name, Signature signature) {
try {
return new SmartHandle(signature, lookup.findStatic(target, name, signature.type()));
} catch (NoSuchMethodException | IllegalAccessException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"SmartHandle",
"findStaticQuiet",
"(",
"Lookup",
"lookup",
",",
"Class",
"<",
"?",
">",
"target",
",",
"String",
"name",
",",
"Signature",
"signature",
")",
"{",
"try",
"{",
"return",
"new",
"SmartHandle",
"(",
"signature",
",",
"lookup",... | Create a new SmartHandle by performing a lookup on the given target class
for the given method name with the given signature.
@param lookup the MethodHandles.Lookup object to use
@param target the class where the method is located
@param name the name of the method
@param signature the signature of the method
@return a new SmartHandle based on the signature and looked-up MethodHandle | [
"Create",
"a",
"new",
"SmartHandle",
"by",
"performing",
"a",
"lookup",
"on",
"the",
"given",
"target",
"class",
"for",
"the",
"given",
"method",
"name",
"with",
"the",
"given",
"signature",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartHandle.java#L103-L109 |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.saveToPropertyVfsBundle | private void saveToPropertyVfsBundle() throws CmsException {
"""
Saves messages to a propertyvfsbundle file.
@throws CmsException thrown if writing to the file fails.
"""
for (Locale l : m_changedTranslations) {
SortedProperties props = m_localizations.get(l);
LockedFile f = m_lockedBundleFiles.get(l);
if ((null != props) && (null != f)) {
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Writer writer = new OutputStreamWriter(outputStream, f.getEncoding());
props.store(writer, null);
byte[] contentBytes = outputStream.toByteArray();
CmsFile file = f.getFile();
file.setContents(contentBytes);
String contentEncodingProperty = m_cms.readPropertyObject(
file,
CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
false).getValue();
if ((null == contentEncodingProperty) || !contentEncodingProperty.equals(f.getEncoding())) {
m_cms.writePropertyObject(
m_cms.getSitePath(file),
new CmsProperty(
CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
f.getEncoding(),
f.getEncoding()));
}
m_cms.writeFile(file);
} catch (IOException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_READING_FILE_UNSUPPORTED_ENCODING_2,
f.getFile().getRootPath(),
f.getEncoding()),
e);
}
}
}
} | java | private void saveToPropertyVfsBundle() throws CmsException {
for (Locale l : m_changedTranslations) {
SortedProperties props = m_localizations.get(l);
LockedFile f = m_lockedBundleFiles.get(l);
if ((null != props) && (null != f)) {
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Writer writer = new OutputStreamWriter(outputStream, f.getEncoding());
props.store(writer, null);
byte[] contentBytes = outputStream.toByteArray();
CmsFile file = f.getFile();
file.setContents(contentBytes);
String contentEncodingProperty = m_cms.readPropertyObject(
file,
CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
false).getValue();
if ((null == contentEncodingProperty) || !contentEncodingProperty.equals(f.getEncoding())) {
m_cms.writePropertyObject(
m_cms.getSitePath(file),
new CmsProperty(
CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
f.getEncoding(),
f.getEncoding()));
}
m_cms.writeFile(file);
} catch (IOException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_READING_FILE_UNSUPPORTED_ENCODING_2,
f.getFile().getRootPath(),
f.getEncoding()),
e);
}
}
}
} | [
"private",
"void",
"saveToPropertyVfsBundle",
"(",
")",
"throws",
"CmsException",
"{",
"for",
"(",
"Locale",
"l",
":",
"m_changedTranslations",
")",
"{",
"SortedProperties",
"props",
"=",
"m_localizations",
".",
"get",
"(",
"l",
")",
";",
"LockedFile",
"f",
"=... | Saves messages to a propertyvfsbundle file.
@throws CmsException thrown if writing to the file fails. | [
"Saves",
"messages",
"to",
"a",
"propertyvfsbundle",
"file",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1830-L1867 |
groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.eachRow | public void eachRow(String sql, List<Object> params, int offset, int maxRows, Closure closure) throws SQLException {
"""
Performs the given SQL query calling the given <code>closure</code> with each row of the result set starting at
the provided <code>offset</code>, and including up to <code>maxRows</code> number of rows.
The row will be a <code>GroovyResultSet</code> which is a <code>ResultSet</code>
that supports accessing the fields using property style notation and ordinal index values.
The query may contain placeholder question marks which match the given list of parameters.
<p>
Note that the underlying implementation is based on either invoking <code>ResultSet.absolute()</code>,
or if the ResultSet type is <code>ResultSet.TYPE_FORWARD_ONLY</code>, the <code>ResultSet.next()</code> method
is invoked equivalently. The first row of a ResultSet is 1, so passing in an offset of 1 or less has no effect
on the initial positioning within the result set.
<p>
Note that different database and JDBC driver implementations may work differently with respect to this method.
Specifically, one should expect that <code>ResultSet.TYPE_FORWARD_ONLY</code> may be less efficient than a
"scrollable" type.
@param sql the sql statement
@param params a list of parameters
@param offset the 1-based offset for the first row to be processed
@param maxRows the maximum number of rows to be processed
@param closure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs
"""
eachRow(sql, params, null, offset, maxRows, closure);
} | java | public void eachRow(String sql, List<Object> params, int offset, int maxRows, Closure closure) throws SQLException {
eachRow(sql, params, null, offset, maxRows, closure);
} | [
"public",
"void",
"eachRow",
"(",
"String",
"sql",
",",
"List",
"<",
"Object",
">",
"params",
",",
"int",
"offset",
",",
"int",
"maxRows",
",",
"Closure",
"closure",
")",
"throws",
"SQLException",
"{",
"eachRow",
"(",
"sql",
",",
"params",
",",
"null",
... | Performs the given SQL query calling the given <code>closure</code> with each row of the result set starting at
the provided <code>offset</code>, and including up to <code>maxRows</code> number of rows.
The row will be a <code>GroovyResultSet</code> which is a <code>ResultSet</code>
that supports accessing the fields using property style notation and ordinal index values.
The query may contain placeholder question marks which match the given list of parameters.
<p>
Note that the underlying implementation is based on either invoking <code>ResultSet.absolute()</code>,
or if the ResultSet type is <code>ResultSet.TYPE_FORWARD_ONLY</code>, the <code>ResultSet.next()</code> method
is invoked equivalently. The first row of a ResultSet is 1, so passing in an offset of 1 or less has no effect
on the initial positioning within the result set.
<p>
Note that different database and JDBC driver implementations may work differently with respect to this method.
Specifically, one should expect that <code>ResultSet.TYPE_FORWARD_ONLY</code> may be less efficient than a
"scrollable" type.
@param sql the sql statement
@param params a list of parameters
@param offset the 1-based offset for the first row to be processed
@param maxRows the maximum number of rows to be processed
@param closure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs | [
"Performs",
"the",
"given",
"SQL",
"query",
"calling",
"the",
"given",
"<code",
">",
"closure<",
"/",
"code",
">",
"with",
"each",
"row",
"of",
"the",
"result",
"set",
"starting",
"at",
"the",
"provided",
"<code",
">",
"offset<",
"/",
"code",
">",
"and",... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1445-L1447 |
maguro/aunit | junit/src/main/java/com/toolazydogs/aunit/internal/Util.java | Util.validatePrimitiveArray | @SuppressWarnings( {
"""
Validate that a method returns primitive array of specific type.
@param method the method to be tested
@param errors a list to place the errors
""""ThrowableInstanceNeverThrown"})
public static void validatePrimitiveArray(Method method, Class type, List<Throwable> errors)
{
Class returnType = method.getReturnType();
if (!returnType.isArray() || !returnType.getComponentType().equals(type))
{
errors.add(new Exception("Method " + method.getName() + "() should return " + type.getName() + "[]"));
}
} | java | @SuppressWarnings({"ThrowableInstanceNeverThrown"})
public static void validatePrimitiveArray(Method method, Class type, List<Throwable> errors)
{
Class returnType = method.getReturnType();
if (!returnType.isArray() || !returnType.getComponentType().equals(type))
{
errors.add(new Exception("Method " + method.getName() + "() should return " + type.getName() + "[]"));
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"ThrowableInstanceNeverThrown\"",
"}",
")",
"public",
"static",
"void",
"validatePrimitiveArray",
"(",
"Method",
"method",
",",
"Class",
"type",
",",
"List",
"<",
"Throwable",
">",
"errors",
")",
"{",
"Class",
"returnType",
"... | Validate that a method returns primitive array of specific type.
@param method the method to be tested
@param errors a list to place the errors | [
"Validate",
"that",
"a",
"method",
"returns",
"primitive",
"array",
"of",
"specific",
"type",
"."
] | train | https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/internal/Util.java#L69-L77 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_scheduler_serviceName_events_uid_GET | public OvhSchedulerEvent billingAccount_scheduler_serviceName_events_uid_GET(String billingAccount, String serviceName, String uid) throws IOException {
"""
Get this object properties
REST: GET /telephony/{billingAccount}/scheduler/{serviceName}/events/{uid}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param uid [required] The unique ICS event identifier
"""
String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events/{uid}";
StringBuilder sb = path(qPath, billingAccount, serviceName, uid);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSchedulerEvent.class);
} | java | public OvhSchedulerEvent billingAccount_scheduler_serviceName_events_uid_GET(String billingAccount, String serviceName, String uid) throws IOException {
String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events/{uid}";
StringBuilder sb = path(qPath, billingAccount, serviceName, uid);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSchedulerEvent.class);
} | [
"public",
"OvhSchedulerEvent",
"billingAccount_scheduler_serviceName_events_uid_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"uid",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/scheduler/{servic... | Get this object properties
REST: GET /telephony/{billingAccount}/scheduler/{serviceName}/events/{uid}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param uid [required] The unique ICS event identifier | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L627-L632 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java | ParserAdapter.setFeature | public void setFeature (String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException {
"""
Set a feature flag for the parser.
<p>The only features recognized are namespaces and
namespace-prefixes.</p>
@param name The feature name, as a complete URI.
@param value The requested feature value.
@exception SAXNotRecognizedException If the feature
can't be assigned or retrieved.
@exception SAXNotSupportedException If the feature
can't be assigned that value.
@see org.xml.sax.XMLReader#setFeature
"""
if (name.equals(NAMESPACES)) {
checkNotParsing("feature", name);
namespaces = value;
if (!namespaces && !prefixes) {
prefixes = true;
}
} else if (name.equals(NAMESPACE_PREFIXES)) {
checkNotParsing("feature", name);
prefixes = value;
if (!prefixes && !namespaces) {
namespaces = true;
}
} else if (name.equals(XMLNS_URIs)) {
checkNotParsing("feature", name);
uris = value;
} else {
throw new SAXNotRecognizedException("Feature: " + name);
}
} | java | public void setFeature (String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException
{
if (name.equals(NAMESPACES)) {
checkNotParsing("feature", name);
namespaces = value;
if (!namespaces && !prefixes) {
prefixes = true;
}
} else if (name.equals(NAMESPACE_PREFIXES)) {
checkNotParsing("feature", name);
prefixes = value;
if (!prefixes && !namespaces) {
namespaces = true;
}
} else if (name.equals(XMLNS_URIs)) {
checkNotParsing("feature", name);
uris = value;
} else {
throw new SAXNotRecognizedException("Feature: " + name);
}
} | [
"public",
"void",
"setFeature",
"(",
"String",
"name",
",",
"boolean",
"value",
")",
"throws",
"SAXNotRecognizedException",
",",
"SAXNotSupportedException",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"NAMESPACES",
")",
")",
"{",
"checkNotParsing",
"(",
"\"featu... | Set a feature flag for the parser.
<p>The only features recognized are namespaces and
namespace-prefixes.</p>
@param name The feature name, as a complete URI.
@param value The requested feature value.
@exception SAXNotRecognizedException If the feature
can't be assigned or retrieved.
@exception SAXNotSupportedException If the feature
can't be assigned that value.
@see org.xml.sax.XMLReader#setFeature | [
"Set",
"a",
"feature",
"flag",
"for",
"the",
"parser",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java#L175-L196 |
tommyettinger/RegExodus | src/main/java/regexodus/ds/CharArrayList.java | CharArrayList.getElements | private void getElements(final int from, final char[] a, final int offset, final int length) {
"""
Copies element of this type-specific list into the given array using optimized system calls.
@param from the start index (inclusive).
@param a the destination array.
@param offset the offset into the destination array where to store the first element copied.
@param length the number of elements to be copied.
"""
CharArrays.ensureOffsetLength(a, offset, length);
System.arraycopy(this.a, from, a, offset, length);
} | java | private void getElements(final int from, final char[] a, final int offset, final int length) {
CharArrays.ensureOffsetLength(a, offset, length);
System.arraycopy(this.a, from, a, offset, length);
} | [
"private",
"void",
"getElements",
"(",
"final",
"int",
"from",
",",
"final",
"char",
"[",
"]",
"a",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"length",
")",
"{",
"CharArrays",
".",
"ensureOffsetLength",
"(",
"a",
",",
"offset",
",",
"length",
... | Copies element of this type-specific list into the given array using optimized system calls.
@param from the start index (inclusive).
@param a the destination array.
@param offset the offset into the destination array where to store the first element copied.
@param length the number of elements to be copied. | [
"Copies",
"element",
"of",
"this",
"type",
"-",
"specific",
"list",
"into",
"the",
"given",
"array",
"using",
"optimized",
"system",
"calls",
"."
] | train | https://github.com/tommyettinger/RegExodus/blob/d4af9bb7c132c5f9d29f45b76121f93b2f89de16/src/main/java/regexodus/ds/CharArrayList.java#L469-L472 |
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor | SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/SortedCellTable.java | SortedCellTable.setComparator | public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
"""
Sets a comparator to use when sorting the given column
@param column
@param comparator
"""
columnSortHandler.setComparator(column, comparator);
} | java | public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
columnSortHandler.setComparator(column, comparator);
} | [
"public",
"void",
"setComparator",
"(",
"Column",
"<",
"T",
",",
"?",
">",
"column",
",",
"Comparator",
"<",
"T",
">",
"comparator",
")",
"{",
"columnSortHandler",
".",
"setComparator",
"(",
"column",
",",
"comparator",
")",
";",
"}"
] | Sets a comparator to use when sorting the given column
@param column
@param comparator | [
"Sets",
"a",
"comparator",
"to",
"use",
"when",
"sorting",
"the",
"given",
"column"
] | train | https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/SortedCellTable.java#L174-L176 |
thelinmichael/spotify-web-api-java | src/main/java/com/wrapper/spotify/SpotifyApi.java | SpotifyApi.reorderPlaylistsTracks | @Deprecated
public ReorderPlaylistsTracksRequest.Builder reorderPlaylistsTracks(String user_id, String playlist_id, int range_start, int insert_before) {
"""
Reorder a track or a group of tracks in a playlist. <br><br>
<p>
When reordering tracks, the timestamp indicating when they were added and the user who added them will be kept
untouched. In addition, the users following the playlists won’t be notified about changes in the playlists when the
tracks are reordered.
@deprecated Playlist IDs are unique for themselves. This parameter is thus no longer used.
(https://developer.spotify.com/community/news/2018/06/12/changes-to-playlist-uris/)
@param user_id The users Spotify user ID.
@param playlist_id The Spotify ID for the playlist.
@param range_start The position of the first track to be reordered.
@param insert_before The position where the tracks should be inserted. To reorder the tracks to the end of the
playlist, simply set insert_before to the position after the last track.
@return A {@link ReorderPlaylistsTracksRequest.Builder}.
@see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs & IDs</a>
"""
return new ReorderPlaylistsTracksRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.user_id(user_id)
.playlist_id(playlist_id)
.range_start(range_start)
.insert_before(insert_before);
} | java | @Deprecated
public ReorderPlaylistsTracksRequest.Builder reorderPlaylistsTracks(String user_id, String playlist_id, int range_start, int insert_before) {
return new ReorderPlaylistsTracksRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.user_id(user_id)
.playlist_id(playlist_id)
.range_start(range_start)
.insert_before(insert_before);
} | [
"@",
"Deprecated",
"public",
"ReorderPlaylistsTracksRequest",
".",
"Builder",
"reorderPlaylistsTracks",
"(",
"String",
"user_id",
",",
"String",
"playlist_id",
",",
"int",
"range_start",
",",
"int",
"insert_before",
")",
"{",
"return",
"new",
"ReorderPlaylistsTracksRequ... | Reorder a track or a group of tracks in a playlist. <br><br>
<p>
When reordering tracks, the timestamp indicating when they were added and the user who added them will be kept
untouched. In addition, the users following the playlists won’t be notified about changes in the playlists when the
tracks are reordered.
@deprecated Playlist IDs are unique for themselves. This parameter is thus no longer used.
(https://developer.spotify.com/community/news/2018/06/12/changes-to-playlist-uris/)
@param user_id The users Spotify user ID.
@param playlist_id The Spotify ID for the playlist.
@param range_start The position of the first track to be reordered.
@param insert_before The position where the tracks should be inserted. To reorder the tracks to the end of the
playlist, simply set insert_before to the position after the last track.
@return A {@link ReorderPlaylistsTracksRequest.Builder}.
@see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs & IDs</a> | [
"Reorder",
"a",
"track",
"or",
"a",
"group",
"of",
"tracks",
"in",
"a",
"playlist",
".",
"<br",
">",
"<br",
">",
"<p",
">",
"When",
"reordering",
"tracks",
"the",
"timestamp",
"indicating",
"when",
"they",
"were",
"added",
"and",
"the",
"user",
"who",
... | train | https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L1335-L1343 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java | CompressorHttp2ConnectionEncoder.newContentCompressor | protected EmbeddedChannel newContentCompressor(ChannelHandlerContext ctx, CharSequence contentEncoding)
throws Http2Exception {
"""
Returns a new {@link EmbeddedChannel} that encodes the HTTP2 message content encoded in the specified
{@code contentEncoding}.
@param ctx the context.
@param contentEncoding the value of the {@code content-encoding} header
@return a new {@link ByteToMessageDecoder} if the specified encoding is supported. {@code null} otherwise
(alternatively, you can throw a {@link Http2Exception} to block unknown encoding).
@throws Http2Exception If the specified encoding is not not supported and warrants an exception
"""
if (GZIP.contentEqualsIgnoreCase(contentEncoding) || X_GZIP.contentEqualsIgnoreCase(contentEncoding)) {
return newCompressionChannel(ctx, ZlibWrapper.GZIP);
}
if (DEFLATE.contentEqualsIgnoreCase(contentEncoding) || X_DEFLATE.contentEqualsIgnoreCase(contentEncoding)) {
return newCompressionChannel(ctx, ZlibWrapper.ZLIB);
}
// 'identity' or unsupported
return null;
} | java | protected EmbeddedChannel newContentCompressor(ChannelHandlerContext ctx, CharSequence contentEncoding)
throws Http2Exception {
if (GZIP.contentEqualsIgnoreCase(contentEncoding) || X_GZIP.contentEqualsIgnoreCase(contentEncoding)) {
return newCompressionChannel(ctx, ZlibWrapper.GZIP);
}
if (DEFLATE.contentEqualsIgnoreCase(contentEncoding) || X_DEFLATE.contentEqualsIgnoreCase(contentEncoding)) {
return newCompressionChannel(ctx, ZlibWrapper.ZLIB);
}
// 'identity' or unsupported
return null;
} | [
"protected",
"EmbeddedChannel",
"newContentCompressor",
"(",
"ChannelHandlerContext",
"ctx",
",",
"CharSequence",
"contentEncoding",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"GZIP",
".",
"contentEqualsIgnoreCase",
"(",
"contentEncoding",
")",
"||",
"X_GZIP",
"."... | Returns a new {@link EmbeddedChannel} that encodes the HTTP2 message content encoded in the specified
{@code contentEncoding}.
@param ctx the context.
@param contentEncoding the value of the {@code content-encoding} header
@return a new {@link ByteToMessageDecoder} if the specified encoding is supported. {@code null} otherwise
(alternatively, you can throw a {@link Http2Exception} to block unknown encoding).
@throws Http2Exception If the specified encoding is not not supported and warrants an exception | [
"Returns",
"a",
"new",
"{",
"@link",
"EmbeddedChannel",
"}",
"that",
"encodes",
"the",
"HTTP2",
"message",
"content",
"encoded",
"in",
"the",
"specified",
"{",
"@code",
"contentEncoding",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java#L193-L203 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.createOrUpdateSecuritySettingsAsync | public Observable<Void> createOrUpdateSecuritySettingsAsync(String deviceName, String resourceGroupName, AsymmetricEncryptedSecret deviceAdminPassword) {
"""
Updates the security settings on a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param deviceAdminPassword Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return createOrUpdateSecuritySettingsWithServiceResponseAsync(deviceName, resourceGroupName, deviceAdminPassword).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> createOrUpdateSecuritySettingsAsync(String deviceName, String resourceGroupName, AsymmetricEncryptedSecret deviceAdminPassword) {
return createOrUpdateSecuritySettingsWithServiceResponseAsync(deviceName, resourceGroupName, deviceAdminPassword).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"createOrUpdateSecuritySettingsAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"AsymmetricEncryptedSecret",
"deviceAdminPassword",
")",
"{",
"return",
"createOrUpdateSecuritySettingsWithServiceResponseAsync",... | Updates the security settings on a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param deviceAdminPassword Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"the",
"security",
"settings",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1864-L1871 |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/BaseBarChart.java | BaseBarChart.calculateBarPositions | protected void calculateBarPositions(int _DataSize) {
"""
Calculates the bar width and bar margin based on the _DataSize and settings and starts the boundary
calculation in child classes.
@param _DataSize Amount of data sets
"""
int dataSize = mScrollEnabled ? mVisibleBars : _DataSize;
float barWidth = mBarWidth;
float margin = mBarMargin;
if (!mFixedBarWidth) {
// calculate the bar width if the bars should be dynamically displayed
barWidth = (mAvailableScreenSize / _DataSize) - margin;
} else {
if(_DataSize < mVisibleBars) {
dataSize = _DataSize;
}
// calculate margin between bars if the bars have a fixed width
float cumulatedBarWidths = barWidth * dataSize;
float remainingScreenSize = mAvailableScreenSize - cumulatedBarWidths;
margin = remainingScreenSize / dataSize;
}
boolean isVertical = this instanceof VerticalBarChart;
int calculatedSize = (int) ((barWidth * _DataSize) + (margin * _DataSize));
int contentWidth = isVertical ? mGraphWidth : calculatedSize;
int contentHeight = isVertical ? calculatedSize : mGraphHeight;
mContentRect = new Rect(0, 0, contentWidth, contentHeight);
mCurrentViewport = new RectF(0, 0, mGraphWidth, mGraphHeight);
calculateBounds(barWidth, margin);
mLegend.invalidate();
mGraph.invalidate();
} | java | protected void calculateBarPositions(int _DataSize) {
int dataSize = mScrollEnabled ? mVisibleBars : _DataSize;
float barWidth = mBarWidth;
float margin = mBarMargin;
if (!mFixedBarWidth) {
// calculate the bar width if the bars should be dynamically displayed
barWidth = (mAvailableScreenSize / _DataSize) - margin;
} else {
if(_DataSize < mVisibleBars) {
dataSize = _DataSize;
}
// calculate margin between bars if the bars have a fixed width
float cumulatedBarWidths = barWidth * dataSize;
float remainingScreenSize = mAvailableScreenSize - cumulatedBarWidths;
margin = remainingScreenSize / dataSize;
}
boolean isVertical = this instanceof VerticalBarChart;
int calculatedSize = (int) ((barWidth * _DataSize) + (margin * _DataSize));
int contentWidth = isVertical ? mGraphWidth : calculatedSize;
int contentHeight = isVertical ? calculatedSize : mGraphHeight;
mContentRect = new Rect(0, 0, contentWidth, contentHeight);
mCurrentViewport = new RectF(0, 0, mGraphWidth, mGraphHeight);
calculateBounds(barWidth, margin);
mLegend.invalidate();
mGraph.invalidate();
} | [
"protected",
"void",
"calculateBarPositions",
"(",
"int",
"_DataSize",
")",
"{",
"int",
"dataSize",
"=",
"mScrollEnabled",
"?",
"mVisibleBars",
":",
"_DataSize",
";",
"float",
"barWidth",
"=",
"mBarWidth",
";",
"float",
"margin",
"=",
"mBarMargin",
";",
"if",
... | Calculates the bar width and bar margin based on the _DataSize and settings and starts the boundary
calculation in child classes.
@param _DataSize Amount of data sets | [
"Calculates",
"the",
"bar",
"width",
"and",
"bar",
"margin",
"based",
"on",
"the",
"_DataSize",
"and",
"settings",
"and",
"starts",
"the",
"boundary",
"calculation",
"in",
"child",
"classes",
"."
] | train | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/BaseBarChart.java#L322-L356 |
cache2k/cache2k | cache2k-api/src/main/java/org/cache2k/Cache2kBuilder.java | Cache2kBuilder.buildForLongKey | @SuppressWarnings("unchecked")
public final LongCache<V> buildForLongKey() {
"""
Builds a cache with the specified configuration parameters.
The behavior is identical to {@link #build()} except that it checks that
the key type is {@code Integer} and casts the created cache to the specialized
interface.
@throws IllegalArgumentException if a cache of the same name is already active in the cache manager
@throws IllegalArgumentException if key type is unexpected
@throws IllegalArgumentException if a configuration entry for the named cache is required but not present
"""
Cache2kConfiguration<K,V> cfg = config();
if (cfg.getKeyType().getType() != Long.class) {
throw new IllegalArgumentException("Long key type expected, was: " + cfg.getKeyType());
}
return (LongCache<V>) CacheManager.PROVIDER.createCache(manager, config());
} | java | @SuppressWarnings("unchecked")
public final LongCache<V> buildForLongKey() {
Cache2kConfiguration<K,V> cfg = config();
if (cfg.getKeyType().getType() != Long.class) {
throw new IllegalArgumentException("Long key type expected, was: " + cfg.getKeyType());
}
return (LongCache<V>) CacheManager.PROVIDER.createCache(manager, config());
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"LongCache",
"<",
"V",
">",
"buildForLongKey",
"(",
")",
"{",
"Cache2kConfiguration",
"<",
"K",
",",
"V",
">",
"cfg",
"=",
"config",
"(",
")",
";",
"if",
"(",
"cfg",
".",
"getKeyType"... | Builds a cache with the specified configuration parameters.
The behavior is identical to {@link #build()} except that it checks that
the key type is {@code Integer} and casts the created cache to the specialized
interface.
@throws IllegalArgumentException if a cache of the same name is already active in the cache manager
@throws IllegalArgumentException if key type is unexpected
@throws IllegalArgumentException if a configuration entry for the named cache is required but not present | [
"Builds",
"a",
"cache",
"with",
"the",
"specified",
"configuration",
"parameters",
".",
"The",
"behavior",
"is",
"identical",
"to",
"{",
"@link",
"#build",
"()",
"}",
"except",
"that",
"it",
"checks",
"that",
"the",
"key",
"type",
"is",
"{",
"@code",
"Inte... | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/Cache2kBuilder.java#L906-L913 |
Stratio/deep-spark | deep-cassandra/src/main/java/com/stratio/deep/cassandra/config/CassandraDeepJobConfig.java | CassandraDeepJobConfig.createOutputTableIfNeeded | public void createOutputTableIfNeeded(Tuple2<Cells, Cells> first) {
"""
Creates the output column family if not exists. <br/>
We first check if the column family exists. <br/>
If not, we get the first element from <i>tupleRDD</i> and we use it as a template to get columns metadata.
<p>
This is a very heavy operation since to obtain the schema we need to get at least one element of the output RDD.
</p>
@param first the pair RDD.
"""
TableMetadata metadata = getSession()
.getCluster()
.getMetadata()
.getKeyspace(this.catalog)
.getTable(quote(this.table));
if (metadata == null && !createTableOnWrite) {
throw new DeepIOException("Cannot write RDD, output table does not exists and configuration object has " +
"'createTableOnWrite' = false");
}
if (metadata != null) {
return;
}
if (first._1() == null || first._1().isEmpty()) {
throw new DeepNoSuchFieldException("no key structure found on row metadata");
}
String createTableQuery = createTableQueryGenerator(first._1(), first._2(), this.catalog,
quote(this.table));
getSession().execute(createTableQuery);
waitForNewTableMetadata();
} | java | public void createOutputTableIfNeeded(Tuple2<Cells, Cells> first) {
TableMetadata metadata = getSession()
.getCluster()
.getMetadata()
.getKeyspace(this.catalog)
.getTable(quote(this.table));
if (metadata == null && !createTableOnWrite) {
throw new DeepIOException("Cannot write RDD, output table does not exists and configuration object has " +
"'createTableOnWrite' = false");
}
if (metadata != null) {
return;
}
if (first._1() == null || first._1().isEmpty()) {
throw new DeepNoSuchFieldException("no key structure found on row metadata");
}
String createTableQuery = createTableQueryGenerator(first._1(), first._2(), this.catalog,
quote(this.table));
getSession().execute(createTableQuery);
waitForNewTableMetadata();
} | [
"public",
"void",
"createOutputTableIfNeeded",
"(",
"Tuple2",
"<",
"Cells",
",",
"Cells",
">",
"first",
")",
"{",
"TableMetadata",
"metadata",
"=",
"getSession",
"(",
")",
".",
"getCluster",
"(",
")",
".",
"getMetadata",
"(",
")",
".",
"getKeyspace",
"(",
... | Creates the output column family if not exists. <br/>
We first check if the column family exists. <br/>
If not, we get the first element from <i>tupleRDD</i> and we use it as a template to get columns metadata.
<p>
This is a very heavy operation since to obtain the schema we need to get at least one element of the output RDD.
</p>
@param first the pair RDD. | [
"Creates",
"the",
"output",
"column",
"family",
"if",
"not",
"exists",
".",
"<br",
"/",
">",
"We",
"first",
"check",
"if",
"the",
"column",
"family",
"exists",
".",
"<br",
"/",
">",
"If",
"not",
"we",
"get",
"the",
"first",
"element",
"from",
"<i",
"... | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/config/CassandraDeepJobConfig.java#L232-L256 |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java | RecoverableUnitIdTable.reserveId | public final synchronized boolean reserveId(long id, Object obj) {
"""
Reserve the given id and associate it with
the given object. This method should be used
during recovery when there is a requirement to
create a new object with a specific id rather than
the one that is next available.
@return true if the id was successfully reserved.
@param id The value of the id to be reserved
@param obj The object that requires the id
"""
if (tc.isEntryEnabled()) Tr.entry(tc, "reserveId", new Object[] {new Long(id), obj});
boolean reserved = false;
// The id can only be reserved if it
// isn't already in the map
if (_idMap.get(id) == null)
{
_idMap.put(id, obj);
reserved = true;
}
if (tc.isEntryEnabled()) Tr.exit(tc, "reserveId", new Boolean(reserved));
return reserved;
} | java | public final synchronized boolean reserveId(long id, Object obj)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "reserveId", new Object[] {new Long(id), obj});
boolean reserved = false;
// The id can only be reserved if it
// isn't already in the map
if (_idMap.get(id) == null)
{
_idMap.put(id, obj);
reserved = true;
}
if (tc.isEntryEnabled()) Tr.exit(tc, "reserveId", new Boolean(reserved));
return reserved;
} | [
"public",
"final",
"synchronized",
"boolean",
"reserveId",
"(",
"long",
"id",
",",
"Object",
"obj",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"reserveId\"",
",",
"new",
"Object",
"[",
"]",
... | Reserve the given id and associate it with
the given object. This method should be used
during recovery when there is a requirement to
create a new object with a specific id rather than
the one that is next available.
@return true if the id was successfully reserved.
@param id The value of the id to be reserved
@param obj The object that requires the id | [
"Reserve",
"the",
"given",
"id",
"and",
"associate",
"it",
"with",
"the",
"given",
"object",
".",
"This",
"method",
"should",
"be",
"used",
"during",
"recovery",
"when",
"there",
"is",
"a",
"requirement",
"to",
"create",
"a",
"new",
"object",
"with",
"a",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java#L83-L100 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.binarySearch | public static <T> int binarySearch(final T[] a, final int fromIndex, final int toIndex, final T key, final Comparator<? super T> cmp) {
"""
{@link Arrays#binarySearch(Object[], int, int, Object, Comparator)}
@param a
@param fromIndex
@param toIndex
@param key
@param c
@return
"""
return Array.binarySearch(a, fromIndex, toIndex, key, cmp);
} | java | public static <T> int binarySearch(final T[] a, final int fromIndex, final int toIndex, final T key, final Comparator<? super T> cmp) {
return Array.binarySearch(a, fromIndex, toIndex, key, cmp);
} | [
"public",
"static",
"<",
"T",
">",
"int",
"binarySearch",
"(",
"final",
"T",
"[",
"]",
"a",
",",
"final",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
",",
"final",
"T",
"key",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"cmp",
... | {@link Arrays#binarySearch(Object[], int, int, Object, Comparator)}
@param a
@param fromIndex
@param toIndex
@param key
@param c
@return | [
"{",
"@link",
"Arrays#binarySearch",
"(",
"Object",
"[]",
"int",
"int",
"Object",
"Comparator",
")",
"}"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12295-L12297 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java | Citrus.beforeSuite | public void beforeSuite(String suiteName, String ... testGroups) {
"""
Performs before suite test actions.
@param suiteName
@param testGroups
"""
testSuiteListener.onStart();
if (!CollectionUtils.isEmpty(beforeSuite)) {
for (SequenceBeforeSuite sequenceBeforeSuite : beforeSuite) {
try {
if (sequenceBeforeSuite.shouldExecute(suiteName, testGroups)) {
sequenceBeforeSuite.execute(createTestContext());
}
} catch (Exception e) {
testSuiteListener.onStartFailure(e);
afterSuite(suiteName, testGroups);
throw new AssertionError("Before suite failed with errors", e);
}
}
testSuiteListener.onStartSuccess();
} else {
testSuiteListener.onStartSuccess();
}
} | java | public void beforeSuite(String suiteName, String ... testGroups) {
testSuiteListener.onStart();
if (!CollectionUtils.isEmpty(beforeSuite)) {
for (SequenceBeforeSuite sequenceBeforeSuite : beforeSuite) {
try {
if (sequenceBeforeSuite.shouldExecute(suiteName, testGroups)) {
sequenceBeforeSuite.execute(createTestContext());
}
} catch (Exception e) {
testSuiteListener.onStartFailure(e);
afterSuite(suiteName, testGroups);
throw new AssertionError("Before suite failed with errors", e);
}
}
testSuiteListener.onStartSuccess();
} else {
testSuiteListener.onStartSuccess();
}
} | [
"public",
"void",
"beforeSuite",
"(",
"String",
"suiteName",
",",
"String",
"...",
"testGroups",
")",
"{",
"testSuiteListener",
".",
"onStart",
"(",
")",
";",
"if",
"(",
"!",
"CollectionUtils",
".",
"isEmpty",
"(",
"beforeSuite",
")",
")",
"{",
"for",
"(",... | Performs before suite test actions.
@param suiteName
@param testGroups | [
"Performs",
"before",
"suite",
"test",
"actions",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java#L325-L346 |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java | DBIDUtil.randomSample | public static ModifiableDBIDs randomSample(DBIDs source, int k, Random random) {
"""
Produce a random sample of the given DBIDs.
@param source Original DBIDs, no duplicates allowed
@param k k Parameter
@param random Random generator
@return new DBIDs
"""
if(k < 0 || k > source.size()) {
throw new IllegalArgumentException("Illegal value for size of random sample: " + k + " > " + source.size() + " or < 0");
}
// Fast, and we're single-threaded here anyway.
random = (random != null) ? random : new FastNonThreadsafeRandom();
// TODO: better balancing for different sizes
// Two methods: constructive vs. destructive
if(k < source.size() >> 2) {
ArrayDBIDs aids = DBIDUtil.ensureArray(source);
DBIDArrayIter iter = aids.iter();
final int size = aids.size();
HashSetModifiableDBIDs sample = DBIDUtil.newHashSet(k);
while(sample.size() < k) {
sample.add(iter.seek(random.nextInt(size)));
}
return sample;
}
else {
ArrayModifiableDBIDs sample = DBIDUtil.newArray(source);
randomShuffle(sample, random, k);
// Delete trailing elements
for(int i = sample.size() - 1; i >= k; i--) {
sample.remove(i);
}
return sample;
}
} | java | public static ModifiableDBIDs randomSample(DBIDs source, int k, Random random) {
if(k < 0 || k > source.size()) {
throw new IllegalArgumentException("Illegal value for size of random sample: " + k + " > " + source.size() + " or < 0");
}
// Fast, and we're single-threaded here anyway.
random = (random != null) ? random : new FastNonThreadsafeRandom();
// TODO: better balancing for different sizes
// Two methods: constructive vs. destructive
if(k < source.size() >> 2) {
ArrayDBIDs aids = DBIDUtil.ensureArray(source);
DBIDArrayIter iter = aids.iter();
final int size = aids.size();
HashSetModifiableDBIDs sample = DBIDUtil.newHashSet(k);
while(sample.size() < k) {
sample.add(iter.seek(random.nextInt(size)));
}
return sample;
}
else {
ArrayModifiableDBIDs sample = DBIDUtil.newArray(source);
randomShuffle(sample, random, k);
// Delete trailing elements
for(int i = sample.size() - 1; i >= k; i--) {
sample.remove(i);
}
return sample;
}
} | [
"public",
"static",
"ModifiableDBIDs",
"randomSample",
"(",
"DBIDs",
"source",
",",
"int",
"k",
",",
"Random",
"random",
")",
"{",
"if",
"(",
"k",
"<",
"0",
"||",
"k",
">",
"source",
".",
"size",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExce... | Produce a random sample of the given DBIDs.
@param source Original DBIDs, no duplicates allowed
@param k k Parameter
@param random Random generator
@return new DBIDs | [
"Produce",
"a",
"random",
"sample",
"of",
"the",
"given",
"DBIDs",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L598-L626 |
jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor.java | GitHubHookRegisterProblemMonitor.registerProblem | public void registerProblem(GitHubRepositoryName repo, Throwable throwable) {
"""
Registers problems. For message {@link Throwable#getMessage()} will be used
@param repo full named GitHub repo, if null nothing will be done
@param throwable exception with message about problem, if null nothing will be done
@see #registerProblem(GitHubRepositoryName, String)
"""
if (throwable == null) {
return;
}
registerProblem(repo, throwable.getMessage());
} | java | public void registerProblem(GitHubRepositoryName repo, Throwable throwable) {
if (throwable == null) {
return;
}
registerProblem(repo, throwable.getMessage());
} | [
"public",
"void",
"registerProblem",
"(",
"GitHubRepositoryName",
"repo",
",",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"throwable",
"==",
"null",
")",
"{",
"return",
";",
"}",
"registerProblem",
"(",
"repo",
",",
"throwable",
".",
"getMessage",
"(",
"... | Registers problems. For message {@link Throwable#getMessage()} will be used
@param repo full named GitHub repo, if null nothing will be done
@param throwable exception with message about problem, if null nothing will be done
@see #registerProblem(GitHubRepositoryName, String) | [
"Registers",
"problems",
".",
"For",
"message",
"{",
"@link",
"Throwable#getMessage",
"()",
"}",
"will",
"be",
"used"
] | train | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor.java#L81-L86 |
wnameless/rubycollect4j | src/main/java/net/sf/rubycollect4j/RubyIO.java | RubyIO.open | public static RubyIO open(String path, String mode) {
"""
Creates a {@link RubyIO} by given path and mode.
@param path
of a File
@param mode
r, rw, w, w+, a, a+
@see Mode
@return {@link RubyIO}
"""
RubyIO io = null;
try {
io = new RubyIO(new File(path), Mode.fromString(mode));
} catch (IOException e) {
logger.log(Level.SEVERE, null, e);
throw new RuntimeException(e);
}
return io;
} | java | public static RubyIO open(String path, String mode) {
RubyIO io = null;
try {
io = new RubyIO(new File(path), Mode.fromString(mode));
} catch (IOException e) {
logger.log(Level.SEVERE, null, e);
throw new RuntimeException(e);
}
return io;
} | [
"public",
"static",
"RubyIO",
"open",
"(",
"String",
"path",
",",
"String",
"mode",
")",
"{",
"RubyIO",
"io",
"=",
"null",
";",
"try",
"{",
"io",
"=",
"new",
"RubyIO",
"(",
"new",
"File",
"(",
"path",
")",
",",
"Mode",
".",
"fromString",
"(",
"mode... | Creates a {@link RubyIO} by given path and mode.
@param path
of a File
@param mode
r, rw, w, w+, a, a+
@see Mode
@return {@link RubyIO} | [
"Creates",
"a",
"{",
"@link",
"RubyIO",
"}",
"by",
"given",
"path",
"and",
"mode",
"."
] | train | https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyIO.java#L162-L171 |
banq/jdonframework | JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java | ModelHandler.initModelIF | public Object initModelIF(EventModel em, ModelForm form, HttpServletRequest request) throws Exception {
"""
Presentation layer need a ModelForm instance that include some initially
data, these data must obtain from service. this method implements these
functions by deleagating service.
this mehtod is only availabe in pushing create view page in pushing
editable view page, the model is obtained by it's key, not from this
method;
@param request
@return Model instance
@throws Exception
@see CreateViewPageUtil
"""
return initModel(request);
} | java | public Object initModelIF(EventModel em, ModelForm form, HttpServletRequest request) throws Exception {
return initModel(request);
} | [
"public",
"Object",
"initModelIF",
"(",
"EventModel",
"em",
",",
"ModelForm",
"form",
",",
"HttpServletRequest",
"request",
")",
"throws",
"Exception",
"{",
"return",
"initModel",
"(",
"request",
")",
";",
"}"
] | Presentation layer need a ModelForm instance that include some initially
data, these data must obtain from service. this method implements these
functions by deleagating service.
this mehtod is only availabe in pushing create view page in pushing
editable view page, the model is obtained by it's key, not from this
method;
@param request
@return Model instance
@throws Exception
@see CreateViewPageUtil | [
"Presentation",
"layer",
"need",
"a",
"ModelForm",
"instance",
"that",
"include",
"some",
"initially",
"data",
"these",
"data",
"must",
"obtain",
"from",
"service",
".",
"this",
"method",
"implements",
"these",
"functions",
"by",
"deleagating",
"service",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java#L102-L104 |
ggrandes/packer | src/main/java/org/javastack/packer/Packer.java | Packer.useRSA | public Packer useRSA(final Key rsaKeyForEncrypt, final Key rsaKeyForDecrypt)
throws NoSuchAlgorithmException, NoSuchPaddingException {
"""
Sets he usage of "RSA/ECB/PKCS1Padding" for encryption (default no)
@param rsaKeyForEncrypt
@param rsaKeyForDecrypt
@return
@throws NoSuchPaddingException
@throws NoSuchAlgorithmException
"""
this.rsaCipher = Cipher.getInstance(ASYM_CIPHER_CHAIN_PADDING);
this.rsaKeyForEncrypt = rsaKeyForEncrypt;
this.rsaKeyForDecrypt = rsaKeyForDecrypt;
return this;
} | java | public Packer useRSA(final Key rsaKeyForEncrypt, final Key rsaKeyForDecrypt)
throws NoSuchAlgorithmException, NoSuchPaddingException {
this.rsaCipher = Cipher.getInstance(ASYM_CIPHER_CHAIN_PADDING);
this.rsaKeyForEncrypt = rsaKeyForEncrypt;
this.rsaKeyForDecrypt = rsaKeyForDecrypt;
return this;
} | [
"public",
"Packer",
"useRSA",
"(",
"final",
"Key",
"rsaKeyForEncrypt",
",",
"final",
"Key",
"rsaKeyForDecrypt",
")",
"throws",
"NoSuchAlgorithmException",
",",
"NoSuchPaddingException",
"{",
"this",
".",
"rsaCipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"ASYM_CIP... | Sets he usage of "RSA/ECB/PKCS1Padding" for encryption (default no)
@param rsaKeyForEncrypt
@param rsaKeyForDecrypt
@return
@throws NoSuchPaddingException
@throws NoSuchAlgorithmException | [
"Sets",
"he",
"usage",
"of",
"RSA",
"/",
"ECB",
"/",
"PKCS1Padding",
"for",
"encryption",
"(",
"default",
"no",
")"
] | train | https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L476-L482 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java | URIUtils.newURIBuilder | public static StringBuilder newURIBuilder(String scheme, String server, int port) {
"""
Create a new URI StringBuilder from the arguments, handling IPv6 host encoding and default ports
@param scheme the URI scheme
@param server the URI server
@param port the URI port
@return a StringBuilder containing URI prefix
"""
StringBuilder builder = new StringBuilder();
appendSchemeHostPort(builder, scheme, server, port);
return builder;
} | java | public static StringBuilder newURIBuilder(String scheme, String server, int port) {
StringBuilder builder = new StringBuilder();
appendSchemeHostPort(builder, scheme, server, port);
return builder;
} | [
"public",
"static",
"StringBuilder",
"newURIBuilder",
"(",
"String",
"scheme",
",",
"String",
"server",
",",
"int",
"port",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"appendSchemeHostPort",
"(",
"builder",
",",
"scheme",
... | Create a new URI StringBuilder from the arguments, handling IPv6 host encoding and default ports
@param scheme the URI scheme
@param server the URI server
@param port the URI port
@return a StringBuilder containing URI prefix | [
"Create",
"a",
"new",
"URI",
"StringBuilder",
"from",
"the",
"arguments",
"handling",
"IPv6",
"host",
"encoding",
"and",
"default",
"ports"
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java#L856-L860 |
jcustenborder/connect-utils | connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/validators/Validators.java | Validators.validTrustManagerFactory | public static Validator validTrustManagerFactory() {
"""
Validator is used to ensure that the TrustManagerFactory Algorithm specified is valid.
@return
"""
return (s, o) -> {
if (!(o instanceof String)) {
throw new ConfigException(s, o, "Must be a string.");
}
String keyStoreType = o.toString();
try {
TrustManagerFactory.getInstance(keyStoreType);
} catch (NoSuchAlgorithmException e) {
ConfigException exception = new ConfigException(s, o, "Invalid Algorithm");
exception.initCause(e);
throw exception;
}
};
} | java | public static Validator validTrustManagerFactory() {
return (s, o) -> {
if (!(o instanceof String)) {
throw new ConfigException(s, o, "Must be a string.");
}
String keyStoreType = o.toString();
try {
TrustManagerFactory.getInstance(keyStoreType);
} catch (NoSuchAlgorithmException e) {
ConfigException exception = new ConfigException(s, o, "Invalid Algorithm");
exception.initCause(e);
throw exception;
}
};
} | [
"public",
"static",
"Validator",
"validTrustManagerFactory",
"(",
")",
"{",
"return",
"(",
"s",
",",
"o",
")",
"->",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"String",
")",
")",
"{",
"throw",
"new",
"ConfigException",
"(",
"s",
",",
"o",
",",
"\"... | Validator is used to ensure that the TrustManagerFactory Algorithm specified is valid.
@return | [
"Validator",
"is",
"used",
"to",
"ensure",
"that",
"the",
"TrustManagerFactory",
"Algorithm",
"specified",
"is",
"valid",
"."
] | train | https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/validators/Validators.java#L232-L247 |
mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/utils/AdapterUtil.java | AdapterUtil.restoreSubItemSelectionStatesForAlternativeStateManagement | public static <Item extends IItem> void restoreSubItemSelectionStatesForAlternativeStateManagement(Item item, List<String> selectedItems) {
"""
internal method to restore the selection state of subItems
@param item the parent item
@param selectedItems the list of selectedItems from the savedInstanceState
"""
if (item instanceof IExpandable && !((IExpandable) item).isExpanded() && ((IExpandable) item).getSubItems() != null) {
List<Item> subItems = (List<Item>) ((IExpandable<Item, ?>) item).getSubItems();
for (int i = 0, size = subItems.size(); i < size; i++) {
Item subItem = subItems.get(i);
String id = String.valueOf(subItem.getIdentifier());
if (selectedItems != null && selectedItems.contains(id)) {
subItem.withSetSelected(true);
}
restoreSubItemSelectionStatesForAlternativeStateManagement(subItem, selectedItems);
}
}
} | java | public static <Item extends IItem> void restoreSubItemSelectionStatesForAlternativeStateManagement(Item item, List<String> selectedItems) {
if (item instanceof IExpandable && !((IExpandable) item).isExpanded() && ((IExpandable) item).getSubItems() != null) {
List<Item> subItems = (List<Item>) ((IExpandable<Item, ?>) item).getSubItems();
for (int i = 0, size = subItems.size(); i < size; i++) {
Item subItem = subItems.get(i);
String id = String.valueOf(subItem.getIdentifier());
if (selectedItems != null && selectedItems.contains(id)) {
subItem.withSetSelected(true);
}
restoreSubItemSelectionStatesForAlternativeStateManagement(subItem, selectedItems);
}
}
} | [
"public",
"static",
"<",
"Item",
"extends",
"IItem",
">",
"void",
"restoreSubItemSelectionStatesForAlternativeStateManagement",
"(",
"Item",
"item",
",",
"List",
"<",
"String",
">",
"selectedItems",
")",
"{",
"if",
"(",
"item",
"instanceof",
"IExpandable",
"&&",
"... | internal method to restore the selection state of subItems
@param item the parent item
@param selectedItems the list of selectedItems from the savedInstanceState | [
"internal",
"method",
"to",
"restore",
"the",
"selection",
"state",
"of",
"subItems"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/utils/AdapterUtil.java#L20-L32 |
samskivert/pythagoras | src/main/java/pythagoras/f/Crossing.java | Crossing.fixRoots | protected static int fixRoots (float[] res, int rc) {
"""
Excludes double roots. Roots are double if they lies enough close with each other.
@param res the roots
@param rc the roots count
@return new roots count
"""
int tc = 0;
for (int i = 0; i < rc; i++) {
out: {
for (int j = i + 1; j < rc; j++) {
if (isZero(res[i] - res[j])) {
break out;
}
}
res[tc++] = res[i];
}
}
return tc;
} | java | protected static int fixRoots (float[] res, int rc) {
int tc = 0;
for (int i = 0; i < rc; i++) {
out: {
for (int j = i + 1; j < rc; j++) {
if (isZero(res[i] - res[j])) {
break out;
}
}
res[tc++] = res[i];
}
}
return tc;
} | [
"protected",
"static",
"int",
"fixRoots",
"(",
"float",
"[",
"]",
"res",
",",
"int",
"rc",
")",
"{",
"int",
"tc",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rc",
";",
"i",
"++",
")",
"{",
"out",
":",
"{",
"for",
"(",
... | Excludes double roots. Roots are double if they lies enough close with each other.
@param res the roots
@param rc the roots count
@return new roots count | [
"Excludes",
"double",
"roots",
".",
"Roots",
"are",
"double",
"if",
"they",
"lies",
"enough",
"close",
"with",
"each",
"other",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Crossing.java#L111-L124 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/result/Result.java | Result.newUpdateResultRequest | public static Result newUpdateResultRequest(Type[] types, long id) {
"""
For UPDATE_RESULT
The parameters are set afterwards as the Result is reused
"""
Result result = newResult(ResultConstants.UPDATE_RESULT);
result.metaData = ResultMetaData.newUpdateResultMetaData(types);
result.id = id;
result.navigator.add(new Object[]{});
return result;
} | java | public static Result newUpdateResultRequest(Type[] types, long id) {
Result result = newResult(ResultConstants.UPDATE_RESULT);
result.metaData = ResultMetaData.newUpdateResultMetaData(types);
result.id = id;
result.navigator.add(new Object[]{});
return result;
} | [
"public",
"static",
"Result",
"newUpdateResultRequest",
"(",
"Type",
"[",
"]",
"types",
",",
"long",
"id",
")",
"{",
"Result",
"result",
"=",
"newResult",
"(",
"ResultConstants",
".",
"UPDATE_RESULT",
")",
";",
"result",
".",
"metaData",
"=",
"ResultMetaData",... | For UPDATE_RESULT
The parameters are set afterwards as the Result is reused | [
"For",
"UPDATE_RESULT",
"The",
"parameters",
"are",
"set",
"afterwards",
"as",
"the",
"Result",
"is",
"reused"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/result/Result.java#L650-L660 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java | NaaccrXmlDictionaryUtils.writeDictionaryToCsv | public static void writeDictionaryToCsv(NaaccrDictionary dictionary, File file) throws IOException {
"""
Write the given dictionary to the give target file using the CSV format.
<br/><br/>
Columns:
<ol>
<li>NAACCR ID</li>
<li>NAACCR number</li>
<li>Name</li>
<li>Start Column</li>
<li>Length</li>
<li>Record Types</li>
<li>Parent XML Element</li>
<li>Data Type</li>
</ol>
@param dictionary dictionary to write
@param file target CSV file
"""
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.US_ASCII))) {
writer.write("NAACCR XML ID,NAACCR Number,Name,Start Column,Length,Record Types,Parent XML Element,Data Type");
writer.newLine();
dictionary.getItems().stream()
.sorted(Comparator.comparing(NaaccrDictionaryItem::getNaaccrId))
.forEach(item -> {
try {
writer.write(item.getNaaccrId());
writer.write(",");
writer.write(item.getNaaccrNum() == null ? "" : item.getNaaccrNum().toString());
writer.write(",\"");
writer.write(item.getNaaccrName() == null ? "" : item.getNaaccrName());
writer.write("\",");
writer.write(item.getStartColumn() == null ? "" : item.getStartColumn().toString());
writer.write(",");
writer.write(item.getLength().toString());
writer.write(",\"");
writer.write(item.getRecordTypes() == null ? "" : item.getRecordTypes());
writer.write("\",");
writer.write(item.getParentXmlElement() == null ? "" : item.getParentXmlElement());
writer.write(",");
writer.write(item.getDataType() == null ? NaaccrXmlDictionaryUtils.NAACCR_DATA_TYPE_TEXT : item.getDataType());
writer.newLine();
}
catch (IOException | RuntimeException ex1) {
throw new RuntimeException(ex1); // doing that to make sure the loop is broken...
}
});
}
catch (RuntimeException ex2) {
throw new IOException(ex2);
}
} | java | public static void writeDictionaryToCsv(NaaccrDictionary dictionary, File file) throws IOException {
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.US_ASCII))) {
writer.write("NAACCR XML ID,NAACCR Number,Name,Start Column,Length,Record Types,Parent XML Element,Data Type");
writer.newLine();
dictionary.getItems().stream()
.sorted(Comparator.comparing(NaaccrDictionaryItem::getNaaccrId))
.forEach(item -> {
try {
writer.write(item.getNaaccrId());
writer.write(",");
writer.write(item.getNaaccrNum() == null ? "" : item.getNaaccrNum().toString());
writer.write(",\"");
writer.write(item.getNaaccrName() == null ? "" : item.getNaaccrName());
writer.write("\",");
writer.write(item.getStartColumn() == null ? "" : item.getStartColumn().toString());
writer.write(",");
writer.write(item.getLength().toString());
writer.write(",\"");
writer.write(item.getRecordTypes() == null ? "" : item.getRecordTypes());
writer.write("\",");
writer.write(item.getParentXmlElement() == null ? "" : item.getParentXmlElement());
writer.write(",");
writer.write(item.getDataType() == null ? NaaccrXmlDictionaryUtils.NAACCR_DATA_TYPE_TEXT : item.getDataType());
writer.newLine();
}
catch (IOException | RuntimeException ex1) {
throw new RuntimeException(ex1); // doing that to make sure the loop is broken...
}
});
}
catch (RuntimeException ex2) {
throw new IOException(ex2);
}
} | [
"public",
"static",
"void",
"writeDictionaryToCsv",
"(",
"NaaccrDictionary",
"dictionary",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"try",
"(",
"BufferedWriter",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"new",
"... | Write the given dictionary to the give target file using the CSV format.
<br/><br/>
Columns:
<ol>
<li>NAACCR ID</li>
<li>NAACCR number</li>
<li>Name</li>
<li>Start Column</li>
<li>Length</li>
<li>Record Types</li>
<li>Parent XML Element</li>
<li>Data Type</li>
</ol>
@param dictionary dictionary to write
@param file target CSV file | [
"Write",
"the",
"given",
"dictionary",
"to",
"the",
"give",
"target",
"file",
"using",
"the",
"CSV",
"format",
".",
"<br",
"/",
">",
"<br",
"/",
">",
"Columns",
":",
"<ol",
">",
"<li",
">",
"NAACCR",
"ID<",
"/",
"li",
">",
"<li",
">",
"NAACCR",
"nu... | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java#L732-L765 |
Berico-Technologies/CLAVIN | src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java | QueryBuilder.removeFeatureCodes | public QueryBuilder removeFeatureCodes(final FeatureCode code1, final FeatureCode... codes) {
"""
Remove the provided {@link FeatureCode} from the set of query constraints.
@param code1 the first {@link FeatureCode} to remove
@param codes the subsequent {@link FeatureCode}s to remove
@return this
"""
featureCodes.remove(code1);
featureCodes.removeAll(Arrays.asList(codes));
return this;
} | java | public QueryBuilder removeFeatureCodes(final FeatureCode code1, final FeatureCode... codes) {
featureCodes.remove(code1);
featureCodes.removeAll(Arrays.asList(codes));
return this;
} | [
"public",
"QueryBuilder",
"removeFeatureCodes",
"(",
"final",
"FeatureCode",
"code1",
",",
"final",
"FeatureCode",
"...",
"codes",
")",
"{",
"featureCodes",
".",
"remove",
"(",
"code1",
")",
";",
"featureCodes",
".",
"removeAll",
"(",
"Arrays",
".",
"asList",
... | Remove the provided {@link FeatureCode} from the set of query constraints.
@param code1 the first {@link FeatureCode} to remove
@param codes the subsequent {@link FeatureCode}s to remove
@return this | [
"Remove",
"the",
"provided",
"{"
] | train | https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java#L424-L428 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/platform/PersistentSettings.java | PersistentSettings.saveProperty | public PersistentSettings saveProperty(String key, @Nullable String value) {
"""
Same as {@link #saveProperty(DbSession, String, String)} but a new database session is
opened and committed.
"""
try (DbSession dbSession = dbClient.openSession(false)) {
savePropertyImpl(dbSession, key, value);
dbSession.commit();
changeNotifier.onGlobalPropertyChange(key, value);
return this;
}
} | java | public PersistentSettings saveProperty(String key, @Nullable String value) {
try (DbSession dbSession = dbClient.openSession(false)) {
savePropertyImpl(dbSession, key, value);
dbSession.commit();
changeNotifier.onGlobalPropertyChange(key, value);
return this;
}
} | [
"public",
"PersistentSettings",
"saveProperty",
"(",
"String",
"key",
",",
"@",
"Nullable",
"String",
"value",
")",
"{",
"try",
"(",
"DbSession",
"dbSession",
"=",
"dbClient",
".",
"openSession",
"(",
"false",
")",
")",
"{",
"savePropertyImpl",
"(",
"dbSession... | Same as {@link #saveProperty(DbSession, String, String)} but a new database session is
opened and committed. | [
"Same",
"as",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/platform/PersistentSettings.java#L61-L68 |
threerings/nenya | core/src/main/java/com/threerings/miso/util/MisoUtil.java | MisoUtil.fineToFull | public static int fineToFull (MisoSceneMetrics metrics, int fine) {
"""
Converts the given fine coordinate to a full coordinate (a tile
coordinate plus a fine coordinate remainder). The fine coordinate
is assumed to be relative to tile <code>(0, 0)</code>.
"""
return toFull(fine / metrics.finegran, fine % metrics.finegran);
} | java | public static int fineToFull (MisoSceneMetrics metrics, int fine)
{
return toFull(fine / metrics.finegran, fine % metrics.finegran);
} | [
"public",
"static",
"int",
"fineToFull",
"(",
"MisoSceneMetrics",
"metrics",
",",
"int",
"fine",
")",
"{",
"return",
"toFull",
"(",
"fine",
"/",
"metrics",
".",
"finegran",
",",
"fine",
"%",
"metrics",
".",
"finegran",
")",
";",
"}"
] | Converts the given fine coordinate to a full coordinate (a tile
coordinate plus a fine coordinate remainder). The fine coordinate
is assumed to be relative to tile <code>(0, 0)</code>. | [
"Converts",
"the",
"given",
"fine",
"coordinate",
"to",
"a",
"full",
"coordinate",
"(",
"a",
"tile",
"coordinate",
"plus",
"a",
"fine",
"coordinate",
"remainder",
")",
".",
"The",
"fine",
"coordinate",
"is",
"assumed",
"to",
"be",
"relative",
"to",
"tile",
... | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L379-L382 |
visenze/visearch-sdk-java | src/main/java/com/visenze/visearch/ViSearch.java | ViSearch.insertStatus | @Override
public InsertStatus insertStatus(String transId, Map<String, String> customParams) {
"""
(For testing) Get insert status by insert trans id.
@param transId the id of the insert trans.
@return the insert trans
"""
return dataOperations.insertStatus(transId, customParams);
} | java | @Override
public InsertStatus insertStatus(String transId, Map<String, String> customParams) {
return dataOperations.insertStatus(transId, customParams);
} | [
"@",
"Override",
"public",
"InsertStatus",
"insertStatus",
"(",
"String",
"transId",
",",
"Map",
"<",
"String",
",",
"String",
">",
"customParams",
")",
"{",
"return",
"dataOperations",
".",
"insertStatus",
"(",
"transId",
",",
"customParams",
")",
";",
"}"
] | (For testing) Get insert status by insert trans id.
@param transId the id of the insert trans.
@return the insert trans | [
"(",
"For",
"testing",
")",
"Get",
"insert",
"status",
"by",
"insert",
"trans",
"id",
"."
] | train | https://github.com/visenze/visearch-sdk-java/blob/133611b84a7489f08bf40b55912ccd2acc7f002c/src/main/java/com/visenze/visearch/ViSearch.java#L171-L174 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java | NetworkConfig.setPeerProperties | public void setPeerProperties(String name, Properties properties) throws InvalidArgumentException {
"""
Set a specific peer's properties.
@param name The name of the peer's property to set.
@param properties The properties to set.
@throws InvalidArgumentException
"""
setNodeProperties("Peer", name, peers, properties);
} | java | public void setPeerProperties(String name, Properties properties) throws InvalidArgumentException {
setNodeProperties("Peer", name, peers, properties);
} | [
"public",
"void",
"setPeerProperties",
"(",
"String",
"name",
",",
"Properties",
"properties",
")",
"throws",
"InvalidArgumentException",
"{",
"setNodeProperties",
"(",
"\"Peer\"",
",",
"name",
",",
"peers",
",",
"properties",
")",
";",
"}"
] | Set a specific peer's properties.
@param name The name of the peer's property to set.
@param properties The properties to set.
@throws InvalidArgumentException | [
"Set",
"a",
"specific",
"peer",
"s",
"properties",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java#L176-L178 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/rbac/GroupRoleManager.java | GroupRoleManager.hasLink | @Override
public boolean hasLink(String name1, String name2, String... domain) {
"""
hasLink determines whether role: name1 inherits role: name2.
domain is a prefix to the roles.
"""
if(super.hasLink(name1, name2, domain)) {
return true;
}
// check name1's groups
if (domain.length == 1) {
try {
List<String> groups = Optional.ofNullable(super.getRoles(name1)).orElse(new ArrayList<>());
for(String group : groups) {
if(hasLink(group, name2, domain)) {
return true;
}
}
} catch (Error e) {
return false;
}
}
return false;
} | java | @Override
public boolean hasLink(String name1, String name2, String... domain) {
if(super.hasLink(name1, name2, domain)) {
return true;
}
// check name1's groups
if (domain.length == 1) {
try {
List<String> groups = Optional.ofNullable(super.getRoles(name1)).orElse(new ArrayList<>());
for(String group : groups) {
if(hasLink(group, name2, domain)) {
return true;
}
}
} catch (Error e) {
return false;
}
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"hasLink",
"(",
"String",
"name1",
",",
"String",
"name2",
",",
"String",
"...",
"domain",
")",
"{",
"if",
"(",
"super",
".",
"hasLink",
"(",
"name1",
",",
"name2",
",",
"domain",
")",
")",
"{",
"return",
"true",
... | hasLink determines whether role: name1 inherits role: name2.
domain is a prefix to the roles. | [
"hasLink",
"determines",
"whether",
"role",
":",
"name1",
"inherits",
"role",
":",
"name2",
".",
"domain",
"is",
"a",
"prefix",
"to",
"the",
"roles",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/rbac/GroupRoleManager.java#L49-L68 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AnderbergHierarchicalClustering.java | AnderbergHierarchicalClustering.initializeNNCache | private static void initializeNNCache(double[] scratch, double[] bestd, int[] besti) {
"""
Initialize the NN cache.
@param scratch Scratch space
@param bestd Best distance
@param besti Best index
"""
final int size = bestd.length;
Arrays.fill(bestd, Double.POSITIVE_INFINITY);
Arrays.fill(besti, -1);
for(int x = 0, p = 0; x < size; x++) {
assert (p == MatrixParadigm.triangleSize(x));
double bestdx = Double.POSITIVE_INFINITY;
int bestix = -1;
for(int y = 0; y < x; y++, p++) {
final double v = scratch[p];
if(v < bestd[y]) {
bestd[y] = v;
besti[y] = x;
}
if(v < bestdx) {
bestdx = v;
bestix = y;
}
}
bestd[x] = bestdx;
besti[x] = bestix;
}
} | java | private static void initializeNNCache(double[] scratch, double[] bestd, int[] besti) {
final int size = bestd.length;
Arrays.fill(bestd, Double.POSITIVE_INFINITY);
Arrays.fill(besti, -1);
for(int x = 0, p = 0; x < size; x++) {
assert (p == MatrixParadigm.triangleSize(x));
double bestdx = Double.POSITIVE_INFINITY;
int bestix = -1;
for(int y = 0; y < x; y++, p++) {
final double v = scratch[p];
if(v < bestd[y]) {
bestd[y] = v;
besti[y] = x;
}
if(v < bestdx) {
bestdx = v;
bestix = y;
}
}
bestd[x] = bestdx;
besti[x] = bestix;
}
} | [
"private",
"static",
"void",
"initializeNNCache",
"(",
"double",
"[",
"]",
"scratch",
",",
"double",
"[",
"]",
"bestd",
",",
"int",
"[",
"]",
"besti",
")",
"{",
"final",
"int",
"size",
"=",
"bestd",
".",
"length",
";",
"Arrays",
".",
"fill",
"(",
"be... | Initialize the NN cache.
@param scratch Scratch space
@param bestd Best distance
@param besti Best index | [
"Initialize",
"the",
"NN",
"cache",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AnderbergHierarchicalClustering.java#L149-L171 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java | BigtableDataClient.readRowsCallable | public <RowT> ServerStreamingCallable<Query, RowT> readRowsCallable(RowAdapter<RowT> rowAdapter) {
"""
Streams back the results of the query. This callable allows for customization of the logical
representation of a row. It's meant for advanced use cases.
<p>Sample code:
<pre>{@code
try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
String tableId = "[TABLE]";
Query query = Query.create(tableId)
.range("[START KEY]", "[END KEY]")
.filter(FILTERS.qualifier().regex("[COLUMN PREFIX].*"));
// Iterator style
try {
for(CustomRow row : bigtableDataClient.readRowsCallable(new CustomRowAdapter()).call(query)) {
// Do something with row
}
} catch (NotFoundException e) {
System.out.println("Tried to read a non-existent table");
} catch (RuntimeException e) {
e.printStackTrace();
}
}
}</pre>
@see ServerStreamingCallable For call styles.
@see Query For query options.
@see com.google.cloud.bigtable.data.v2.models.Filters For the filter building DSL.
"""
return stub.createReadRowsCallable(rowAdapter);
} | java | public <RowT> ServerStreamingCallable<Query, RowT> readRowsCallable(RowAdapter<RowT> rowAdapter) {
return stub.createReadRowsCallable(rowAdapter);
} | [
"public",
"<",
"RowT",
">",
"ServerStreamingCallable",
"<",
"Query",
",",
"RowT",
">",
"readRowsCallable",
"(",
"RowAdapter",
"<",
"RowT",
">",
"rowAdapter",
")",
"{",
"return",
"stub",
".",
"createReadRowsCallable",
"(",
"rowAdapter",
")",
";",
"}"
] | Streams back the results of the query. This callable allows for customization of the logical
representation of a row. It's meant for advanced use cases.
<p>Sample code:
<pre>{@code
try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
String tableId = "[TABLE]";
Query query = Query.create(tableId)
.range("[START KEY]", "[END KEY]")
.filter(FILTERS.qualifier().regex("[COLUMN PREFIX].*"));
// Iterator style
try {
for(CustomRow row : bigtableDataClient.readRowsCallable(new CustomRowAdapter()).call(query)) {
// Do something with row
}
} catch (NotFoundException e) {
System.out.println("Tried to read a non-existent table");
} catch (RuntimeException e) {
e.printStackTrace();
}
}
}</pre>
@see ServerStreamingCallable For call styles.
@see Query For query options.
@see com.google.cloud.bigtable.data.v2.models.Filters For the filter building DSL. | [
"Streams",
"back",
"the",
"results",
"of",
"the",
"query",
".",
"This",
"callable",
"allows",
"for",
"customization",
"of",
"the",
"logical",
"representation",
"of",
"a",
"row",
".",
"It",
"s",
"meant",
"for",
"advanced",
"use",
"cases",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L666-L668 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/TagsInner.java | TagsInner.createOrUpdateValueAsync | public Observable<TagValueInner> createOrUpdateValueAsync(String tagName, String tagValue) {
"""
Creates a tag value. The name of the tag must already exist.
@param tagName The name of the tag.
@param tagValue The value of the tag to create.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TagValueInner object
"""
return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).map(new Func1<ServiceResponse<TagValueInner>, TagValueInner>() {
@Override
public TagValueInner call(ServiceResponse<TagValueInner> response) {
return response.body();
}
});
} | java | public Observable<TagValueInner> createOrUpdateValueAsync(String tagName, String tagValue) {
return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).map(new Func1<ServiceResponse<TagValueInner>, TagValueInner>() {
@Override
public TagValueInner call(ServiceResponse<TagValueInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TagValueInner",
">",
"createOrUpdateValueAsync",
"(",
"String",
"tagName",
",",
"String",
"tagValue",
")",
"{",
"return",
"createOrUpdateValueWithServiceResponseAsync",
"(",
"tagName",
",",
"tagValue",
")",
".",
"map",
"(",
"new",
"Func... | Creates a tag value. The name of the tag must already exist.
@param tagName The name of the tag.
@param tagValue The value of the tag to create.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TagValueInner object | [
"Creates",
"a",
"tag",
"value",
".",
"The",
"name",
"of",
"the",
"tag",
"must",
"already",
"exist",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/TagsInner.java#L209-L216 |
zxing/zxing | android/src/com/google/zxing/client/android/camera/CameraManager.java | CameraManager.buildLuminanceSource | public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) {
"""
A factory method to build the appropriate LuminanceSource object based on the format
of the preview buffers, as described by Camera.Parameters.
@param data A preview frame.
@param width The width of the image.
@param height The height of the image.
@return A PlanarYUVLuminanceSource instance.
"""
Rect rect = getFramingRectInPreview();
if (rect == null) {
return null;
}
// Go ahead and assume it's YUV rather than die.
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height(), false);
} | java | public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) {
Rect rect = getFramingRectInPreview();
if (rect == null) {
return null;
}
// Go ahead and assume it's YUV rather than die.
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height(), false);
} | [
"public",
"PlanarYUVLuminanceSource",
"buildLuminanceSource",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Rect",
"rect",
"=",
"getFramingRectInPreview",
"(",
")",
";",
"if",
"(",
"rect",
"==",
"null",
")",
"{",
"ret... | A factory method to build the appropriate LuminanceSource object based on the format
of the preview buffers, as described by Camera.Parameters.
@param data A preview frame.
@param width The width of the image.
@param height The height of the image.
@return A PlanarYUVLuminanceSource instance. | [
"A",
"factory",
"method",
"to",
"build",
"the",
"appropriate",
"LuminanceSource",
"object",
"based",
"on",
"the",
"format",
"of",
"the",
"preview",
"buffers",
"as",
"described",
"by",
"Camera",
".",
"Parameters",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L321-L329 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/STGD.java | STGD.setGravity | public void setGravity(double gravity) {
"""
Sets the gravity regularization parameter that "weighs down" the
coefficient values. Larger gravity values impose stronger regularization,
and encourage greater sparsity.
@param gravity the regularization parameter in ( 0, Infinity )
"""
if(Double.isInfinite(gravity) || Double.isNaN(gravity) || gravity <= 0)
throw new IllegalArgumentException("Gravity must be positive, not " + gravity);
this.gravity = gravity;
} | java | public void setGravity(double gravity)
{
if(Double.isInfinite(gravity) || Double.isNaN(gravity) || gravity <= 0)
throw new IllegalArgumentException("Gravity must be positive, not " + gravity);
this.gravity = gravity;
} | [
"public",
"void",
"setGravity",
"(",
"double",
"gravity",
")",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"gravity",
")",
"||",
"Double",
".",
"isNaN",
"(",
"gravity",
")",
"||",
"gravity",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",... | Sets the gravity regularization parameter that "weighs down" the
coefficient values. Larger gravity values impose stronger regularization,
and encourage greater sparsity.
@param gravity the regularization parameter in ( 0, Infinity ) | [
"Sets",
"the",
"gravity",
"regularization",
"parameter",
"that",
"weighs",
"down",
"the",
"coefficient",
"values",
".",
"Larger",
"gravity",
"values",
"impose",
"stronger",
"regularization",
"and",
"encourage",
"greater",
"sparsity",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/STGD.java#L153-L158 |
twilio/twilio-java | src/main/java/com/twilio/rest/proxy/v1/service/SessionCreator.java | SessionCreator.setParticipants | public SessionCreator setParticipants(final Map<String, Object> participants) {
"""
The Participant objects to include in the new session..
@param participants The Participant objects to include in the new session
@return this
"""
return setParticipants(Promoter.listOfOne(participants));
} | java | public SessionCreator setParticipants(final Map<String, Object> participants) {
return setParticipants(Promoter.listOfOne(participants));
} | [
"public",
"SessionCreator",
"setParticipants",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"participants",
")",
"{",
"return",
"setParticipants",
"(",
"Promoter",
".",
"listOfOne",
"(",
"participants",
")",
")",
";",
"}"
] | The Participant objects to include in the new session..
@param participants The Participant objects to include in the new session
@return this | [
"The",
"Participant",
"objects",
"to",
"include",
"in",
"the",
"new",
"session",
".."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/proxy/v1/service/SessionCreator.java#L128-L130 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.forEachCodePoint | public static void forEachCodePoint(String string, CodePointProcedure procedure) {
"""
For each int code point in the {@code string}, execute the {@link CodePointProcedure}.
@since 7.0
"""
int size = string.length();
for (int i = 0; i < size; )
{
int codePoint = string.codePointAt(i);
procedure.value(codePoint);
i += Character.charCount(codePoint);
}
} | java | public static void forEachCodePoint(String string, CodePointProcedure procedure)
{
int size = string.length();
for (int i = 0; i < size; )
{
int codePoint = string.codePointAt(i);
procedure.value(codePoint);
i += Character.charCount(codePoint);
}
} | [
"public",
"static",
"void",
"forEachCodePoint",
"(",
"String",
"string",
",",
"CodePointProcedure",
"procedure",
")",
"{",
"int",
"size",
"=",
"string",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
")",
... | For each int code point in the {@code string}, execute the {@link CodePointProcedure}.
@since 7.0 | [
"For",
"each",
"int",
"code",
"point",
"in",
"the",
"{",
"@code",
"string",
"}",
"execute",
"the",
"{",
"@link",
"CodePointProcedure",
"}",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L385-L394 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbBlob.java | MariaDbBlob.setBytes | public int setBytes(final long pos, final byte[] bytes) throws SQLException {
"""
Writes the given array of bytes to the <code>BLOB</code> value that this <code>Blob</code>
object represents, starting at position <code>pos</code>, and returns the number of bytes
written. The array of bytes will overwrite the existing bytes in the <code>Blob</code> object
starting at the position <code>pos</code>. If the end of the
<code>Blob</code> value is reached while writing the array of bytes, then the length of the
<code>Blob</code>
value will be increased to accommodate the extra bytes.
@param pos the position in the <code>BLOB</code> object at which to start writing; the first
position is 1
@param bytes the array of bytes to be written to the <code>BLOB</code> value that this
<code>Blob</code> object represents
@return the number of bytes written
@see #getBytes
"""
if (pos < 1) {
throw ExceptionMapper.getSqlException("pos should be > 0, first position is 1.");
}
final int arrayPos = (int) pos - 1;
if (length > arrayPos + bytes.length) {
System.arraycopy(bytes, 0, data, offset + arrayPos, bytes.length);
} else {
byte[] newContent = new byte[arrayPos + bytes.length];
if (Math.min(arrayPos, length) > 0) {
System.arraycopy(data, this.offset, newContent, 0, Math.min(arrayPos, length));
}
System.arraycopy(bytes, 0, newContent, arrayPos, bytes.length);
data = newContent;
length = arrayPos + bytes.length;
offset = 0;
}
return bytes.length;
} | java | public int setBytes(final long pos, final byte[] bytes) throws SQLException {
if (pos < 1) {
throw ExceptionMapper.getSqlException("pos should be > 0, first position is 1.");
}
final int arrayPos = (int) pos - 1;
if (length > arrayPos + bytes.length) {
System.arraycopy(bytes, 0, data, offset + arrayPos, bytes.length);
} else {
byte[] newContent = new byte[arrayPos + bytes.length];
if (Math.min(arrayPos, length) > 0) {
System.arraycopy(data, this.offset, newContent, 0, Math.min(arrayPos, length));
}
System.arraycopy(bytes, 0, newContent, arrayPos, bytes.length);
data = newContent;
length = arrayPos + bytes.length;
offset = 0;
}
return bytes.length;
} | [
"public",
"int",
"setBytes",
"(",
"final",
"long",
"pos",
",",
"final",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"pos",
"<",
"1",
")",
"{",
"throw",
"ExceptionMapper",
".",
"getSqlException",
"(",
"\"pos should be > 0, first ... | Writes the given array of bytes to the <code>BLOB</code> value that this <code>Blob</code>
object represents, starting at position <code>pos</code>, and returns the number of bytes
written. The array of bytes will overwrite the existing bytes in the <code>Blob</code> object
starting at the position <code>pos</code>. If the end of the
<code>Blob</code> value is reached while writing the array of bytes, then the length of the
<code>Blob</code>
value will be increased to accommodate the extra bytes.
@param pos the position in the <code>BLOB</code> object at which to start writing; the first
position is 1
@param bytes the array of bytes to be written to the <code>BLOB</code> value that this
<code>Blob</code> object represents
@return the number of bytes written
@see #getBytes | [
"Writes",
"the",
"given",
"array",
"of",
"bytes",
"to",
"the",
"<code",
">",
"BLOB<",
"/",
"code",
">",
"value",
"that",
"this",
"<code",
">",
"Blob<",
"/",
"code",
">",
"object",
"represents",
"starting",
"at",
"position",
"<code",
">",
"pos<",
"/",
"... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbBlob.java#L279-L303 |
thombergs/docx-stamper | src/main/java/org/wickedsource/docxstamper/processor/CommentProcessorRegistry.java | CommentProcessorRegistry.runProcessorsOnInlineContent | private <T> void runProcessorsOnInlineContent(ProxyBuilder<T> proxyBuilder,
ParagraphCoordinates paragraphCoordinates) {
"""
Finds all processor expressions within the specified paragraph and tries
to evaluate it against all registered {@link ICommentProcessor}s.
@param proxyBuilder a builder for a proxy around the context root object to customize its interface
@param paragraphCoordinates the paragraph to process.
@param <T> type of the context root object
"""
ParagraphWrapper paragraph = new ParagraphWrapper(paragraphCoordinates.getParagraph());
List<String> processorExpressions = expressionUtil
.findProcessorExpressions(paragraph.getText());
for (String processorExpression : processorExpressions) {
String strippedExpression = expressionUtil.stripExpression(processorExpression);
for (final ICommentProcessor processor : commentProcessors) {
Class<?> commentProcessorInterface = commentProcessorInterfaces.get(processor);
proxyBuilder.withInterface(commentProcessorInterface, processor);
processor.setCurrentParagraphCoordinates(paragraphCoordinates);
}
try {
T contextRootProxy = proxyBuilder.build();
expressionResolver.resolveExpression(strippedExpression, contextRootProxy);
placeholderReplacer.replace(paragraph, processorExpression, null);
logger.debug(String.format(
"Processor expression '%s' has been successfully processed by a comment processor.",
processorExpression));
} catch (SpelEvaluationException | SpelParseException e) {
if (failOnInvalidExpression) {
throw new UnresolvedExpressionException(strippedExpression, e);
} else {
logger.warn(String.format(
"Skipping processor expression '%s' because it can not be resolved by any comment processor. Reason: %s. Set log level to TRACE to view Stacktrace.",
processorExpression, e.getMessage()));
logger.trace("Reason for skipping processor expression: ", e);
}
} catch (ProxyException e) {
throw new DocxStamperException("Could not create a proxy around context root object", e);
}
}
} | java | private <T> void runProcessorsOnInlineContent(ProxyBuilder<T> proxyBuilder,
ParagraphCoordinates paragraphCoordinates) {
ParagraphWrapper paragraph = new ParagraphWrapper(paragraphCoordinates.getParagraph());
List<String> processorExpressions = expressionUtil
.findProcessorExpressions(paragraph.getText());
for (String processorExpression : processorExpressions) {
String strippedExpression = expressionUtil.stripExpression(processorExpression);
for (final ICommentProcessor processor : commentProcessors) {
Class<?> commentProcessorInterface = commentProcessorInterfaces.get(processor);
proxyBuilder.withInterface(commentProcessorInterface, processor);
processor.setCurrentParagraphCoordinates(paragraphCoordinates);
}
try {
T contextRootProxy = proxyBuilder.build();
expressionResolver.resolveExpression(strippedExpression, contextRootProxy);
placeholderReplacer.replace(paragraph, processorExpression, null);
logger.debug(String.format(
"Processor expression '%s' has been successfully processed by a comment processor.",
processorExpression));
} catch (SpelEvaluationException | SpelParseException e) {
if (failOnInvalidExpression) {
throw new UnresolvedExpressionException(strippedExpression, e);
} else {
logger.warn(String.format(
"Skipping processor expression '%s' because it can not be resolved by any comment processor. Reason: %s. Set log level to TRACE to view Stacktrace.",
processorExpression, e.getMessage()));
logger.trace("Reason for skipping processor expression: ", e);
}
} catch (ProxyException e) {
throw new DocxStamperException("Could not create a proxy around context root object", e);
}
}
} | [
"private",
"<",
"T",
">",
"void",
"runProcessorsOnInlineContent",
"(",
"ProxyBuilder",
"<",
"T",
">",
"proxyBuilder",
",",
"ParagraphCoordinates",
"paragraphCoordinates",
")",
"{",
"ParagraphWrapper",
"paragraph",
"=",
"new",
"ParagraphWrapper",
"(",
"paragraphCoordinat... | Finds all processor expressions within the specified paragraph and tries
to evaluate it against all registered {@link ICommentProcessor}s.
@param proxyBuilder a builder for a proxy around the context root object to customize its interface
@param paragraphCoordinates the paragraph to process.
@param <T> type of the context root object | [
"Finds",
"all",
"processor",
"expressions",
"within",
"the",
"specified",
"paragraph",
"and",
"tries",
"to",
"evaluate",
"it",
"against",
"all",
"registered",
"{",
"@link",
"ICommentProcessor",
"}",
"s",
"."
] | train | https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/processor/CommentProcessorRegistry.java#L112-L148 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java | NodeImpl.setNameNS | static void setNameNS(NodeImpl node, String namespaceURI, String qualifiedName) {
"""
Sets {@code node} to be namespace-aware and assigns its namespace URI
and qualified name.
@param node an element or attribute node.
@param namespaceURI this node's namespace URI. May be null.
@param qualifiedName a possibly-prefixed name like "img" or "html:img".
"""
if (qualifiedName == null) {
throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName);
}
String prefix = null;
int p = qualifiedName.lastIndexOf(":");
if (p != -1) {
prefix = validatePrefix(qualifiedName.substring(0, p), true, namespaceURI);
qualifiedName = qualifiedName.substring(p + 1);
}
if (!DocumentImpl.isXMLIdentifier(qualifiedName)) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, qualifiedName);
}
switch (node.getNodeType()) {
case ATTRIBUTE_NODE:
if ("xmlns".equals(qualifiedName)
&& !"http://www.w3.org/2000/xmlns/".equals(namespaceURI)) {
throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName);
}
AttrImpl attr = (AttrImpl) node;
attr.namespaceAware = true;
attr.namespaceURI = namespaceURI;
attr.prefix = prefix;
attr.localName = qualifiedName;
break;
case ELEMENT_NODE:
ElementImpl element = (ElementImpl) node;
element.namespaceAware = true;
element.namespaceURI = namespaceURI;
element.prefix = prefix;
element.localName = qualifiedName;
break;
default:
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"Cannot rename nodes of type " + node.getNodeType());
}
} | java | static void setNameNS(NodeImpl node, String namespaceURI, String qualifiedName) {
if (qualifiedName == null) {
throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName);
}
String prefix = null;
int p = qualifiedName.lastIndexOf(":");
if (p != -1) {
prefix = validatePrefix(qualifiedName.substring(0, p), true, namespaceURI);
qualifiedName = qualifiedName.substring(p + 1);
}
if (!DocumentImpl.isXMLIdentifier(qualifiedName)) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, qualifiedName);
}
switch (node.getNodeType()) {
case ATTRIBUTE_NODE:
if ("xmlns".equals(qualifiedName)
&& !"http://www.w3.org/2000/xmlns/".equals(namespaceURI)) {
throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName);
}
AttrImpl attr = (AttrImpl) node;
attr.namespaceAware = true;
attr.namespaceURI = namespaceURI;
attr.prefix = prefix;
attr.localName = qualifiedName;
break;
case ELEMENT_NODE:
ElementImpl element = (ElementImpl) node;
element.namespaceAware = true;
element.namespaceURI = namespaceURI;
element.prefix = prefix;
element.localName = qualifiedName;
break;
default:
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"Cannot rename nodes of type " + node.getNodeType());
}
} | [
"static",
"void",
"setNameNS",
"(",
"NodeImpl",
"node",
",",
"String",
"namespaceURI",
",",
"String",
"qualifiedName",
")",
"{",
"if",
"(",
"qualifiedName",
"==",
"null",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"DOMException",
".",
"NAMESPACE_ERR",
",",... | Sets {@code node} to be namespace-aware and assigns its namespace URI
and qualified name.
@param node an element or attribute node.
@param namespaceURI this node's namespace URI. May be null.
@param qualifiedName a possibly-prefixed name like "img" or "html:img". | [
"Sets",
"{",
"@code",
"node",
"}",
"to",
"be",
"namespace",
"-",
"aware",
"and",
"assigns",
"its",
"namespace",
"URI",
"and",
"qualified",
"name",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java#L230-L272 |
FrodeRanders/java-vopn | src/main/java/org/gautelis/vopn/io/FileIO.java | FileIO.getRemoteFile | public static File getRemoteFile(URL url, boolean keepAlive) throws IOException {
"""
Retrieves file from a remote location identified by a URL.
<p>
@param url
@return
@throws IOException
"""
File downloadedFile = File.createTempFile("downloaded-", ".bytes");
URLConnection conn = url.openConnection();
if (keepAlive) {
conn.setRequestProperty("connection", "Keep-Alive");
}
conn.setUseCaches(false);
try (ReadableByteChannel inputChannel = Channels.newChannel(conn.getInputStream())) {
try (WritableByteChannel outputChannel = Channels.newChannel(new FileOutputStream(downloadedFile))) {
fastChannelCopy(inputChannel, outputChannel);
}
}
return downloadedFile;
} | java | public static File getRemoteFile(URL url, boolean keepAlive) throws IOException {
File downloadedFile = File.createTempFile("downloaded-", ".bytes");
URLConnection conn = url.openConnection();
if (keepAlive) {
conn.setRequestProperty("connection", "Keep-Alive");
}
conn.setUseCaches(false);
try (ReadableByteChannel inputChannel = Channels.newChannel(conn.getInputStream())) {
try (WritableByteChannel outputChannel = Channels.newChannel(new FileOutputStream(downloadedFile))) {
fastChannelCopy(inputChannel, outputChannel);
}
}
return downloadedFile;
} | [
"public",
"static",
"File",
"getRemoteFile",
"(",
"URL",
"url",
",",
"boolean",
"keepAlive",
")",
"throws",
"IOException",
"{",
"File",
"downloadedFile",
"=",
"File",
".",
"createTempFile",
"(",
"\"downloaded-\"",
",",
"\".bytes\"",
")",
";",
"URLConnection",
"c... | Retrieves file from a remote location identified by a URL.
<p>
@param url
@return
@throws IOException | [
"Retrieves",
"file",
"from",
"a",
"remote",
"location",
"identified",
"by",
"a",
"URL",
".",
"<p",
">"
] | train | https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/io/FileIO.java#L221-L236 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java | SeaGlassSynthPainterImpl.paintTabbedPaneTabBackground | public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex) {
"""
Paints the background of a tab of a tabbed pane.
@param context SynthContext identifying the <code>JComponent</code> and
<code>Region</code> to paint to
@param g <code>Graphics</code> to paint to
@param x X coordinate of the area to paint to
@param y Y coordinate of the area to paint to
@param w Width of the area to paint to
@param h Height of the area to paint to
@param tabIndex Index of tab being painted.
"""
paintBackground(context, g, x, y, w, h, null);
} | java | public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex) {
paintBackground(context, g, x, y, w, h, null);
} | [
"public",
"void",
"paintTabbedPaneTabBackground",
"(",
"SynthContext",
"context",
",",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
",",
"int",
"tabIndex",
")",
"{",
"paintBackground",
"(",
"context",
",",
"g",
","... | Paints the background of a tab of a tabbed pane.
@param context SynthContext identifying the <code>JComponent</code> and
<code>Region</code> to paint to
@param g <code>Graphics</code> to paint to
@param x X coordinate of the area to paint to
@param y Y coordinate of the area to paint to
@param w Width of the area to paint to
@param h Height of the area to paint to
@param tabIndex Index of tab being painted. | [
"Paints",
"the",
"background",
"of",
"a",
"tab",
"of",
"a",
"tabbed",
"pane",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L2048-L2050 |
encoway/edu | edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java | EventDrivenUpdatesMap.add | public void add(String events, String...ids) {
"""
Maps the the specified {@code ids} as listeners for {@code events}.
@param events the events triggering an update of the specified {@code ids}
@param ids the ids to be updated
"""
for (String event : EventDrivenUpdatesMap.parseEvents(events)) {
Set<String> listenerIds = delegate.get(event);
if (listenerIds == null) {
listenerIds = new HashSet<>();
delegate.put(event, listenerIds);
}
listenerIds.addAll(Arrays.asList(ids));
}
} | java | public void add(String events, String...ids) {
for (String event : EventDrivenUpdatesMap.parseEvents(events)) {
Set<String> listenerIds = delegate.get(event);
if (listenerIds == null) {
listenerIds = new HashSet<>();
delegate.put(event, listenerIds);
}
listenerIds.addAll(Arrays.asList(ids));
}
} | [
"public",
"void",
"add",
"(",
"String",
"events",
",",
"String",
"...",
"ids",
")",
"{",
"for",
"(",
"String",
"event",
":",
"EventDrivenUpdatesMap",
".",
"parseEvents",
"(",
"events",
")",
")",
"{",
"Set",
"<",
"String",
">",
"listenerIds",
"=",
"delega... | Maps the the specified {@code ids} as listeners for {@code events}.
@param events the events triggering an update of the specified {@code ids}
@param ids the ids to be updated | [
"Maps",
"the",
"the",
"specified",
"{"
] | train | https://github.com/encoway/edu/blob/52ae92b2207f7d5668e212904359fbeb360f3f05/edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java#L129-L139 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.addSession | public void addSession(String id, Session session) {
"""
Add a session to this scheduler.
@param id The session ID.
@param session The session.
"""
poolGroupManager.addSession(id, session);
LOG.info("Session " + id +
" has been added to " + type + " scheduler");
} | java | public void addSession(String id, Session session) {
poolGroupManager.addSession(id, session);
LOG.info("Session " + id +
" has been added to " + type + " scheduler");
} | [
"public",
"void",
"addSession",
"(",
"String",
"id",
",",
"Session",
"session",
")",
"{",
"poolGroupManager",
".",
"addSession",
"(",
"id",
",",
"session",
")",
";",
"LOG",
".",
"info",
"(",
"\"Session \"",
"+",
"id",
"+",
"\" has been added to \"",
"+",
"... | Add a session to this scheduler.
@param id The session ID.
@param session The session. | [
"Add",
"a",
"session",
"to",
"this",
"scheduler",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L784-L788 |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/meta/model/Attribute.java | Attribute.getRefEntity | public EntityType getRefEntity() {
"""
When getDataType=xref/mref, get other end of xref
@return referenced entity
@throws UnsupportedOperationException if attribute type is not a reference type
"""
if (!hasRefEntity()) {
throw new UnsupportedOperationException(
String.format("getRefEntity not supported for attribute type '%s'", getDataType()));
}
return getEntity(REF_ENTITY_TYPE, EntityType.class);
} | java | public EntityType getRefEntity() {
if (!hasRefEntity()) {
throw new UnsupportedOperationException(
String.format("getRefEntity not supported for attribute type '%s'", getDataType()));
}
return getEntity(REF_ENTITY_TYPE, EntityType.class);
} | [
"public",
"EntityType",
"getRefEntity",
"(",
")",
"{",
"if",
"(",
"!",
"hasRefEntity",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"String",
".",
"format",
"(",
"\"getRefEntity not supported for attribute type '%s'\"",
",",
"getDataType",... | When getDataType=xref/mref, get other end of xref
@return referenced entity
@throws UnsupportedOperationException if attribute type is not a reference type | [
"When",
"getDataType",
"=",
"xref",
"/",
"mref",
"get",
"other",
"end",
"of",
"xref"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/Attribute.java#L342-L348 |
operasoftware/operaprestodriver | src/com/opera/core/systems/scope/ScopeServices.java | ScopeServices.getHostInfo | private HostInfo getHostInfo() {
"""
Gets information on available services and their versions from Opera. This includes the STP
version, core version, platform, operating system, user agent string and a list of available
services.
@return information about the connected browser's debug capabilities
"""
Response response = executeMessage(ScopeMessage.HOST_INFO, null);
try {
return HostInfo.parseFrom(response.getPayload());
} catch (InvalidProtocolBufferException e) {
throw new CommunicationException("Error while parsing host info", e);
}
} | java | private HostInfo getHostInfo() {
Response response = executeMessage(ScopeMessage.HOST_INFO, null);
try {
return HostInfo.parseFrom(response.getPayload());
} catch (InvalidProtocolBufferException e) {
throw new CommunicationException("Error while parsing host info", e);
}
} | [
"private",
"HostInfo",
"getHostInfo",
"(",
")",
"{",
"Response",
"response",
"=",
"executeMessage",
"(",
"ScopeMessage",
".",
"HOST_INFO",
",",
"null",
")",
";",
"try",
"{",
"return",
"HostInfo",
".",
"parseFrom",
"(",
"response",
".",
"getPayload",
"(",
")"... | Gets information on available services and their versions from Opera. This includes the STP
version, core version, platform, operating system, user agent string and a list of available
services.
@return information about the connected browser's debug capabilities | [
"Gets",
"information",
"on",
"available",
"services",
"and",
"their",
"versions",
"from",
"Opera",
".",
"This",
"includes",
"the",
"STP",
"version",
"core",
"version",
"platform",
"operating",
"system",
"user",
"agent",
"string",
"and",
"a",
"list",
"of",
"ava... | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/scope/ScopeServices.java#L223-L231 |
stackify/stackify-api-java | src/main/java/com/stackify/api/common/lang/Threads.java | Threads.sleepQuietly | public static void sleepQuietly(final long sleepFor, final TimeUnit unit) {
"""
Sleeps and eats any exceptions
@param sleepFor Sleep for value
@param unit Unit of measure
"""
try {
Thread.sleep(unit.toMillis(sleepFor));
} catch (Throwable t) {
// do nothing
}
} | java | public static void sleepQuietly(final long sleepFor, final TimeUnit unit) {
try {
Thread.sleep(unit.toMillis(sleepFor));
} catch (Throwable t) {
// do nothing
}
} | [
"public",
"static",
"void",
"sleepQuietly",
"(",
"final",
"long",
"sleepFor",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"unit",
".",
"toMillis",
"(",
"sleepFor",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
... | Sleeps and eats any exceptions
@param sleepFor Sleep for value
@param unit Unit of measure | [
"Sleeps",
"and",
"eats",
"any",
"exceptions"
] | train | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/lang/Threads.java#L31-L37 |
amzn/ion-java | src/com/amazon/ion/impl/UnifiedInputStreamX.java | UnifiedInputStreamX.read | public final int read(byte[] dst, int offset, int length) throws IOException {
"""
It is unclear what the implication to the rest of the system to make it 'conform'
"""
if (!is_byte_data()) {
throw new IOException("byte read is not support over character sources");
}
int remaining = length;
while (remaining > 0 && !isEOF()) {
int ready = _limit - _pos;
if (ready > remaining) {
ready = remaining;
}
System.arraycopy(_bytes, _pos, dst, offset, ready);
_pos += ready;
offset += ready;
remaining -= ready;
if (remaining == 0 || _pos < _limit || refill_helper()) {
break;
}
}
return length - remaining;
} | java | public final int read(byte[] dst, int offset, int length) throws IOException
{
if (!is_byte_data()) {
throw new IOException("byte read is not support over character sources");
}
int remaining = length;
while (remaining > 0 && !isEOF()) {
int ready = _limit - _pos;
if (ready > remaining) {
ready = remaining;
}
System.arraycopy(_bytes, _pos, dst, offset, ready);
_pos += ready;
offset += ready;
remaining -= ready;
if (remaining == 0 || _pos < _limit || refill_helper()) {
break;
}
}
return length - remaining;
} | [
"public",
"final",
"int",
"read",
"(",
"byte",
"[",
"]",
"dst",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"is_byte_data",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"byte read is not sup... | It is unclear what the implication to the rest of the system to make it 'conform' | [
"It",
"is",
"unclear",
"what",
"the",
"implication",
"to",
"the",
"rest",
"of",
"the",
"system",
"to",
"make",
"it",
"conform"
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/UnifiedInputStreamX.java#L365-L385 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/read/ScanAdapter.java | ScanAdapter.buildFilter | public Filters.Filter buildFilter(Scan scan, ReadHooks hooks) {
"""
Given a {@link Scan}, build a {@link Filters.Filter} that include matching columns
@param scan a {@link Scan} object.
@param hooks a {@link ReadHooks} object.
@return a {@link Filters.Filter} object.
"""
ChainFilter chain = FILTERS.chain();
Optional<Filters.Filter> familyFilter = createColumnFamilyFilter(scan);
if (familyFilter.isPresent()) {
chain.filter(familyFilter.get());
}
if (scan.getTimeRange() != null && !scan.getTimeRange().isAllTime()) {
chain.filter(createTimeRangeFilter(scan.getTimeRange()));
}
if (scan.getMaxVersions() != Integer.MAX_VALUE) {
chain.filter(createColumnLimitFilter(scan.getMaxVersions()));
}
Optional<Filters.Filter> userFilter = createUserFilter(scan, hooks);
if (userFilter.isPresent()) {
chain.filter(userFilter.get());
}
return chain;
} | java | public Filters.Filter buildFilter(Scan scan, ReadHooks hooks) {
ChainFilter chain = FILTERS.chain();
Optional<Filters.Filter> familyFilter = createColumnFamilyFilter(scan);
if (familyFilter.isPresent()) {
chain.filter(familyFilter.get());
}
if (scan.getTimeRange() != null && !scan.getTimeRange().isAllTime()) {
chain.filter(createTimeRangeFilter(scan.getTimeRange()));
}
if (scan.getMaxVersions() != Integer.MAX_VALUE) {
chain.filter(createColumnLimitFilter(scan.getMaxVersions()));
}
Optional<Filters.Filter> userFilter = createUserFilter(scan, hooks);
if (userFilter.isPresent()) {
chain.filter(userFilter.get());
}
return chain;
} | [
"public",
"Filters",
".",
"Filter",
"buildFilter",
"(",
"Scan",
"scan",
",",
"ReadHooks",
"hooks",
")",
"{",
"ChainFilter",
"chain",
"=",
"FILTERS",
".",
"chain",
"(",
")",
";",
"Optional",
"<",
"Filters",
".",
"Filter",
">",
"familyFilter",
"=",
"createCo... | Given a {@link Scan}, build a {@link Filters.Filter} that include matching columns
@param scan a {@link Scan} object.
@param hooks a {@link ReadHooks} object.
@return a {@link Filters.Filter} object. | [
"Given",
"a",
"{",
"@link",
"Scan",
"}",
"build",
"a",
"{",
"@link",
"Filters",
".",
"Filter",
"}",
"that",
"include",
"matching",
"columns"
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/read/ScanAdapter.java#L117-L138 |
alkacon/opencms-core | src/org/opencms/search/CmsSearch.java | CmsSearch.addFieldQuery | public void addFieldQuery(String fieldName, String searchQuery, Occur occur) {
"""
Adds an individual query for a search field.<p>
If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])}
will be ignored and only the individual field search settings will be used.<p>
When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind:
All SHOULD clauses will be grouped and wrapped in one query,
all MUST and MUST_NOT clauses will be grouped in another query.
This means that at least one of the terms which are given as a SHOULD query must occur in the
search result.<p>
@param fieldName the field name
@param searchQuery the search query
@param occur the occur parameter for the query in the field
@since 7.5.1
"""
addFieldQuery(new CmsSearchParameters.CmsSearchFieldQuery(fieldName, searchQuery, occur));
} | java | public void addFieldQuery(String fieldName, String searchQuery, Occur occur) {
addFieldQuery(new CmsSearchParameters.CmsSearchFieldQuery(fieldName, searchQuery, occur));
} | [
"public",
"void",
"addFieldQuery",
"(",
"String",
"fieldName",
",",
"String",
"searchQuery",
",",
"Occur",
"occur",
")",
"{",
"addFieldQuery",
"(",
"new",
"CmsSearchParameters",
".",
"CmsSearchFieldQuery",
"(",
"fieldName",
",",
"searchQuery",
",",
"occur",
")",
... | Adds an individual query for a search field.<p>
If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])}
will be ignored and only the individual field search settings will be used.<p>
When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind:
All SHOULD clauses will be grouped and wrapped in one query,
all MUST and MUST_NOT clauses will be grouped in another query.
This means that at least one of the terms which are given as a SHOULD query must occur in the
search result.<p>
@param fieldName the field name
@param searchQuery the search query
@param occur the occur parameter for the query in the field
@since 7.5.1 | [
"Adds",
"an",
"individual",
"query",
"for",
"a",
"search",
"field",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearch.java#L165-L168 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/AtsUtils.java | AtsUtils.download | public static File download(String url, File toDir) throws AlipayApiException {
"""
通过HTTP GET方式下载文件到指定的目录。
@param url 需要下载的URL
@param toDir 需要下载到的目录
@return 下载后的文件
"""
toDir.mkdirs();
HttpURLConnection conn = null;
OutputStream output = null;
File file = null;
try {
conn = getConnection(new URL(url));
String ctype = conn.getContentType();
if (CTYPE_OCTET.equals(ctype)) {
String fileName = getFileName(conn);
file = new File(toDir, fileName);
output = new FileOutputStream(file);
copy(conn.getInputStream(), output);
} else {
String rsp = WebUtils.getResponseAsString(conn);
throw new AlipayApiException(rsp);
}
} catch (IOException e) {
throw new AlipayApiException(e.getMessage());
} finally {
closeQuietly(output);
if (conn != null) {
conn.disconnect();
}
}
return file;
} | java | public static File download(String url, File toDir) throws AlipayApiException {
toDir.mkdirs();
HttpURLConnection conn = null;
OutputStream output = null;
File file = null;
try {
conn = getConnection(new URL(url));
String ctype = conn.getContentType();
if (CTYPE_OCTET.equals(ctype)) {
String fileName = getFileName(conn);
file = new File(toDir, fileName);
output = new FileOutputStream(file);
copy(conn.getInputStream(), output);
} else {
String rsp = WebUtils.getResponseAsString(conn);
throw new AlipayApiException(rsp);
}
} catch (IOException e) {
throw new AlipayApiException(e.getMessage());
} finally {
closeQuietly(output);
if (conn != null) {
conn.disconnect();
}
}
return file;
} | [
"public",
"static",
"File",
"download",
"(",
"String",
"url",
",",
"File",
"toDir",
")",
"throws",
"AlipayApiException",
"{",
"toDir",
".",
"mkdirs",
"(",
")",
";",
"HttpURLConnection",
"conn",
"=",
"null",
";",
"OutputStream",
"output",
"=",
"null",
";",
... | 通过HTTP GET方式下载文件到指定的目录。
@param url 需要下载的URL
@param toDir 需要下载到的目录
@return 下载后的文件 | [
"通过HTTP",
"GET方式下载文件到指定的目录。"
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/AtsUtils.java#L114-L140 |
ops4j/org.ops4j.pax.swissbox | pax-swissbox-core/src/main/java/org/ops4j/pax/swissbox/core/BundleUtils.java | BundleUtils.getBundle | public static Bundle getBundle( BundleContext bc, String symbolicName, String version ) {
"""
Returns the bundle with the given symbolic name and the given version, or null if no such
bundle exists
@param bc bundle context
@param symbolicName bundle symbolic name
@param version bundle version
@return matching bundle, or null
"""
for( Bundle bundle : bc.getBundles() )
{
if( bundle.getSymbolicName().equals( symbolicName ) )
{
if( version == null || version.equals( bundle.getVersion() ) )
{
return bundle;
}
}
}
return null;
} | java | public static Bundle getBundle( BundleContext bc, String symbolicName, String version )
{
for( Bundle bundle : bc.getBundles() )
{
if( bundle.getSymbolicName().equals( symbolicName ) )
{
if( version == null || version.equals( bundle.getVersion() ) )
{
return bundle;
}
}
}
return null;
} | [
"public",
"static",
"Bundle",
"getBundle",
"(",
"BundleContext",
"bc",
",",
"String",
"symbolicName",
",",
"String",
"version",
")",
"{",
"for",
"(",
"Bundle",
"bundle",
":",
"bc",
".",
"getBundles",
"(",
")",
")",
"{",
"if",
"(",
"bundle",
".",
"getSymb... | Returns the bundle with the given symbolic name and the given version, or null if no such
bundle exists
@param bc bundle context
@param symbolicName bundle symbolic name
@param version bundle version
@return matching bundle, or null | [
"Returns",
"the",
"bundle",
"with",
"the",
"given",
"symbolic",
"name",
"and",
"the",
"given",
"version",
"or",
"null",
"if",
"no",
"such",
"bundle",
"exists"
] | train | https://github.com/ops4j/org.ops4j.pax.swissbox/blob/00b0ee16cdbe8017984a4d7ba808b10d985c5b5c/pax-swissbox-core/src/main/java/org/ops4j/pax/swissbox/core/BundleUtils.java#L128-L141 |
apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java | AbstractServiceValidateController.handleProxyGrantingTicketDelivery | public TicketGrantingTicket handleProxyGrantingTicketDelivery(final String serviceTicketId, final Credential credential)
throws AuthenticationException, AbstractTicketException {
"""
Handle proxy granting ticket delivery.
@param serviceTicketId the service ticket id
@param credential the service credential
@return the ticket granting ticket
@throws AuthenticationException the authentication exception
@throws AbstractTicketException the abstract ticket exception
"""
val serviceTicket = serviceValidateConfigurationContext.getCentralAuthenticationService().getTicket(serviceTicketId, ServiceTicket.class);
val authenticationResult = serviceValidateConfigurationContext.getAuthenticationSystemSupport()
.handleAndFinalizeSingleAuthenticationTransaction(serviceTicket.getService(), credential);
val proxyGrantingTicketId = serviceValidateConfigurationContext.getCentralAuthenticationService()
.createProxyGrantingTicket(serviceTicketId, authenticationResult);
LOGGER.debug("Generated proxy-granting ticket [{}] off of service ticket [{}] and credential [{}]", proxyGrantingTicketId.getId(), serviceTicketId, credential);
return proxyGrantingTicketId;
} | java | public TicketGrantingTicket handleProxyGrantingTicketDelivery(final String serviceTicketId, final Credential credential)
throws AuthenticationException, AbstractTicketException {
val serviceTicket = serviceValidateConfigurationContext.getCentralAuthenticationService().getTicket(serviceTicketId, ServiceTicket.class);
val authenticationResult = serviceValidateConfigurationContext.getAuthenticationSystemSupport()
.handleAndFinalizeSingleAuthenticationTransaction(serviceTicket.getService(), credential);
val proxyGrantingTicketId = serviceValidateConfigurationContext.getCentralAuthenticationService()
.createProxyGrantingTicket(serviceTicketId, authenticationResult);
LOGGER.debug("Generated proxy-granting ticket [{}] off of service ticket [{}] and credential [{}]", proxyGrantingTicketId.getId(), serviceTicketId, credential);
return proxyGrantingTicketId;
} | [
"public",
"TicketGrantingTicket",
"handleProxyGrantingTicketDelivery",
"(",
"final",
"String",
"serviceTicketId",
",",
"final",
"Credential",
"credential",
")",
"throws",
"AuthenticationException",
",",
"AbstractTicketException",
"{",
"val",
"serviceTicket",
"=",
"serviceVali... | Handle proxy granting ticket delivery.
@param serviceTicketId the service ticket id
@param credential the service credential
@return the ticket granting ticket
@throws AuthenticationException the authentication exception
@throws AbstractTicketException the abstract ticket exception | [
"Handle",
"proxy",
"granting",
"ticket",
"delivery",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L124-L133 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobContext.java | JobContext.setTaskOutputDir | private void setTaskOutputDir() {
"""
If {@link ConfigurationKeys#WRITER_OUTPUT_DIR} (which is deprecated) is specified, use its value.
Otherwise, if {@link ConfigurationKeys#TASK_DATA_ROOT_DIR_KEY} is specified, use its value
plus {@link #TASK_OUTPUT_DIR_NAME}.
"""
if (this.jobState.contains(ConfigurationKeys.WRITER_OUTPUT_DIR)) {
LOG.warn(String.format("Property %s is deprecated. No need to use it if %s is specified.",
ConfigurationKeys.WRITER_OUTPUT_DIR, ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY));
} else {
String workingDir = this.jobState.getProp(ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY);
this.jobState.setProp(ConfigurationKeys.WRITER_OUTPUT_DIR, new Path(workingDir, TASK_OUTPUT_DIR_NAME).toString());
LOG.info(String
.format("Writer Output Directory is set to %s.", this.jobState.getProp(ConfigurationKeys.WRITER_OUTPUT_DIR)));
}
} | java | private void setTaskOutputDir() {
if (this.jobState.contains(ConfigurationKeys.WRITER_OUTPUT_DIR)) {
LOG.warn(String.format("Property %s is deprecated. No need to use it if %s is specified.",
ConfigurationKeys.WRITER_OUTPUT_DIR, ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY));
} else {
String workingDir = this.jobState.getProp(ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY);
this.jobState.setProp(ConfigurationKeys.WRITER_OUTPUT_DIR, new Path(workingDir, TASK_OUTPUT_DIR_NAME).toString());
LOG.info(String
.format("Writer Output Directory is set to %s.", this.jobState.getProp(ConfigurationKeys.WRITER_OUTPUT_DIR)));
}
} | [
"private",
"void",
"setTaskOutputDir",
"(",
")",
"{",
"if",
"(",
"this",
".",
"jobState",
".",
"contains",
"(",
"ConfigurationKeys",
".",
"WRITER_OUTPUT_DIR",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"String",
".",
"format",
"(",
"\"Property %s is deprecated. N... | If {@link ConfigurationKeys#WRITER_OUTPUT_DIR} (which is deprecated) is specified, use its value.
Otherwise, if {@link ConfigurationKeys#TASK_DATA_ROOT_DIR_KEY} is specified, use its value
plus {@link #TASK_OUTPUT_DIR_NAME}. | [
"If",
"{",
"@link",
"ConfigurationKeys#WRITER_OUTPUT_DIR",
"}",
"(",
"which",
"is",
"deprecated",
")",
"is",
"specified",
"use",
"its",
"value",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobContext.java#L364-L374 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getSecretVersionsWithServiceResponseAsync | public Observable<ServiceResponse<Page<SecretItem>>> getSecretVersionsWithServiceResponseAsync(final String vaultBaseUrl, final String secretName) {
"""
List all versions of the specified secret.
The full secret identifier and attributes are provided in the response. No values are returned for the secrets. This operations requires the secrets/list permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SecretItem> object
"""
return getSecretVersionsSinglePageAsync(vaultBaseUrl, secretName)
.concatMap(new Func1<ServiceResponse<Page<SecretItem>>, Observable<ServiceResponse<Page<SecretItem>>>>() {
@Override
public Observable<ServiceResponse<Page<SecretItem>>> call(ServiceResponse<Page<SecretItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getSecretVersionsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<SecretItem>>> getSecretVersionsWithServiceResponseAsync(final String vaultBaseUrl, final String secretName) {
return getSecretVersionsSinglePageAsync(vaultBaseUrl, secretName)
.concatMap(new Func1<ServiceResponse<Page<SecretItem>>, Observable<ServiceResponse<Page<SecretItem>>>>() {
@Override
public Observable<ServiceResponse<Page<SecretItem>>> call(ServiceResponse<Page<SecretItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getSecretVersionsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"SecretItem",
">",
">",
">",
"getSecretVersionsWithServiceResponseAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"String",
"secretName",
")",
"{",
"return",
"getSecretVersionsSinglePageAsyn... | List all versions of the specified secret.
The full secret identifier and attributes are provided in the response. No values are returned for the secrets. This operations requires the secrets/list permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SecretItem> object | [
"List",
"all",
"versions",
"of",
"the",
"specified",
"secret",
".",
"The",
"full",
"secret",
"identifier",
"and",
"attributes",
"are",
"provided",
"in",
"the",
"response",
".",
"No",
"values",
"are",
"returned",
"for",
"the",
"secrets",
".",
"This",
"operati... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4217-L4229 |
alkacon/opencms-core | src/org/opencms/lock/CmsLockManager.java | CmsLockManager.internalSiblingLock | private CmsLock internalSiblingLock(CmsLock exclusiveLock, String siblingName) {
"""
Returns a shared lock for the given excclusive lock and sibling.<p>
@param exclusiveLock the exclusive lock to use (has to be set on a sibling of siblingName)
@param siblingName the siblings name
@return the shared lock
"""
CmsLock lock = null;
if (!exclusiveLock.getSystemLock().isUnlocked()) {
lock = new CmsLock(
siblingName,
exclusiveLock.getUserId(),
exclusiveLock.getProject(),
exclusiveLock.getSystemLock().getType());
}
if ((lock == null) || !exclusiveLock.getEditionLock().isNullLock()) {
CmsLockType type = CmsLockType.SHARED_EXCLUSIVE;
if (!getParentLock(siblingName).isNullLock()) {
type = CmsLockType.SHARED_INHERITED;
}
if (lock == null) {
lock = new CmsLock(siblingName, exclusiveLock.getUserId(), exclusiveLock.getProject(), type);
} else {
CmsLock editionLock = new CmsLock(
siblingName,
exclusiveLock.getUserId(),
exclusiveLock.getProject(),
type);
lock.setRelatedLock(editionLock);
}
}
return lock;
} | java | private CmsLock internalSiblingLock(CmsLock exclusiveLock, String siblingName) {
CmsLock lock = null;
if (!exclusiveLock.getSystemLock().isUnlocked()) {
lock = new CmsLock(
siblingName,
exclusiveLock.getUserId(),
exclusiveLock.getProject(),
exclusiveLock.getSystemLock().getType());
}
if ((lock == null) || !exclusiveLock.getEditionLock().isNullLock()) {
CmsLockType type = CmsLockType.SHARED_EXCLUSIVE;
if (!getParentLock(siblingName).isNullLock()) {
type = CmsLockType.SHARED_INHERITED;
}
if (lock == null) {
lock = new CmsLock(siblingName, exclusiveLock.getUserId(), exclusiveLock.getProject(), type);
} else {
CmsLock editionLock = new CmsLock(
siblingName,
exclusiveLock.getUserId(),
exclusiveLock.getProject(),
type);
lock.setRelatedLock(editionLock);
}
}
return lock;
} | [
"private",
"CmsLock",
"internalSiblingLock",
"(",
"CmsLock",
"exclusiveLock",
",",
"String",
"siblingName",
")",
"{",
"CmsLock",
"lock",
"=",
"null",
";",
"if",
"(",
"!",
"exclusiveLock",
".",
"getSystemLock",
"(",
")",
".",
"isUnlocked",
"(",
")",
")",
"{",... | Returns a shared lock for the given excclusive lock and sibling.<p>
@param exclusiveLock the exclusive lock to use (has to be set on a sibling of siblingName)
@param siblingName the siblings name
@return the shared lock | [
"Returns",
"a",
"shared",
"lock",
"for",
"the",
"given",
"excclusive",
"lock",
"and",
"sibling",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/lock/CmsLockManager.java#L906-L933 |
geomajas/geomajas-project-server | plugin/geocoder/geocoder/src/main/java/org/geomajas/plugin/geocoder/service/GeocoderUtilService.java | GeocoderUtilService.extendPoint | public Envelope extendPoint(Coordinate coordinate, CoordinateReferenceSystem crs,
double width, double height) throws GeomajasException {
"""
Build an area around a point with given width and height in meters.
<p/>
The calculation tries to get the size right up to mm precision, but it may be less precise as the number of
attempts to reach the precision are limited.
@param coordinate center for result envelope.
@param crs crs for coordinate
@param width width in meters
@param height height in meters
@return envelope width requested size (up to mm precision) centered on point
@throws GeomajasException transformation problems
"""
double halfCrsWidth = EXTEND_MAPUNIT_TEST_LENGTH;
double halfCrsHeight = EXTEND_MAPUNIT_TEST_LENGTH;
double x = coordinate.x;
double y = coordinate.y;
for (int i = EXTEND_MAX_ITERATIONS; i > 0; i--) {
try {
Coordinate test;
test = new Coordinate(x + halfCrsWidth, y);
double deltaX = JTS.orthodromicDistance(coordinate, test, crs);
test = new Coordinate(x, y + halfCrsHeight);
double deltaY = JTS.orthodromicDistance(coordinate, test, crs);
if (Math.abs(deltaX - width / 2) < DISTANCE_PRECISION &&
Math.abs(deltaY - height / 2) < DISTANCE_PRECISION) {
break;
}
halfCrsWidth = halfCrsWidth / deltaX * width / 2;
halfCrsHeight = halfCrsHeight / deltaY * height / 2;
} catch (TransformException te) {
throw new GeomajasException(te, ExceptionCode.GEOMETRY_TRANSFORMATION_FAILED, crs);
}
}
return new Envelope(x - halfCrsWidth, x + halfCrsWidth, y - halfCrsHeight, y + halfCrsHeight);
} | java | public Envelope extendPoint(Coordinate coordinate, CoordinateReferenceSystem crs,
double width, double height) throws GeomajasException {
double halfCrsWidth = EXTEND_MAPUNIT_TEST_LENGTH;
double halfCrsHeight = EXTEND_MAPUNIT_TEST_LENGTH;
double x = coordinate.x;
double y = coordinate.y;
for (int i = EXTEND_MAX_ITERATIONS; i > 0; i--) {
try {
Coordinate test;
test = new Coordinate(x + halfCrsWidth, y);
double deltaX = JTS.orthodromicDistance(coordinate, test, crs);
test = new Coordinate(x, y + halfCrsHeight);
double deltaY = JTS.orthodromicDistance(coordinate, test, crs);
if (Math.abs(deltaX - width / 2) < DISTANCE_PRECISION &&
Math.abs(deltaY - height / 2) < DISTANCE_PRECISION) {
break;
}
halfCrsWidth = halfCrsWidth / deltaX * width / 2;
halfCrsHeight = halfCrsHeight / deltaY * height / 2;
} catch (TransformException te) {
throw new GeomajasException(te, ExceptionCode.GEOMETRY_TRANSFORMATION_FAILED, crs);
}
}
return new Envelope(x - halfCrsWidth, x + halfCrsWidth, y - halfCrsHeight, y + halfCrsHeight);
} | [
"public",
"Envelope",
"extendPoint",
"(",
"Coordinate",
"coordinate",
",",
"CoordinateReferenceSystem",
"crs",
",",
"double",
"width",
",",
"double",
"height",
")",
"throws",
"GeomajasException",
"{",
"double",
"halfCrsWidth",
"=",
"EXTEND_MAPUNIT_TEST_LENGTH",
";",
"... | Build an area around a point with given width and height in meters.
<p/>
The calculation tries to get the size right up to mm precision, but it may be less precise as the number of
attempts to reach the precision are limited.
@param coordinate center for result envelope.
@param crs crs for coordinate
@param width width in meters
@param height height in meters
@return envelope width requested size (up to mm precision) centered on point
@throws GeomajasException transformation problems | [
"Build",
"an",
"area",
"around",
"a",
"point",
"with",
"given",
"width",
"and",
"height",
"in",
"meters",
".",
"<p",
"/",
">",
"The",
"calculation",
"tries",
"to",
"get",
"the",
"size",
"right",
"up",
"to",
"mm",
"precision",
"but",
"it",
"may",
"be",
... | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/geocoder/geocoder/src/main/java/org/geomajas/plugin/geocoder/service/GeocoderUtilService.java#L74-L98 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.setTimePicker | public void setTimePicker(TimePicker timePicker, int hour, int minute) {
"""
Sets the time in the specified TimePicker.
@param timePicker the {@link TimePicker} object
@param hour the hour e.g. 15
@param minute the minute e.g. 30
"""
if(config.commandLogging){
Log.d(config.commandLoggingTag, "setTimePicker("+timePicker+", "+hour+", "+minute+")");
}
timePicker = (TimePicker) waiter.waitForView(timePicker, Timeout.getSmallTimeout());
setter.setTimePicker(timePicker, hour, minute);
} | java | public void setTimePicker(TimePicker timePicker, int hour, int minute) {
if(config.commandLogging){
Log.d(config.commandLoggingTag, "setTimePicker("+timePicker+", "+hour+", "+minute+")");
}
timePicker = (TimePicker) waiter.waitForView(timePicker, Timeout.getSmallTimeout());
setter.setTimePicker(timePicker, hour, minute);
} | [
"public",
"void",
"setTimePicker",
"(",
"TimePicker",
"timePicker",
",",
"int",
"hour",
",",
"int",
"minute",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"setTimePicker(\"",... | Sets the time in the specified TimePicker.
@param timePicker the {@link TimePicker} object
@param hour the hour e.g. 15
@param minute the minute e.g. 30 | [
"Sets",
"the",
"time",
"in",
"the",
"specified",
"TimePicker",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2571-L2578 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_senders_sender_DELETE | public void serviceName_senders_sender_DELETE(String serviceName, String sender) throws IOException {
"""
Delete the sms sender given
REST: DELETE /sms/{serviceName}/senders/{sender}
@param serviceName [required] The internal name of your SMS offer
@param sender [required] The sms sender
"""
String qPath = "/sms/{serviceName}/senders/{sender}";
StringBuilder sb = path(qPath, serviceName, sender);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void serviceName_senders_sender_DELETE(String serviceName, String sender) throws IOException {
String qPath = "/sms/{serviceName}/senders/{sender}";
StringBuilder sb = path(qPath, serviceName, sender);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"serviceName_senders_sender_DELETE",
"(",
"String",
"serviceName",
",",
"String",
"sender",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/senders/{sender}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
"... | Delete the sms sender given
REST: DELETE /sms/{serviceName}/senders/{sender}
@param serviceName [required] The internal name of your SMS offer
@param sender [required] The sms sender | [
"Delete",
"the",
"sms",
"sender",
"given"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L210-L214 |
ppiastucki/recast4j | detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java | PathCorridor.isValid | boolean isValid(int maxLookAhead, NavMeshQuery navquery, QueryFilter filter) {
"""
Checks the current corridor path to see if its polygon references remain valid. The path can be invalidated if
there are structural changes to the underlying navigation mesh, or the state of a polygon within the path changes
resulting in it being filtered out. (E.g. An exclusion or inclusion flag changes.)
@param maxLookAhead
The number of polygons from the beginning of the corridor to search.
@param navquery
The query object used to build the corridor.
@param filter
The filter to apply to the operation.
@return
"""
// Check that all polygons still pass query filter.
int n = Math.min(m_path.size(), maxLookAhead);
for (int i = 0; i < n; ++i) {
if (!navquery.isValidPolyRef(m_path.get(i), filter)) {
return false;
}
}
return true;
} | java | boolean isValid(int maxLookAhead, NavMeshQuery navquery, QueryFilter filter) {
// Check that all polygons still pass query filter.
int n = Math.min(m_path.size(), maxLookAhead);
for (int i = 0; i < n; ++i) {
if (!navquery.isValidPolyRef(m_path.get(i), filter)) {
return false;
}
}
return true;
} | [
"boolean",
"isValid",
"(",
"int",
"maxLookAhead",
",",
"NavMeshQuery",
"navquery",
",",
"QueryFilter",
"filter",
")",
"{",
"// Check that all polygons still pass query filter.",
"int",
"n",
"=",
"Math",
".",
"min",
"(",
"m_path",
".",
"size",
"(",
")",
",",
"max... | Checks the current corridor path to see if its polygon references remain valid. The path can be invalidated if
there are structural changes to the underlying navigation mesh, or the state of a polygon within the path changes
resulting in it being filtered out. (E.g. An exclusion or inclusion flag changes.)
@param maxLookAhead
The number of polygons from the beginning of the corridor to search.
@param navquery
The query object used to build the corridor.
@param filter
The filter to apply to the operation.
@return | [
"Checks",
"the",
"current",
"corridor",
"path",
"to",
"see",
"if",
"its",
"polygon",
"references",
"remain",
"valid",
".",
"The",
"path",
"can",
"be",
"invalidated",
"if",
"there",
"are",
"structural",
"changes",
"to",
"the",
"underlying",
"navigation",
"mesh"... | train | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java#L503-L513 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java | Aggregations.doubleMin | public static <Key, Value> Aggregation<Key, Double, Double> doubleMin() {
"""
Returns an aggregation to find the double minimum of all supplied values.<br/>
This aggregation is similar to: <pre>SELECT MIN(value) FROM x</pre>
@param <Key> the input key type
@param <Value> the supplied value type
@return the minimum value over all supplied values
"""
return new AggregationAdapter(new DoubleMinAggregation<Key, Value>());
} | java | public static <Key, Value> Aggregation<Key, Double, Double> doubleMin() {
return new AggregationAdapter(new DoubleMinAggregation<Key, Value>());
} | [
"public",
"static",
"<",
"Key",
",",
"Value",
">",
"Aggregation",
"<",
"Key",
",",
"Double",
",",
"Double",
">",
"doubleMin",
"(",
")",
"{",
"return",
"new",
"AggregationAdapter",
"(",
"new",
"DoubleMinAggregation",
"<",
"Key",
",",
"Value",
">",
"(",
")... | Returns an aggregation to find the double minimum of all supplied values.<br/>
This aggregation is similar to: <pre>SELECT MIN(value) FROM x</pre>
@param <Key> the input key type
@param <Value> the supplied value type
@return the minimum value over all supplied values | [
"Returns",
"an",
"aggregation",
"to",
"find",
"the",
"double",
"minimum",
"of",
"all",
"supplied",
"values",
".",
"<br",
"/",
">",
"This",
"aggregation",
"is",
"similar",
"to",
":",
"<pre",
">",
"SELECT",
"MIN",
"(",
"value",
")",
"FROM",
"x<",
"/",
"p... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L222-L224 |
Multifarious/MacroManager | src/main/java/com/fasterxml/mama/balancing/MeteredBalancingPolicy.java | MeteredBalancingPolicy.drainToLoad | protected void drainToLoad(long targetLoad, int time, boolean useHandoff) {
"""
Drains excess load on this node down to a fraction distributed across the cluster.
The target load is set to (clusterLoad / # nodes).
"""
final double startingLoad = myLoad();
double currentLoad = startingLoad;
List<String> drainList = new LinkedList<String>();
Set<String> eligibleToDrop = new LinkedHashSet<String>(cluster.myWorkUnits);
eligibleToDrop.removeAll(cluster.workUnitsPeggedToMe);
for (String workUnit : eligibleToDrop) {
if (currentLoad <= targetLoad) {
break;
}
double workUnitLoad = cluster.getWorkUnitLoad(workUnit);
if (workUnitLoad > 0 && (currentLoad - workUnitLoad) > targetLoad) {
drainList.add(workUnit);
currentLoad -= workUnitLoad;
}
}
int drainInterval = (int) (((double) config.drainTime / drainList.size()) * 1000);
TimerTask drainTask = buildDrainTask(drainList, drainInterval, useHandoff, currentLoad);
if (!drainList.isEmpty()) {
LOG.info("Releasing work units over {} seconds. Current load: {}. Target: {}. Releasing: {}",
time, startingLoad, targetLoad, Strings.mkstring(drainList, ", "));
cluster.schedule(drainTask, 0, TimeUnit.SECONDS);
}
} | java | protected void drainToLoad(long targetLoad, int time, boolean useHandoff)
{
final double startingLoad = myLoad();
double currentLoad = startingLoad;
List<String> drainList = new LinkedList<String>();
Set<String> eligibleToDrop = new LinkedHashSet<String>(cluster.myWorkUnits);
eligibleToDrop.removeAll(cluster.workUnitsPeggedToMe);
for (String workUnit : eligibleToDrop) {
if (currentLoad <= targetLoad) {
break;
}
double workUnitLoad = cluster.getWorkUnitLoad(workUnit);
if (workUnitLoad > 0 && (currentLoad - workUnitLoad) > targetLoad) {
drainList.add(workUnit);
currentLoad -= workUnitLoad;
}
}
int drainInterval = (int) (((double) config.drainTime / drainList.size()) * 1000);
TimerTask drainTask = buildDrainTask(drainList, drainInterval, useHandoff, currentLoad);
if (!drainList.isEmpty()) {
LOG.info("Releasing work units over {} seconds. Current load: {}. Target: {}. Releasing: {}",
time, startingLoad, targetLoad, Strings.mkstring(drainList, ", "));
cluster.schedule(drainTask, 0, TimeUnit.SECONDS);
}
} | [
"protected",
"void",
"drainToLoad",
"(",
"long",
"targetLoad",
",",
"int",
"time",
",",
"boolean",
"useHandoff",
")",
"{",
"final",
"double",
"startingLoad",
"=",
"myLoad",
"(",
")",
";",
"double",
"currentLoad",
"=",
"startingLoad",
";",
"List",
"<",
"Strin... | Drains excess load on this node down to a fraction distributed across the cluster.
The target load is set to (clusterLoad / # nodes). | [
"Drains",
"excess",
"load",
"on",
"this",
"node",
"down",
"to",
"a",
"fraction",
"distributed",
"across",
"the",
"cluster",
".",
"The",
"target",
"load",
"is",
"set",
"to",
"(",
"clusterLoad",
"/",
"#",
"nodes",
")",
"."
] | train | https://github.com/Multifarious/MacroManager/blob/559785839981f460aaeba3c3fddff7fb667d9581/src/main/java/com/fasterxml/mama/balancing/MeteredBalancingPolicy.java#L200-L228 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/StatementBuilder.java | StatementBuilder.appendStatementString | protected void appendStatementString(StringBuilder sb, List<ArgumentHolder> argList) throws SQLException {
"""
Internal method to build a query while tracking various arguments. Users should use the
{@link #prepareStatementString()} method instead.
<p>
This needs to be protected because of (WARNING: DO NOT MAKE A JAVADOC LINK) InternalQueryBuilder (WARNING: DO NOT
MAKE A JAVADOC LINK).
</p>
"""
appendStatementStart(sb, argList);
appendWhereStatement(sb, argList, WhereOperation.FIRST);
appendStatementEnd(sb, argList);
} | java | protected void appendStatementString(StringBuilder sb, List<ArgumentHolder> argList) throws SQLException {
appendStatementStart(sb, argList);
appendWhereStatement(sb, argList, WhereOperation.FIRST);
appendStatementEnd(sb, argList);
} | [
"protected",
"void",
"appendStatementString",
"(",
"StringBuilder",
"sb",
",",
"List",
"<",
"ArgumentHolder",
">",
"argList",
")",
"throws",
"SQLException",
"{",
"appendStatementStart",
"(",
"sb",
",",
"argList",
")",
";",
"appendWhereStatement",
"(",
"sb",
",",
... | Internal method to build a query while tracking various arguments. Users should use the
{@link #prepareStatementString()} method instead.
<p>
This needs to be protected because of (WARNING: DO NOT MAKE A JAVADOC LINK) InternalQueryBuilder (WARNING: DO NOT
MAKE A JAVADOC LINK).
</p> | [
"Internal",
"method",
"to",
"build",
"a",
"query",
"while",
"tracking",
"various",
"arguments",
".",
"Users",
"should",
"use",
"the",
"{",
"@link",
"#prepareStatementString",
"()",
"}",
"method",
"instead",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementBuilder.java#L131-L135 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/crf/CRFBiasedClassifier.java | CRFBiasedClassifier.adjustBias | public void adjustBias(List<List<IN>> develData, Function<Double,Double> evalFunction, double low, double high) {
"""
/*
Adjust the bias parameter to optimize some objective function.
Note that this function only tunes the bias parameter of one class
(class of index 0), and is thus only useful for binary classification
problems.
"""
LineSearcher ls = new GoldenSectionLineSearch(true,1e-2,low,high);
CRFBiasedClassifierOptimizer optimizer = new CRFBiasedClassifierOptimizer(this, evalFunction);
double optVal = ls.minimize(optimizer);
int bi = featureIndex.indexOf(BIAS);
System.err.println("Class bias of "+weights[bi][0]+" reaches optimial value "+optVal);
} | java | public void adjustBias(List<List<IN>> develData, Function<Double,Double> evalFunction, double low, double high) {
LineSearcher ls = new GoldenSectionLineSearch(true,1e-2,low,high);
CRFBiasedClassifierOptimizer optimizer = new CRFBiasedClassifierOptimizer(this, evalFunction);
double optVal = ls.minimize(optimizer);
int bi = featureIndex.indexOf(BIAS);
System.err.println("Class bias of "+weights[bi][0]+" reaches optimial value "+optVal);
} | [
"public",
"void",
"adjustBias",
"(",
"List",
"<",
"List",
"<",
"IN",
">",
">",
"develData",
",",
"Function",
"<",
"Double",
",",
"Double",
">",
"evalFunction",
",",
"double",
"low",
",",
"double",
"high",
")",
"{",
"LineSearcher",
"ls",
"=",
"new",
"Go... | /*
Adjust the bias parameter to optimize some objective function.
Note that this function only tunes the bias parameter of one class
(class of index 0), and is thus only useful for binary classification
problems. | [
"/",
"*",
"Adjust",
"the",
"bias",
"parameter",
"to",
"optimize",
"some",
"objective",
"function",
".",
"Note",
"that",
"this",
"function",
"only",
"tunes",
"the",
"bias",
"parameter",
"of",
"one",
"class",
"(",
"class",
"of",
"index",
"0",
")",
"and",
"... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/crf/CRFBiasedClassifier.java#L132-L138 |
xcesco/kripton | kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SqlUtils.java | SqlUtils.printIf | public static String printIf(boolean condition, String format, Object ...objects) {
"""
Display string <code>String.format(format, objects)</code> only if condition is true
@param condition the condition
@param format the format
@param objects the objects
@return the string
"""
return condition ? String.format(format, objects) : "";
} | java | public static String printIf(boolean condition, String format, Object ...objects)
{
return condition ? String.format(format, objects) : "";
} | [
"public",
"static",
"String",
"printIf",
"(",
"boolean",
"condition",
",",
"String",
"format",
",",
"Object",
"...",
"objects",
")",
"{",
"return",
"condition",
"?",
"String",
".",
"format",
"(",
"format",
",",
"objects",
")",
":",
"\"\"",
";",
"}"
] | Display string <code>String.format(format, objects)</code> only if condition is true
@param condition the condition
@param format the format
@param objects the objects
@return the string | [
"Display",
"string",
"<code",
">",
"String",
".",
"format",
"(",
"format",
"objects",
")",
"<",
"/",
"code",
">",
"only",
"if",
"condition",
"is",
"true"
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SqlUtils.java#L34-L37 |
VoltDB/voltdb | src/frontend/org/voltdb/StatsSource.java | StatsSource.updateStatsRow | protected void updateStatsRow(Object rowKey, Object rowValues[]) {
"""
Update the parameter array with the latest values. This is similar to
populateColumnSchema in that it must be overriden by derived classes and
the derived class implementation must call the super classes
implementation.
@param rowKey Key identifying the specific row to be populated
@param rowValues Output parameter. Array of values to be updated.
"""
rowValues[0] = now;
rowValues[1] = m_hostId;
rowValues[2] = m_hostname;
} | java | protected void updateStatsRow(Object rowKey, Object rowValues[]) {
rowValues[0] = now;
rowValues[1] = m_hostId;
rowValues[2] = m_hostname;
} | [
"protected",
"void",
"updateStatsRow",
"(",
"Object",
"rowKey",
",",
"Object",
"rowValues",
"[",
"]",
")",
"{",
"rowValues",
"[",
"0",
"]",
"=",
"now",
";",
"rowValues",
"[",
"1",
"]",
"=",
"m_hostId",
";",
"rowValues",
"[",
"2",
"]",
"=",
"m_hostname"... | Update the parameter array with the latest values. This is similar to
populateColumnSchema in that it must be overriden by derived classes and
the derived class implementation must call the super classes
implementation.
@param rowKey Key identifying the specific row to be populated
@param rowValues Output parameter. Array of values to be updated. | [
"Update",
"the",
"parameter",
"array",
"with",
"the",
"latest",
"values",
".",
"This",
"is",
"similar",
"to",
"populateColumnSchema",
"in",
"that",
"it",
"must",
"be",
"overriden",
"by",
"derived",
"classes",
"and",
"the",
"derived",
"class",
"implementation",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/StatsSource.java#L183-L187 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java | AbstractMemberWriter.addComment | protected void addComment(Element member, Content htmltree) {
"""
Add the comment for the given member.
@param member the member being documented.
@param htmltree the content tree to which the comment will be added.
"""
if (!utils.getFullBody(member).isEmpty()) {
writer.addInlineComment(member, htmltree);
}
} | java | protected void addComment(Element member, Content htmltree) {
if (!utils.getFullBody(member).isEmpty()) {
writer.addInlineComment(member, htmltree);
}
} | [
"protected",
"void",
"addComment",
"(",
"Element",
"member",
",",
"Content",
"htmltree",
")",
"{",
"if",
"(",
"!",
"utils",
".",
"getFullBody",
"(",
"member",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"writer",
".",
"addInlineComment",
"(",
"member",
",",... | Add the comment for the given member.
@param member the member being documented.
@param htmltree the content tree to which the comment will be added. | [
"Add",
"the",
"comment",
"for",
"the",
"given",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java#L369-L373 |
hltcoe/annotated-nyt | src/main/java/com/nytlabs/corpus/NYTCorpusDocumentParser.java | NYTCorpusDocumentParser.getDOMObject | private Document getDOMObject(InputStream is, boolean validating)
throws SAXException, IOException, ParserConfigurationException {
"""
Parse an {@link InputStream} containing an XML document, into a DOM object.
@param is
An {@link InputStream} representing an xml file.
@param validating
True iff validating should be turned on.
@return A DOM Object containing a parsed XML document or a null value if
there is an error in parsing.
@throws ParserConfigurationException
@throws IOException
@throws SAXException
"""
// Create a builder factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
if (!validating) {
factory.setValidating(validating);
factory.setSchema(null);
factory.setNamespaceAware(false);
}
DocumentBuilder builder = factory.newDocumentBuilder();
// Create the builder and parse the file
Document doc = builder.parse(is);
return doc;
} | java | private Document getDOMObject(InputStream is, boolean validating)
throws SAXException, IOException, ParserConfigurationException {
// Create a builder factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
if (!validating) {
factory.setValidating(validating);
factory.setSchema(null);
factory.setNamespaceAware(false);
}
DocumentBuilder builder = factory.newDocumentBuilder();
// Create the builder and parse the file
Document doc = builder.parse(is);
return doc;
} | [
"private",
"Document",
"getDOMObject",
"(",
"InputStream",
"is",
",",
"boolean",
"validating",
")",
"throws",
"SAXException",
",",
"IOException",
",",
"ParserConfigurationException",
"{",
"// Create a builder factory",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuil... | Parse an {@link InputStream} containing an XML document, into a DOM object.
@param is
An {@link InputStream} representing an xml file.
@param validating
True iff validating should be turned on.
@return A DOM Object containing a parsed XML document or a null value if
there is an error in parsing.
@throws ParserConfigurationException
@throws IOException
@throws SAXException | [
"Parse",
"an",
"{",
"@link",
"InputStream",
"}",
"containing",
"an",
"XML",
"document",
"into",
"a",
"DOM",
"object",
"."
] | train | https://github.com/hltcoe/annotated-nyt/blob/0a4daa97705591cefea9de61614770ae2665a48e/src/main/java/com/nytlabs/corpus/NYTCorpusDocumentParser.java#L464-L480 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityEngine.java | DefaultVelocityEngine.restoreTemplateScope | private void restoreTemplateScope(InternalContextAdapterImpl ica, Scope currentTemplateScope) {
"""
Restore the previous {@code $template} variable, if any, in the velocity context.
@param ica the current velocity context
@param currentTemplateScope the current Scope, from which to take the replaced variable
"""
if (currentTemplateScope.getParent() != null) {
ica.put(TEMPLATE_SCOPE_NAME, currentTemplateScope.getParent());
} else if (currentTemplateScope.getReplaced() != null) {
ica.put(TEMPLATE_SCOPE_NAME, currentTemplateScope.getReplaced());
} else {
ica.remove(TEMPLATE_SCOPE_NAME);
}
} | java | private void restoreTemplateScope(InternalContextAdapterImpl ica, Scope currentTemplateScope)
{
if (currentTemplateScope.getParent() != null) {
ica.put(TEMPLATE_SCOPE_NAME, currentTemplateScope.getParent());
} else if (currentTemplateScope.getReplaced() != null) {
ica.put(TEMPLATE_SCOPE_NAME, currentTemplateScope.getReplaced());
} else {
ica.remove(TEMPLATE_SCOPE_NAME);
}
} | [
"private",
"void",
"restoreTemplateScope",
"(",
"InternalContextAdapterImpl",
"ica",
",",
"Scope",
"currentTemplateScope",
")",
"{",
"if",
"(",
"currentTemplateScope",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"ica",
".",
"put",
"(",
"TEMPLATE_SCOPE_NAME... | Restore the previous {@code $template} variable, if any, in the velocity context.
@param ica the current velocity context
@param currentTemplateScope the current Scope, from which to take the replaced variable | [
"Restore",
"the",
"previous",
"{",
"@code",
"$template",
"}",
"variable",
"if",
"any",
"in",
"the",
"velocity",
"context",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityEngine.java#L178-L187 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java | ActiveSyncManager.launchPollingThread | public void launchPollingThread(long mountId, long txId) {
"""
Launches polling thread on a particular mount point with starting txId.
@param mountId launch polling thread on a mount id
@param txId specifies the transaction id to initialize the pollling thread
"""
LOG.debug("launch polling thread for mount id {}, txId {}", mountId, txId);
if (!mPollerMap.containsKey(mountId)) {
try (CloseableResource<UnderFileSystem> ufsClient =
mMountTable.getUfsClient(mountId).acquireUfsResource()) {
ufsClient.get().startActiveSyncPolling(txId);
} catch (IOException e) {
LOG.warn("IO Exception trying to launch Polling thread {}", e);
}
ActiveSyncer syncer = new ActiveSyncer(mFileSystemMaster, this, mMountTable, mountId);
Future<?> future = getExecutor().submit(
new HeartbeatThread(HeartbeatContext.MASTER_ACTIVE_UFS_SYNC,
syncer, (int) ServerConfiguration.getMs(PropertyKey.MASTER_ACTIVE_UFS_SYNC_INTERVAL),
ServerConfiguration.global()));
mPollerMap.put(mountId, future);
}
} | java | public void launchPollingThread(long mountId, long txId) {
LOG.debug("launch polling thread for mount id {}, txId {}", mountId, txId);
if (!mPollerMap.containsKey(mountId)) {
try (CloseableResource<UnderFileSystem> ufsClient =
mMountTable.getUfsClient(mountId).acquireUfsResource()) {
ufsClient.get().startActiveSyncPolling(txId);
} catch (IOException e) {
LOG.warn("IO Exception trying to launch Polling thread {}", e);
}
ActiveSyncer syncer = new ActiveSyncer(mFileSystemMaster, this, mMountTable, mountId);
Future<?> future = getExecutor().submit(
new HeartbeatThread(HeartbeatContext.MASTER_ACTIVE_UFS_SYNC,
syncer, (int) ServerConfiguration.getMs(PropertyKey.MASTER_ACTIVE_UFS_SYNC_INTERVAL),
ServerConfiguration.global()));
mPollerMap.put(mountId, future);
}
} | [
"public",
"void",
"launchPollingThread",
"(",
"long",
"mountId",
",",
"long",
"txId",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"launch polling thread for mount id {}, txId {}\"",
",",
"mountId",
",",
"txId",
")",
";",
"if",
"(",
"!",
"mPollerMap",
".",
"containsKey... | Launches polling thread on a particular mount point with starting txId.
@param mountId launch polling thread on a mount id
@param txId specifies the transaction id to initialize the pollling thread | [
"Launches",
"polling",
"thread",
"on",
"a",
"particular",
"mount",
"point",
"with",
"starting",
"txId",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java#L209-L225 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/searchindex/CmsSearchWidgetDialog.java | CmsSearchWidgetDialog.initWorkplaceRequestValues | @SuppressWarnings( {
"""
Additionally saves <code>{@link #PARAM_SEARCH_PARAMS}</code> to the dialog object map.<p>
@see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
""""unchecked", "rawtypes"})
@Override
protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) {
super.initWorkplaceRequestValues(settings, request);
Map dialogMap = (Map)getDialogObject();
if (dialogMap != null) {
dialogMap.put(PARAM_SEARCH_PARAMS, m_searchParams);
dialogMap.put(PARAM_SEARCH_OBJECT, m_search);
}
} | java | @SuppressWarnings({"unchecked", "rawtypes"})
@Override
protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) {
super.initWorkplaceRequestValues(settings, request);
Map dialogMap = (Map)getDialogObject();
if (dialogMap != null) {
dialogMap.put(PARAM_SEARCH_PARAMS, m_searchParams);
dialogMap.put(PARAM_SEARCH_OBJECT, m_search);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"@",
"Override",
"protected",
"void",
"initWorkplaceRequestValues",
"(",
"CmsWorkplaceSettings",
"settings",
",",
"HttpServletRequest",
"request",
")",
"{",
"super",
".",
"initWorkplace... | Additionally saves <code>{@link #PARAM_SEARCH_PARAMS}</code> to the dialog object map.<p>
@see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest) | [
"Additionally",
"saves",
"<code",
">",
"{",
"@link",
"#PARAM_SEARCH_PARAMS",
"}",
"<",
"/",
"code",
">",
"to",
"the",
"dialog",
"object",
"map",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsSearchWidgetDialog.java#L515-L525 |
networknt/light-4j | dump/src/main/java/com/networknt/dump/StatusCodeDumper.java | StatusCodeDumper.putDumpInfoTo | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
"""
put this.statusCodeResult to result
@param result a Map you want to put dumping info to.
"""
if(StringUtils.isNotBlank(this.statusCodeResult)) {
result.put(DumpConstants.STATUS_CODE, this.statusCodeResult);
}
} | java | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(StringUtils.isNotBlank(this.statusCodeResult)) {
result.put(DumpConstants.STATUS_CODE, this.statusCodeResult);
}
} | [
"@",
"Override",
"protected",
"void",
"putDumpInfoTo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"this",
".",
"statusCodeResult",
")",
")",
"{",
"result",
".",
"put",
"(",
"DumpCo... | put this.statusCodeResult to result
@param result a Map you want to put dumping info to. | [
"put",
"this",
".",
"statusCodeResult",
"to",
"result"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/StatusCodeDumper.java#L48-L53 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java | SnowflakeStatementV1.executeQuery | @Override
public ResultSet executeQuery(String sql) throws SQLException {
"""
Execute SQL query
@param sql sql statement
@return ResultSet
@throws SQLException if @link{#executeQueryInternal(String, Map)} throws an exception
"""
raiseSQLExceptionIfStatementIsClosed();
return executeQueryInternal(sql, null);
} | java | @Override
public ResultSet executeQuery(String sql) throws SQLException
{
raiseSQLExceptionIfStatementIsClosed();
return executeQueryInternal(sql, null);
} | [
"@",
"Override",
"public",
"ResultSet",
"executeQuery",
"(",
"String",
"sql",
")",
"throws",
"SQLException",
"{",
"raiseSQLExceptionIfStatementIsClosed",
"(",
")",
";",
"return",
"executeQueryInternal",
"(",
"sql",
",",
"null",
")",
";",
"}"
] | Execute SQL query
@param sql sql statement
@return ResultSet
@throws SQLException if @link{#executeQueryInternal(String, Map)} throws an exception | [
"Execute",
"SQL",
"query"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java#L159-L164 |
wildfly/wildfly-build-tools | provisioning/src/main/java/org/wildfly/build/util/ZipFileSubsystemInputStreamSources.java | ZipFileSubsystemInputStreamSources.addSubsystemFileSource | public void addSubsystemFileSource(String subsystemFileName, File zipFile, ZipEntry zipEntry) {
"""
Creates a zip entry inputstream source and maps it to the specified filename.
@param subsystemFileName
@param zipFile
@param zipEntry
"""
inputStreamSourceMap.put(subsystemFileName, new ZipEntryInputStreamSource(zipFile, zipEntry));
} | java | public void addSubsystemFileSource(String subsystemFileName, File zipFile, ZipEntry zipEntry) {
inputStreamSourceMap.put(subsystemFileName, new ZipEntryInputStreamSource(zipFile, zipEntry));
} | [
"public",
"void",
"addSubsystemFileSource",
"(",
"String",
"subsystemFileName",
",",
"File",
"zipFile",
",",
"ZipEntry",
"zipEntry",
")",
"{",
"inputStreamSourceMap",
".",
"put",
"(",
"subsystemFileName",
",",
"new",
"ZipEntryInputStreamSource",
"(",
"zipFile",
",",
... | Creates a zip entry inputstream source and maps it to the specified filename.
@param subsystemFileName
@param zipFile
@param zipEntry | [
"Creates",
"a",
"zip",
"entry",
"inputstream",
"source",
"and",
"maps",
"it",
"to",
"the",
"specified",
"filename",
"."
] | train | https://github.com/wildfly/wildfly-build-tools/blob/520a5f2e58e6a24097d63fd65c51a8fc29847a61/provisioning/src/main/java/org/wildfly/build/util/ZipFileSubsystemInputStreamSources.java#L45-L47 |
Erudika/para | para-server/src/main/java/com/erudika/para/rest/RestUtils.java | RestUtils.getStatusResponse | public static Response getStatusResponse(Response.Status status, String... messages) {
"""
A generic JSON response handler.
@param status status code
@param messages zero or more errors
@return a response as JSON
"""
if (status == null) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
String msg = StringUtils.join(messages, ". ");
if (StringUtils.isBlank(msg)) {
msg = status.getReasonPhrase();
}
try {
return GenericExceptionMapper.getExceptionResponse(status.getStatusCode(), msg);
} catch (Exception ex) {
logger.error(null, ex);
return Response.status(Response.Status.BAD_REQUEST).build();
}
} | java | public static Response getStatusResponse(Response.Status status, String... messages) {
if (status == null) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
String msg = StringUtils.join(messages, ". ");
if (StringUtils.isBlank(msg)) {
msg = status.getReasonPhrase();
}
try {
return GenericExceptionMapper.getExceptionResponse(status.getStatusCode(), msg);
} catch (Exception ex) {
logger.error(null, ex);
return Response.status(Response.Status.BAD_REQUEST).build();
}
} | [
"public",
"static",
"Response",
"getStatusResponse",
"(",
"Response",
".",
"Status",
"status",
",",
"String",
"...",
"messages",
")",
"{",
"if",
"(",
"status",
"==",
"null",
")",
"{",
"return",
"Response",
".",
"status",
"(",
"Response",
".",
"Status",
"."... | A generic JSON response handler.
@param status status code
@param messages zero or more errors
@return a response as JSON | [
"A",
"generic",
"JSON",
"response",
"handler",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L920-L934 |
keyboardsurfer/Crouton | library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java | Crouton.showText | public static void showText(Activity activity, int textResourceId, Style style, ViewGroup viewGroup) {
"""
Creates a {@link Crouton} with provided text-resource and style for a given
activity and displays it directly.
@param activity
The {@link Activity} that represents the context in which the Crouton should exist.
@param textResourceId
The resource id of the text you want to display.
@param style
The style that this {@link Crouton} should be created with.
@param viewGroup
The {@link ViewGroup} that this {@link Crouton} should be added to.
"""
showText(activity, activity.getString(textResourceId), style, viewGroup);
} | java | public static void showText(Activity activity, int textResourceId, Style style, ViewGroup viewGroup) {
showText(activity, activity.getString(textResourceId), style, viewGroup);
} | [
"public",
"static",
"void",
"showText",
"(",
"Activity",
"activity",
",",
"int",
"textResourceId",
",",
"Style",
"style",
",",
"ViewGroup",
"viewGroup",
")",
"{",
"showText",
"(",
"activity",
",",
"activity",
".",
"getString",
"(",
"textResourceId",
")",
",",
... | Creates a {@link Crouton} with provided text-resource and style for a given
activity and displays it directly.
@param activity
The {@link Activity} that represents the context in which the Crouton should exist.
@param textResourceId
The resource id of the text you want to display.
@param style
The style that this {@link Crouton} should be created with.
@param viewGroup
The {@link ViewGroup} that this {@link Crouton} should be added to. | [
"Creates",
"a",
"{",
"@link",
"Crouton",
"}",
"with",
"provided",
"text",
"-",
"resource",
"and",
"style",
"for",
"a",
"given",
"activity",
"and",
"displays",
"it",
"directly",
"."
] | train | https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java#L510-L512 |
pac4j/pac4j | pac4j-saml/src/main/java/org/pac4j/saml/transport/Pac4jHTTPRedirectDeflateEncoder.java | Pac4jHTTPRedirectDeflateEncoder.buildRedirectURL | protected String buildRedirectURL(MessageContext<SAMLObject> messageContext, String endpoint, String message)
throws MessageEncodingException {
"""
Builds the URL to redirect the client to.
@param messageContext current message context
@param endpoint endpoint URL to send encoded message to
@param message Deflated and Base64 encoded message
@return URL to redirect client to
@throws MessageEncodingException thrown if the SAML message is neither a RequestAbstractType or Response
"""
log.debug("Building URL to redirect client to");
URLBuilder urlBuilder;
try {
urlBuilder = new URLBuilder(endpoint);
} catch (MalformedURLException e) {
throw new MessageEncodingException("Endpoint URL " + endpoint + " is not a valid URL", e);
}
List<Pair<String, String>> queryParams = urlBuilder.getQueryParams();
queryParams.clear();
SAMLObject outboundMessage = messageContext.getMessage();
if (outboundMessage instanceof RequestAbstractType) {
queryParams.add(new Pair<>("SAMLRequest", message));
} else if (outboundMessage instanceof StatusResponseType) {
queryParams.add(new Pair<>("SAMLResponse", message));
} else {
throw new MessageEncodingException(
"SAML message is neither a SAML RequestAbstractType or StatusResponseType");
}
String relayState = SAMLBindingSupport.getRelayState(messageContext);
if (SAMLBindingSupport.checkRelayState(relayState)) {
queryParams.add(new Pair<>("RelayState", relayState));
}
SignatureSigningParameters signingParameters =
SAMLMessageSecuritySupport.getContextSigningParameters(messageContext);
if (signingParameters != null && signingParameters.getSigningCredential() != null) {
String sigAlgURI = getSignatureAlgorithmURI(signingParameters);
Pair<String, String> sigAlg = new Pair<>("SigAlg", sigAlgURI);
queryParams.add(sigAlg);
String sigMaterial = urlBuilder.buildQueryString();
queryParams.add(new Pair<>("Signature", generateSignature(
signingParameters.getSigningCredential(), sigAlgURI, sigMaterial)));
} else {
log.debug("No signing credential was supplied, skipping HTTP-Redirect DEFLATE signing");
}
return urlBuilder.buildURL();
} | java | protected String buildRedirectURL(MessageContext<SAMLObject> messageContext, String endpoint, String message)
throws MessageEncodingException {
log.debug("Building URL to redirect client to");
URLBuilder urlBuilder;
try {
urlBuilder = new URLBuilder(endpoint);
} catch (MalformedURLException e) {
throw new MessageEncodingException("Endpoint URL " + endpoint + " is not a valid URL", e);
}
List<Pair<String, String>> queryParams = urlBuilder.getQueryParams();
queryParams.clear();
SAMLObject outboundMessage = messageContext.getMessage();
if (outboundMessage instanceof RequestAbstractType) {
queryParams.add(new Pair<>("SAMLRequest", message));
} else if (outboundMessage instanceof StatusResponseType) {
queryParams.add(new Pair<>("SAMLResponse", message));
} else {
throw new MessageEncodingException(
"SAML message is neither a SAML RequestAbstractType or StatusResponseType");
}
String relayState = SAMLBindingSupport.getRelayState(messageContext);
if (SAMLBindingSupport.checkRelayState(relayState)) {
queryParams.add(new Pair<>("RelayState", relayState));
}
SignatureSigningParameters signingParameters =
SAMLMessageSecuritySupport.getContextSigningParameters(messageContext);
if (signingParameters != null && signingParameters.getSigningCredential() != null) {
String sigAlgURI = getSignatureAlgorithmURI(signingParameters);
Pair<String, String> sigAlg = new Pair<>("SigAlg", sigAlgURI);
queryParams.add(sigAlg);
String sigMaterial = urlBuilder.buildQueryString();
queryParams.add(new Pair<>("Signature", generateSignature(
signingParameters.getSigningCredential(), sigAlgURI, sigMaterial)));
} else {
log.debug("No signing credential was supplied, skipping HTTP-Redirect DEFLATE signing");
}
return urlBuilder.buildURL();
} | [
"protected",
"String",
"buildRedirectURL",
"(",
"MessageContext",
"<",
"SAMLObject",
">",
"messageContext",
",",
"String",
"endpoint",
",",
"String",
"message",
")",
"throws",
"MessageEncodingException",
"{",
"log",
".",
"debug",
"(",
"\"Building URL to redirect client ... | Builds the URL to redirect the client to.
@param messageContext current message context
@param endpoint endpoint URL to send encoded message to
@param message Deflated and Base64 encoded message
@return URL to redirect client to
@throws MessageEncodingException thrown if the SAML message is neither a RequestAbstractType or Response | [
"Builds",
"the",
"URL",
"to",
"redirect",
"the",
"client",
"to",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/transport/Pac4jHTTPRedirectDeflateEncoder.java#L169-L214 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java | FirewallRulesInner.createOrUpdate | public FirewallRuleInner createOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) {
"""
Creates or updates a firewall rule.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param firewallRuleName The name of the firewall rule.
@param parameters The required parameters for creating or updating a firewall rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the FirewallRuleInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().body();
} | java | public FirewallRuleInner createOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().body();
} | [
"public",
"FirewallRuleInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"firewallRuleName",
",",
"FirewallRuleInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",... | Creates or updates a firewall rule.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param firewallRuleName The name of the firewall rule.
@param parameters The required parameters for creating or updating a firewall rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the FirewallRuleInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"firewall",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java#L89-L91 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/user/UserRowSync.java | UserRowSync.setRow | public void setRow(long id, TRow row) {
"""
Set the row id, row, and notify all waiting threads to retrieve the row.
@param id
user row id
@param row
user row or null
"""
lock.lock();
try {
RowCondition rowCondition = rows.remove(id);
if (rowCondition != null) {
rowCondition.row = row;
rowCondition.condition.signalAll();
}
} finally {
lock.unlock();
}
} | java | public void setRow(long id, TRow row) {
lock.lock();
try {
RowCondition rowCondition = rows.remove(id);
if (rowCondition != null) {
rowCondition.row = row;
rowCondition.condition.signalAll();
}
} finally {
lock.unlock();
}
} | [
"public",
"void",
"setRow",
"(",
"long",
"id",
",",
"TRow",
"row",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"RowCondition",
"rowCondition",
"=",
"rows",
".",
"remove",
"(",
"id",
")",
";",
"if",
"(",
"rowCondition",
"!=",
"null",
"... | Set the row id, row, and notify all waiting threads to retrieve the row.
@param id
user row id
@param row
user row or null | [
"Set",
"the",
"row",
"id",
"row",
"and",
"notify",
"all",
"waiting",
"threads",
"to",
"retrieve",
"the",
"row",
"."
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserRowSync.java#L114-L126 |
gocd/gocd | base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java | DirectoryScanner.scandir | protected void scandir(File dir, String vpath, boolean fast) {
"""
Scan the given directory for files and directories. Found files and
directories are placed in their respective collections, based on the
matching of includes, excludes, and the selectors. When a directory
is found, it is scanned recursively.
@param dir The directory to scan. Must not be <code>null</code>.
@param vpath The path relative to the base directory (needed to
prevent problems with an absolute path when using
dir). Must not be <code>null</code>.
@param fast Whether or not this call is part of a fast scan.
@see #filesIncluded
@see #filesNotIncluded
@see #filesExcluded
@see #dirsIncluded
@see #dirsNotIncluded
@see #dirsExcluded
@see #slowScan
"""
if (dir == null) {
throw new RuntimeException("dir must not be null.");
}
String[] newfiles = dir.list();
if (newfiles == null) {
if (!dir.exists()) {
throw new RuntimeException(dir + " doesn't exist.");
} else if (!dir.isDirectory()) {
throw new RuntimeException(dir + " is not a directory.");
} else {
throw new RuntimeException("IO error scanning directory '"
+ dir.getAbsolutePath() + "'");
}
}
scandir(dir, vpath, fast, newfiles);
} | java | protected void scandir(File dir, String vpath, boolean fast) {
if (dir == null) {
throw new RuntimeException("dir must not be null.");
}
String[] newfiles = dir.list();
if (newfiles == null) {
if (!dir.exists()) {
throw new RuntimeException(dir + " doesn't exist.");
} else if (!dir.isDirectory()) {
throw new RuntimeException(dir + " is not a directory.");
} else {
throw new RuntimeException("IO error scanning directory '"
+ dir.getAbsolutePath() + "'");
}
}
scandir(dir, vpath, fast, newfiles);
} | [
"protected",
"void",
"scandir",
"(",
"File",
"dir",
",",
"String",
"vpath",
",",
"boolean",
"fast",
")",
"{",
"if",
"(",
"dir",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"dir must not be null.\"",
")",
";",
"}",
"String",
"[",
"]... | Scan the given directory for files and directories. Found files and
directories are placed in their respective collections, based on the
matching of includes, excludes, and the selectors. When a directory
is found, it is scanned recursively.
@param dir The directory to scan. Must not be <code>null</code>.
@param vpath The path relative to the base directory (needed to
prevent problems with an absolute path when using
dir). Must not be <code>null</code>.
@param fast Whether or not this call is part of a fast scan.
@see #filesIncluded
@see #filesNotIncluded
@see #filesExcluded
@see #dirsIncluded
@see #dirsNotIncluded
@see #dirsExcluded
@see #slowScan | [
"Scan",
"the",
"given",
"directory",
"for",
"files",
"and",
"directories",
".",
"Found",
"files",
"and",
"directories",
"are",
"placed",
"in",
"their",
"respective",
"collections",
"based",
"on",
"the",
"matching",
"of",
"includes",
"excludes",
"and",
"the",
"... | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L1051-L1067 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/DistributionSetInfoPanel.java | DistributionSetInfoPanel.getSWModlabel | private Label getSWModlabel(final String labelName, final SoftwareModule swModule) {
"""
Create Label for SW Module.
@param labelName
as Name
@param swModule
as Module (JVM|OS|AH)
@return Label as UI
"""
return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion());
} | java | private Label getSWModlabel(final String labelName, final SoftwareModule swModule) {
return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion());
} | [
"private",
"Label",
"getSWModlabel",
"(",
"final",
"String",
"labelName",
",",
"final",
"SoftwareModule",
"swModule",
")",
"{",
"return",
"SPUIComponentProvider",
".",
"createNameValueLabel",
"(",
"labelName",
"+",
"\" : \"",
",",
"swModule",
".",
"getName",
"(",
... | Create Label for SW Module.
@param labelName
as Name
@param swModule
as Module (JVM|OS|AH)
@return Label as UI | [
"Create",
"Label",
"for",
"SW",
"Module",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/DistributionSetInfoPanel.java#L90-L92 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java | CertificatesInner.createOrUpdateAsync | public Observable<CertificateDescriptionInner> createOrUpdateAsync(String resourceGroupName, String resourceName, String certificateName) {
"""
Upload the certificate to the IoT hub.
Adds new or replaces existing certificate.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param certificateName The name of the certificate
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CertificateDescriptionInner object
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).map(new Func1<ServiceResponse<CertificateDescriptionInner>, CertificateDescriptionInner>() {
@Override
public CertificateDescriptionInner call(ServiceResponse<CertificateDescriptionInner> response) {
return response.body();
}
});
} | java | public Observable<CertificateDescriptionInner> createOrUpdateAsync(String resourceGroupName, String resourceName, String certificateName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).map(new Func1<ServiceResponse<CertificateDescriptionInner>, CertificateDescriptionInner>() {
@Override
public CertificateDescriptionInner call(ServiceResponse<CertificateDescriptionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CertificateDescriptionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"certificateName",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",... | Upload the certificate to the IoT hub.
Adds new or replaces existing certificate.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param certificateName The name of the certificate
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CertificateDescriptionInner object | [
"Upload",
"the",
"certificate",
"to",
"the",
"IoT",
"hub",
".",
"Adds",
"new",
"or",
"replaces",
"existing",
"certificate",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java#L314-L321 |
lucee/Lucee | core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java | NtpMessage.encodeTimestamp | public static void encodeTimestamp(byte[] array, int pointer, double timestamp) {
"""
Encodes a timestamp in the specified position in the message
@param array
@param pointer
@param timestamp
"""
// Converts a double into a 64-bit fixed point
for (int i = 0; i < 8; i++) {
// 2^24, 2^16, 2^8, .. 2^-32
double base = Math.pow(2, (3 - i) * 8);
// Capture byte value
array[pointer + i] = (byte) (timestamp / base);
// Subtract captured value from remaining total
timestamp = timestamp - (unsignedByteToShort(array[pointer + i]) * base);
}
// From RFC 2030: It is advisable to fill the non-significan't
// low order bits of the timestamp with a random, unbiased
// bitstring, both to avoid systematic roundoff errors and as
// a means of loop detection and replay detection.
array[7] = (byte) (Math.random() * 255.0);
} | java | public static void encodeTimestamp(byte[] array, int pointer, double timestamp) {
// Converts a double into a 64-bit fixed point
for (int i = 0; i < 8; i++) {
// 2^24, 2^16, 2^8, .. 2^-32
double base = Math.pow(2, (3 - i) * 8);
// Capture byte value
array[pointer + i] = (byte) (timestamp / base);
// Subtract captured value from remaining total
timestamp = timestamp - (unsignedByteToShort(array[pointer + i]) * base);
}
// From RFC 2030: It is advisable to fill the non-significan't
// low order bits of the timestamp with a random, unbiased
// bitstring, both to avoid systematic roundoff errors and as
// a means of loop detection and replay detection.
array[7] = (byte) (Math.random() * 255.0);
} | [
"public",
"static",
"void",
"encodeTimestamp",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"pointer",
",",
"double",
"timestamp",
")",
"{",
"// Converts a double into a 64-bit fixed point",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"+... | Encodes a timestamp in the specified position in the message
@param array
@param pointer
@param timestamp | [
"Encodes",
"a",
"timestamp",
"in",
"the",
"specified",
"position",
"in",
"the",
"message"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java#L306-L324 |
spring-projects/spring-credhub | spring-credhub-core/src/main/java/org/springframework/credhub/configuration/CredHubTemplateFactory.java | CredHubTemplateFactory.reactiveCredHubTemplate | public ReactiveCredHubOperations reactiveCredHubTemplate(CredHubProperties credHubProperties,
ClientOptions clientOptions,
ReactiveClientRegistrationRepository clientRegistrationRepository,
ServerOAuth2AuthorizedClientRepository authorizedClientRepository) {
"""
Create a {@link ReactiveCredHubTemplate} for interaction with a CredHub server
using OAuth2 for authentication.
@param credHubProperties connection properties
@param clientOptions connection options
@param clientRegistrationRepository a repository of OAuth2 client registrations
@param authorizedClientRepository a repository of OAuth2 client authorizations
@return a {@code ReactiveCredHubTemplate}
"""
return new ReactiveCredHubTemplate(credHubProperties, clientHttpConnector(clientOptions),
clientRegistrationRepository, authorizedClientRepository);
} | java | public ReactiveCredHubOperations reactiveCredHubTemplate(CredHubProperties credHubProperties,
ClientOptions clientOptions,
ReactiveClientRegistrationRepository clientRegistrationRepository,
ServerOAuth2AuthorizedClientRepository authorizedClientRepository) {
return new ReactiveCredHubTemplate(credHubProperties, clientHttpConnector(clientOptions),
clientRegistrationRepository, authorizedClientRepository);
} | [
"public",
"ReactiveCredHubOperations",
"reactiveCredHubTemplate",
"(",
"CredHubProperties",
"credHubProperties",
",",
"ClientOptions",
"clientOptions",
",",
"ReactiveClientRegistrationRepository",
"clientRegistrationRepository",
",",
"ServerOAuth2AuthorizedClientRepository",
"authorizedC... | Create a {@link ReactiveCredHubTemplate} for interaction with a CredHub server
using OAuth2 for authentication.
@param credHubProperties connection properties
@param clientOptions connection options
@param clientRegistrationRepository a repository of OAuth2 client registrations
@param authorizedClientRepository a repository of OAuth2 client authorizations
@return a {@code ReactiveCredHubTemplate} | [
"Create",
"a",
"{",
"@link",
"ReactiveCredHubTemplate",
"}",
"for",
"interaction",
"with",
"a",
"CredHub",
"server",
"using",
"OAuth2",
"for",
"authentication",
"."
] | train | https://github.com/spring-projects/spring-credhub/blob/4d82cfa60d6c04e707ff32d78bc5d80cff4e132e/spring-credhub-core/src/main/java/org/springframework/credhub/configuration/CredHubTemplateFactory.java#L91-L97 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java | UnderFileSystemUtils.deleteFileIfExists | public static void deleteFileIfExists(UnderFileSystem ufs, String path) {
"""
Deletes the specified path from the specified under file system if it is a file and exists.
@param ufs instance of {@link UnderFileSystem}
@param path the path to delete
"""
try {
if (ufs.isFile(path)) {
ufs.deleteFile(path);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public static void deleteFileIfExists(UnderFileSystem ufs, String path) {
try {
if (ufs.isFile(path)) {
ufs.deleteFile(path);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"deleteFileIfExists",
"(",
"UnderFileSystem",
"ufs",
",",
"String",
"path",
")",
"{",
"try",
"{",
"if",
"(",
"ufs",
".",
"isFile",
"(",
"path",
")",
")",
"{",
"ufs",
".",
"deleteFile",
"(",
"path",
")",
";",
"}",
"}",
"cat... | Deletes the specified path from the specified under file system if it is a file and exists.
@param ufs instance of {@link UnderFileSystem}
@param path the path to delete | [
"Deletes",
"the",
"specified",
"path",
"from",
"the",
"specified",
"under",
"file",
"system",
"if",
"it",
"is",
"a",
"file",
"and",
"exists",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java#L74-L82 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingautosuggest/src/main/java/com/microsoft/azure/cognitiveservices/search/autosuggest/implementation/BingAutoSuggestSearchImpl.java | BingAutoSuggestSearchImpl.autoSuggest | public Suggestions autoSuggest(String query, AutoSuggestOptionalParameter autoSuggestOptionalParameter) {
"""
The AutoSuggest API lets you send a search query to Bing and get back a list of suggestions. This section provides technical details about the query parameters and headers that you use to request suggestions and the JSON response objects that contain them.
@param query The user's search term.
@param autoSuggestOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the Suggestions object if successful.
"""
return autoSuggestWithServiceResponseAsync(query, autoSuggestOptionalParameter).toBlocking().single().body();
} | java | public Suggestions autoSuggest(String query, AutoSuggestOptionalParameter autoSuggestOptionalParameter) {
return autoSuggestWithServiceResponseAsync(query, autoSuggestOptionalParameter).toBlocking().single().body();
} | [
"public",
"Suggestions",
"autoSuggest",
"(",
"String",
"query",
",",
"AutoSuggestOptionalParameter",
"autoSuggestOptionalParameter",
")",
"{",
"return",
"autoSuggestWithServiceResponseAsync",
"(",
"query",
",",
"autoSuggestOptionalParameter",
")",
".",
"toBlocking",
"(",
")... | The AutoSuggest API lets you send a search query to Bing and get back a list of suggestions. This section provides technical details about the query parameters and headers that you use to request suggestions and the JSON response objects that contain them.
@param query The user's search term.
@param autoSuggestOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the Suggestions object if successful. | [
"The",
"AutoSuggest",
"API",
"lets",
"you",
"send",
"a",
"search",
"query",
"to",
"Bing",
"and",
"get",
"back",
"a",
"list",
"of",
"suggestions",
".",
"This",
"section",
"provides",
"technical",
"details",
"about",
"the",
"query",
"parameters",
"and",
"heade... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingautosuggest/src/main/java/com/microsoft/azure/cognitiveservices/search/autosuggest/implementation/BingAutoSuggestSearchImpl.java#L78-L80 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/builder/FieldAccessor.java | FieldAccessor.getValue | public Object getValue(final Object record) {
"""
フィールドの値を取得する。
@param record レコードオブジェクト。
@return フィールドの値。
@throws IllegalArgumentException レコードのインスタンスがフィールドが定義されているクラスと異なる場合。
@throws SuperCsvReflectionException フィールドの値の取得に失敗した場合。
"""
Objects.requireNonNull(record);
if(!getDeclaredClass().equals(record.getClass())) {
throw new IllegalArgumentException(String.format("not match record class type. expected=%s. actual=%s, ",
type.getName(), record.getClass().getName()));
}
try {
return field.get(record);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new SuperCsvReflectionException("fail get field value.", e);
}
} | java | public Object getValue(final Object record) {
Objects.requireNonNull(record);
if(!getDeclaredClass().equals(record.getClass())) {
throw new IllegalArgumentException(String.format("not match record class type. expected=%s. actual=%s, ",
type.getName(), record.getClass().getName()));
}
try {
return field.get(record);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new SuperCsvReflectionException("fail get field value.", e);
}
} | [
"public",
"Object",
"getValue",
"(",
"final",
"Object",
"record",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"record",
")",
";",
"if",
"(",
"!",
"getDeclaredClass",
"(",
")",
".",
"equals",
"(",
"record",
".",
"getClass",
"(",
")",
")",
")",
"{",... | フィールドの値を取得する。
@param record レコードオブジェクト。
@return フィールドの値。
@throws IllegalArgumentException レコードのインスタンスがフィールドが定義されているクラスと異なる場合。
@throws SuperCsvReflectionException フィールドの値の取得に失敗した場合。 | [
"フィールドの値を取得する。"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/FieldAccessor.java#L316-L330 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.