repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java | SwapFile.createTempFile | public static SwapFile createTempFile(String prefix, String suffix, File directory) throws IOException
{
throw new IOException("Not applicable. Call get(File, String) method instead");
} | java | public static SwapFile createTempFile(String prefix, String suffix, File directory) throws IOException
{
throw new IOException("Not applicable. Call get(File, String) method instead");
} | [
"public",
"static",
"SwapFile",
"createTempFile",
"(",
"String",
"prefix",
",",
"String",
"suffix",
",",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"throw",
"new",
"IOException",
"(",
"\"Not applicable. Call get(File, String) method instead\"",
")",
";",
... | Not applicable. Call get(File, String) method instead.
@throws IOException
I/O error | [
"Not",
"applicable",
".",
"Call",
"get",
"(",
"File",
"String",
")",
"method",
"instead",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java#L214-L217 |
protostuff/protostuff | protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java | XmlIOUtil.writeTo | public static <T> void writeTo(XMLStreamWriter writer, T message, Schema<T> schema)
throws IOException, XMLStreamException, XmlOutputException
{
writer.writeStartElement(schema.messageName());
schema.writeTo(new XmlOutput(writer, schema), message);
writer.writeEndElement();
} | java | public static <T> void writeTo(XMLStreamWriter writer, T message, Schema<T> schema)
throws IOException, XMLStreamException, XmlOutputException
{
writer.writeStartElement(schema.messageName());
schema.writeTo(new XmlOutput(writer, schema), message);
writer.writeEndElement();
} | [
"public",
"static",
"<",
"T",
">",
"void",
"writeTo",
"(",
"XMLStreamWriter",
"writer",
",",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
")",
"throws",
"IOException",
",",
"XMLStreamException",
",",
"XmlOutputException",
"{",
"writer",
".",
"writ... | Serializes the {@code message} into an {@link XMLStreamWriter} using the given {@code schema}. | [
"Serializes",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L445-L453 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/rules/Rules.java | Rules.matchesCondition | public static Condition matchesCondition(String key, boolean keyRegex, String value, boolean valueRegex) {
return new MatchesCondition(key, keyRegex, value, valueRegex);
} | java | public static Condition matchesCondition(String key, boolean keyRegex, String value, boolean valueRegex) {
return new MatchesCondition(key, keyRegex, value, valueRegex);
} | [
"public",
"static",
"Condition",
"matchesCondition",
"(",
"String",
"key",
",",
"boolean",
"keyRegex",
",",
"String",
"value",
",",
"boolean",
"valueRegex",
")",
"{",
"return",
"new",
"MatchesCondition",
"(",
"key",
",",
"keyRegex",
",",
"value",
",",
"valueRe... | Create a single match condition
@param key key name or regular expression
@param keyRegex true if the key is a regular expression key match, false for an equals match
@param value value value string
@param valueRegex true if the value is a regular expression match, false for an equals match
@return new condition | [
"Create",
"a",
"single",
"match",
"condition"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/rules/Rules.java#L85-L87 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java | SDMath.isNonDecreasing | public SDVariable isNonDecreasing(String name, SDVariable x) {
validateNumerical("isNonDecreasing", x);
SDVariable result = f().isNonDecreasing(x);
return updateVariableNameAndReference(result, name);
} | java | public SDVariable isNonDecreasing(String name, SDVariable x) {
validateNumerical("isNonDecreasing", x);
SDVariable result = f().isNonDecreasing(x);
return updateVariableNameAndReference(result, name);
} | [
"public",
"SDVariable",
"isNonDecreasing",
"(",
"String",
"name",
",",
"SDVariable",
"x",
")",
"{",
"validateNumerical",
"(",
"\"isNonDecreasing\"",
",",
"x",
")",
";",
"SDVariable",
"result",
"=",
"f",
"(",
")",
".",
"isNonDecreasing",
"(",
"x",
")",
";",
... | Is the array non decreasing?<br>
An array is non-decreasing if for every valid i, x[i] <= x[i+1]. For Rank 2+ arrays, values are compared
in 'c' (row major) order
@param name Output name
@param x Input variable
@return Scalar variable with value 1 if non-decreasing, or 0 otherwise | [
"Is",
"the",
"array",
"non",
"decreasing?<br",
">",
"An",
"array",
"is",
"non",
"-",
"decreasing",
"if",
"for",
"every",
"valid",
"i",
"x",
"[",
"i",
"]",
"<",
"=",
"x",
"[",
"i",
"+",
"1",
"]",
".",
"For",
"Rank",
"2",
"+",
"arrays",
"values",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1403-L1407 |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.forName | @Deprecated
public static Class<?> forName(String name) throws ClassNotFoundException, LinkageError {
return forName(name, getDefaultClassLoader());
} | java | @Deprecated
public static Class<?> forName(String name) throws ClassNotFoundException, LinkageError {
return forName(name, getDefaultClassLoader());
} | [
"@",
"Deprecated",
"public",
"static",
"Class",
"<",
"?",
">",
"forName",
"(",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
",",
"LinkageError",
"{",
"return",
"forName",
"(",
"name",
",",
"getDefaultClassLoader",
"(",
")",
")",
";",
"}"
] | Replacement for {@code Class.forName()} that also returns Class instances
for primitives (like "int") and array class names (like "String[]").
<p>Always uses the default class loader: that is, preferably the thread context
class loader, or the ClassLoader that loaded the ClassUtils class as fallback.
@param name the name of the Class
@return Class instance for the supplied name
@throws ClassNotFoundException if the class was not found
@throws LinkageError if the class file could not be loaded
@see Class#forName(String, boolean, ClassLoader)
@see #getDefaultClassLoader()
@deprecated in favor of specifying a ClassLoader explicitly:
see {@link #forName(String, ClassLoader)} | [
"Replacement",
"for",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L209-L212 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newSearchException | public static SearchException newSearchException(Throwable cause, String message, Object... args) {
return new SearchException(format(message, args), cause);
} | java | public static SearchException newSearchException(Throwable cause, String message, Object... args) {
return new SearchException(format(message, args), cause);
} | [
"public",
"static",
"SearchException",
"newSearchException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"SearchException",
"(",
"format",
"(",
"message",
",",
"args",
")",
",",
"cause",
")",
... | Constructs and initializes a new {@link SearchException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link SearchException} was thrown.
@param message {@link String} describing the {@link SearchException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link SearchException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.util.search.SearchException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"SearchException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L887-L889 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java | ConvertBufferedImage.convertTo | public static BufferedImage convertTo(JComponent comp, BufferedImage storage) {
if (storage == null)
storage = new BufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = storage.createGraphics();
comp.paintComponents(g2);
return storage;
} | java | public static BufferedImage convertTo(JComponent comp, BufferedImage storage) {
if (storage == null)
storage = new BufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = storage.createGraphics();
comp.paintComponents(g2);
return storage;
} | [
"public",
"static",
"BufferedImage",
"convertTo",
"(",
"JComponent",
"comp",
",",
"BufferedImage",
"storage",
")",
"{",
"if",
"(",
"storage",
"==",
"null",
")",
"storage",
"=",
"new",
"BufferedImage",
"(",
"comp",
".",
"getWidth",
"(",
")",
",",
"comp",
".... | Draws the component into a BufferedImage.
@param comp The component being drawn into an image.
@param storage if not null the component is drawn into it, if null a new BufferedImage is created.
@return image of the component | [
"Draws",
"the",
"component",
"into",
"a",
"BufferedImage",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L915-L924 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/Diff.java | Diff.appendDifference | private void appendDifference(StringBuilder appendTo, Difference difference) {
appendTo.append(' ').append(difference).append('\n');
} | java | private void appendDifference(StringBuilder appendTo, Difference difference) {
appendTo.append(' ').append(difference).append('\n');
} | [
"private",
"void",
"appendDifference",
"(",
"StringBuilder",
"appendTo",
",",
"Difference",
"difference",
")",
"{",
"appendTo",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"difference",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}"
] | Append a meaningful message to the buffer of messages
@param appendTo the messages buffer
@param difference | [
"Append",
"a",
"meaningful",
"message",
"to",
"the",
"buffer",
"of",
"messages"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/Diff.java#L268-L270 |
Cornutum/tcases | tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputJson.java | SystemInputJson.addProperties | private static JsonObjectBuilder addProperties( JsonObjectBuilder builder, VarValueDef value)
{
JsonArrayBuilder properties = Json.createArrayBuilder();
value.getProperties().forEach( property -> properties.add( property));
JsonArray json = properties.build();
if( !json.isEmpty())
{
builder.add( PROPERTIES_KEY, json);
}
return builder;
} | java | private static JsonObjectBuilder addProperties( JsonObjectBuilder builder, VarValueDef value)
{
JsonArrayBuilder properties = Json.createArrayBuilder();
value.getProperties().forEach( property -> properties.add( property));
JsonArray json = properties.build();
if( !json.isEmpty())
{
builder.add( PROPERTIES_KEY, json);
}
return builder;
} | [
"private",
"static",
"JsonObjectBuilder",
"addProperties",
"(",
"JsonObjectBuilder",
"builder",
",",
"VarValueDef",
"value",
")",
"{",
"JsonArrayBuilder",
"properties",
"=",
"Json",
".",
"createArrayBuilder",
"(",
")",
";",
"value",
".",
"getProperties",
"(",
")",
... | Add any properties from the given value to the given JsonObjectBuilder. | [
"Add",
"any",
"properties",
"from",
"the",
"given",
"value",
"to",
"the",
"given",
"JsonObjectBuilder",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputJson.java#L159-L171 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/ExceptionTableSensitiveMethodVisitor.java | ExceptionTableSensitiveMethodVisitor.onVisitFieldInsn | protected void onVisitFieldInsn(int opcode, String owner, String name, String descriptor) {
super.visitFieldInsn(opcode, owner, name, descriptor);
} | java | protected void onVisitFieldInsn(int opcode, String owner, String name, String descriptor) {
super.visitFieldInsn(opcode, owner, name, descriptor);
} | [
"protected",
"void",
"onVisitFieldInsn",
"(",
"int",
"opcode",
",",
"String",
"owner",
",",
"String",
"name",
",",
"String",
"descriptor",
")",
"{",
"super",
".",
"visitFieldInsn",
"(",
"opcode",
",",
"owner",
",",
"name",
",",
"descriptor",
")",
";",
"}"
... | Visits a field instruction.
@param opcode The visited opcode.
@param owner The field's owner.
@param name The field's name.
@param descriptor The field's descriptor. | [
"Visits",
"a",
"field",
"instruction",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/ExceptionTableSensitiveMethodVisitor.java#L138-L140 |
line/armeria | examples/annotated-http-service/src/main/java/example/armeria/server/annotated/MessageConverterService.java | MessageConverterService.json4 | @Post("/obj/future")
@ProducesJson
public CompletionStage<Response> json4(@RequestObject Request request,
ServiceRequestContext ctx) {
final CompletableFuture<Response> future = new CompletableFuture<>();
ctx.blockingTaskExecutor()
.submit(() -> future.complete(new Response(Response.SUCCESS, request.name())));
return future;
} | java | @Post("/obj/future")
@ProducesJson
public CompletionStage<Response> json4(@RequestObject Request request,
ServiceRequestContext ctx) {
final CompletableFuture<Response> future = new CompletableFuture<>();
ctx.blockingTaskExecutor()
.submit(() -> future.complete(new Response(Response.SUCCESS, request.name())));
return future;
} | [
"@",
"Post",
"(",
"\"/obj/future\"",
")",
"@",
"ProducesJson",
"public",
"CompletionStage",
"<",
"Response",
">",
"json4",
"(",
"@",
"RequestObject",
"Request",
"request",
",",
"ServiceRequestContext",
"ctx",
")",
"{",
"final",
"CompletableFuture",
"<",
"Response"... | Returns a {@link CompletionStage} object. The {@link JacksonResponseConverterFunction} will
be executed after the future is completed with the {@link Response} object.
<p>Note that the {@link ServiceRequestContext} of the request is also automatically injected. See
<a href="https://line.github.io/armeria/server-annotated-service.html#other-classes-automatically-injected">
Other classes automatically injected</a> for more information. | [
"Returns",
"a",
"{",
"@link",
"CompletionStage",
"}",
"object",
".",
"The",
"{",
"@link",
"JacksonResponseConverterFunction",
"}",
"will",
"be",
"executed",
"after",
"the",
"future",
"is",
"completed",
"with",
"the",
"{",
"@link",
"Response",
"}",
"object",
".... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/examples/annotated-http-service/src/main/java/example/armeria/server/annotated/MessageConverterService.java#L100-L108 |
opencredo/opencredo-esper | esper-template/src/main/java/org/opencredo/esper/config/xml/EsperListenerParser.java | EsperListenerParser.parseListeners | @SuppressWarnings("unchecked")
public ManagedSet parseListeners(Element element, ParserContext parserContext) {
ManagedSet listeners = new ManagedSet();
NodeList childNodes = element.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node child = childNodes.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element childElement = (Element) child;
String localName = child.getLocalName();
if ("bean".equals(localName)) {
BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(childElement);
parserContext.registerBeanComponent(new BeanComponentDefinition(holder));
listeners.add(new RuntimeBeanReference(holder.getBeanName()));
} else if ("ref".equals(localName)) {
String ref = childElement.getAttribute("bean");
listeners.add(new RuntimeBeanReference(ref));
}
}
}
return listeners;
} | java | @SuppressWarnings("unchecked")
public ManagedSet parseListeners(Element element, ParserContext parserContext) {
ManagedSet listeners = new ManagedSet();
NodeList childNodes = element.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node child = childNodes.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element childElement = (Element) child;
String localName = child.getLocalName();
if ("bean".equals(localName)) {
BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(childElement);
parserContext.registerBeanComponent(new BeanComponentDefinition(holder));
listeners.add(new RuntimeBeanReference(holder.getBeanName()));
} else if ("ref".equals(localName)) {
String ref = childElement.getAttribute("bean");
listeners.add(new RuntimeBeanReference(ref));
}
}
}
return listeners;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"ManagedSet",
"parseListeners",
"(",
"Element",
"element",
",",
"ParserContext",
"parserContext",
")",
"{",
"ManagedSet",
"listeners",
"=",
"new",
"ManagedSet",
"(",
")",
";",
"NodeList",
"childNodes",
... | Parses out a set of configured esper statement listeners.
@param element
the esper listeners element
@param parserContext
the parser's current context
@return a list of configured esper statement listeners | [
"Parses",
"out",
"a",
"set",
"of",
"configured",
"esper",
"statement",
"listeners",
"."
] | train | https://github.com/opencredo/opencredo-esper/blob/a88c9fd0301a4d6962da70d85577c27d50d08825/esper-template/src/main/java/org/opencredo/esper/config/xml/EsperListenerParser.java#L48-L68 |
voldemort/voldemort | src/java/voldemort/utils/ReflectUtils.java | ReflectUtils.callConstructor | public static <T> T callConstructor(Class<T> klass, Object[] args) {
Class<?>[] klasses = new Class[args.length];
for(int i = 0; i < args.length; i++)
klasses[i] = args[i].getClass();
return callConstructor(klass, klasses, args);
} | java | public static <T> T callConstructor(Class<T> klass, Object[] args) {
Class<?>[] klasses = new Class[args.length];
for(int i = 0; i < args.length; i++)
klasses[i] = args[i].getClass();
return callConstructor(klass, klasses, args);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"callConstructor",
"(",
"Class",
"<",
"T",
">",
"klass",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"klasses",
"=",
"new",
"Class",
"[",
"args",
".",
"length",
"]",
";",
... | Call the constructor for the given class, inferring the correct types for
the arguments. This could be confusing if there are multiple constructors
with the same number of arguments and the values themselves don't
disambiguate.
@param klass The class to construct
@param args The arguments
@return The constructed value | [
"Call",
"the",
"constructor",
"for",
"the",
"given",
"class",
"inferring",
"the",
"correct",
"types",
"for",
"the",
"arguments",
".",
"This",
"could",
"be",
"confusing",
"if",
"there",
"are",
"multiple",
"constructors",
"with",
"the",
"same",
"number",
"of",
... | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ReflectUtils.java#L99-L104 |
termsuite/termsuite-core | src/main/java/fr/univnantes/termsuite/io/tbx/TbxExporter.java | TbxExporter.addTermEntry | private void addTermEntry(Document tbxDocument, TerminologyService termino, OccurrenceStore occurrenceStore, TermService term, boolean isVariant) {
String langsetId = LANGSET_ID_PREFIX + getId(term.getTerm());
Node body = tbxDocument.getElementsByTagName("body").item(0);
Element termEntry = tbxDocument.createElement("termEntry");
termEntry.setAttribute("xml:id",
TERMENTRY_ID_PREFIX + getId(term.getTerm()));
body.appendChild(termEntry);
Element langSet = tbxDocument.createElement("langSet");
langSet.setAttribute("xml:id", langsetId);
langSet.setAttribute("xml:lang", termino.getLang().getCode());
termEntry.appendChild(langSet);
for (RelationService variation : term.inboundRelations().collect(toSet()))
this.addTermBase(tbxDocument, langSet, variation.getFrom().getGroupingKey(), null);
for (RelationService variation : term.outboundRelations().collect(toSet())) {
this.addTermVariant(tbxDocument, langSet, String.format("langset-%d", getId(variation.getTo().getTerm())),
variation.getTo().getGroupingKey());
}
Collection<TermOccurrence> allOccurrences = occurrenceStore.getOccurrences(term.getTerm());
this.addDescrip(tbxDocument, langSet, langSet, "nbOccurrences", allOccurrences.size());
Element tig = tbxDocument.createElement("tig");
tig.setAttribute("xml:id", TIG_ID_PREFIX + getId(term.getTerm()));
langSet.appendChild(tig);
Element termElmt = tbxDocument.createElement("term");
termElmt.setTextContent(term.getGroupingKey());
tig.appendChild(termElmt);
List<Form> forms = occurrenceStore.getForms(term.getTerm());
addNote(tbxDocument, langSet, tig, "termPilot", term.getPilot());
this.addNote(tbxDocument, langSet, tig, "termType", isVariant ? "variant" : "termEntry");
this.addNote(tbxDocument,
langSet,
tig,
"partOfSpeech",
term.isMultiWord() ? "noun" : term.getWords().get(0).getSyntacticLabel());
this.addNote(tbxDocument, langSet, tig, "termPattern", term.getWords().get(0).getSyntacticLabel());
this.addNote(tbxDocument, langSet, tig, "termComplexity",
this.getComplexity(term));
this.addDescrip(tbxDocument, langSet, tig, "termSpecificity",
NUMBER_FORMATTER.format(term.getSpecificity()));
this.addDescrip(tbxDocument, langSet, tig, "nbOccurrences",
term.getFrequency());
this.addDescrip(tbxDocument, langSet, tig, "relativeFrequency",
NUMBER_FORMATTER.format(term.getFrequency()));
addDescrip(tbxDocument, langSet, tig, "formList",
buildFormListJSON(occurrenceStore, term.getTerm(), forms.size()));
this.addDescrip(tbxDocument, langSet, tig, "domainSpecificity",
term.getSpecificity());
} | java | private void addTermEntry(Document tbxDocument, TerminologyService termino, OccurrenceStore occurrenceStore, TermService term, boolean isVariant) {
String langsetId = LANGSET_ID_PREFIX + getId(term.getTerm());
Node body = tbxDocument.getElementsByTagName("body").item(0);
Element termEntry = tbxDocument.createElement("termEntry");
termEntry.setAttribute("xml:id",
TERMENTRY_ID_PREFIX + getId(term.getTerm()));
body.appendChild(termEntry);
Element langSet = tbxDocument.createElement("langSet");
langSet.setAttribute("xml:id", langsetId);
langSet.setAttribute("xml:lang", termino.getLang().getCode());
termEntry.appendChild(langSet);
for (RelationService variation : term.inboundRelations().collect(toSet()))
this.addTermBase(tbxDocument, langSet, variation.getFrom().getGroupingKey(), null);
for (RelationService variation : term.outboundRelations().collect(toSet())) {
this.addTermVariant(tbxDocument, langSet, String.format("langset-%d", getId(variation.getTo().getTerm())),
variation.getTo().getGroupingKey());
}
Collection<TermOccurrence> allOccurrences = occurrenceStore.getOccurrences(term.getTerm());
this.addDescrip(tbxDocument, langSet, langSet, "nbOccurrences", allOccurrences.size());
Element tig = tbxDocument.createElement("tig");
tig.setAttribute("xml:id", TIG_ID_PREFIX + getId(term.getTerm()));
langSet.appendChild(tig);
Element termElmt = tbxDocument.createElement("term");
termElmt.setTextContent(term.getGroupingKey());
tig.appendChild(termElmt);
List<Form> forms = occurrenceStore.getForms(term.getTerm());
addNote(tbxDocument, langSet, tig, "termPilot", term.getPilot());
this.addNote(tbxDocument, langSet, tig, "termType", isVariant ? "variant" : "termEntry");
this.addNote(tbxDocument,
langSet,
tig,
"partOfSpeech",
term.isMultiWord() ? "noun" : term.getWords().get(0).getSyntacticLabel());
this.addNote(tbxDocument, langSet, tig, "termPattern", term.getWords().get(0).getSyntacticLabel());
this.addNote(tbxDocument, langSet, tig, "termComplexity",
this.getComplexity(term));
this.addDescrip(tbxDocument, langSet, tig, "termSpecificity",
NUMBER_FORMATTER.format(term.getSpecificity()));
this.addDescrip(tbxDocument, langSet, tig, "nbOccurrences",
term.getFrequency());
this.addDescrip(tbxDocument, langSet, tig, "relativeFrequency",
NUMBER_FORMATTER.format(term.getFrequency()));
addDescrip(tbxDocument, langSet, tig, "formList",
buildFormListJSON(occurrenceStore, term.getTerm(), forms.size()));
this.addDescrip(tbxDocument, langSet, tig, "domainSpecificity",
term.getSpecificity());
} | [
"private",
"void",
"addTermEntry",
"(",
"Document",
"tbxDocument",
",",
"TerminologyService",
"termino",
",",
"OccurrenceStore",
"occurrenceStore",
",",
"TermService",
"term",
",",
"boolean",
"isVariant",
")",
"{",
"String",
"langsetId",
"=",
"LANGSET_ID_PREFIX",
"+",... | Add a term to the TBX document.
@param doc
@param langsetId
@param term
@param isVariant
@throws IOException | [
"Add",
"a",
"term",
"to",
"the",
"TBX",
"document",
"."
] | train | https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/io/tbx/TbxExporter.java#L174-L226 |
wkgcass/Style | src/main/java/net/cassite/style/aggregation/MapFuncSup.java | MapFuncSup.forThose | @SuppressWarnings("unchecked")
public <R> R forThose(RFunc2<Boolean, K, V> predicate, VFunc3<K, V, IteratorInfo<R>> func) {
return (R) forThose(predicate, Style.$(func));
} | java | @SuppressWarnings("unchecked")
public <R> R forThose(RFunc2<Boolean, K, V> predicate, VFunc3<K, V, IteratorInfo<R>> func) {
return (R) forThose(predicate, Style.$(func));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"R",
">",
"R",
"forThose",
"(",
"RFunc2",
"<",
"Boolean",
",",
"K",
",",
"V",
">",
"predicate",
",",
"VFunc3",
"<",
"K",
",",
"V",
",",
"IteratorInfo",
"<",
"R",
">",
">",
"func",
"... | define a function to deal with each element in the map
@param predicate a function takes in each element from map and returns
true or false(or null)
@param func a function takes in each element from map and iterator
info
@return return 'last loop value'.<br>
check
<a href="https://github.com/wkgcass/Style/">tutorial</a> for
more info about 'last loop value'
@see IteratorInfo | [
"define",
"a",
"function",
"to",
"deal",
"with",
"each",
"element",
"in",
"the",
"map"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/MapFuncSup.java#L129-L132 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java | ActionUtil.getListener | public static ActionListener getListener(BaseComponent component, String eventName) {
return (ActionListener) component.getAttribute(ActionListener.getAttrName(eventName));
} | java | public static ActionListener getListener(BaseComponent component, String eventName) {
return (ActionListener) component.getAttribute(ActionListener.getAttrName(eventName));
} | [
"public",
"static",
"ActionListener",
"getListener",
"(",
"BaseComponent",
"component",
",",
"String",
"eventName",
")",
"{",
"return",
"(",
"ActionListener",
")",
"component",
".",
"getAttribute",
"(",
"ActionListener",
".",
"getAttrName",
"(",
"eventName",
")",
... | Returns the listener associated with the given component and event.
@param component The component.
@param eventName The event name.
@return A DeferredEventListener, or null if not found. | [
"Returns",
"the",
"listener",
"associated",
"with",
"the",
"given",
"component",
"and",
"event",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L216-L218 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java | DateTimePatternGenerator.addPattern | public DateTimePatternGenerator addPattern(String pattern, boolean override, PatternInfo returnInfo) {
return addPatternWithSkeleton(pattern, null, override, returnInfo);
} | java | public DateTimePatternGenerator addPattern(String pattern, boolean override, PatternInfo returnInfo) {
return addPatternWithSkeleton(pattern, null, override, returnInfo);
} | [
"public",
"DateTimePatternGenerator",
"addPattern",
"(",
"String",
"pattern",
",",
"boolean",
"override",
",",
"PatternInfo",
"returnInfo",
")",
"{",
"return",
"addPatternWithSkeleton",
"(",
"pattern",
",",
"null",
",",
"override",
",",
"returnInfo",
")",
";",
"}"... | Adds a pattern to the generator. If the pattern has the same skeleton as
an existing pattern, and the override parameter is set, then the previous
value is overridden. Otherwise, the previous value is retained. In either
case, the conflicting information is returned in PatternInfo.
<p>
Note that single-field patterns (like "MMM") are automatically added, and
don't need to be added explicitly!
* <p>Example code:{@sample external/icu/android_icu4j/src/samples/java/android/icu/samples/text/datetimepatterngenerator/DateTimePatternGeneratorSample.java addPatternExample}
@param pattern Pattern to add.
@param override When existing values are to be overridden use true, otherwise
use false.
@param returnInfo Returned information. | [
"Adds",
"a",
"pattern",
"to",
"the",
"generator",
".",
"If",
"the",
"pattern",
"has",
"the",
"same",
"skeleton",
"as",
"an",
"existing",
"pattern",
"and",
"the",
"override",
"parameter",
"is",
"set",
"then",
"the",
"previous",
"value",
"is",
"overridden",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L642-L644 |
aws/aws-sdk-java | aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/StepFactory.java | StepFactory.newInstallHiveStep | public HadoopJarStepConfig newInstallHiveStep(String... hiveVersions) {
if (hiveVersions.length > 0) {
return newHivePigStep("hive", "--install-hive", "--hive-versions",
StringUtils.join(",", hiveVersions));
}
return newHivePigStep("hive", "--install-hive", "--hive-versions", "latest");
} | java | public HadoopJarStepConfig newInstallHiveStep(String... hiveVersions) {
if (hiveVersions.length > 0) {
return newHivePigStep("hive", "--install-hive", "--hive-versions",
StringUtils.join(",", hiveVersions));
}
return newHivePigStep("hive", "--install-hive", "--hive-versions", "latest");
} | [
"public",
"HadoopJarStepConfig",
"newInstallHiveStep",
"(",
"String",
"...",
"hiveVersions",
")",
"{",
"if",
"(",
"hiveVersions",
".",
"length",
">",
"0",
")",
"{",
"return",
"newHivePigStep",
"(",
"\"hive\"",
",",
"\"--install-hive\"",
",",
"\"--hive-versions\"",
... | Step that installs the specified versions of Hive on your job flow.
@param hiveVersions the versions of Hive to install
@return HadoopJarStepConfig that can be passed to your job flow. | [
"Step",
"that",
"installs",
"the",
"specified",
"versions",
"of",
"Hive",
"on",
"your",
"job",
"flow",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/StepFactory.java#L176-L182 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/util/HeaderScreen.java | HeaderScreen.getNextLocation | public ScreenLocation getNextLocation(short position, short setNewAnchor)
{
if (position == ScreenConstants.FIRST_LOCATION)
position = ScreenConstants.FIRST_INPUT_LOCATION;
if (position == ScreenConstants.NEXT_LOGICAL)
position = ScreenConstants.BELOW_LAST_ANCHOR;
return super.getNextLocation(position, setNewAnchor);
} | java | public ScreenLocation getNextLocation(short position, short setNewAnchor)
{
if (position == ScreenConstants.FIRST_LOCATION)
position = ScreenConstants.FIRST_INPUT_LOCATION;
if (position == ScreenConstants.NEXT_LOGICAL)
position = ScreenConstants.BELOW_LAST_ANCHOR;
return super.getNextLocation(position, setNewAnchor);
} | [
"public",
"ScreenLocation",
"getNextLocation",
"(",
"short",
"position",
",",
"short",
"setNewAnchor",
")",
"{",
"if",
"(",
"position",
"==",
"ScreenConstants",
".",
"FIRST_LOCATION",
")",
"position",
"=",
"ScreenConstants",
".",
"FIRST_INPUT_LOCATION",
";",
"if",
... | Code this position and Anchor to add it to the LayoutManager.
@param position The position of the next location (row and column).
@param setNewAnchor Set anchor?
@return The new screen location constant. | [
"Code",
"this",
"position",
"and",
"Anchor",
"to",
"add",
"it",
"to",
"the",
"LayoutManager",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/util/HeaderScreen.java#L71-L78 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/subset/neigh/adv/DisjointMultiSwapNeighbourhood.java | DisjointMultiSwapNeighbourhood.numSwaps | private int numSwaps(Set<Integer> addCandidates, Set<Integer> deleteCandidates){
return Math.min(addCandidates.size(), Math.min(deleteCandidates.size(), numSwaps));
} | java | private int numSwaps(Set<Integer> addCandidates, Set<Integer> deleteCandidates){
return Math.min(addCandidates.size(), Math.min(deleteCandidates.size(), numSwaps));
} | [
"private",
"int",
"numSwaps",
"(",
"Set",
"<",
"Integer",
">",
"addCandidates",
",",
"Set",
"<",
"Integer",
">",
"deleteCandidates",
")",
"{",
"return",
"Math",
".",
"min",
"(",
"addCandidates",
".",
"size",
"(",
")",
",",
"Math",
".",
"min",
"(",
"del... | Infer the number of swaps that will be performed, taking into account the fixed number of desired
swaps as specified at construction and the maximum number of possible swaps for the given subset solution.
@param addCandidates candidate IDs to be added to the selection
@param deleteCandidates candidate IDs to be removed from the selection
@return number of swaps to be performed: desired fixed number if possible, or less (as many as possible) | [
"Infer",
"the",
"number",
"of",
"swaps",
"that",
"will",
"be",
"performed",
"taking",
"into",
"account",
"the",
"fixed",
"number",
"of",
"desired",
"swaps",
"as",
"specified",
"at",
"construction",
"and",
"the",
"maximum",
"number",
"of",
"possible",
"swaps",
... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/adv/DisjointMultiSwapNeighbourhood.java#L188-L190 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java | WrapperManager.discardObject | @Override
public void discardObject(EJBCache wrapperCache, Object key, Object ele)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "discardObject", new Object[] { key, ele });
EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) ele;
wrapperCommon.disconnect(); // @MD20022C, F58064
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "discardObject");
} | java | @Override
public void discardObject(EJBCache wrapperCache, Object key, Object ele)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "discardObject", new Object[] { key, ele });
EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) ele;
wrapperCommon.disconnect(); // @MD20022C, F58064
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "discardObject");
} | [
"@",
"Override",
"public",
"void",
"discardObject",
"(",
"EJBCache",
"wrapperCache",
",",
"Object",
"key",
",",
"Object",
"ele",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
... | Unregister a wrapper instance when it is castout of the wrapper
cache. | [
"Unregister",
"a",
"wrapper",
"instance",
"when",
"it",
"is",
"castout",
"of",
"the",
"wrapper",
"cache",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java#L472-L483 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/services/process/ProcessExecutor.java | ProcessExecutor.lockProcessInstance | public Integer lockProcessInstance(Long procInstId)
throws DataAccessException {
try {
if (!isInTransaction()) throw
new DataAccessException("Cannot lock activity instance without a transaction");
return engineImpl.getDataAccess().lockProcessInstance(procInstId);
} catch (SQLException e) {
throw new DataAccessException(0, "Failed to lock process instance", e);
}
} | java | public Integer lockProcessInstance(Long procInstId)
throws DataAccessException {
try {
if (!isInTransaction()) throw
new DataAccessException("Cannot lock activity instance without a transaction");
return engineImpl.getDataAccess().lockProcessInstance(procInstId);
} catch (SQLException e) {
throw new DataAccessException(0, "Failed to lock process instance", e);
}
} | [
"public",
"Integer",
"lockProcessInstance",
"(",
"Long",
"procInstId",
")",
"throws",
"DataAccessException",
"{",
"try",
"{",
"if",
"(",
"!",
"isInTransaction",
"(",
")",
")",
"throw",
"new",
"DataAccessException",
"(",
"\"Cannot lock activity instance without a transac... | this method must be called within the same transaction scope (namely engine is already started
@param procInstId
@throws DataAccessException | [
"this",
"method",
"must",
"be",
"called",
"within",
"the",
"same",
"transaction",
"scope",
"(",
"namely",
"engine",
"is",
"already",
"started"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/process/ProcessExecutor.java#L1184-L1193 |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java | ColorPixel.getGrey | public static final double getGrey(final double r, final double g, final double b, final double redWeight, final double greenWeight, final double blueWeight){
return r*redWeight+g*greenWeight+b*blueWeight;
} | java | public static final double getGrey(final double r, final double g, final double b, final double redWeight, final double greenWeight, final double blueWeight){
return r*redWeight+g*greenWeight+b*blueWeight;
} | [
"public",
"static",
"final",
"double",
"getGrey",
"(",
"final",
"double",
"r",
",",
"final",
"double",
"g",
",",
"final",
"double",
"b",
",",
"final",
"double",
"redWeight",
",",
"final",
"double",
"greenWeight",
",",
"final",
"double",
"blueWeight",
")",
... | Calculates a grey value from the specified RGB color using the specified
weights for each R,G and B channel.
<p>
It is advised to use non-negative weights that sum up to 1.0 to get a
grey value within the same value range as the specified color channels.
<pre>
grey = r*redWeight + g*greenWeight + b*blueWeight
</pre>
@param r red value of the color
@param g green value of the color
@param b blue value of the color
@param redWeight weight for red channel
@param greenWeight weight for green channel
@param blueWeight weight for blue channel
@return weighted grey value of the specified RGB color. | [
"Calculates",
"a",
"grey",
"value",
"from",
"the",
"specified",
"RGB",
"color",
"using",
"the",
"specified",
"weights",
"for",
"each",
"R",
"G",
"and",
"B",
"channel",
".",
"<p",
">",
"It",
"is",
"advised",
"to",
"use",
"non",
"-",
"negative",
"weights",... | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java#L558-L560 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/scheduler/multitenant/IsolatedPool.java | IsolatedPool.getNodesForNotIsolatedTop | private int getNodesForNotIsolatedTop(TopologyDetails td, Set<Node> allNodes, NodePool[] lesserPools) {
String topId = td.getId();
LOG.debug("Topology {} is not isolated", topId);
int totalTasks = td.getExecutors().size();
int origRequest = td.getNumWorkers();
int slotsRequested = Math.min(totalTasks, origRequest);
int slotsUsed = Node.countSlotsUsed(topId, allNodes);
int slotsFree = Node.countFreeSlotsAlive(allNodes);
// Check to see if we have enough slots before trying to get them
int slotsAvailable = 0;
if (slotsRequested > slotsFree) {
slotsAvailable = NodePool.slotsAvailable(lesserPools);
}
int slotsToUse = Math.min(slotsRequested - slotsUsed, slotsFree + slotsAvailable);
LOG.debug("Slots... requested {} used {} free {} available {} to be used {}",
new Object[]{slotsRequested, slotsUsed, slotsFree, slotsAvailable, slotsToUse});
if (slotsToUse <= 0) {
_cluster.setStatus(topId, "Not Enough Slots Available to Schedule Topology");
return 0;
}
int slotsNeeded = slotsToUse - slotsFree;
int numNewNodes = NodePool.getNodeCountIfSlotsWereTaken(slotsNeeded, lesserPools);
LOG.debug("Nodes... new {} used {} max {}", new Object[]{numNewNodes, _usedNodes, _maxNodes});
if ((numNewNodes + _usedNodes) > _maxNodes) {
_cluster.setStatus(topId, "Max Nodes(" + _maxNodes + ") for this user would be exceeded. " + (numNewNodes - (_maxNodes - _usedNodes))
+ " more nodes needed to run topology.");
return 0;
}
Collection<Node> found = NodePool.takeNodesBySlot(slotsNeeded, lesserPools);
_usedNodes += found.size();
allNodes.addAll(found);
return slotsToUse;
} | java | private int getNodesForNotIsolatedTop(TopologyDetails td, Set<Node> allNodes, NodePool[] lesserPools) {
String topId = td.getId();
LOG.debug("Topology {} is not isolated", topId);
int totalTasks = td.getExecutors().size();
int origRequest = td.getNumWorkers();
int slotsRequested = Math.min(totalTasks, origRequest);
int slotsUsed = Node.countSlotsUsed(topId, allNodes);
int slotsFree = Node.countFreeSlotsAlive(allNodes);
// Check to see if we have enough slots before trying to get them
int slotsAvailable = 0;
if (slotsRequested > slotsFree) {
slotsAvailable = NodePool.slotsAvailable(lesserPools);
}
int slotsToUse = Math.min(slotsRequested - slotsUsed, slotsFree + slotsAvailable);
LOG.debug("Slots... requested {} used {} free {} available {} to be used {}",
new Object[]{slotsRequested, slotsUsed, slotsFree, slotsAvailable, slotsToUse});
if (slotsToUse <= 0) {
_cluster.setStatus(topId, "Not Enough Slots Available to Schedule Topology");
return 0;
}
int slotsNeeded = slotsToUse - slotsFree;
int numNewNodes = NodePool.getNodeCountIfSlotsWereTaken(slotsNeeded, lesserPools);
LOG.debug("Nodes... new {} used {} max {}", new Object[]{numNewNodes, _usedNodes, _maxNodes});
if ((numNewNodes + _usedNodes) > _maxNodes) {
_cluster.setStatus(topId, "Max Nodes(" + _maxNodes + ") for this user would be exceeded. " + (numNewNodes - (_maxNodes - _usedNodes))
+ " more nodes needed to run topology.");
return 0;
}
Collection<Node> found = NodePool.takeNodesBySlot(slotsNeeded, lesserPools);
_usedNodes += found.size();
allNodes.addAll(found);
return slotsToUse;
} | [
"private",
"int",
"getNodesForNotIsolatedTop",
"(",
"TopologyDetails",
"td",
",",
"Set",
"<",
"Node",
">",
"allNodes",
",",
"NodePool",
"[",
"]",
"lesserPools",
")",
"{",
"String",
"topId",
"=",
"td",
".",
"getId",
"(",
")",
";",
"LOG",
".",
"debug",
"("... | Get the nodes needed to schedule a non-isolated topology.
@param td the topology to be scheduled
@param allNodes the nodes already scheduled for this topology. This will be updated to include new nodes if needed.
@param lesserPools node pools we can steal nodes from
@return the number of additional slots that should be used for scheduling. | [
"Get",
"the",
"nodes",
"needed",
"to",
"schedule",
"a",
"non",
"-",
"isolated",
"topology",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/scheduler/multitenant/IsolatedPool.java#L202-L235 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_input_inputId_configuration_logstash_GET | public OvhLogstashConfiguration serviceName_input_inputId_configuration_logstash_GET(String serviceName, String inputId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/input/{inputId}/configuration/logstash";
StringBuilder sb = path(qPath, serviceName, inputId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhLogstashConfiguration.class);
} | java | public OvhLogstashConfiguration serviceName_input_inputId_configuration_logstash_GET(String serviceName, String inputId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/input/{inputId}/configuration/logstash";
StringBuilder sb = path(qPath, serviceName, inputId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhLogstashConfiguration.class);
} | [
"public",
"OvhLogstashConfiguration",
"serviceName_input_inputId_configuration_logstash_GET",
"(",
"String",
"serviceName",
",",
"String",
"inputId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/input/{inputId}/configuration/logstash\"",
"... | Returns the logstash configuration
REST: GET /dbaas/logs/{serviceName}/input/{inputId}/configuration/logstash
@param serviceName [required] Service name
@param inputId [required] Input ID | [
"Returns",
"the",
"logstash",
"configuration"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L258-L263 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.getReportQueryIteratorFromQuery | private OJBIterator getReportQueryIteratorFromQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException
{
RsIteratorFactory factory = ReportRsIteratorFactoryImpl.getInstance();
OJBIterator result = getRsIteratorFromQuery(query, cld, factory);
if (query.usePaging())
{
result = new PagingIterator(result, query.getStartAtIndex(), query.getEndAtIndex());
}
return result;
} | java | private OJBIterator getReportQueryIteratorFromQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException
{
RsIteratorFactory factory = ReportRsIteratorFactoryImpl.getInstance();
OJBIterator result = getRsIteratorFromQuery(query, cld, factory);
if (query.usePaging())
{
result = new PagingIterator(result, query.getStartAtIndex(), query.getEndAtIndex());
}
return result;
} | [
"private",
"OJBIterator",
"getReportQueryIteratorFromQuery",
"(",
"Query",
"query",
",",
"ClassDescriptor",
"cld",
")",
"throws",
"PersistenceBrokerException",
"{",
"RsIteratorFactory",
"factory",
"=",
"ReportRsIteratorFactoryImpl",
".",
"getInstance",
"(",
")",
";",
"OJB... | Get an extent aware Iterator based on the ReportQuery
@param query
@param cld
@return OJBIterator | [
"Get",
"an",
"extent",
"aware",
"Iterator",
"based",
"on",
"the",
"ReportQuery"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L2157-L2168 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java | ComponentCollision.addPoints | private void addPoints(int minX, int minY, int maxX, int maxY, Collidable collidable)
{
addPoint(new Point(minX, minY), collidable);
if (minX != maxX && minY == maxY)
{
addPoint(new Point(maxX, minY), collidable);
}
else if (minX == maxX && minY != maxY)
{
addPoint(new Point(minX, maxY), collidable);
}
else if (minX != maxX)
{
addPoint(new Point(minX, maxY), collidable);
addPoint(new Point(maxX, minY), collidable);
addPoint(new Point(maxX, maxY), collidable);
}
} | java | private void addPoints(int minX, int minY, int maxX, int maxY, Collidable collidable)
{
addPoint(new Point(minX, minY), collidable);
if (minX != maxX && minY == maxY)
{
addPoint(new Point(maxX, minY), collidable);
}
else if (minX == maxX && minY != maxY)
{
addPoint(new Point(minX, maxY), collidable);
}
else if (minX != maxX)
{
addPoint(new Point(minX, maxY), collidable);
addPoint(new Point(maxX, minY), collidable);
addPoint(new Point(maxX, maxY), collidable);
}
} | [
"private",
"void",
"addPoints",
"(",
"int",
"minX",
",",
"int",
"minY",
",",
"int",
"maxX",
",",
"int",
"maxY",
",",
"Collidable",
"collidable",
")",
"{",
"addPoint",
"(",
"new",
"Point",
"(",
"minX",
",",
"minY",
")",
",",
"collidable",
")",
";",
"i... | Add point and adjacent points depending of the collidable max collision size.
@param minX The min horizontal location.
@param minY The min vertical location.
@param maxX The min horizontal location.
@param maxY The min vertical location.
@param collidable The collidable reference. | [
"Add",
"point",
"and",
"adjacent",
"points",
"depending",
"of",
"the",
"collidable",
"max",
"collision",
"size",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java#L332-L350 |
derari/cthul | strings/src/main/java/org/cthul/strings/format/conversion/FormatConversionBase.java | FormatConversionBase.justifyRight | protected static void justifyRight(Appendable a, CharSequence csq, char pad, int width) throws IOException {
final int padLen = width - csq.length();
for (int i = 0; i < padLen; i++) a.append(pad);
a.append(csq);
} | java | protected static void justifyRight(Appendable a, CharSequence csq, char pad, int width) throws IOException {
final int padLen = width - csq.length();
for (int i = 0; i < padLen; i++) a.append(pad);
a.append(csq);
} | [
"protected",
"static",
"void",
"justifyRight",
"(",
"Appendable",
"a",
",",
"CharSequence",
"csq",
",",
"char",
"pad",
",",
"int",
"width",
")",
"throws",
"IOException",
"{",
"final",
"int",
"padLen",
"=",
"width",
"-",
"csq",
".",
"length",
"(",
")",
";... | Appends {@code csq} to {@code a}, right-justified.
@param a
@param csq
@param pad padding character
@param width minimum of characters that will be written
@throws IOException | [
"Appends",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/strings/src/main/java/org/cthul/strings/format/conversion/FormatConversionBase.java#L53-L57 |
korpling/ANNIS | annis-interfaces/src/main/java/annis/service/objects/CorpusConfig.java | CorpusConfig.getConfig | public String getConfig(String configName, String def)
{
if (config != null)
{
return config.getProperty(configName, def);
}
else
{
return def;
}
} | java | public String getConfig(String configName, String def)
{
if (config != null)
{
return config.getProperty(configName, def);
}
else
{
return def;
}
} | [
"public",
"String",
"getConfig",
"(",
"String",
"configName",
",",
"String",
"def",
")",
"{",
"if",
"(",
"config",
"!=",
"null",
")",
"{",
"return",
"config",
".",
"getProperty",
"(",
"configName",
",",
"def",
")",
";",
"}",
"else",
"{",
"return",
"def... | Returns a configuration from the underlying property object.
@param configName The name of the configuration.
@param def the default value, if no config is found.
@return Can be null if the config name does not exists. | [
"Returns",
"a",
"configuration",
"from",
"the",
"underlying",
"property",
"object",
"."
] | train | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-interfaces/src/main/java/annis/service/objects/CorpusConfig.java#L104-L114 |
Ellzord/JALSE | src/main/java/jalse/entities/Entities.java | Entities.isSubtype | public static boolean isSubtype(final Class<? extends Entity> descendant, final Class<? extends Entity> ancestor) {
return !ancestor.equals(descendant) && ancestor.isAssignableFrom(descendant);
} | java | public static boolean isSubtype(final Class<? extends Entity> descendant, final Class<? extends Entity> ancestor) {
return !ancestor.equals(descendant) && ancestor.isAssignableFrom(descendant);
} | [
"public",
"static",
"boolean",
"isSubtype",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Entity",
">",
"descendant",
",",
"final",
"Class",
"<",
"?",
"extends",
"Entity",
">",
"ancestor",
")",
"{",
"return",
"!",
"ancestor",
".",
"equals",
"(",
"descendant... | Checks if the specified type is a descendant from the specified ancestor type.
@param descendant
Descendant type.
@param ancestor
Ancestor type.
@return Whether the descendant is descended from the ancestor type. | [
"Checks",
"if",
"the",
"specified",
"type",
"is",
"a",
"descendant",
"from",
"the",
"specified",
"ancestor",
"type",
"."
] | train | https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L297-L299 |
elki-project/elki | elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/progress/StepProgress.java | StepProgress.beginStep | public void beginStep(int step, String stepTitle, Logging logger) {
setProcessed(step - 1);
this.stepTitle = stepTitle;
logger.progress(this);
} | java | public void beginStep(int step, String stepTitle, Logging logger) {
setProcessed(step - 1);
this.stepTitle = stepTitle;
logger.progress(this);
} | [
"public",
"void",
"beginStep",
"(",
"int",
"step",
",",
"String",
"stepTitle",
",",
"Logging",
"logger",
")",
"{",
"setProcessed",
"(",
"step",
"-",
"1",
")",
";",
"this",
".",
"stepTitle",
"=",
"stepTitle",
";",
"logger",
".",
"progress",
"(",
"this",
... | Do a new step and log it
@param step Step number
@param stepTitle Step title
@param logger Logger to report to. | [
"Do",
"a",
"new",
"step",
"and",
"log",
"it"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/progress/StepProgress.java#L80-L84 |
codegist/crest | core/src/main/java/org/codegist/crest/util/ComponentFactory.java | ComponentFactory.instantiate | public static <T> T instantiate(Class<T> clazz, CRestConfig crestConfig) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException {
try {
return accessible(clazz.getDeclaredConstructor(CRestConfig.class)).newInstance(crestConfig);
} catch (NoSuchMethodException e) {
return accessible(clazz.getDeclaredConstructor()).newInstance();
}
} | java | public static <T> T instantiate(Class<T> clazz, CRestConfig crestConfig) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException {
try {
return accessible(clazz.getDeclaredConstructor(CRestConfig.class)).newInstance(crestConfig);
} catch (NoSuchMethodException e) {
return accessible(clazz.getDeclaredConstructor()).newInstance();
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"instantiate",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"CRestConfig",
"crestConfig",
")",
"throws",
"InvocationTargetException",
",",
"IllegalAccessException",
",",
"InstantiationException",
",",
"NoSuchMethodException",
"{... | Instanciate the given component class passing the CRestConfig to the constructor if available, otherwise uses the default empty constructor.
@param clazz the component class to instanciate
@param crestConfig the CRestConfig to pass if the component is CRestConfig aware
@param <T> Type of the component
@return the component instance
@throws InvocationTargetException
@throws IllegalAccessException
@throws InstantiationException
@throws NoSuchMethodException | [
"Instanciate",
"the",
"given",
"component",
"class",
"passing",
"the",
"CRestConfig",
"to",
"the",
"constructor",
"if",
"available",
"otherwise",
"uses",
"the",
"default",
"empty",
"constructor",
"."
] | train | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/util/ComponentFactory.java#L54-L60 |
aol/cyclops | cyclops/src/main/java/cyclops/companion/Streams.java | Streams.foldRightMapToType | public final static <R,T> R foldRightMapToType(final Stream<T> stream, final Reducer<R,T> reducer) {
return reducer.foldMap(Streams.reverse(stream));
} | java | public final static <R,T> R foldRightMapToType(final Stream<T> stream, final Reducer<R,T> reducer) {
return reducer.foldMap(Streams.reverse(stream));
} | [
"public",
"final",
"static",
"<",
"R",
",",
"T",
">",
"R",
"foldRightMapToType",
"(",
"final",
"Stream",
"<",
"T",
">",
"stream",
",",
"final",
"Reducer",
"<",
"R",
",",
"T",
">",
"reducer",
")",
"{",
"return",
"reducer",
".",
"foldMap",
"(",
"Stream... | Attempt to transform this Monad to the same type as the supplied Monoid (using mapToType on the monoid interface)
Then use Monoid to reduce values
@param reducer Monoid to reduce values
@return Reduce result | [
"Attempt",
"to",
"transform",
"this",
"Monad",
"to",
"the",
"same",
"type",
"as",
"the",
"supplied",
"Monoid",
"(",
"using",
"mapToType",
"on",
"the",
"monoid",
"interface",
")",
"Then",
"use",
"Monoid",
"to",
"reduce",
"values"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1994-L1996 |
upwork/java-upwork | src/com/Upwork/api/Routers/Payments.java | Payments.submitBonus | public JSONObject submitBonus(String teamReference, HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
} | java | public JSONObject submitBonus(String teamReference, HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
} | [
"public",
"JSONObject",
"submitBonus",
"(",
"String",
"teamReference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/hr/v2/teams/\"",
"+",
"teamReference",
"+",
"\"/ad... | Submit a Custom Payment
@param teamReference Team reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Submit",
"a",
"Custom",
"Payment"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Payments.java#L54-L56 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractBoottimeAddStepHandler.java | AbstractBoottimeAddStepHandler.rollbackRuntime | @Deprecated
@Override
@SuppressWarnings("deprecation")
protected void rollbackRuntime(OperationContext context, ModelNode operation, ModelNode model, List<ServiceController<?>> controllers) {
revertReload(context);
} | java | @Deprecated
@Override
@SuppressWarnings("deprecation")
protected void rollbackRuntime(OperationContext context, ModelNode operation, ModelNode model, List<ServiceController<?>> controllers) {
revertReload(context);
} | [
"@",
"Deprecated",
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"protected",
"void",
"rollbackRuntime",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"operation",
",",
"ModelNode",
"model",
",",
"List",
"<",
"ServiceController",
"<"... | <strong>Deprecated</strong>. Overrides the superclass to call {@link OperationContext#revertReloadRequired()}
if {@link OperationContext#isBooting()} returns {@code false}.
{@inheritDoc} | [
"<strong",
">",
"Deprecated<",
"/",
"strong",
">",
".",
"Overrides",
"the",
"superclass",
"to",
"call",
"{",
"@link",
"OperationContext#revertReloadRequired",
"()",
"}",
"if",
"{",
"@link",
"OperationContext#isBooting",
"()",
"}",
"returns",
"{",
"@code",
"false",... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractBoottimeAddStepHandler.java#L182-L187 |
alkacon/opencms-core | src/org/opencms/i18n/CmsEncoder.java | CmsEncoder.decodeStringsFromBase64Parameter | public static List<String> decodeStringsFromBase64Parameter(String data) {
data = StringUtils.replaceChars(data, BASE64_EXTRA_REPLACEMENTS, BASE64_EXTRA);
byte[] bytes = deobfuscateBytes(Base64.decodeBase64(data));
try {
JSONArray json = new JSONArray(new String(bytes, "UTF-8"));
List<String> result = Lists.newArrayList();
for (int i = 0; i < json.length(); i++) {
result.add(json.getString(i));
}
return result;
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
throw new IllegalArgumentException("Decoding failed: " + data, e);
}
return null;
} | java | public static List<String> decodeStringsFromBase64Parameter(String data) {
data = StringUtils.replaceChars(data, BASE64_EXTRA_REPLACEMENTS, BASE64_EXTRA);
byte[] bytes = deobfuscateBytes(Base64.decodeBase64(data));
try {
JSONArray json = new JSONArray(new String(bytes, "UTF-8"));
List<String> result = Lists.newArrayList();
for (int i = 0; i < json.length(); i++) {
result.add(json.getString(i));
}
return result;
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
throw new IllegalArgumentException("Decoding failed: " + data, e);
}
return null;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"decodeStringsFromBase64Parameter",
"(",
"String",
"data",
")",
"{",
"data",
"=",
"StringUtils",
".",
"replaceChars",
"(",
"data",
",",
"BASE64_EXTRA_REPLACEMENTS",
",",
"BASE64_EXTRA",
")",
";",
"byte",
"[",
"]",
... | Decodes a parameter which has been encoded from a string list using encodeStringsAsBase64Parameter.<p>
@param data the data to decode
@return the list of strings | [
"Decodes",
"a",
"parameter",
"which",
"has",
"been",
"encoded",
"from",
"a",
"string",
"list",
"using",
"encodeStringsAsBase64Parameter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L347-L365 |
sebastiangraf/jSCSI | bundles/target/src/main/java/org/jscsi/target/connection/stage/login/TargetLoginStage.java | TargetLoginStage.sendPduSequence | protected final void sendPduSequence (final String keyValuePairs, final LoginStage nextStage) throws SettingsException , InterruptedException , IOException , InternetSCSIException , DigestException {
// some variables
ProtocolDataUnit pdu;
BasicHeaderSegment bhs;
LoginRequestParser parser;
boolean continueFlag = true;
boolean transitFlag = false;
// split input string into text data segments
final ByteBuffer[] dataSegments = ReadWrite.stringToTextDataSegments(keyValuePairs,// string
settings.getMaxRecvDataSegmentLength());// bufferSize
// send all data segments (and receive confirmations)
for (int i = 0; i < dataSegments.length; ++i) {
// adjust flags
if (i == dataSegments.length - 1) {
continueFlag = false;
if (stageNumber != nextStage) transitFlag = true;
}
// create and send PDU
pdu = TargetPduFactory.createLoginResponsePdu(transitFlag,// transitFlag
continueFlag,// continueFlag
stageNumber,// currentStage
nextStage,// nextStage
session.getInitiatorSessionID(),// initiatorSessionID
session.getTargetSessionIdentifyingHandle(),// targetSessionIdentifyingHandle
initiatorTaskTag, LoginStatus.SUCCESS,// status
dataSegments[i]);// dataSegment
connection.sendPdu(pdu);
// receive confirmation
if (continueFlag) {
// receive and check
pdu = connection.receivePdu();
bhs = pdu.getBasicHeaderSegment();
parser = (LoginRequestParser) bhs.getParser();
if (!checkPdu(pdu) || parser.isContinueFlag()) {
// send login reject and leave stage
sendRejectPdu(LoginStatus.INITIATOR_ERROR);
throw new InternetSCSIException();
}
}
}
} | java | protected final void sendPduSequence (final String keyValuePairs, final LoginStage nextStage) throws SettingsException , InterruptedException , IOException , InternetSCSIException , DigestException {
// some variables
ProtocolDataUnit pdu;
BasicHeaderSegment bhs;
LoginRequestParser parser;
boolean continueFlag = true;
boolean transitFlag = false;
// split input string into text data segments
final ByteBuffer[] dataSegments = ReadWrite.stringToTextDataSegments(keyValuePairs,// string
settings.getMaxRecvDataSegmentLength());// bufferSize
// send all data segments (and receive confirmations)
for (int i = 0; i < dataSegments.length; ++i) {
// adjust flags
if (i == dataSegments.length - 1) {
continueFlag = false;
if (stageNumber != nextStage) transitFlag = true;
}
// create and send PDU
pdu = TargetPduFactory.createLoginResponsePdu(transitFlag,// transitFlag
continueFlag,// continueFlag
stageNumber,// currentStage
nextStage,// nextStage
session.getInitiatorSessionID(),// initiatorSessionID
session.getTargetSessionIdentifyingHandle(),// targetSessionIdentifyingHandle
initiatorTaskTag, LoginStatus.SUCCESS,// status
dataSegments[i]);// dataSegment
connection.sendPdu(pdu);
// receive confirmation
if (continueFlag) {
// receive and check
pdu = connection.receivePdu();
bhs = pdu.getBasicHeaderSegment();
parser = (LoginRequestParser) bhs.getParser();
if (!checkPdu(pdu) || parser.isContinueFlag()) {
// send login reject and leave stage
sendRejectPdu(LoginStatus.INITIATOR_ERROR);
throw new InternetSCSIException();
}
}
}
} | [
"protected",
"final",
"void",
"sendPduSequence",
"(",
"final",
"String",
"keyValuePairs",
",",
"final",
"LoginStage",
"nextStage",
")",
"throws",
"SettingsException",
",",
"InterruptedException",
",",
"IOException",
",",
"InternetSCSIException",
",",
"DigestException",
... | Sends a Login Response PDU sequence containing the specified <i>key-value</i> pairs.
@param keyValuePairs contains <i>key-value</i> pairs to send
@param nextStage indicates if the target is willing to transition to a different stage
@throws SettingsException
@throws InterruptedException
@throws IOException
@throws InternetSCSIException
@throws DigestException | [
"Sends",
"a",
"Login",
"Response",
"PDU",
"sequence",
"containing",
"the",
"specified",
"<i",
">",
"key",
"-",
"value<",
"/",
"i",
">",
"pairs",
"."
] | train | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/target/src/main/java/org/jscsi/target/connection/stage/login/TargetLoginStage.java#L193-L239 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/DBQuery.java | DBQuery.notEquals | public static Query notEquals(String field, Object value) {
return new Query().notEquals(field, value);
} | java | public static Query notEquals(String field, Object value) {
return new Query().notEquals(field, value);
} | [
"public",
"static",
"Query",
"notEquals",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"Query",
"(",
")",
".",
"notEquals",
"(",
"field",
",",
"value",
")",
";",
"}"
] | The field is not equal to the given value
@param field The field to compare
@param value The value to compare to
@return the query | [
"The",
"field",
"is",
"not",
"equal",
"to",
"the",
"given",
"value"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBQuery.java#L106-L108 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java | HpackEncoder.encodeInteger | private static void encodeInteger(ByteBuf out, int mask, int n, long i) {
assert n >= 0 && n <= 8 : "N: " + n;
int nbits = 0xFF >>> (8 - n);
if (i < nbits) {
out.writeByte((int) (mask | i));
} else {
out.writeByte(mask | nbits);
long length = i - nbits;
for (; (length & ~0x7F) != 0; length >>>= 7) {
out.writeByte((int) ((length & 0x7F) | 0x80));
}
out.writeByte((int) length);
}
} | java | private static void encodeInteger(ByteBuf out, int mask, int n, long i) {
assert n >= 0 && n <= 8 : "N: " + n;
int nbits = 0xFF >>> (8 - n);
if (i < nbits) {
out.writeByte((int) (mask | i));
} else {
out.writeByte(mask | nbits);
long length = i - nbits;
for (; (length & ~0x7F) != 0; length >>>= 7) {
out.writeByte((int) ((length & 0x7F) | 0x80));
}
out.writeByte((int) length);
}
} | [
"private",
"static",
"void",
"encodeInteger",
"(",
"ByteBuf",
"out",
",",
"int",
"mask",
",",
"int",
"n",
",",
"long",
"i",
")",
"{",
"assert",
"n",
">=",
"0",
"&&",
"n",
"<=",
"8",
":",
"\"N: \"",
"+",
"n",
";",
"int",
"nbits",
"=",
"0xFF",
">>>... | Encode integer according to <a href="https://tools.ietf.org/html/rfc7541#section-5.1">Section 5.1</a>. | [
"Encode",
"integer",
"according",
"to",
"<a",
"href",
"=",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc7541#section",
"-",
"5",
".",
"1",
">",
"Section",
"5",
".",
"1<",
"/",
"a",
">",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L234-L247 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/graph/AbstractGraph.java | AbstractGraph.removeInternal | private void removeInternal(int vertex, EdgeSet<T> edges) {
// Discount all the edges that were stored in this vertices edge set
numEdges -= edges.size();
// Now find all the edges stored in other vertices that might point to
// this vertex and remove them
for (Edge e : edges) {
// Identify the other vertex in the removed edge and remove the
// edge from the vertex's corresponding EdgeSet.
int otherVertex = (e.from() == vertex) ? e.to() : e.from();
EdgeSet<T> otherEdges = vertexToEdges.get(otherVertex);
assert otherEdges.contains(e)
: "Error in ensuring consistent from/to edge sets";
otherEdges.remove(e);
}
// Update any of the subgraphs that had this vertex to notify them
// that it was removed
Iterator<WeakReference<Subgraph>> iter = subgraphs.iterator();
while (iter.hasNext()) {
WeakReference<Subgraph> ref = iter.next();
Subgraph s = ref.get();
// Check whether this subgraph was already gc'd (the subgraph
// was no longer in use) and if so, remove the ref from the list
// to avoid iterating over it again
if (s == null) {
iter.remove();
continue;
}
// Remove the vertex from the subgraph
s.vertexSubset.remove(vertex);
}
} | java | private void removeInternal(int vertex, EdgeSet<T> edges) {
// Discount all the edges that were stored in this vertices edge set
numEdges -= edges.size();
// Now find all the edges stored in other vertices that might point to
// this vertex and remove them
for (Edge e : edges) {
// Identify the other vertex in the removed edge and remove the
// edge from the vertex's corresponding EdgeSet.
int otherVertex = (e.from() == vertex) ? e.to() : e.from();
EdgeSet<T> otherEdges = vertexToEdges.get(otherVertex);
assert otherEdges.contains(e)
: "Error in ensuring consistent from/to edge sets";
otherEdges.remove(e);
}
// Update any of the subgraphs that had this vertex to notify them
// that it was removed
Iterator<WeakReference<Subgraph>> iter = subgraphs.iterator();
while (iter.hasNext()) {
WeakReference<Subgraph> ref = iter.next();
Subgraph s = ref.get();
// Check whether this subgraph was already gc'd (the subgraph
// was no longer in use) and if so, remove the ref from the list
// to avoid iterating over it again
if (s == null) {
iter.remove();
continue;
}
// Remove the vertex from the subgraph
s.vertexSubset.remove(vertex);
}
} | [
"private",
"void",
"removeInternal",
"(",
"int",
"vertex",
",",
"EdgeSet",
"<",
"T",
">",
"edges",
")",
"{",
"// Discount all the edges that were stored in this vertices edge set",
"numEdges",
"-=",
"edges",
".",
"size",
"(",
")",
";",
"// Now find all the edges stored ... | Removes the edges of the provided vertex from this graph, accounting for
the presence of the edges in the corresponding {@link EdgeSet}'s for the
other vertex in each edge. This method should only be called once a
vertex has been removed from the {@link #vertexToEdges} mapping. | [
"Removes",
"the",
"edges",
"of",
"the",
"provided",
"vertex",
"from",
"this",
"graph",
"accounting",
"for",
"the",
"presence",
"of",
"the",
"edges",
"in",
"the",
"corresponding",
"{"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/graph/AbstractGraph.java#L392-L425 |
headius/invokebinder | src/main/java/com/headius/invokebinder/SmartBinder.java | SmartBinder.filterReturn | public SmartBinder filterReturn(SmartHandle filter) {
return new SmartBinder(this, signature().changeReturn(filter.signature().type().returnType()), binder.filterReturn(filter.handle()));
} | java | public SmartBinder filterReturn(SmartHandle filter) {
return new SmartBinder(this, signature().changeReturn(filter.signature().type().returnType()), binder.filterReturn(filter.handle()));
} | [
"public",
"SmartBinder",
"filterReturn",
"(",
"SmartHandle",
"filter",
")",
"{",
"return",
"new",
"SmartBinder",
"(",
"this",
",",
"signature",
"(",
")",
".",
"changeReturn",
"(",
"filter",
".",
"signature",
"(",
")",
".",
"type",
"(",
")",
".",
"returnTyp... | Use the given filter function to transform the return value at this
point in the binder. The filter will be inserted into the handle, and
return values will pass through it before continuing.
The filter's argument must match the expected return value downstream
from this point in the binder, and the return value must match the
return value at this point in the binder.
@param filter the function to use to transform the return value at this point
@return a new SmartBinder with the filter applied | [
"Use",
"the",
"given",
"filter",
"function",
"to",
"transform",
"the",
"return",
"value",
"at",
"this",
"point",
"in",
"the",
"binder",
".",
"The",
"filter",
"will",
"be",
"inserted",
"into",
"the",
"handle",
"and",
"return",
"values",
"will",
"pass",
"thr... | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L961-L963 |
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java | Searcher.hasFacetRefinement | @SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"}) // For library users
public boolean hasFacetRefinement(@NonNull String attribute, @NonNull String value) {
List<String> attributeRefinements = refinementMap.get(attribute);
return attributeRefinements != null && attributeRefinements.contains(value);
} | java | @SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"}) // For library users
public boolean hasFacetRefinement(@NonNull String attribute, @NonNull String value) {
List<String> attributeRefinements = refinementMap.get(attribute);
return attributeRefinements != null && attributeRefinements.contains(value);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
",",
"\"SameParameterValue\"",
"}",
")",
"// For library users",
"public",
"boolean",
"hasFacetRefinement",
"(",
"@",
"NonNull",
"String",
"attribute",
",",
"@",
"NonNull",
"String",
"value",
... | Checks if a facet refinement is enabled.
@param attribute the attribute to refine on.
@param value the facet's value to check.
@return {@code true} if {@code attribute} is being refined with {@code value}. | [
"Checks",
"if",
"a",
"facet",
"refinement",
"is",
"enabled",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L624-L628 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java | RingPlacer.placeRing | public void placeRing(IRing ring, Point2d ringCenter, double bondLength) {
placeRing(ring, ringCenter, bondLength, defaultAngles);
} | java | public void placeRing(IRing ring, Point2d ringCenter, double bondLength) {
placeRing(ring, ringCenter, bondLength, defaultAngles);
} | [
"public",
"void",
"placeRing",
"(",
"IRing",
"ring",
",",
"Point2d",
"ringCenter",
",",
"double",
"bondLength",
")",
"{",
"placeRing",
"(",
"ring",
",",
"ringCenter",
",",
"bondLength",
",",
"defaultAngles",
")",
";",
"}"
] | Place ring with default start angles, using {@link #defaultAngles}.
@param ring the ring to place.
@param ringCenter center coordinates of the ring.
@param bondLength given bond length. | [
"Place",
"ring",
"with",
"default",
"start",
"angles",
"using",
"{"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java#L137-L139 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/hash/HashPartition.java | HashPartition.finalizeProbePhase | public int finalizeProbePhase(List<MemorySegment> freeMemory, List<HashPartition<BT, PT>> spilledPartitions)
throws IOException
{
if (isInMemory()) {
// in this case, return all memory buffers
// return the overflow segments
for (int k = 0; k < this.numOverflowSegments; k++) {
freeMemory.add(this.overflowSegments[k]);
}
this.overflowSegments = null;
this.numOverflowSegments = 0;
this.nextOverflowBucket = 0;
// return the partition buffers
for (int i = 0; i < this.partitionBuffers.length; i++) {
freeMemory.add(this.partitionBuffers[i]);
}
this.partitionBuffers = null;
return 0;
}
else if (this.probeSideRecordCounter == 0) {
// partition is empty, no spilled buffers
// return the memory buffer
freeMemory.add(this.probeSideBuffer.getCurrentSegment());
// delete the spill files
this.probeSideChannel.close();
this.buildSideChannel.deleteChannel();
this.probeSideChannel.deleteChannel();
return 0;
}
else {
// flush the last probe side buffer and register this partition as pending
this.probeSideBuffer.close();
this.probeSideChannel.close();
spilledPartitions.add(this);
return 1;
}
} | java | public int finalizeProbePhase(List<MemorySegment> freeMemory, List<HashPartition<BT, PT>> spilledPartitions)
throws IOException
{
if (isInMemory()) {
// in this case, return all memory buffers
// return the overflow segments
for (int k = 0; k < this.numOverflowSegments; k++) {
freeMemory.add(this.overflowSegments[k]);
}
this.overflowSegments = null;
this.numOverflowSegments = 0;
this.nextOverflowBucket = 0;
// return the partition buffers
for (int i = 0; i < this.partitionBuffers.length; i++) {
freeMemory.add(this.partitionBuffers[i]);
}
this.partitionBuffers = null;
return 0;
}
else if (this.probeSideRecordCounter == 0) {
// partition is empty, no spilled buffers
// return the memory buffer
freeMemory.add(this.probeSideBuffer.getCurrentSegment());
// delete the spill files
this.probeSideChannel.close();
this.buildSideChannel.deleteChannel();
this.probeSideChannel.deleteChannel();
return 0;
}
else {
// flush the last probe side buffer and register this partition as pending
this.probeSideBuffer.close();
this.probeSideChannel.close();
spilledPartitions.add(this);
return 1;
}
} | [
"public",
"int",
"finalizeProbePhase",
"(",
"List",
"<",
"MemorySegment",
">",
"freeMemory",
",",
"List",
"<",
"HashPartition",
"<",
"BT",
",",
"PT",
">",
">",
"spilledPartitions",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isInMemory",
"(",
")",
")",
... | @param freeMemory
@param spilledPartitions
@return The number of write-behind buffers reclaimable after this method call.
@throws IOException | [
"@param",
"freeMemory",
"@param",
"spilledPartitions",
"@return",
"The",
"number",
"of",
"write",
"-",
"behind",
"buffers",
"reclaimable",
"after",
"this",
"method",
"call",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/hash/HashPartition.java#L341-L380 |
SimplicityApks/ReminderDatePicker | lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/PickerSpinner.java | PickerSpinner.insertAdapterItem | public void insertAdapterItem(TwinTextItem item, int index) {
int selection = getSelectedItemPosition();
Object selectedItem = getSelectedItem();
((PickerSpinnerAdapter) getAdapter()).insert(item, index);
// select the new item if there was an equal temporary item selected
if(selectedItem.equals(item))
setSelectionQuietly(index);
// otherwise keep track when inserting above the selection
else if(index <= selection)
setSelectionQuietly(selection+1);
} | java | public void insertAdapterItem(TwinTextItem item, int index) {
int selection = getSelectedItemPosition();
Object selectedItem = getSelectedItem();
((PickerSpinnerAdapter) getAdapter()).insert(item, index);
// select the new item if there was an equal temporary item selected
if(selectedItem.equals(item))
setSelectionQuietly(index);
// otherwise keep track when inserting above the selection
else if(index <= selection)
setSelectionQuietly(selection+1);
} | [
"public",
"void",
"insertAdapterItem",
"(",
"TwinTextItem",
"item",
",",
"int",
"index",
")",
"{",
"int",
"selection",
"=",
"getSelectedItemPosition",
"(",
")",
";",
"Object",
"selectedItem",
"=",
"getSelectedItem",
"(",
")",
";",
"(",
"(",
"PickerSpinnerAdapter... | Inserts the item at the specified index into the adapter's data set and takes care of handling selection changes.
Always call this method instead of getAdapter().insert().
@param item The item to insert.
@param index The index where it'll be at. | [
"Inserts",
"the",
"item",
"at",
"the",
"specified",
"index",
"into",
"the",
"adapter",
"s",
"data",
"set",
"and",
"takes",
"care",
"of",
"handling",
"selection",
"changes",
".",
"Always",
"call",
"this",
"method",
"instead",
"of",
"getAdapter",
"()",
".",
... | train | https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/PickerSpinner.java#L303-L313 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/DeepSubtypeAnalysis.java | DeepSubtypeAnalysis.deepInstanceOf | public static double deepInstanceOf(JavaClass x, JavaClass y) throws ClassNotFoundException {
return Analyze.deepInstanceOf(x, y);
} | java | public static double deepInstanceOf(JavaClass x, JavaClass y) throws ClassNotFoundException {
return Analyze.deepInstanceOf(x, y);
} | [
"public",
"static",
"double",
"deepInstanceOf",
"(",
"JavaClass",
"x",
",",
"JavaClass",
"y",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"Analyze",
".",
"deepInstanceOf",
"(",
"x",
",",
"y",
")",
";",
"}"
] | Given two JavaClasses, try to estimate the probability that an reference
of type x is also an instance of type y. Will return 0 only if it is
impossible and 1 only if it is guaranteed.
@param x
Known type of object
@param y
Type queried about
@return 0 - 1 value indicating probability | [
"Given",
"two",
"JavaClasses",
"try",
"to",
"estimate",
"the",
"probability",
"that",
"an",
"reference",
"of",
"type",
"x",
"is",
"also",
"an",
"instance",
"of",
"type",
"y",
".",
"Will",
"return",
"0",
"only",
"if",
"it",
"is",
"impossible",
"and",
"1",... | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/DeepSubtypeAnalysis.java#L305-L308 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java | StorageAccountsInner.beginCreate | public StorageAccountInner beginCreate(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | java | public StorageAccountInner beginCreate(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | [
"public",
"StorageAccountInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"StorageAccountCreateParameters",
"parameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",... | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param parameters The parameters to provide for the created account.
@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 StorageAccountInner object if successful. | [
"Asynchronously",
"creates",
"a",
"new",
"storage",
"account",
"with",
"the",
"specified",
"parameters",
".",
"If",
"an",
"account",
"is",
"already",
"created",
"and",
"a",
"subsequent",
"create",
"request",
"is",
"issued",
"with",
"different",
"properties",
"th... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L304-L306 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplatesFactory.java | URLTemplatesFactory.initServletRequest | public static void initServletRequest(ServletRequest servletRequest, URLTemplatesFactory templatesFactory)
{
assert servletRequest != null : "The ServletRequest cannot be null.";
if (servletRequest == null) {
throw new IllegalArgumentException("The ServletRequest cannot be null.");
}
servletRequest.setAttribute(URL_TEMPLATE_FACTORY_ATTR, templatesFactory);
} | java | public static void initServletRequest(ServletRequest servletRequest, URLTemplatesFactory templatesFactory)
{
assert servletRequest != null : "The ServletRequest cannot be null.";
if (servletRequest == null) {
throw new IllegalArgumentException("The ServletRequest cannot be null.");
}
servletRequest.setAttribute(URL_TEMPLATE_FACTORY_ATTR, templatesFactory);
} | [
"public",
"static",
"void",
"initServletRequest",
"(",
"ServletRequest",
"servletRequest",
",",
"URLTemplatesFactory",
"templatesFactory",
")",
"{",
"assert",
"servletRequest",
"!=",
"null",
":",
"\"The ServletRequest cannot be null.\"",
";",
"if",
"(",
"servletRequest",
... | Adds a given URLTemplatesFactory instance as an attribute on the ServletRequest.
@param servletRequest the current ServletRequest.
@param templatesFactory the URLTemplatesFactory instance to add as an attribute of the request | [
"Adds",
"a",
"given",
"URLTemplatesFactory",
"instance",
"as",
"an",
"attribute",
"on",
"the",
"ServletRequest",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplatesFactory.java#L117-L126 |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.checkLoopInvariant | private void checkLoopInvariant(String msg, Stmt.Loop stmt, Context context) {
//
Tuple<WyilFile.Expr> loopInvariant = stmt.getInvariant();
LocalEnvironment environment = context.getEnvironment();
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) environment
.getParent().enclosingDeclaration;
// Construct argument to invocation
Tuple<WyilFile.Decl.Variable> localVariables = determineUsedVariables(stmt.getInvariant());
Expr[] arguments = new Expr[localVariables.size()];
for (int i = 0; i != arguments.length; ++i) {
WyilFile.Decl.Variable var = localVariables.get(i);
arguments[i] = new Expr.VariableAccess(environment.read(var));
}
//
for (int i = 0; i != loopInvariant.size(); ++i) {
WyilFile.Expr clause = loopInvariant.get(i);
Name ident = convert(declaration.getQualifiedName(), "_loopinvariant_" + clause.getIndex(), declaration.getName());
Expr macroCall = new Expr.Invoke(null, ident, null, arguments);
context.emit(new VerificationCondition(msg, context.assumptions, macroCall,
clause.getParent(WyilFile.Attribute.Span.class)));
}
} | java | private void checkLoopInvariant(String msg, Stmt.Loop stmt, Context context) {
//
Tuple<WyilFile.Expr> loopInvariant = stmt.getInvariant();
LocalEnvironment environment = context.getEnvironment();
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) environment
.getParent().enclosingDeclaration;
// Construct argument to invocation
Tuple<WyilFile.Decl.Variable> localVariables = determineUsedVariables(stmt.getInvariant());
Expr[] arguments = new Expr[localVariables.size()];
for (int i = 0; i != arguments.length; ++i) {
WyilFile.Decl.Variable var = localVariables.get(i);
arguments[i] = new Expr.VariableAccess(environment.read(var));
}
//
for (int i = 0; i != loopInvariant.size(); ++i) {
WyilFile.Expr clause = loopInvariant.get(i);
Name ident = convert(declaration.getQualifiedName(), "_loopinvariant_" + clause.getIndex(), declaration.getName());
Expr macroCall = new Expr.Invoke(null, ident, null, arguments);
context.emit(new VerificationCondition(msg, context.assumptions, macroCall,
clause.getParent(WyilFile.Attribute.Span.class)));
}
} | [
"private",
"void",
"checkLoopInvariant",
"(",
"String",
"msg",
",",
"Stmt",
".",
"Loop",
"stmt",
",",
"Context",
"context",
")",
"{",
"//",
"Tuple",
"<",
"WyilFile",
".",
"Expr",
">",
"loopInvariant",
"=",
"stmt",
".",
"getInvariant",
"(",
")",
";",
"Loc... | Emit verification condition(s) to ensure that the clauses of loop invariant
hold at a given point
@param loopInvariant
The clauses making up the loop invariant
@param context | [
"Emit",
"verification",
"condition",
"(",
"s",
")",
"to",
"ensure",
"that",
"the",
"clauses",
"of",
"loop",
"invariant",
"hold",
"at",
"a",
"given",
"point"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1116-L1137 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java | FileUtil.getRelativePath | public static String getRelativePath(String base, String child) {
return new File(base).toURI().relativize(new File(child).toURI()).getPath();
} | java | public static String getRelativePath(String base, String child) {
return new File(base).toURI().relativize(new File(child).toURI()).getPath();
} | [
"public",
"static",
"String",
"getRelativePath",
"(",
"String",
"base",
",",
"String",
"child",
")",
"{",
"return",
"new",
"File",
"(",
"base",
")",
".",
"toURI",
"(",
")",
".",
"relativize",
"(",
"new",
"File",
"(",
"child",
")",
".",
"toURI",
"(",
... | Determines a file's relative path related to a base directory (a parent some levels up in the tree).
@param base base directory.
@param child file to get relative path for.
@return relative path. | [
"Determines",
"a",
"file",
"s",
"relative",
"path",
"related",
"to",
"a",
"base",
"directory",
"(",
"a",
"parent",
"some",
"levels",
"up",
"in",
"the",
"tree",
")",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L276-L278 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java | JawrRequestHandler.initApplicationConfigManager | private JawrApplicationConfigManager initApplicationConfigManager() {
JawrApplicationConfigManager appConfigMgr = (JawrApplicationConfigManager) servletContext
.getAttribute(JawrConstant.JAWR_APPLICATION_CONFIG_MANAGER);
if (appConfigMgr == null) {
appConfigMgr = new JawrApplicationConfigManager();
servletContext.setAttribute(JawrConstant.JAWR_APPLICATION_CONFIG_MANAGER, appConfigMgr);
}
// Create the config manager for the current Request Handler
JawrConfigManager configMgr = new JawrConfigManager(this, jawrConfig.getConfigProperties());
// Initialize the jawrApplicationConfigManager
if (resourceType.equals(JawrConstant.JS_TYPE)) {
appConfigMgr.setJsMBean(configMgr);
} else if (resourceType.equals(JawrConstant.CSS_TYPE)) {
appConfigMgr.setCssMBean(configMgr);
} else {
appConfigMgr.setBinaryMBean(configMgr);
}
return appConfigMgr;
} | java | private JawrApplicationConfigManager initApplicationConfigManager() {
JawrApplicationConfigManager appConfigMgr = (JawrApplicationConfigManager) servletContext
.getAttribute(JawrConstant.JAWR_APPLICATION_CONFIG_MANAGER);
if (appConfigMgr == null) {
appConfigMgr = new JawrApplicationConfigManager();
servletContext.setAttribute(JawrConstant.JAWR_APPLICATION_CONFIG_MANAGER, appConfigMgr);
}
// Create the config manager for the current Request Handler
JawrConfigManager configMgr = new JawrConfigManager(this, jawrConfig.getConfigProperties());
// Initialize the jawrApplicationConfigManager
if (resourceType.equals(JawrConstant.JS_TYPE)) {
appConfigMgr.setJsMBean(configMgr);
} else if (resourceType.equals(JawrConstant.CSS_TYPE)) {
appConfigMgr.setCssMBean(configMgr);
} else {
appConfigMgr.setBinaryMBean(configMgr);
}
return appConfigMgr;
} | [
"private",
"JawrApplicationConfigManager",
"initApplicationConfigManager",
"(",
")",
"{",
"JawrApplicationConfigManager",
"appConfigMgr",
"=",
"(",
"JawrApplicationConfigManager",
")",
"servletContext",
".",
"getAttribute",
"(",
"JawrConstant",
".",
"JAWR_APPLICATION_CONFIG_MANAG... | Initialize the application config manager
@return the application config manager | [
"Initialize",
"the",
"application",
"config",
"manager"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java#L367-L388 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java | LayoutService.cloneLayout | @Override
public void cloneLayout(LayoutIdentifier layout, LayoutIdentifier layout2) {
String text = getLayoutContent(layout);
saveLayout(layout2, text);
} | java | @Override
public void cloneLayout(LayoutIdentifier layout, LayoutIdentifier layout2) {
String text = getLayoutContent(layout);
saveLayout(layout2, text);
} | [
"@",
"Override",
"public",
"void",
"cloneLayout",
"(",
"LayoutIdentifier",
"layout",
",",
"LayoutIdentifier",
"layout2",
")",
"{",
"String",
"text",
"=",
"getLayoutContent",
"(",
"layout",
")",
";",
"saveLayout",
"(",
"layout2",
",",
"text",
")",
";",
"}"
] | Clone a layout.
@param layout The original layout identifier.
@param layout2 The new layout identifier. | [
"Clone",
"a",
"layout",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java#L103-L107 |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/TableLocation.java | TableLocation.capsIdentifier | public static String capsIdentifier(String identifier, Boolean isH2Database) {
if(isH2Database != null) {
if(isH2Database) {
return identifier.toUpperCase();
} else {
return identifier.toLowerCase();
}
} else {
return identifier;
}
} | java | public static String capsIdentifier(String identifier, Boolean isH2Database) {
if(isH2Database != null) {
if(isH2Database) {
return identifier.toUpperCase();
} else {
return identifier.toLowerCase();
}
} else {
return identifier;
}
} | [
"public",
"static",
"String",
"capsIdentifier",
"(",
"String",
"identifier",
",",
"Boolean",
"isH2Database",
")",
"{",
"if",
"(",
"isH2Database",
"!=",
"null",
")",
"{",
"if",
"(",
"isH2Database",
")",
"{",
"return",
"identifier",
".",
"toUpperCase",
"(",
")... | Change case of parameters to make it more user-friendly.
@param identifier Table, Catalog, Schema, or column name
@param isH2Database True if H2, False if PostGreSQL, null if unknown
@return Upper or lower case version of identifier | [
"Change",
"case",
"of",
"parameters",
"to",
"make",
"it",
"more",
"user",
"-",
"friendly",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/TableLocation.java#L233-L243 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/TransactionOutPoint.java | TransactionOutPoint.getConnectedKey | @Nullable
public ECKey getConnectedKey(KeyBag keyBag) throws ScriptException {
TransactionOutput connectedOutput = getConnectedOutput();
checkNotNull(connectedOutput, "Input is not connected so cannot retrieve key");
Script connectedScript = connectedOutput.getScriptPubKey();
if (ScriptPattern.isP2PKH(connectedScript)) {
byte[] addressBytes = ScriptPattern.extractHashFromP2PKH(connectedScript);
return keyBag.findKeyFromPubKeyHash(addressBytes, Script.ScriptType.P2PKH);
} else if (ScriptPattern.isP2WPKH(connectedScript)) {
byte[] addressBytes = ScriptPattern.extractHashFromP2WH(connectedScript);
return keyBag.findKeyFromPubKeyHash(addressBytes, Script.ScriptType.P2WPKH);
} else if (ScriptPattern.isP2PK(connectedScript)) {
byte[] pubkeyBytes = ScriptPattern.extractKeyFromP2PK(connectedScript);
return keyBag.findKeyFromPubKey(pubkeyBytes);
} else {
throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Could not understand form of connected output script: " + connectedScript);
}
} | java | @Nullable
public ECKey getConnectedKey(KeyBag keyBag) throws ScriptException {
TransactionOutput connectedOutput = getConnectedOutput();
checkNotNull(connectedOutput, "Input is not connected so cannot retrieve key");
Script connectedScript = connectedOutput.getScriptPubKey();
if (ScriptPattern.isP2PKH(connectedScript)) {
byte[] addressBytes = ScriptPattern.extractHashFromP2PKH(connectedScript);
return keyBag.findKeyFromPubKeyHash(addressBytes, Script.ScriptType.P2PKH);
} else if (ScriptPattern.isP2WPKH(connectedScript)) {
byte[] addressBytes = ScriptPattern.extractHashFromP2WH(connectedScript);
return keyBag.findKeyFromPubKeyHash(addressBytes, Script.ScriptType.P2WPKH);
} else if (ScriptPattern.isP2PK(connectedScript)) {
byte[] pubkeyBytes = ScriptPattern.extractKeyFromP2PK(connectedScript);
return keyBag.findKeyFromPubKey(pubkeyBytes);
} else {
throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Could not understand form of connected output script: " + connectedScript);
}
} | [
"@",
"Nullable",
"public",
"ECKey",
"getConnectedKey",
"(",
"KeyBag",
"keyBag",
")",
"throws",
"ScriptException",
"{",
"TransactionOutput",
"connectedOutput",
"=",
"getConnectedOutput",
"(",
")",
";",
"checkNotNull",
"(",
"connectedOutput",
",",
"\"Input is not connecte... | Returns the ECKey identified in the connected output, for either P2PKH, P2WPKH or P2PK scripts.
For P2SH scripts you can use {@link #getConnectedRedeemData(KeyBag)} and then get the
key from RedeemData.
If the script form cannot be understood, throws ScriptException.
@return an ECKey or null if the connected key cannot be found in the wallet. | [
"Returns",
"the",
"ECKey",
"identified",
"in",
"the",
"connected",
"output",
"for",
"either",
"P2PKH",
"P2WPKH",
"or",
"P2PK",
"scripts",
".",
"For",
"P2SH",
"scripts",
"you",
"can",
"use",
"{",
"@link",
"#getConnectedRedeemData",
"(",
"KeyBag",
")",
"}",
"a... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/TransactionOutPoint.java#L139-L156 |
Stratio/cassandra-lucene-index | builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java | Builder.geoDistance | public static GeoDistanceSortField geoDistance(String field, double latitude, double longitude) {
return new GeoDistanceSortField(field, latitude, longitude);
} | java | public static GeoDistanceSortField geoDistance(String field, double latitude, double longitude) {
return new GeoDistanceSortField(field, latitude, longitude);
} | [
"public",
"static",
"GeoDistanceSortField",
"geoDistance",
"(",
"String",
"field",
",",
"double",
"latitude",
",",
"double",
"longitude",
")",
"{",
"return",
"new",
"GeoDistanceSortField",
"(",
"field",
",",
"latitude",
",",
"longitude",
")",
";",
"}"
] | Returns a new {@link GeoDistanceSortField} for the specified field.
@param field the name of the geo point field mapper to be used for sorting
@param latitude the latitude in degrees of the point to min distance sort by
@param longitude the longitude in degrees of the point to min distance sort by
@return a new geo distance sort field | [
"Returns",
"a",
"new",
"{",
"@link",
"GeoDistanceSortField",
"}",
"for",
"the",
"specified",
"field",
"."
] | train | https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java#L513-L515 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.writePublishReport | public void writePublishReport(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsException {
CmsPublishReport report = (CmsPublishReport)publishJob.removePublishReport();
if (report != null) {
getProjectDriver(dbc).writePublishReport(dbc, publishJob.getPublishHistoryId(), report.getContents());
}
} | java | public void writePublishReport(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsException {
CmsPublishReport report = (CmsPublishReport)publishJob.removePublishReport();
if (report != null) {
getProjectDriver(dbc).writePublishReport(dbc, publishJob.getPublishHistoryId(), report.getContents());
}
} | [
"public",
"void",
"writePublishReport",
"(",
"CmsDbContext",
"dbc",
",",
"CmsPublishJobInfoBean",
"publishJob",
")",
"throws",
"CmsException",
"{",
"CmsPublishReport",
"report",
"=",
"(",
"CmsPublishReport",
")",
"publishJob",
".",
"removePublishReport",
"(",
")",
";"... | Writes the publish report for a publish job.<p>
@param dbc the current database context
@param publishJob the publish job
@throws CmsException if something goes wrong | [
"Writes",
"the",
"publish",
"report",
"for",
"a",
"publish",
"job",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10125-L10132 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupBean.java | CmsSetupBean.htmlModule | protected String htmlModule(CmsModule module, int pos) {
StringBuffer html = new StringBuffer(256);
html.append("\t<tr>\n");
html.append("\t\t<td style='vertical-align: top;'>\n");
html.append("\t\t\t<input type='checkbox' name='availableModules' value='");
html.append(module.getName());
html.append("' checked='checked' onClick=\"checkModuleDependencies('");
html.append(module.getName());
html.append("');\">\n");
html.append("\t\t</td>\n");
html.append("\t\t<td style='vertical-align: top; width: 100%; padding-top: 4px;'>\n\t\t\t");
html.append(getDisplayForModule(module));
html.append("\n\t\t</td>\n");
html.append("\t\t<td style='vertical-align: top; text-align: right;'>\n");
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(module.getDescription())) {
html.append("\t\t\t");
html.append(getHtmlHelpIcon("" + pos, ""));
}
html.append("\t\t</td>\n");
html.append("\t</tr>\n");
return html.toString();
} | java | protected String htmlModule(CmsModule module, int pos) {
StringBuffer html = new StringBuffer(256);
html.append("\t<tr>\n");
html.append("\t\t<td style='vertical-align: top;'>\n");
html.append("\t\t\t<input type='checkbox' name='availableModules' value='");
html.append(module.getName());
html.append("' checked='checked' onClick=\"checkModuleDependencies('");
html.append(module.getName());
html.append("');\">\n");
html.append("\t\t</td>\n");
html.append("\t\t<td style='vertical-align: top; width: 100%; padding-top: 4px;'>\n\t\t\t");
html.append(getDisplayForModule(module));
html.append("\n\t\t</td>\n");
html.append("\t\t<td style='vertical-align: top; text-align: right;'>\n");
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(module.getDescription())) {
html.append("\t\t\t");
html.append(getHtmlHelpIcon("" + pos, ""));
}
html.append("\t\t</td>\n");
html.append("\t</tr>\n");
return html.toString();
} | [
"protected",
"String",
"htmlModule",
"(",
"CmsModule",
"module",
",",
"int",
"pos",
")",
"{",
"StringBuffer",
"html",
"=",
"new",
"StringBuffer",
"(",
"256",
")",
";",
"html",
".",
"append",
"(",
"\"\\t<tr>\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\... | Returns html for the given module to fill the selection list.<p>
@param module the module to generate the code for
@param pos the position in the list
@return html code | [
"Returns",
"html",
"for",
"the",
"given",
"module",
"to",
"fill",
"the",
"selection",
"list",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L2546-L2568 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/util/Utils.java | Utils.hasAnnotationAttribute | public static <T> boolean hasAnnotationAttribute(final Annotation anno, final String attrName, final Class<T> attrType) {
return getAnnotationAttribute(anno, attrName, attrType).isPresent();
} | java | public static <T> boolean hasAnnotationAttribute(final Annotation anno, final String attrName, final Class<T> attrType) {
return getAnnotationAttribute(anno, attrName, attrType).isPresent();
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"hasAnnotationAttribute",
"(",
"final",
"Annotation",
"anno",
",",
"final",
"String",
"attrName",
",",
"final",
"Class",
"<",
"T",
">",
"attrType",
")",
"{",
"return",
"getAnnotationAttribute",
"(",
"anno",
",",
... | アノテーションの指定した属性値を持つかどうか判定する。
<p>アノテーションの修飾子はpublicである必要があります。</p>
@param anno アノテーションのインスタンス
@param attrName 属性名
@param attrType 属性のタイプ。
@return 属性を持つ場合trueを返す。 | [
"アノテーションの指定した属性値を持つかどうか判定する。",
"<p",
">",
"アノテーションの修飾子はpublicである必要があります。<",
"/",
"p",
">"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/util/Utils.java#L165-L169 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getDownloadThumbnailRequest | public BoxRequestsFile.DownloadThumbnail getDownloadThumbnailRequest(OutputStream outputStream, String fileId) {
BoxRequestsFile.DownloadThumbnail request = new BoxRequestsFile.DownloadThumbnail(fileId, outputStream, getThumbnailFileDownloadUrl(fileId), mSession);
return request;
} | java | public BoxRequestsFile.DownloadThumbnail getDownloadThumbnailRequest(OutputStream outputStream, String fileId) {
BoxRequestsFile.DownloadThumbnail request = new BoxRequestsFile.DownloadThumbnail(fileId, outputStream, getThumbnailFileDownloadUrl(fileId), mSession);
return request;
} | [
"public",
"BoxRequestsFile",
".",
"DownloadThumbnail",
"getDownloadThumbnailRequest",
"(",
"OutputStream",
"outputStream",
",",
"String",
"fileId",
")",
"{",
"BoxRequestsFile",
".",
"DownloadThumbnail",
"request",
"=",
"new",
"BoxRequestsFile",
".",
"DownloadThumbnail",
"... | Gets a request that downloads the given file thumbnail to the provided outputStream. Developer is responsible for closing the outputStream provided.
@param outputStream outputStream to write file contents to.
@param fileId the file id to download.
@return request to download a file thumbnail | [
"Gets",
"a",
"request",
"that",
"downloads",
"the",
"given",
"file",
"thumbnail",
"to",
"the",
"provided",
"outputStream",
".",
"Developer",
"is",
"responsible",
"for",
"closing",
"the",
"outputStream",
"provided",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L429-L432 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/util/MSwingUtilities.java | MSwingUtilities.getScaledInstance | public static Image getScaledInstance(Image img, int targetWidth, int targetHeight) {
final int type = BufferedImage.TYPE_INT_ARGB;
Image ret = img;
final int width = ret.getWidth(null);
final int height = ret.getHeight(null);
if (width != targetWidth && height != targetHeight) {
// a priori plus performant que Image.getScaledInstance
final BufferedImage scratchImage = new BufferedImage(targetWidth, targetHeight, type);
final Graphics2D g2 = scratchImage.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.drawImage(ret, 0, 0, targetWidth, targetHeight, 0, 0, width, height, null);
g2.dispose();
ret = scratchImage;
}
return ret;
} | java | public static Image getScaledInstance(Image img, int targetWidth, int targetHeight) {
final int type = BufferedImage.TYPE_INT_ARGB;
Image ret = img;
final int width = ret.getWidth(null);
final int height = ret.getHeight(null);
if (width != targetWidth && height != targetHeight) {
// a priori plus performant que Image.getScaledInstance
final BufferedImage scratchImage = new BufferedImage(targetWidth, targetHeight, type);
final Graphics2D g2 = scratchImage.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.drawImage(ret, 0, 0, targetWidth, targetHeight, 0, 0, width, height, null);
g2.dispose();
ret = scratchImage;
}
return ret;
} | [
"public",
"static",
"Image",
"getScaledInstance",
"(",
"Image",
"img",
",",
"int",
"targetWidth",
",",
"int",
"targetHeight",
")",
"{",
"final",
"int",
"type",
"=",
"BufferedImage",
".",
"TYPE_INT_ARGB",
";",
"Image",
"ret",
"=",
"img",
";",
"final",
"int",
... | Redimensionne une image.
@param img Image
@param targetWidth int
@param targetHeight int
@return Image | [
"Redimensionne",
"une",
"image",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/util/MSwingUtilities.java#L228-L244 |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/MatrixIO.java | MatrixIO.saveSparseCSV | public static void saveSparseCSV(FMatrixSparseTriplet A , String fileName )
throws IOException
{
PrintStream fileStream = new PrintStream(fileName);
fileStream.println(A.getNumRows() + " " + A.getNumCols() +" "+A.nz_length+ " real");
for (int i = 0; i < A.nz_length; i++) {
int row = A.nz_rowcol.data[i*2];
int col = A.nz_rowcol.data[i*2+1];
float value = A.nz_value.data[i];
fileStream.println(row+" "+col+" "+value);
}
fileStream.close();
} | java | public static void saveSparseCSV(FMatrixSparseTriplet A , String fileName )
throws IOException
{
PrintStream fileStream = new PrintStream(fileName);
fileStream.println(A.getNumRows() + " " + A.getNumCols() +" "+A.nz_length+ " real");
for (int i = 0; i < A.nz_length; i++) {
int row = A.nz_rowcol.data[i*2];
int col = A.nz_rowcol.data[i*2+1];
float value = A.nz_value.data[i];
fileStream.println(row+" "+col+" "+value);
}
fileStream.close();
} | [
"public",
"static",
"void",
"saveSparseCSV",
"(",
"FMatrixSparseTriplet",
"A",
",",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"PrintStream",
"fileStream",
"=",
"new",
"PrintStream",
"(",
"fileName",
")",
";",
"fileStream",
".",
"println",
"(",
"A"... | Saves a matrix to disk using in a Column Space Value (CSV) format. For a
description of the format see {@link MatrixIO#loadCSV(String,boolean)}.
@param A The matrix being saved.
@param fileName Name of the file its being saved at.
@throws java.io.IOException | [
"Saves",
"a",
"matrix",
"to",
"disk",
"using",
"in",
"a",
"Column",
"Space",
"Value",
"(",
"CSV",
")",
"format",
".",
"For",
"a",
"description",
"of",
"the",
"format",
"see",
"{",
"@link",
"MatrixIO#loadCSV",
"(",
"String",
"boolean",
")",
"}",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/MatrixIO.java#L151-L165 |
groovy/groovy-core | src/main/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.postNodeCompletion | protected Object postNodeCompletion(Object parent, Object node) {
for (Closure postNodeCompletionDelegate : getProxyBuilder().getPostNodeCompletionDelegates()) {
(postNodeCompletionDelegate).call(new Object[]{this, parent, node});
}
return node;
} | java | protected Object postNodeCompletion(Object parent, Object node) {
for (Closure postNodeCompletionDelegate : getProxyBuilder().getPostNodeCompletionDelegates()) {
(postNodeCompletionDelegate).call(new Object[]{this, parent, node});
}
return node;
} | [
"protected",
"Object",
"postNodeCompletion",
"(",
"Object",
"parent",
",",
"Object",
"node",
")",
"{",
"for",
"(",
"Closure",
"postNodeCompletionDelegate",
":",
"getProxyBuilder",
"(",
")",
".",
"getPostNodeCompletionDelegates",
"(",
")",
")",
"{",
"(",
"postNodeC... | A hook to allow nodes to be processed once they have had all of their
children applied and allows the actual node object that represents the
Markup element to be changed.<br>
It will call any registered postNodeCompletionDelegates, if you override
this method be sure to call this impl at the end of your code.
@param node the current node being processed
@param parent the parent of the node being processed
@return the node, possibly new, that represents the markup element | [
"A",
"hook",
"to",
"allow",
"nodes",
"to",
"be",
"processed",
"once",
"they",
"have",
"had",
"all",
"of",
"their",
"children",
"applied",
"and",
"allows",
"the",
"actual",
"node",
"object",
"that",
"represents",
"the",
"Markup",
"element",
"to",
"be",
"cha... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/util/FactoryBuilderSupport.java#L1039-L1045 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java | ReplyFactory.addAirlineItineraryTemplate | public static AirlineItineraryTemplateBuilder addAirlineItineraryTemplate(
String introMessage, String locale, String pnrNumber,
BigDecimal totalPrice, String currency) {
return new AirlineItineraryTemplateBuilder(introMessage, locale,
pnrNumber, totalPrice, currency);
} | java | public static AirlineItineraryTemplateBuilder addAirlineItineraryTemplate(
String introMessage, String locale, String pnrNumber,
BigDecimal totalPrice, String currency) {
return new AirlineItineraryTemplateBuilder(introMessage, locale,
pnrNumber, totalPrice, currency);
} | [
"public",
"static",
"AirlineItineraryTemplateBuilder",
"addAirlineItineraryTemplate",
"(",
"String",
"introMessage",
",",
"String",
"locale",
",",
"String",
"pnrNumber",
",",
"BigDecimal",
"totalPrice",
",",
"String",
"currency",
")",
"{",
"return",
"new",
"AirlineItine... | Adds an Airline Itinerary Template to the response.
@param introMessage
the message to send before the template. It can't be empty.
@param locale
the current locale. It can't be empty and must be in format
[a-z]{2}_[A-Z]{2}. Locale must be in format [a-z]{2}_[A-Z]{2}.
For more information see<a href=
"https://developers.facebook.com/docs/internationalization#locales"
> Facebook's locale support</a>.
@param pnrNumber
the Passenger Name Record number (Booking Number). It can't be
empty.
@param totalPrice
the total price of the itinerary.
@param currency
the currency for the price. It can't be empty. The currency
must be a three digit ISO-4217-3 code in format [A-Z]{3}. For
more information see <a href=
"https://developers.facebook.com/docs/payments/reference/supportedcurrencies"
> Facebook's currency support</a>
@return a builder for the response.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/airline-itinerary-template"
> Facebook's Messenger Platform Airline Itinerary Template
Documentation</a> | [
"Adds",
"an",
"Airline",
"Itinerary",
"Template",
"to",
"the",
"response",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java#L294-L299 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/metric/MoreMeters.java | MoreMeters.timerWithDefaultQuantiles | @Deprecated
public static Timer timerWithDefaultQuantiles(MeterRegistry registry, String name, Iterable<Tag> tags) {
requireNonNull(registry, "registry");
requireNonNull(name, "name");
requireNonNull(tags, "tags");
return Timer.builder(name)
.tags(tags)
.publishPercentiles(PERCENTILES)
.register(registry);
} | java | @Deprecated
public static Timer timerWithDefaultQuantiles(MeterRegistry registry, String name, Iterable<Tag> tags) {
requireNonNull(registry, "registry");
requireNonNull(name, "name");
requireNonNull(tags, "tags");
return Timer.builder(name)
.tags(tags)
.publishPercentiles(PERCENTILES)
.register(registry);
} | [
"@",
"Deprecated",
"public",
"static",
"Timer",
"timerWithDefaultQuantiles",
"(",
"MeterRegistry",
"registry",
",",
"String",
"name",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
")",
"{",
"requireNonNull",
"(",
"registry",
",",
"\"registry\"",
")",
";",
"requireNo... | Returns a newly-registered {@link Timer} with percentile publication configured.
@deprecated Use {@link #newTimer(MeterRegistry, String, Iterable)}. | [
"Returns",
"a",
"newly",
"-",
"registered",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/metric/MoreMeters.java#L154-L163 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getEventsBatch | public OneLoginResponse<Event> getEventsBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getEventsBatch(batchSize, null);
} | java | public OneLoginResponse<Event> getEventsBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getEventsBatch(batchSize, null);
} | [
"public",
"OneLoginResponse",
"<",
"Event",
">",
"getEventsBatch",
"(",
"int",
"batchSize",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"return",
"getEventsBatch",
"(",
"batchSize",
",",
"null",
")",
";",
"}"
... | Get a batch of Events.
@param batchSize Size of the Batch
@return OneLoginResponse of Event (Batch)
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see com.onelogin.sdk.model.Event
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/events/get-events">Get Events documentation</a> | [
"Get",
"a",
"batch",
"of",
"Events",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L1985-L1987 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/hadoop/ConfigHelper.java | ConfigHelper.setOutputColumnFamily | public static void setOutputColumnFamily(Configuration conf, String keyspace, String columnFamily)
{
setOutputKeyspace(conf, keyspace);
setOutputColumnFamily(conf, columnFamily);
} | java | public static void setOutputColumnFamily(Configuration conf, String keyspace, String columnFamily)
{
setOutputKeyspace(conf, keyspace);
setOutputColumnFamily(conf, columnFamily);
} | [
"public",
"static",
"void",
"setOutputColumnFamily",
"(",
"Configuration",
"conf",
",",
"String",
"keyspace",
",",
"String",
"columnFamily",
")",
"{",
"setOutputKeyspace",
"(",
"conf",
",",
"keyspace",
")",
";",
"setOutputColumnFamily",
"(",
"conf",
",",
"columnFa... | Set the column family for the output of this job.
@param conf Job configuration you are about to run
@param keyspace
@param columnFamily | [
"Set",
"the",
"column",
"family",
"for",
"the",
"output",
"of",
"this",
"job",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/ConfigHelper.java#L140-L144 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java | ObjectOutputStream.writeFieldDescriptors | private void writeFieldDescriptors(ObjectStreamClass classDesc, boolean externalizable) throws IOException {
Class<?> loadedClass = classDesc.forClass();
ObjectStreamField[] fields = null;
int fieldCount = 0;
// The fields of String are not needed since Strings are treated as
// primitive types
if (!externalizable && loadedClass != ObjectStreamClass.STRINGCLASS) {
fields = classDesc.fields();
fieldCount = fields.length;
}
// Field count
output.writeShort(fieldCount);
// Field names
for (int i = 0; i < fieldCount; i++) {
ObjectStreamField f = fields[i];
boolean wasPrimitive = f.writeField(output);
if (!wasPrimitive) {
writeObject(f.getTypeString());
}
}
} | java | private void writeFieldDescriptors(ObjectStreamClass classDesc, boolean externalizable) throws IOException {
Class<?> loadedClass = classDesc.forClass();
ObjectStreamField[] fields = null;
int fieldCount = 0;
// The fields of String are not needed since Strings are treated as
// primitive types
if (!externalizable && loadedClass != ObjectStreamClass.STRINGCLASS) {
fields = classDesc.fields();
fieldCount = fields.length;
}
// Field count
output.writeShort(fieldCount);
// Field names
for (int i = 0; i < fieldCount; i++) {
ObjectStreamField f = fields[i];
boolean wasPrimitive = f.writeField(output);
if (!wasPrimitive) {
writeObject(f.getTypeString());
}
}
} | [
"private",
"void",
"writeFieldDescriptors",
"(",
"ObjectStreamClass",
"classDesc",
",",
"boolean",
"externalizable",
")",
"throws",
"IOException",
"{",
"Class",
"<",
"?",
">",
"loadedClass",
"=",
"classDesc",
".",
"forClass",
"(",
")",
";",
"ObjectStreamField",
"[... | Writes a collection of field descriptors (name, type name, etc) for the
class descriptor {@code classDesc} (an
{@code ObjectStreamClass})
@param classDesc
The class descriptor (an {@code ObjectStreamClass})
for which to write field information
@param externalizable
true if the descriptors are externalizable
@throws IOException
If an IO exception happened when writing the field
descriptors.
@see #writeObject(Object) | [
"Writes",
"a",
"collection",
"of",
"field",
"descriptors",
"(",
"name",
"type",
"name",
"etc",
")",
"for",
"the",
"class",
"descriptor",
"{",
"@code",
"classDesc",
"}",
"(",
"an",
"{",
"@code",
"ObjectStreamClass",
"}",
")"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java#L823-L845 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java | EvaluateRetrievalPerformance.findMatches | private void findMatches(ModifiableDBIDs posn, Relation<?> lrelation, Object label) {
posn.clear();
for(DBIDIter ri = lrelation.iterDBIDs(); ri.valid(); ri.advance()) {
if(match(label, lrelation.get(ri))) {
posn.add(ri);
}
}
} | java | private void findMatches(ModifiableDBIDs posn, Relation<?> lrelation, Object label) {
posn.clear();
for(DBIDIter ri = lrelation.iterDBIDs(); ri.valid(); ri.advance()) {
if(match(label, lrelation.get(ri))) {
posn.add(ri);
}
}
} | [
"private",
"void",
"findMatches",
"(",
"ModifiableDBIDs",
"posn",
",",
"Relation",
"<",
"?",
">",
"lrelation",
",",
"Object",
"label",
")",
"{",
"posn",
".",
"clear",
"(",
")",
";",
"for",
"(",
"DBIDIter",
"ri",
"=",
"lrelation",
".",
"iterDBIDs",
"(",
... | Find all matching objects.
@param posn Output set.
@param lrelation Label relation
@param label Query object label | [
"Find",
"all",
"matching",
"objects",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java#L227-L234 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/Branch.java | Branch.getInstance | public static Branch getInstance(@NonNull Context context, @NonNull String branchKey) {
if (branchReferral_ == null) {
branchReferral_ = Branch.initInstance(context);
}
branchReferral_.context_ = context.getApplicationContext();
if (branchKey.startsWith("key_")) {
boolean isNewBranchKeySet = branchReferral_.prefHelper_.setBranchKey(branchKey);
//on setting a new key clear link cache and pending requests
if (isNewBranchKeySet) {
branchReferral_.linkCache_.clear();
branchReferral_.requestQueue_.clear();
}
} else {
PrefHelper.Debug("Branch Key is invalid. Please check your BranchKey");
}
return branchReferral_;
} | java | public static Branch getInstance(@NonNull Context context, @NonNull String branchKey) {
if (branchReferral_ == null) {
branchReferral_ = Branch.initInstance(context);
}
branchReferral_.context_ = context.getApplicationContext();
if (branchKey.startsWith("key_")) {
boolean isNewBranchKeySet = branchReferral_.prefHelper_.setBranchKey(branchKey);
//on setting a new key clear link cache and pending requests
if (isNewBranchKeySet) {
branchReferral_.linkCache_.clear();
branchReferral_.requestQueue_.clear();
}
} else {
PrefHelper.Debug("Branch Key is invalid. Please check your BranchKey");
}
return branchReferral_;
} | [
"public",
"static",
"Branch",
"getInstance",
"(",
"@",
"NonNull",
"Context",
"context",
",",
"@",
"NonNull",
"String",
"branchKey",
")",
"{",
"if",
"(",
"branchReferral_",
"==",
"null",
")",
"{",
"branchReferral_",
"=",
"Branch",
".",
"initInstance",
"(",
"c... | <p>Singleton method to return the pre-initialised, or newly initialise and return, a singleton
object of the type {@link Branch}.</p>
@param context A {@link Context} from which this call was made.
@param branchKey Your Branch key as a {@link String}.
@return An initialised {@link Branch} object, either fetched from a pre-initialised
instance within the singleton class, or a newly instantiated object where
one was not already requested during the current app lifecycle.
@see <a href="https://github.com/BranchMetrics/Branch-Android-SDK/blob/05e234855f983ae022633eb01989adb05775532e/README.md#add-your-app-key-to-your-project">
Adding your app key to your project</a> | [
"<p",
">",
"Singleton",
"method",
"to",
"return",
"the",
"pre",
"-",
"initialised",
"or",
"newly",
"initialise",
"and",
"return",
"a",
"singleton",
"object",
"of",
"the",
"type",
"{",
"@link",
"Branch",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L593-L609 |
networknt/light-rest-4j | openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java | ResponseValidator.validateResponseContent | public Status validateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode, String mediaTypeName) {
OpenApiOperation operation = null;
try {
operation = getOpenApiOperation(uri, httpMethod);
} catch (URISyntaxException e) {
logger.error(e.getMessage());
return new Status(VALIDATOR_RESPONSE_CONTENT_UNEXPECTED, httpMethod, uri);
}
if(operation == null) {
return new Status(VALIDATOR_RESPONSE_CONTENT_UNEXPECTED, httpMethod, uri);
}
return validateResponseContent(responseContent, operation, statusCode, mediaTypeName);
} | java | public Status validateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode, String mediaTypeName) {
OpenApiOperation operation = null;
try {
operation = getOpenApiOperation(uri, httpMethod);
} catch (URISyntaxException e) {
logger.error(e.getMessage());
return new Status(VALIDATOR_RESPONSE_CONTENT_UNEXPECTED, httpMethod, uri);
}
if(operation == null) {
return new Status(VALIDATOR_RESPONSE_CONTENT_UNEXPECTED, httpMethod, uri);
}
return validateResponseContent(responseContent, operation, statusCode, mediaTypeName);
} | [
"public",
"Status",
"validateResponseContent",
"(",
"Object",
"responseContent",
",",
"String",
"uri",
",",
"String",
"httpMethod",
",",
"String",
"statusCode",
",",
"String",
"mediaTypeName",
")",
"{",
"OpenApiOperation",
"operation",
"=",
"null",
";",
"try",
"{"... | validate a given response content object with schema coordinate (uri, httpMethod, statusCode, mediaTypeName)
uri, httpMethod, statusCode, mediaTypeName is to locate the schema to validate
@param responseContent response content needs to be validated
@param uri original uri of the request
@param httpMethod eg. "put" or "get"
@param statusCode eg. 200, 400
@param mediaTypeName eg. "application/json"
@return Status | [
"validate",
"a",
"given",
"response",
"content",
"object",
"with",
"schema",
"coordinate",
"(",
"uri",
"httpMethod",
"statusCode",
"mediaTypeName",
")",
"uri",
"httpMethod",
"statusCode",
"mediaTypeName",
"is",
"to",
"locate",
"the",
"schema",
"to",
"validate"
] | train | https://github.com/networknt/light-rest-4j/blob/06b15128e6101351e617284a636ef5d632e6b1fe/openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java#L94-L106 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.security.common/src/com/ibm/ws/messaging/security/beans/Permission.java | Permission.addAllGroupsToRole | protected void addAllGroupsToRole(Set<String> groups, String role) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "addAllGroupsToRole", new Object[] { groups, role });
}
Set<String> groupsForTheRole = roleToGroupMap.get(role);
if (groupsForTheRole != null) {
groupsForTheRole.addAll(groups);
} else {
groupsForTheRole = groups;
}
roleToGroupMap.put(role, groupsForTheRole);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "addAllGroupsToRole");
}
} | java | protected void addAllGroupsToRole(Set<String> groups, String role) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "addAllGroupsToRole", new Object[] { groups, role });
}
Set<String> groupsForTheRole = roleToGroupMap.get(role);
if (groupsForTheRole != null) {
groupsForTheRole.addAll(groups);
} else {
groupsForTheRole = groups;
}
roleToGroupMap.put(role, groupsForTheRole);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "addAllGroupsToRole");
}
} | [
"protected",
"void",
"addAllGroupsToRole",
"(",
"Set",
"<",
"String",
">",
"groups",
",",
"String",
"role",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
... | Add all the groups to a particular role
@param groups
@param role | [
"Add",
"all",
"the",
"groups",
"to",
"a",
"particular",
"role"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security.common/src/com/ibm/ws/messaging/security/beans/Permission.java#L148-L162 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEvents.java | XMLStreamEvents.removeAttributeWithNamespaceURI | public Attribute removeAttributeWithNamespaceURI(CharSequence uri, CharSequence name) {
for (Iterator<Attribute> it = event.attributes.iterator(); it.hasNext(); ) {
Attribute attr = it.next();
if (attr.localName.equals(name) && getNamespaceURI(attr.namespacePrefix).equals(uri)) {
it.remove();
return attr;
}
}
return null;
} | java | public Attribute removeAttributeWithNamespaceURI(CharSequence uri, CharSequence name) {
for (Iterator<Attribute> it = event.attributes.iterator(); it.hasNext(); ) {
Attribute attr = it.next();
if (attr.localName.equals(name) && getNamespaceURI(attr.namespacePrefix).equals(uri)) {
it.remove();
return attr;
}
}
return null;
} | [
"public",
"Attribute",
"removeAttributeWithNamespaceURI",
"(",
"CharSequence",
"uri",
",",
"CharSequence",
"name",
")",
"{",
"for",
"(",
"Iterator",
"<",
"Attribute",
">",
"it",
"=",
"event",
".",
"attributes",
".",
"iterator",
"(",
")",
";",
"it",
".",
"has... | Remove and return the attribute for the given namespace URI and local name if it exists. | [
"Remove",
"and",
"return",
"the",
"attribute",
"for",
"the",
"given",
"namespace",
"URI",
"and",
"local",
"name",
"if",
"it",
"exists",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEvents.java#L245-L254 |
eurekaclinical/eurekaclinical-common | src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java | EurekaClinicalClient.doPostForm | protected void doPostForm(String path, MultivaluedMap<String, String> formParams, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
ensurePostFormHeaders(headers, requestBuilder, true, false);
ClientResponse response = requestBuilder.post(ClientResponse.class);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.NO_CONTENT);
response.close();
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | java | protected void doPostForm(String path, MultivaluedMap<String, String> formParams, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
ensurePostFormHeaders(headers, requestBuilder, true, false);
ClientResponse response = requestBuilder.post(ClientResponse.class);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.NO_CONTENT);
response.close();
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | [
"protected",
"void",
"doPostForm",
"(",
"String",
"path",
",",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"formParams",
",",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"ClientException",
"{",
"this",
".",
"readLock... | Submits a form.
@param path the API to call.
@param formParams the multi-part form content.
@param headers any headers to send. If no Content Type header is
specified, it adds a Content Type for form data.
@throws ClientException if a status code other than 200 (OK) and 204 (No
Content) is returned. | [
"Submits",
"a",
"form",
"."
] | train | https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L565-L578 |
AgNO3/jcifs-ng | src/main/java/jcifs/dcerpc/DcerpcHandle.java | DcerpcHandle.getHandle | public static DcerpcHandle getHandle ( String url, CIFSContext tc ) throws MalformedURLException, DcerpcException {
return getHandle(url, tc, false);
} | java | public static DcerpcHandle getHandle ( String url, CIFSContext tc ) throws MalformedURLException, DcerpcException {
return getHandle(url, tc, false);
} | [
"public",
"static",
"DcerpcHandle",
"getHandle",
"(",
"String",
"url",
",",
"CIFSContext",
"tc",
")",
"throws",
"MalformedURLException",
",",
"DcerpcException",
"{",
"return",
"getHandle",
"(",
"url",
",",
"tc",
",",
"false",
")",
";",
"}"
] | Get a handle to a service
@param url
@param tc
context to use
@return a DCERPC handle for the given url
@throws MalformedURLException
@throws DcerpcException | [
"Get",
"a",
"handle",
"to",
"a",
"service"
] | train | https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/dcerpc/DcerpcHandle.java#L182-L184 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/AnnotationQuery.java | AnnotationQuery.setTag | @JsonIgnore
public void setTag(String key, String value) {
requireArgument(key != null && !key.trim().isEmpty(), "Tag key cannot be null.");
requireArgument(!ReservedField.isReservedField(key), "Tag is a reserved tag name.");
if (value == null || value.isEmpty()) {
_tags.remove(key);
} else {
_tags.put(key, value);
}
} | java | @JsonIgnore
public void setTag(String key, String value) {
requireArgument(key != null && !key.trim().isEmpty(), "Tag key cannot be null.");
requireArgument(!ReservedField.isReservedField(key), "Tag is a reserved tag name.");
if (value == null || value.isEmpty()) {
_tags.remove(key);
} else {
_tags.put(key, value);
}
} | [
"@",
"JsonIgnore",
"public",
"void",
"setTag",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"requireArgument",
"(",
"key",
"!=",
"null",
"&&",
"!",
"key",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
",",
"\"Tag key cannot be null.\"",
")"... | Sets a single tag for the query.
@param key The key for the tag. Cannot null, empty or a reserved field name.
@param value The tag value. If the value is null, the tag is removed from the query tags. | [
"Sets",
"a",
"single",
"tag",
"for",
"the",
"query",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/AnnotationQuery.java#L194-L203 |
lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.getVariants | public List<Variant> getVariants() {
List<Variant> vs = new ArrayList<Variant>();
for (Map.Entry<String, ProvFormat> entry : mimeTypeRevMap.entrySet()) {
if (isOutputFormat(entry.getValue())) {
String[] parts = entry.getKey().split("/");
MediaType m = new MediaType(parts[0], parts[1]);
vs.add(new Variant(m, (java.util.Locale) null, (String) null));
}
}
return vs;
} | java | public List<Variant> getVariants() {
List<Variant> vs = new ArrayList<Variant>();
for (Map.Entry<String, ProvFormat> entry : mimeTypeRevMap.entrySet()) {
if (isOutputFormat(entry.getValue())) {
String[] parts = entry.getKey().split("/");
MediaType m = new MediaType(parts[0], parts[1]);
vs.add(new Variant(m, (java.util.Locale) null, (String) null));
}
}
return vs;
} | [
"public",
"List",
"<",
"Variant",
">",
"getVariants",
"(",
")",
"{",
"List",
"<",
"Variant",
">",
"vs",
"=",
"new",
"ArrayList",
"<",
"Variant",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"ProvFormat",
">",
"entry",
":... | Support for content negotiation, jax-rs style. Create a list of media
type supported by the framework.
@see <a href="http://docs.oracle.com/javaee/6/tutorial/doc/gkqbq.html">Content Negotiation</a> | [
"Support",
"for",
"content",
"negotiation",
"jax",
"-",
"rs",
"style",
".",
"Create",
"a",
"list",
"of",
"media",
"type",
"supported",
"by",
"the",
"framework",
"."
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L329-L339 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/ClassFile.java | ClassFile.getNameAndTypeIndex | public int getNameAndTypeIndex(String name, String descriptor)
{
for (ConstantInfo ci : listConstantInfo(NameAndType.class))
{
NameAndType nat = (NameAndType) ci;
int nameIndex = nat.getName_index();
String str = getString(nameIndex);
if (name.equals(str))
{
int descriptorIndex = nat.getDescriptor_index();
String descr = getString(descriptorIndex);
if (descriptor.equals(descr))
{
return constantPoolIndexMap.get(ci);
}
}
}
return -1;
} | java | public int getNameAndTypeIndex(String name, String descriptor)
{
for (ConstantInfo ci : listConstantInfo(NameAndType.class))
{
NameAndType nat = (NameAndType) ci;
int nameIndex = nat.getName_index();
String str = getString(nameIndex);
if (name.equals(str))
{
int descriptorIndex = nat.getDescriptor_index();
String descr = getString(descriptorIndex);
if (descriptor.equals(descr))
{
return constantPoolIndexMap.get(ci);
}
}
}
return -1;
} | [
"public",
"int",
"getNameAndTypeIndex",
"(",
"String",
"name",
",",
"String",
"descriptor",
")",
"{",
"for",
"(",
"ConstantInfo",
"ci",
":",
"listConstantInfo",
"(",
"NameAndType",
".",
"class",
")",
")",
"{",
"NameAndType",
"nat",
"=",
"(",
"NameAndType",
"... | Returns the constant map index to name and type
@param name
@param descriptor
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"name",
"and",
"type"
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/ClassFile.java#L300-L318 |
JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/spi/MoneyUtils.java | MoneyUtils.checkAmountParameter | public static void checkAmountParameter(MonetaryAmount amount, CurrencyUnit currencyUnit) {
requireNonNull(amount, "Amount must not be null.");
final CurrencyUnit amountCurrency = amount.getCurrency();
if (!currencyUnit.getCurrencyCode().equals(amountCurrency.getCurrencyCode())) {
throw new MonetaryException("Currency mismatch: " + currencyUnit + '/' + amountCurrency);
}
} | java | public static void checkAmountParameter(MonetaryAmount amount, CurrencyUnit currencyUnit) {
requireNonNull(amount, "Amount must not be null.");
final CurrencyUnit amountCurrency = amount.getCurrency();
if (!currencyUnit.getCurrencyCode().equals(amountCurrency.getCurrencyCode())) {
throw new MonetaryException("Currency mismatch: " + currencyUnit + '/' + amountCurrency);
}
} | [
"public",
"static",
"void",
"checkAmountParameter",
"(",
"MonetaryAmount",
"amount",
",",
"CurrencyUnit",
"currencyUnit",
")",
"{",
"requireNonNull",
"(",
"amount",
",",
"\"Amount must not be null.\"",
")",
";",
"final",
"CurrencyUnit",
"amountCurrency",
"=",
"amount",
... | Method to check if a currency is compatible with this amount instance.
@param amount The monetary amount to be compared to, never null.
@param currencyUnit the currency unit to compare, never null.
@throws MonetaryException If the amount is null, or the amount's {@link CurrencyUnit} is not
compatible, meaning has a different value of
{@link CurrencyUnit#getCurrencyCode()}). | [
"Method",
"to",
"check",
"if",
"a",
"currency",
"is",
"compatible",
"with",
"this",
"amount",
"instance",
"."
] | train | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/spi/MoneyUtils.java#L148-L154 |
alkacon/opencms-core | src/org/opencms/ui/apps/logfile/CmsLogChannelTable.java | CmsLogChannelTable.onItemClick | @SuppressWarnings("unchecked")
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) {
if (!event.isCtrlKey() && !event.isShiftKey()) {
if (event.getButton().equals(MouseButton.LEFT)) {
setValue(null);
}
changeValueIfNotMultiSelect(itemId);
// don't interfere with multi-selection using control key
if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) {
m_menu.removeAllItems();
fillContextMenu((Set<Logger>)getValue());
m_menu.openForTable(event, itemId, propertyId, this);
}
}
} | java | @SuppressWarnings("unchecked")
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) {
if (!event.isCtrlKey() && !event.isShiftKey()) {
if (event.getButton().equals(MouseButton.LEFT)) {
setValue(null);
}
changeValueIfNotMultiSelect(itemId);
// don't interfere with multi-selection using control key
if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) {
m_menu.removeAllItems();
fillContextMenu((Set<Logger>)getValue());
m_menu.openForTable(event, itemId, propertyId, this);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"void",
"onItemClick",
"(",
"MouseEvents",
".",
"ClickEvent",
"event",
",",
"Object",
"itemId",
",",
"Object",
"propertyId",
")",
"{",
"if",
"(",
"!",
"event",
".",
"isCtrlKey",
"(",
")",
"&&",
"!",
"even... | Handles the table item clicks, including clicks on images inside of a table item.<p>
@param event the click event
@param itemId of the clicked row
@param propertyId column id | [
"Handles",
"the",
"table",
"item",
"clicks",
"including",
"clicks",
"on",
"images",
"inside",
"of",
"a",
"table",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/logfile/CmsLogChannelTable.java#L530-L547 |
Drivemode/TypefaceHelper | TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java | TypefaceHelper.setTypeface | public <V extends TextView> void setTypeface(V view, String typefaceName) {
Typeface typeface = mCache.get(typefaceName);
view.setTypeface(typeface);
} | java | public <V extends TextView> void setTypeface(V view, String typefaceName) {
Typeface typeface = mCache.get(typefaceName);
view.setTypeface(typeface);
} | [
"public",
"<",
"V",
"extends",
"TextView",
">",
"void",
"setTypeface",
"(",
"V",
"view",
",",
"String",
"typefaceName",
")",
"{",
"Typeface",
"typeface",
"=",
"mCache",
".",
"get",
"(",
"typefaceName",
")",
";",
"view",
".",
"setTypeface",
"(",
"typeface",... | Set the typeface to the target view.
@param view to set typeface.
@param typefaceName typeface name.
@param <V> text view parameter. | [
"Set",
"the",
"typeface",
"to",
"the",
"target",
"view",
"."
] | train | https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L84-L87 |
virgo47/javasimon | core/src/main/java/org/javasimon/utils/LoggingCallback.java | LoggingCallback.onManagerWarning | @Override
public void onManagerWarning(String warning, Exception cause) {
logger.log(level, "SIMON WARNING: " + warning, cause);
} | java | @Override
public void onManagerWarning(String warning, Exception cause) {
logger.log(level, "SIMON WARNING: " + warning, cause);
} | [
"@",
"Override",
"public",
"void",
"onManagerWarning",
"(",
"String",
"warning",
",",
"Exception",
"cause",
")",
"{",
"logger",
".",
"log",
"(",
"level",
",",
"\"SIMON WARNING: \"",
"+",
"warning",
",",
"cause",
")",
";",
"}"
] | Logs the warning on a specified log level.
@param warning warning message
@param cause throwable cause | [
"Logs",
"the",
"warning",
"on",
"a",
"specified",
"log",
"level",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/LoggingCallback.java#L39-L42 |
google/flogger | api/src/main/java/com/google/common/flogger/parser/ParseException.java | ParseException.withStartPosition | public static ParseException withStartPosition(
String errorMessage, String logMessage, int start) {
return new ParseException(msg(errorMessage, logMessage, start, -1), logMessage);
} | java | public static ParseException withStartPosition(
String errorMessage, String logMessage, int start) {
return new ParseException(msg(errorMessage, logMessage, start, -1), logMessage);
} | [
"public",
"static",
"ParseException",
"withStartPosition",
"(",
"String",
"errorMessage",
",",
"String",
"logMessage",
",",
"int",
"start",
")",
"{",
"return",
"new",
"ParseException",
"(",
"msg",
"(",
"errorMessage",
",",
"logMessage",
",",
"start",
",",
"-",
... | Creates a new parse exception for situations in which only the start position of the error is
known.
@param errorMessage the user error message.
@param logMessage the original log message.
@param start the index of the first character in the invalid section of the log message.
@return the parser exception. | [
"Creates",
"a",
"new",
"parse",
"exception",
"for",
"situations",
"in",
"which",
"only",
"the",
"start",
"position",
"of",
"the",
"error",
"is",
"known",
"."
] | train | https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/parser/ParseException.java#L69-L72 |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRImporter.java | LRImporter.getHarvestJSONData | public LRResult getHarvestJSONData(String requestID, Boolean byResourceID, Boolean byDocID) throws LRException
{
String path = getHarvestRequestPath(requestID, byResourceID, byDocID);
JSONObject json = getJSONFromPath(path);
return new LRResult(json);
} | java | public LRResult getHarvestJSONData(String requestID, Boolean byResourceID, Boolean byDocID) throws LRException
{
String path = getHarvestRequestPath(requestID, byResourceID, byDocID);
JSONObject json = getJSONFromPath(path);
return new LRResult(json);
} | [
"public",
"LRResult",
"getHarvestJSONData",
"(",
"String",
"requestID",
",",
"Boolean",
"byResourceID",
",",
"Boolean",
"byDocID",
")",
"throws",
"LRException",
"{",
"String",
"path",
"=",
"getHarvestRequestPath",
"(",
"requestID",
",",
"byResourceID",
",",
"byDocID... | Get a result from a harvest request
@param requestID the "request_id" value to use for this request
@param byResourceID the "by_resource_id" value to use for this request
@param byDocID the "by_doc_id" value to use for this request
@return the result from this request | [
"Get",
"a",
"result",
"from",
"a",
"harvest",
"request"
] | train | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRImporter.java#L264-L271 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/database/CursorUtils.java | CursorUtils.getString | public static String getString(Cursor cursor, String columnName) {
if (cursor == null) {
return null;
}
return cursor.getString(cursor.getColumnIndex(columnName));
} | java | public static String getString(Cursor cursor, String columnName) {
if (cursor == null) {
return null;
}
return cursor.getString(cursor.getColumnIndex(columnName));
} | [
"public",
"static",
"String",
"getString",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"cursor",
".",
"getString",
"(",
"cursor",
".",
"getColumnIndex",
... | Read the String data for the column.
@see android.database.Cursor#getString(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the String value. | [
"Read",
"the",
"String",
"data",
"for",
"the",
"column",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L80-L86 |
irmen/Pyrolite | java/src/main/java/net/razorvine/pyro/PyroProxy.java | PyroProxy.getMetadata | protected void getMetadata(String objectId) throws PickleException, PyroException, IOException {
// get metadata from server (methods, attrs, oneway, ...) and remember them in some attributes of the proxy
if(objectId==null) objectId=this.objectid;
if(sock==null) {
connect();
if(!pyroMethods.isEmpty() || !pyroAttrs.isEmpty())
return; // metadata has already been retrieved as part of creating the connection
}
// invoke the get_metadata method on the daemon
@SuppressWarnings("unchecked")
HashMap<String, Object> result = (HashMap<String, Object>) this.internal_call("get_metadata", Config.DAEMON_NAME, 0, false, new Object[] {objectId});
if(result==null)
return;
_processMetadata(result);
} | java | protected void getMetadata(String objectId) throws PickleException, PyroException, IOException {
// get metadata from server (methods, attrs, oneway, ...) and remember them in some attributes of the proxy
if(objectId==null) objectId=this.objectid;
if(sock==null) {
connect();
if(!pyroMethods.isEmpty() || !pyroAttrs.isEmpty())
return; // metadata has already been retrieved as part of creating the connection
}
// invoke the get_metadata method on the daemon
@SuppressWarnings("unchecked")
HashMap<String, Object> result = (HashMap<String, Object>) this.internal_call("get_metadata", Config.DAEMON_NAME, 0, false, new Object[] {objectId});
if(result==null)
return;
_processMetadata(result);
} | [
"protected",
"void",
"getMetadata",
"(",
"String",
"objectId",
")",
"throws",
"PickleException",
",",
"PyroException",
",",
"IOException",
"{",
"// get metadata from server (methods, attrs, oneway, ...) and remember them in some attributes of the proxy",
"if",
"(",
"objectId",
"=... | get metadata from server (methods, attrs, oneway, ...) and remember them in some attributes of the proxy | [
"get",
"metadata",
"from",
"server",
"(",
"methods",
"attrs",
"oneway",
"...",
")",
"and",
"remember",
"them",
"in",
"some",
"attributes",
"of",
"the",
"proxy"
] | train | https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pyro/PyroProxy.java#L95-L111 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java | XcodeProjectWriter.addNativeTargetConfigurationList | private PBXObjectRef addNativeTargetConfigurationList(final Map objects, final String projectName) {
//
// Create a configuration list with
// two stock configurations: Debug and Release
//
final List<PBXObjectRef> configurations = new ArrayList<>();
final Map debugSettings = new HashMap();
debugSettings.put("COPY_PHASE_STRIP", "NO");
debugSettings.put("GCC_DYNAMIC_NO_PIC", "NO");
debugSettings.put("GCC_ENABLE_FIX_AND_CONTINUE", "YES");
debugSettings.put("GCC_MODEL_TUNING", "G5");
debugSettings.put("GCC_OPTIMIZATION_LEVEL", "0");
debugSettings.put("INSTALL_PATH", "$(HOME)/bin");
debugSettings.put("PRODUCT_NAME", projectName);
debugSettings.put("ZERO_LINK", "YES");
final PBXObjectRef debugConfig = createXCBuildConfiguration("Debug", debugSettings);
objects.put(debugConfig.getID(), debugConfig.getProperties());
configurations.add(debugConfig);
final Map<String, Object> releaseSettings = new HashMap<>();
final List<String> archs = new ArrayList<>();
archs.add("ppc");
archs.add("i386");
releaseSettings.put("ARCHS", archs);
releaseSettings.put("GCC_GENERATE_DEBUGGING_SYMBOLS", "NO");
releaseSettings.put("GCC_MODEL_TUNING", "G5");
releaseSettings.put("INSTALL_PATH", "$(HOME)/bin");
releaseSettings.put("PRODUCT_NAME", projectName);
final PBXObjectRef releaseConfig = createXCBuildConfiguration("Release", releaseSettings);
objects.put(releaseConfig.getID(), releaseConfig.getProperties());
configurations.add(releaseConfig);
final PBXObjectRef configurationList = createXCConfigurationList(configurations);
objects.put(configurationList.getID(), configurationList.getProperties());
return configurationList;
} | java | private PBXObjectRef addNativeTargetConfigurationList(final Map objects, final String projectName) {
//
// Create a configuration list with
// two stock configurations: Debug and Release
//
final List<PBXObjectRef> configurations = new ArrayList<>();
final Map debugSettings = new HashMap();
debugSettings.put("COPY_PHASE_STRIP", "NO");
debugSettings.put("GCC_DYNAMIC_NO_PIC", "NO");
debugSettings.put("GCC_ENABLE_FIX_AND_CONTINUE", "YES");
debugSettings.put("GCC_MODEL_TUNING", "G5");
debugSettings.put("GCC_OPTIMIZATION_LEVEL", "0");
debugSettings.put("INSTALL_PATH", "$(HOME)/bin");
debugSettings.put("PRODUCT_NAME", projectName);
debugSettings.put("ZERO_LINK", "YES");
final PBXObjectRef debugConfig = createXCBuildConfiguration("Debug", debugSettings);
objects.put(debugConfig.getID(), debugConfig.getProperties());
configurations.add(debugConfig);
final Map<String, Object> releaseSettings = new HashMap<>();
final List<String> archs = new ArrayList<>();
archs.add("ppc");
archs.add("i386");
releaseSettings.put("ARCHS", archs);
releaseSettings.put("GCC_GENERATE_DEBUGGING_SYMBOLS", "NO");
releaseSettings.put("GCC_MODEL_TUNING", "G5");
releaseSettings.put("INSTALL_PATH", "$(HOME)/bin");
releaseSettings.put("PRODUCT_NAME", projectName);
final PBXObjectRef releaseConfig = createXCBuildConfiguration("Release", releaseSettings);
objects.put(releaseConfig.getID(), releaseConfig.getProperties());
configurations.add(releaseConfig);
final PBXObjectRef configurationList = createXCConfigurationList(configurations);
objects.put(configurationList.getID(), configurationList.getProperties());
return configurationList;
} | [
"private",
"PBXObjectRef",
"addNativeTargetConfigurationList",
"(",
"final",
"Map",
"objects",
",",
"final",
"String",
"projectName",
")",
"{",
"//",
"// Create a configuration list with",
"// two stock configurations: Debug and Release",
"//",
"final",
"List",
"<",
"PBXObjec... | Add native target configuration list.
@param objects
map of objects.
@param projectName
project name.
@return build configurations for native target. | [
"Add",
"native",
"target",
"configuration",
"list",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java#L552-L588 |
reactor/reactor-netty | src/main/java/reactor/netty/tcp/TcpClient.java | TcpClient.doOnConnected | public final TcpClient doOnConnected(Consumer<? super Connection> doOnConnected) {
Objects.requireNonNull(doOnConnected, "doOnConnected");
return new TcpClientDoOn(this, null, doOnConnected, null);
} | java | public final TcpClient doOnConnected(Consumer<? super Connection> doOnConnected) {
Objects.requireNonNull(doOnConnected, "doOnConnected");
return new TcpClientDoOn(this, null, doOnConnected, null);
} | [
"public",
"final",
"TcpClient",
"doOnConnected",
"(",
"Consumer",
"<",
"?",
"super",
"Connection",
">",
"doOnConnected",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"doOnConnected",
",",
"\"doOnConnected\"",
")",
";",
"return",
"new",
"TcpClientDoOn",
"(",
... | Setup a callback called after {@link Channel} has been connected.
@param doOnConnected a consumer observing connected events
@return a new {@link TcpClient} | [
"Setup",
"a",
"callback",
"called",
"after",
"{",
"@link",
"Channel",
"}",
"has",
"been",
"connected",
"."
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/TcpClient.java#L250-L253 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java | AnnotationUtils.getAnnotation | @SuppressWarnings("unchecked")
public static <T extends Annotation> T getAnnotation(Annotation ann, Class<T> annotationType) {
if (annotationType.isInstance(ann)) {
return (T) ann;
}
try {
return ann.annotationType().getAnnotation(annotationType);
}
catch (Exception ex) {
// Assuming nested Class values not resolvable within annotation attributes...
logIntrospectionFailure(ann.annotationType(), ex);
return null;
}
} | java | @SuppressWarnings("unchecked")
public static <T extends Annotation> T getAnnotation(Annotation ann, Class<T> annotationType) {
if (annotationType.isInstance(ann)) {
return (T) ann;
}
try {
return ann.annotationType().getAnnotation(annotationType);
}
catch (Exception ex) {
// Assuming nested Class values not resolvable within annotation attributes...
logIntrospectionFailure(ann.annotationType(), ex);
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getAnnotation",
"(",
"Annotation",
"ann",
",",
"Class",
"<",
"T",
">",
"annotationType",
")",
"{",
"if",
"(",
"annotationType",
".",
"isInst... | Get a single {@link Annotation} of {@code annotationType} from the supplied
annotation: either the given annotation itself or a meta-annotation thereof.
@param ann the Annotation to check
@param annotationType the annotation type to look for, both locally and as a meta-annotation
@return the matching annotation, or {@code null} if none found
@since 4.0 | [
"Get",
"a",
"single",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L83-L96 |
joinfaces/joinfaces | joinfaces-security-taglib/src/main/java/org/joinfaces/security/FaceletsTagUtils.java | FaceletsTagUtils.isAllowed | public static boolean isAllowed(String url, String method) throws IOException {
AuthorizeFaceletsTag authorizeTag = new AuthorizeFaceletsTag();
authorizeTag.setUrl(url);
authorizeTag.setMethod(method);
return authorizeTag.authorizeUsingUrlCheck();
} | java | public static boolean isAllowed(String url, String method) throws IOException {
AuthorizeFaceletsTag authorizeTag = new AuthorizeFaceletsTag();
authorizeTag.setUrl(url);
authorizeTag.setMethod(method);
return authorizeTag.authorizeUsingUrlCheck();
} | [
"public",
"static",
"boolean",
"isAllowed",
"(",
"String",
"url",
",",
"String",
"method",
")",
"throws",
"IOException",
"{",
"AuthorizeFaceletsTag",
"authorizeTag",
"=",
"new",
"AuthorizeFaceletsTag",
"(",
")",
";",
"authorizeTag",
".",
"setUrl",
"(",
"url",
")... | Returns true if the user is allowed to access the given URL and HTTP
method combination. The HTTP method is optional and case insensitive.
@param url to be accessed.
@param method to be called.
@return computation if the user is allowed to access the given URL and HTTP method.
@throws IOException io exception | [
"Returns",
"true",
"if",
"the",
"user",
"is",
"allowed",
"to",
"access",
"the",
"given",
"URL",
"and",
"HTTP",
"method",
"combination",
".",
"The",
"HTTP",
"method",
"is",
"optional",
"and",
"case",
"insensitive",
"."
] | train | https://github.com/joinfaces/joinfaces/blob/c9fc811a9eaf695820951f2c04715297dd1e6d66/joinfaces-security-taglib/src/main/java/org/joinfaces/security/FaceletsTagUtils.java#L78-L83 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSType.java | JSType.getTypesUnderInequality | public TypePair getTypesUnderInequality(JSType that) {
// unions types
if (that.isUnionType()) {
TypePair p = that.toMaybeUnionType().getTypesUnderInequality(this);
return new TypePair(p.typeB, p.typeA);
}
// other types
switch (testForEquality(that)) {
case TRUE:
JSType noType = getNativeType(JSTypeNative.NO_TYPE);
return new TypePair(noType, noType);
case FALSE:
case UNKNOWN:
return new TypePair(this, that);
}
// switch case is exhaustive
throw new IllegalStateException();
} | java | public TypePair getTypesUnderInequality(JSType that) {
// unions types
if (that.isUnionType()) {
TypePair p = that.toMaybeUnionType().getTypesUnderInequality(this);
return new TypePair(p.typeB, p.typeA);
}
// other types
switch (testForEquality(that)) {
case TRUE:
JSType noType = getNativeType(JSTypeNative.NO_TYPE);
return new TypePair(noType, noType);
case FALSE:
case UNKNOWN:
return new TypePair(this, that);
}
// switch case is exhaustive
throw new IllegalStateException();
} | [
"public",
"TypePair",
"getTypesUnderInequality",
"(",
"JSType",
"that",
")",
"{",
"// unions types",
"if",
"(",
"that",
".",
"isUnionType",
"(",
")",
")",
"{",
"TypePair",
"p",
"=",
"that",
".",
"toMaybeUnionType",
"(",
")",
".",
"getTypesUnderInequality",
"("... | Computes the subset of {@code this} and {@code that} types if inequality
is observed. If a value {@code v1} of type {@code number} is not equal to a
value {@code v2} of type {@code (undefined,number)}, we can infer that the
type of {@code v1} is {@code number} and the type of {@code v2} is
{@code number} as well.
@return a pair containing the restricted type of {@code this} as the first
component and the restricted type of {@code that} as the second
element. The returned pair is never {@code null} even though its
components may be {@code null} | [
"Computes",
"the",
"subset",
"of",
"{",
"@code",
"this",
"}",
"and",
"{",
"@code",
"that",
"}",
"types",
"if",
"inequality",
"is",
"observed",
".",
"If",
"a",
"value",
"{",
"@code",
"v1",
"}",
"of",
"type",
"{",
"@code",
"number",
"}",
"is",
"not",
... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSType.java#L1388-L1408 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDir.java | StorageDir.newStorageDir | public static StorageDir newStorageDir(StorageTier tier, int dirIndex, long capacityBytes,
String dirPath) throws BlockAlreadyExistsException, IOException, WorkerOutOfSpaceException {
StorageDir dir = new StorageDir(tier, dirIndex, capacityBytes, dirPath);
dir.initializeMeta();
return dir;
} | java | public static StorageDir newStorageDir(StorageTier tier, int dirIndex, long capacityBytes,
String dirPath) throws BlockAlreadyExistsException, IOException, WorkerOutOfSpaceException {
StorageDir dir = new StorageDir(tier, dirIndex, capacityBytes, dirPath);
dir.initializeMeta();
return dir;
} | [
"public",
"static",
"StorageDir",
"newStorageDir",
"(",
"StorageTier",
"tier",
",",
"int",
"dirIndex",
",",
"long",
"capacityBytes",
",",
"String",
"dirPath",
")",
"throws",
"BlockAlreadyExistsException",
",",
"IOException",
",",
"WorkerOutOfSpaceException",
"{",
"Sto... | Factory method to create {@link StorageDir}.
It will load metadata of existing committed blocks in the dirPath specified. Only files with
directory depth 1 under dirPath and whose file name can be parsed into {@code long} will be
considered as existing committed blocks, these files will be preserved, others files or
directories will be deleted.
@param tier the {@link StorageTier} this dir belongs to
@param dirIndex the index of this dir in its tier
@param capacityBytes the initial capacity of this dir, can not be modified later
@param dirPath filesystem path of this dir for actual storage
@return the new created {@link StorageDir}
@throws BlockAlreadyExistsException when metadata of existing committed blocks already exists
@throws WorkerOutOfSpaceException when metadata can not be added due to limited left space | [
"Factory",
"method",
"to",
"create",
"{",
"@link",
"StorageDir",
"}",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDir.java#L89-L94 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java | ExecutionEnvironment.fromParallelCollection | public <X> DataSource<X> fromParallelCollection(SplittableIterator<X> iterator, Class<X> type) {
return fromParallelCollection(iterator, TypeExtractor.getForClass(type));
} | java | public <X> DataSource<X> fromParallelCollection(SplittableIterator<X> iterator, Class<X> type) {
return fromParallelCollection(iterator, TypeExtractor.getForClass(type));
} | [
"public",
"<",
"X",
">",
"DataSource",
"<",
"X",
">",
"fromParallelCollection",
"(",
"SplittableIterator",
"<",
"X",
">",
"iterator",
",",
"Class",
"<",
"X",
">",
"type",
")",
"{",
"return",
"fromParallelCollection",
"(",
"iterator",
",",
"TypeExtractor",
".... | Creates a new data set that contains elements in the iterator. The iterator is splittable, allowing the
framework to create a parallel data source that returns the elements in the iterator.
<p>Because the iterator will remain unmodified until the actual execution happens, the type of data
returned by the iterator must be given explicitly in the form of the type class (this is due to the
fact that the Java compiler erases the generic type information).
@param iterator The iterator that produces the elements of the data set.
@param type The class of the data produced by the iterator. Must not be a generic class.
@return A DataSet representing the elements in the iterator.
@see #fromParallelCollection(SplittableIterator, TypeInformation) | [
"Creates",
"a",
"new",
"data",
"set",
"that",
"contains",
"elements",
"in",
"the",
"iterator",
".",
"The",
"iterator",
"is",
"splittable",
"allowing",
"the",
"framework",
"to",
"create",
"a",
"parallel",
"data",
"source",
"that",
"returns",
"the",
"elements",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L760-L762 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java | AttributeLocalizedContentUrl.deleteLocalizedContentUrl | public static MozuUrl deleteLocalizedContentUrl(String attributeFQN, String localeCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("localeCode", localeCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteLocalizedContentUrl(String attributeFQN, String localeCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("localeCode", localeCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteLocalizedContentUrl",
"(",
"String",
"attributeFQN",
",",
"String",
"localeCode",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedCo... | Get Resource Url for DeleteLocalizedContent
@param attributeFQN Fully qualified name for an attribute.
@param localeCode The two character country code that sets the locale, such as US for United States. Sites, tenants, and catalogs use locale codes for localizing content, such as translated product text per supported country.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteLocalizedContent"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java#L92-L98 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java | CouchClient.update | public Response update(String id, Object document) {
Misc.checkNotNullOrEmpty(id, "id");
Misc.checkNotNull(document, "Document");
// Get the latest rev, will throw if doc doesn't exist
getDocumentRev(id);
return putUpdate(id, document);
} | java | public Response update(String id, Object document) {
Misc.checkNotNullOrEmpty(id, "id");
Misc.checkNotNull(document, "Document");
// Get the latest rev, will throw if doc doesn't exist
getDocumentRev(id);
return putUpdate(id, document);
} | [
"public",
"Response",
"update",
"(",
"String",
"id",
",",
"Object",
"document",
")",
"{",
"Misc",
".",
"checkNotNullOrEmpty",
"(",
"id",
",",
"\"id\"",
")",
";",
"Misc",
".",
"checkNotNull",
"(",
"document",
",",
"\"Document\"",
")",
";",
"// Get the latest ... | Document should be complete document include "_id" matches ID | [
"Document",
"should",
"be",
"complete",
"document",
"include",
"_id",
"matches",
"ID"
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java#L738-L746 |
google/closure-templates | java/src/com/google/template/soy/passes/MsgWithIdFunctionPass.java | MsgWithIdFunctionPass.handleMsgIdCall | private void handleMsgIdCall(FunctionNode fn, MsgFallbackGroupNode msgNode) {
ExprNode msgIdNode;
long primaryMsgId = MsgUtils.computeMsgIdForDualFormat(msgNode.getChild(0));
if (msgNode.numChildren() == 1) {
// easy peasy
msgIdNode = createMsgIdNode(primaryMsgId, fn.getSourceLocation());
} else {
long fallbackMsgId = MsgUtils.computeMsgIdForDualFormat(msgNode.getChild(1));
ConditionalOpNode condOpNode = new ConditionalOpNode(fn.getSourceLocation());
FunctionNode isPrimaryMsgInUse =
new FunctionNode(
Identifier.create(
BuiltinFunction.IS_PRIMARY_MSG_IN_USE.getName(), fn.getSourceLocation()),
BuiltinFunction.IS_PRIMARY_MSG_IN_USE,
fn.getSourceLocation());
// We add the varRef, and the 2 message ids to the funcitonnode as arguments so they are
// trivial to access in the backends. This is a little hacky however since we never generate
// code for these things.
// We could formalize the hack by providing a way to stash arbitrary data in the FunctionNode
// and then just pack this up in a non-AST datastructure.
isPrimaryMsgInUse.addChild(fn.getChild(0).copy(new CopyState()));
isPrimaryMsgInUse.addChild(new IntegerNode(primaryMsgId, fn.getSourceLocation()));
isPrimaryMsgInUse.addChild(new IntegerNode(fallbackMsgId, fn.getSourceLocation()));
condOpNode.addChild(isPrimaryMsgInUse);
condOpNode.addChild(createMsgIdNode(primaryMsgId, fn.getSourceLocation()));
condOpNode.addChild(createMsgIdNode(fallbackMsgId, fn.getSourceLocation()));
msgIdNode = condOpNode;
}
// We need to generate a record literal
// This map literal has 2 keys: 'id' and 'msg'
RecordLiteralNode recordLiteral =
new RecordLiteralNode(
Identifier.create("record", fn.getSourceLocation()),
ImmutableList.of(
Identifier.create("id", fn.getSourceLocation()),
Identifier.create("msg", fn.getSourceLocation())),
fn.getSourceLocation());
recordLiteral.addChildren(ImmutableList.of(msgIdNode, fn.getChild(0).copy(new CopyState())));
fn.getParent().replaceChild(fn, recordLiteral);
} | java | private void handleMsgIdCall(FunctionNode fn, MsgFallbackGroupNode msgNode) {
ExprNode msgIdNode;
long primaryMsgId = MsgUtils.computeMsgIdForDualFormat(msgNode.getChild(0));
if (msgNode.numChildren() == 1) {
// easy peasy
msgIdNode = createMsgIdNode(primaryMsgId, fn.getSourceLocation());
} else {
long fallbackMsgId = MsgUtils.computeMsgIdForDualFormat(msgNode.getChild(1));
ConditionalOpNode condOpNode = new ConditionalOpNode(fn.getSourceLocation());
FunctionNode isPrimaryMsgInUse =
new FunctionNode(
Identifier.create(
BuiltinFunction.IS_PRIMARY_MSG_IN_USE.getName(), fn.getSourceLocation()),
BuiltinFunction.IS_PRIMARY_MSG_IN_USE,
fn.getSourceLocation());
// We add the varRef, and the 2 message ids to the funcitonnode as arguments so they are
// trivial to access in the backends. This is a little hacky however since we never generate
// code for these things.
// We could formalize the hack by providing a way to stash arbitrary data in the FunctionNode
// and then just pack this up in a non-AST datastructure.
isPrimaryMsgInUse.addChild(fn.getChild(0).copy(new CopyState()));
isPrimaryMsgInUse.addChild(new IntegerNode(primaryMsgId, fn.getSourceLocation()));
isPrimaryMsgInUse.addChild(new IntegerNode(fallbackMsgId, fn.getSourceLocation()));
condOpNode.addChild(isPrimaryMsgInUse);
condOpNode.addChild(createMsgIdNode(primaryMsgId, fn.getSourceLocation()));
condOpNode.addChild(createMsgIdNode(fallbackMsgId, fn.getSourceLocation()));
msgIdNode = condOpNode;
}
// We need to generate a record literal
// This map literal has 2 keys: 'id' and 'msg'
RecordLiteralNode recordLiteral =
new RecordLiteralNode(
Identifier.create("record", fn.getSourceLocation()),
ImmutableList.of(
Identifier.create("id", fn.getSourceLocation()),
Identifier.create("msg", fn.getSourceLocation())),
fn.getSourceLocation());
recordLiteral.addChildren(ImmutableList.of(msgIdNode, fn.getChild(0).copy(new CopyState())));
fn.getParent().replaceChild(fn, recordLiteral);
} | [
"private",
"void",
"handleMsgIdCall",
"(",
"FunctionNode",
"fn",
",",
"MsgFallbackGroupNode",
"msgNode",
")",
"{",
"ExprNode",
"msgIdNode",
";",
"long",
"primaryMsgId",
"=",
"MsgUtils",
".",
"computeMsgIdForDualFormat",
"(",
"msgNode",
".",
"getChild",
"(",
"0",
"... | Rewrites calls to msgId($msgVar) to either a static constant message id or a conditional if
there is a fallback. | [
"Rewrites",
"calls",
"to",
"msgId",
"(",
"$msgVar",
")",
"to",
"either",
"a",
"static",
"constant",
"message",
"id",
"or",
"a",
"conditional",
"if",
"there",
"is",
"a",
"fallback",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/MsgWithIdFunctionPass.java#L154-L193 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.saas_csp2_new_duration_POST | public OvhOrder saas_csp2_new_duration_POST(String duration, String giftCode, Long officeBusinessQuantity, Long officeProPlusQuantity) throws IOException {
String qPath = "/order/saas/csp2/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "giftCode", giftCode);
addBody(o, "officeBusinessQuantity", officeBusinessQuantity);
addBody(o, "officeProPlusQuantity", officeProPlusQuantity);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder saas_csp2_new_duration_POST(String duration, String giftCode, Long officeBusinessQuantity, Long officeProPlusQuantity) throws IOException {
String qPath = "/order/saas/csp2/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "giftCode", giftCode);
addBody(o, "officeBusinessQuantity", officeBusinessQuantity);
addBody(o, "officeProPlusQuantity", officeProPlusQuantity);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"saas_csp2_new_duration_POST",
"(",
"String",
"duration",
",",
"String",
"giftCode",
",",
"Long",
"officeBusinessQuantity",
",",
"Long",
"officeProPlusQuantity",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/saas/csp2/new/{dura... | Create order
REST: POST /order/saas/csp2/new/{duration}
@param giftCode [required] Gift code for office license
@param officeProPlusQuantity [required] Number of prepaid office pro plus license
@param officeBusinessQuantity [required] Number of prepaid office business license
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4192-L4201 |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/parsing/InterfacesXml.java | InterfacesXml.writeInterfaceCriteria | private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final ModelNode subModel, final boolean nested) throws XMLStreamException {
for (final Property property : subModel.asPropertyList()) {
if (property.getValue().isDefined()) {
writeInterfaceCriteria(writer, property, nested);
}
}
} | java | private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final ModelNode subModel, final boolean nested) throws XMLStreamException {
for (final Property property : subModel.asPropertyList()) {
if (property.getValue().isDefined()) {
writeInterfaceCriteria(writer, property, nested);
}
}
} | [
"private",
"void",
"writeInterfaceCriteria",
"(",
"final",
"XMLExtendedStreamWriter",
"writer",
",",
"final",
"ModelNode",
"subModel",
",",
"final",
"boolean",
"nested",
")",
"throws",
"XMLStreamException",
"{",
"for",
"(",
"final",
"Property",
"property",
":",
"sub... | Write the criteria elements, extracting the information of the sub-model.
@param writer the xml stream writer
@param subModel the interface model
@param nested whether it the criteria elements are nested as part of <not /> or <any />
@throws XMLStreamException | [
"Write",
"the",
"criteria",
"elements",
"extracting",
"the",
"information",
"of",
"the",
"sub",
"-",
"model",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/parsing/InterfacesXml.java#L280-L286 |
Netflix/dyno | dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/hash/Murmur2Hash.java | Murmur2Hash.hash32 | public static int hash32(final byte[] data, int length, int seed) {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
final int m = 0x5bd1e995;
final int r = 24;
// Initialize the hash to a random value
int h = seed^length;
int length4 = length/4;
for (int i=0; i<length4; i++) {
final int i4 = i*4;
int k = (data[i4+0]&0xff) +((data[i4+1]&0xff)<<8)
+((data[i4+2]&0xff)<<16) +((data[i4+3]&0xff)<<24);
k *= m;
k ^= k >>> r;
k *= m;
h *= m;
h ^= k;
}
// Handle the last few bytes of the input array
switch (length%4) {
case 3: h ^= (data[(length&~3) +2]&0xff) << 16;
case 2: h ^= (data[(length&~3) +1]&0xff) << 8;
case 1: h ^= (data[length&~3]&0xff);
h *= m;
}
h ^= h >>> 13;
h *= m;
h ^= h >>> 15;
return h;
} | java | public static int hash32(final byte[] data, int length, int seed) {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
final int m = 0x5bd1e995;
final int r = 24;
// Initialize the hash to a random value
int h = seed^length;
int length4 = length/4;
for (int i=0; i<length4; i++) {
final int i4 = i*4;
int k = (data[i4+0]&0xff) +((data[i4+1]&0xff)<<8)
+((data[i4+2]&0xff)<<16) +((data[i4+3]&0xff)<<24);
k *= m;
k ^= k >>> r;
k *= m;
h *= m;
h ^= k;
}
// Handle the last few bytes of the input array
switch (length%4) {
case 3: h ^= (data[(length&~3) +2]&0xff) << 16;
case 2: h ^= (data[(length&~3) +1]&0xff) << 8;
case 1: h ^= (data[length&~3]&0xff);
h *= m;
}
h ^= h >>> 13;
h *= m;
h ^= h >>> 15;
return h;
} | [
"public",
"static",
"int",
"hash32",
"(",
"final",
"byte",
"[",
"]",
"data",
",",
"int",
"length",
",",
"int",
"seed",
")",
"{",
"// 'm' and 'r' are mixing constants generated offline.",
"// They're not really 'magic', they just happen to work well.",
"final",
"int",
"m",... | Generates 32 bit hash from byte array of the given length and
seed.
@param data byte array to hash
@param length length of the array to hash
@param seed initial seed value
@return 32 bit hash of the given array | [
"Generates",
"32",
"bit",
"hash",
"from",
"byte",
"array",
"of",
"the",
"given",
"length",
"and",
"seed",
"."
] | train | https://github.com/Netflix/dyno/blob/158f807083ea8e9b09c8089cb07f98e954ad5b23/dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/hash/Murmur2Hash.java#L48-L82 |
apereo/cas | core/cas-server-core-services-api/src/main/java/org/apereo/cas/authentication/principal/ShibbolethCompatiblePersistentIdGenerator.java | ShibbolethCompatiblePersistentIdGenerator.determinePrincipalIdFromAttributes | public String determinePrincipalIdFromAttributes(final String defaultId, final Map<String, List<Object>> attributes) {
return FunctionUtils.doIf(
StringUtils.isNotBlank(this.attribute) && attributes.containsKey(this.attribute),
() -> {
val attributeValue = attributes.get(this.attribute);
LOGGER.debug("Using attribute [{}] to establish principal id", this.attribute);
return CollectionUtils.firstElement(attributeValue).get().toString();
},
() -> {
LOGGER.debug("Using principal id [{}] to generate persistent identifier", defaultId);
return defaultId;
}
).get();
} | java | public String determinePrincipalIdFromAttributes(final String defaultId, final Map<String, List<Object>> attributes) {
return FunctionUtils.doIf(
StringUtils.isNotBlank(this.attribute) && attributes.containsKey(this.attribute),
() -> {
val attributeValue = attributes.get(this.attribute);
LOGGER.debug("Using attribute [{}] to establish principal id", this.attribute);
return CollectionUtils.firstElement(attributeValue).get().toString();
},
() -> {
LOGGER.debug("Using principal id [{}] to generate persistent identifier", defaultId);
return defaultId;
}
).get();
} | [
"public",
"String",
"determinePrincipalIdFromAttributes",
"(",
"final",
"String",
"defaultId",
",",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"Object",
">",
">",
"attributes",
")",
"{",
"return",
"FunctionUtils",
".",
"doIf",
"(",
"StringUtils",
".",
"i... | Determine principal id from attributes.
@param defaultId the default id
@param attributes the attributes
@return the string | [
"Determine",
"principal",
"id",
"from",
"attributes",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/authentication/principal/ShibbolethCompatiblePersistentIdGenerator.java#L91-L104 |
indeedeng/util | compress/src/main/java/com/indeed/util/compress/SnappyCodec.java | SnappyCodec.createInputStream | @Override
public CompressionInputStream createInputStream(InputStream in,
Decompressor decompressor)
throws IOException {
checkNativeCodeLoaded();
return new BlockDecompressorStream(in, decompressor, 256*1024);
} | java | @Override
public CompressionInputStream createInputStream(InputStream in,
Decompressor decompressor)
throws IOException {
checkNativeCodeLoaded();
return new BlockDecompressorStream(in, decompressor, 256*1024);
} | [
"@",
"Override",
"public",
"CompressionInputStream",
"createInputStream",
"(",
"InputStream",
"in",
",",
"Decompressor",
"decompressor",
")",
"throws",
"IOException",
"{",
"checkNativeCodeLoaded",
"(",
")",
";",
"return",
"new",
"BlockDecompressorStream",
"(",
"in",
"... | Create a {@link CompressionInputStream} that will read from the given
{@link InputStream} with the given {@link Decompressor}.
@param in the stream to read compressed bytes from
@param decompressor decompressor to use
@return a stream to read uncompressed bytes from
@throws IOException | [
"Create",
"a",
"{",
"@link",
"CompressionInputStream",
"}",
"that",
"will",
"read",
"from",
"the",
"given",
"{",
"@link",
"InputStream",
"}",
"with",
"the",
"given",
"{",
"@link",
"Decompressor",
"}",
"."
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/compress/src/main/java/com/indeed/util/compress/SnappyCodec.java#L129-L135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.