repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
HalBuilder/halbuilder-guava | src/main/java/com/theoryinpractise/halbuilder/guava/Representations.java | Representations.withLink | public static void withLink(Representation representation, String rel, String href, Predicate<ReadableRepresentation> predicate) {
withLink(representation, rel, href,
Optional.of(predicate),
Optional.<String>absent(),
Optional.<String>absent(),
Optional.<String>absent(),
Optional.<String>absent());
} | java | public static void withLink(Representation representation, String rel, String href, Predicate<ReadableRepresentation> predicate) {
withLink(representation, rel, href,
Optional.of(predicate),
Optional.<String>absent(),
Optional.<String>absent(),
Optional.<String>absent(),
Optional.<String>absent());
} | [
"public",
"static",
"void",
"withLink",
"(",
"Representation",
"representation",
",",
"String",
"rel",
",",
"String",
"href",
",",
"Predicate",
"<",
"ReadableRepresentation",
">",
"predicate",
")",
"{",
"withLink",
"(",
"representation",
",",
"rel",
",",
"href",... | Add a link to this resource
@param rel
@param href The target href for the link, relative to the href of this resource. | [
"Add",
"a",
"link",
"to",
"this",
"resource"
] | train | https://github.com/HalBuilder/halbuilder-guava/blob/648cb1ae6c4b4cebd82364a8d72d9801bd3db771/src/main/java/com/theoryinpractise/halbuilder/guava/Representations.java#L24-L31 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javap/Main.java | Main.run | public static int run(String[] args, PrintWriter out) {
JavapTask t = new JavapTask();
t.setLog(out);
return t.run(args);
} | java | public static int run(String[] args, PrintWriter out) {
JavapTask t = new JavapTask();
t.setLog(out);
return t.run(args);
} | [
"public",
"static",
"int",
"run",
"(",
"String",
"[",
"]",
"args",
",",
"PrintWriter",
"out",
")",
"{",
"JavapTask",
"t",
"=",
"new",
"JavapTask",
"(",
")",
";",
"t",
".",
"setLog",
"(",
"out",
")",
";",
"return",
"t",
".",
"run",
"(",
"args",
")... | Entry point that does <i>not</i> call System.exit.
@param args command line arguments
@param out output stream
@return an exit code. 0 means success, non-zero means an error occurred. | [
"Entry",
"point",
"that",
"does",
"<i",
">",
"not<",
"/",
"i",
">",
"call",
"System",
".",
"exit",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javap/Main.java#L56-L60 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/services/process/ProcessEngineDriver.java | ProcessEngineDriver.startProcess | public Long startProcess(Long processId, String masterRequestId, String ownerType,
Long ownerId, Map<String,String> vars, Map<String,String> headers) throws Exception {
return startProcess(processId, masterRequestId, ownerType, ownerId, vars, null, null, headers);
} | java | public Long startProcess(Long processId, String masterRequestId, String ownerType,
Long ownerId, Map<String,String> vars, Map<String,String> headers) throws Exception {
return startProcess(processId, masterRequestId, ownerType, ownerId, vars, null, null, headers);
} | [
"public",
"Long",
"startProcess",
"(",
"Long",
"processId",
",",
"String",
"masterRequestId",
",",
"String",
"ownerType",
",",
"Long",
"ownerId",
",",
"Map",
"<",
"String",
",",
"String",
">",
"vars",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers... | Start a process.
@param processId
@param masterRequestId
@param ownerType
@param ownerId
@param vars Input parameter bindings for the process instance to be created
@param headers
@return the process instance ID | [
"Start",
"a",
"process",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/process/ProcessEngineDriver.java#L921-L924 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/AbstractGeneratedSQLTransform.java | AbstractGeneratedSQLTransform.generateReadPropertyFromCursor | @Override
public void generateReadPropertyFromCursor(Builder methodBuilder, TypeName beanClass, String beanName, ModelProperty property, String cursorName, String indexName) {
methodBuilder.addCode(setter(beanClass, beanName, property, "$T.parse$L($L.getBlob($L))"), TypeUtility.mergeTypeNameWithSuffix(beanClass, "Table"), formatter.convert(property.getName()), cursorName,
indexName);
} | java | @Override
public void generateReadPropertyFromCursor(Builder methodBuilder, TypeName beanClass, String beanName, ModelProperty property, String cursorName, String indexName) {
methodBuilder.addCode(setter(beanClass, beanName, property, "$T.parse$L($L.getBlob($L))"), TypeUtility.mergeTypeNameWithSuffix(beanClass, "Table"), formatter.convert(property.getName()), cursorName,
indexName);
} | [
"@",
"Override",
"public",
"void",
"generateReadPropertyFromCursor",
"(",
"Builder",
"methodBuilder",
",",
"TypeName",
"beanClass",
",",
"String",
"beanName",
",",
"ModelProperty",
"property",
",",
"String",
"cursorName",
",",
"String",
"indexName",
")",
"{",
"metho... | /* (non-Javadoc)
@see com.abubusoft.kripton.processor.sqlite.transform.SQLTransform#generateReadPropertyFromCursor(com.squareup.javapoet.MethodSpec.Builder, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.core.ModelProperty, java.lang.String, java.lang.String) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/AbstractGeneratedSQLTransform.java#L79-L83 |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/vat/VATManager.java | VATManager.findVATItem | @Nullable
public IVATItem findVATItem (@Nullable final EVATItemType eType, @Nullable final BigDecimal aPercentage)
{
if (eType == null || aPercentage == null)
return null;
return findFirst (x -> x.getType ().equals (eType) && x.hasPercentage (aPercentage));
} | java | @Nullable
public IVATItem findVATItem (@Nullable final EVATItemType eType, @Nullable final BigDecimal aPercentage)
{
if (eType == null || aPercentage == null)
return null;
return findFirst (x -> x.getType ().equals (eType) && x.hasPercentage (aPercentage));
} | [
"@",
"Nullable",
"public",
"IVATItem",
"findVATItem",
"(",
"@",
"Nullable",
"final",
"EVATItemType",
"eType",
",",
"@",
"Nullable",
"final",
"BigDecimal",
"aPercentage",
")",
"{",
"if",
"(",
"eType",
"==",
"null",
"||",
"aPercentage",
"==",
"null",
")",
"ret... | Find a matching VAT item with the passed properties, independent of the
country.
@param eType
The VAT type to use. May be <code>null</code> resulting in a
<code>null</code> result.
@param aPercentage
The percentage to find. May be <code>null</code> resulting in a
<code>null</code> result.
@return <code>null</code> if no matching item could be found, | [
"Find",
"a",
"matching",
"VAT",
"item",
"with",
"the",
"passed",
"properties",
"independent",
"of",
"the",
"country",
"."
] | train | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/vat/VATManager.java#L352-L358 |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java | EpanetWrapper.ENsetlinkvalue | public void ENsetlinkvalue( int index, LinkParameters linkParameter, float value ) throws EpanetException {
int errcode = epanet.ENsetnodevalue(index, linkParameter.getCode(), value);
checkError(errcode);
} | java | public void ENsetlinkvalue( int index, LinkParameters linkParameter, float value ) throws EpanetException {
int errcode = epanet.ENsetnodevalue(index, linkParameter.getCode(), value);
checkError(errcode);
} | [
"public",
"void",
"ENsetlinkvalue",
"(",
"int",
"index",
",",
"LinkParameters",
"linkParameter",
",",
"float",
"value",
")",
"throws",
"EpanetException",
"{",
"int",
"errcode",
"=",
"epanet",
".",
"ENsetnodevalue",
"(",
"index",
",",
"linkParameter",
".",
"getCo... | Sets the value of a parameter for a specific link.
@param index node index.
@param paramcode parameter code.
@param value parameter value.
@throws EpanetException | [
"Sets",
"the",
"value",
"of",
"a",
"parameter",
"for",
"a",
"specific",
"link",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L622-L625 |
frostwire/frostwire-jlibtorrent | src/main/java/com/frostwire/jlibtorrent/FileStorage.java | FileStorage.addFile | public void addFile(String path, long size, file_flags_t flags, int mtime) {
fs.add_file(path, size, flags, mtime);
} | java | public void addFile(String path, long size, file_flags_t flags, int mtime) {
fs.add_file(path, size, flags, mtime);
} | [
"public",
"void",
"addFile",
"(",
"String",
"path",
",",
"long",
"size",
",",
"file_flags_t",
"flags",
",",
"int",
"mtime",
")",
"{",
"fs",
".",
"add_file",
"(",
"path",
",",
"size",
",",
"flags",
",",
"mtime",
")",
";",
"}"
] | Adds a file to the file storage. The {@code flags} argument sets attributes on the file.
The file attributes is an extension and may not work in all bittorrent clients.
<p>
If more files than one are added, certain restrictions to their paths apply.
In a multi-file file storage (torrent), all files must share the same root directory.
<p>
That is, the first path element of all files must be the same.
This shared path element is also set to the name of the torrent. It
can be changed by calling {@link #name(String)}.
<p>
The built in functions to traverse a directory to add files will
make sure this requirement is fulfilled.
@param path the path
@param size the file size
@param flags the file flags
@param mtime the time | [
"Adds",
"a",
"file",
"to",
"the",
"file",
"storage",
".",
"The",
"{",
"@code",
"flags",
"}",
"argument",
"sets",
"attributes",
"on",
"the",
"file",
".",
"The",
"file",
"attributes",
"is",
"an",
"extension",
"and",
"may",
"not",
"work",
"in",
"all",
"bi... | train | https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/FileStorage.java#L125-L127 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/search/Search.java | Search.updateBestSolution | protected boolean updateBestSolution(SolutionType newSolution){
// validate solution
Validation validation = getProblem().validate(newSolution);
if(validation.passed()){
// passed validation: evaluate
Evaluation evaluation = getProblem().evaluate(newSolution);
// update if better
return updateBestSolution(newSolution, evaluation, validation);
} else {
// invalid solution
return false;
}
} | java | protected boolean updateBestSolution(SolutionType newSolution){
// validate solution
Validation validation = getProblem().validate(newSolution);
if(validation.passed()){
// passed validation: evaluate
Evaluation evaluation = getProblem().evaluate(newSolution);
// update if better
return updateBestSolution(newSolution, evaluation, validation);
} else {
// invalid solution
return false;
}
} | [
"protected",
"boolean",
"updateBestSolution",
"(",
"SolutionType",
"newSolution",
")",
"{",
"// validate solution",
"Validation",
"validation",
"=",
"getProblem",
"(",
")",
".",
"validate",
"(",
"newSolution",
")",
";",
"if",
"(",
"validation",
".",
"passed",
"(",... | <p>
Checks whether a new best solution has been found and updates it accordingly.
The given solution is evaluated and validated, after which the best solution
is updated only if the solution is valid and
</p>
<ul>
<li>no best solution had been set before, or</li>
<li>the new solution has a better evaluation</li>
</ul>
<p>
If the new solution is invalid or has a worse evaluation than the current best
solution, calling this method has no effect. Note that the best solution is
<b>retained</b> across subsequent runs of the same search.
</p>
@param newSolution newly presented solution
@return <code>true</code> if the given solution is accepted as the new best solution | [
"<p",
">",
"Checks",
"whether",
"a",
"new",
"best",
"solution",
"has",
"been",
"found",
"and",
"updates",
"it",
"accordingly",
".",
"The",
"given",
"solution",
"is",
"evaluated",
"and",
"validated",
"after",
"which",
"the",
"best",
"solution",
"is",
"updated... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/Search.java#L853-L865 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/StringUtils.java | StringUtils.areEqual | public static boolean areEqual(String s1, String s2) {
return (s1 == null) ? s2 == null : s1.equals(s2);
} | java | public static boolean areEqual(String s1, String s2) {
return (s1 == null) ? s2 == null : s1.equals(s2);
} | [
"public",
"static",
"boolean",
"areEqual",
"(",
"String",
"s1",
",",
"String",
"s2",
")",
"{",
"return",
"(",
"s1",
"==",
"null",
")",
"?",
"s2",
"==",
"null",
":",
"s1",
".",
"equals",
"(",
"s2",
")",
";",
"}"
] | Null safe equals() method
@return true if the two strs are equal, or if they're both null; false otherwise. | [
"Null",
"safe",
"equals",
"()",
"method"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/StringUtils.java#L176-L178 |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java | MessageArgsUnitParser.inputFromExactUnit | protected static Unit inputFromExactUnit(Unit exact, UnitConverter converter) {
switch (exact) {
case TERABIT:
case GIGABIT:
case MEGABIT:
case KILOBIT:
case BIT:
return Unit.BIT;
case TERABYTE:
case GIGABYTE:
case MEGABYTE:
case KILOBYTE:
case BYTE:
return Unit.BYTE;
default:
break;
}
UnitCategory category = exact.category();
switch (category) {
case CONSUMPTION:
return converter.consumptionUnit();
case ELECTRIC:
return Unit.AMPERE;
case FREQUENCY:
return Unit.HERTZ;
case LIGHT:
return Unit.LUX;
case PRESSURE:
return Unit.MILLIBAR;
case SPEED:
return converter.speedUnit();
case TEMPERATURE:
return converter.temperatureUnit();
default:
UnitFactorSet factorSet = getDefaultFactorSet(category, converter);
if (factorSet != null) {
return factorSet.base();
}
break;
}
return null;
} | java | protected static Unit inputFromExactUnit(Unit exact, UnitConverter converter) {
switch (exact) {
case TERABIT:
case GIGABIT:
case MEGABIT:
case KILOBIT:
case BIT:
return Unit.BIT;
case TERABYTE:
case GIGABYTE:
case MEGABYTE:
case KILOBYTE:
case BYTE:
return Unit.BYTE;
default:
break;
}
UnitCategory category = exact.category();
switch (category) {
case CONSUMPTION:
return converter.consumptionUnit();
case ELECTRIC:
return Unit.AMPERE;
case FREQUENCY:
return Unit.HERTZ;
case LIGHT:
return Unit.LUX;
case PRESSURE:
return Unit.MILLIBAR;
case SPEED:
return converter.speedUnit();
case TEMPERATURE:
return converter.temperatureUnit();
default:
UnitFactorSet factorSet = getDefaultFactorSet(category, converter);
if (factorSet != null) {
return factorSet.base();
}
break;
}
return null;
} | [
"protected",
"static",
"Unit",
"inputFromExactUnit",
"(",
"Unit",
"exact",
",",
"UnitConverter",
"converter",
")",
"{",
"switch",
"(",
"exact",
")",
"{",
"case",
"TERABIT",
":",
"case",
"GIGABIT",
":",
"case",
"MEGABIT",
":",
"case",
"KILOBIT",
":",
"case",
... | Based on the unit we're converting to, guess the input unit. For example, if we're
converting to MEGABIT and no input unit was specified, assume BIT. | [
"Based",
"on",
"the",
"unit",
"we",
"re",
"converting",
"to",
"guess",
"the",
"input",
"unit",
".",
"For",
"example",
"if",
"we",
"re",
"converting",
"to",
"MEGABIT",
"and",
"no",
"input",
"unit",
"was",
"specified",
"assume",
"BIT",
"."
] | train | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java#L164-L209 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java | OutputsInner.createOrReplaceAsync | public Observable<OutputInner> createOrReplaceAsync(String resourceGroupName, String jobName, String outputName, OutputInner output, String ifMatch, String ifNoneMatch) {
return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, outputName, output, ifMatch, ifNoneMatch).map(new Func1<ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders>, OutputInner>() {
@Override
public OutputInner call(ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders> response) {
return response.body();
}
});
} | java | public Observable<OutputInner> createOrReplaceAsync(String resourceGroupName, String jobName, String outputName, OutputInner output, String ifMatch, String ifNoneMatch) {
return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, outputName, output, ifMatch, ifNoneMatch).map(new Func1<ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders>, OutputInner>() {
@Override
public OutputInner call(ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OutputInner",
">",
"createOrReplaceAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"String",
"outputName",
",",
"OutputInner",
"output",
",",
"String",
"ifMatch",
",",
"String",
"ifNoneMatch",
")",
"{",
"ret... | Creates an output or replaces an already existing output under an existing streaming job.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@param outputName The name of the output.
@param output The definition of the output that will be used to create a new output or replace the existing one under the streaming job.
@param ifMatch The ETag of the output. Omit this value to always overwrite the current output. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes.
@param ifNoneMatch Set to '*' to allow a new output to be created, but to prevent updating an existing output. Other values will result in a 412 Pre-condition Failed response.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OutputInner object | [
"Creates",
"an",
"output",
"or",
"replaces",
"an",
"already",
"existing",
"output",
"under",
"an",
"existing",
"streaming",
"job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java#L247-L254 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/GridLayoutRenderer.java | GridLayoutRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WPanel panel = (WPanel) component;
XmlStringBuilder xml = renderContext.getWriter();
GridLayout layout = (GridLayout) panel.getLayout();
Size hgap = layout.getHorizontalGap();
String hgapString = hgap == null ? null : hgap.toString();
Size vgap = layout.getVerticalGap();
String vgapString = vgap == null ? null : vgap.toString();
int rows = layout.getRows();
int cols = layout.getCols();
xml.appendTagOpen("ui:gridlayout");
xml.appendAttribute("rows", rows > 0 ? String.valueOf(rows) : "0");
xml.appendAttribute("cols", cols > 0 ? String.valueOf(cols) : "0");
xml.appendOptionalAttribute("hgap", hgapString);
xml.appendOptionalAttribute("vgap", vgapString);
xml.appendClose();
int size = panel.getChildCount();
for (int i = 0; i < size; i++) {
xml.appendTag("ui:cell");
WComponent child = panel.getChildAt(i);
child.paint(renderContext);
xml.appendEndTag("ui:cell");
}
xml.appendEndTag("ui:gridlayout");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WPanel panel = (WPanel) component;
XmlStringBuilder xml = renderContext.getWriter();
GridLayout layout = (GridLayout) panel.getLayout();
Size hgap = layout.getHorizontalGap();
String hgapString = hgap == null ? null : hgap.toString();
Size vgap = layout.getVerticalGap();
String vgapString = vgap == null ? null : vgap.toString();
int rows = layout.getRows();
int cols = layout.getCols();
xml.appendTagOpen("ui:gridlayout");
xml.appendAttribute("rows", rows > 0 ? String.valueOf(rows) : "0");
xml.appendAttribute("cols", cols > 0 ? String.valueOf(cols) : "0");
xml.appendOptionalAttribute("hgap", hgapString);
xml.appendOptionalAttribute("vgap", vgapString);
xml.appendClose();
int size = panel.getChildCount();
for (int i = 0; i < size; i++) {
xml.appendTag("ui:cell");
WComponent child = panel.getChildAt(i);
child.paint(renderContext);
xml.appendEndTag("ui:cell");
}
xml.appendEndTag("ui:gridlayout");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WPanel",
"panel",
"=",
"(",
"WPanel",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
... | Paints the given WPanel's children.
@param component the container to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WPanel",
"s",
"children",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/GridLayoutRenderer.java#L26-L57 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/ISODateTimeFormat.java | ISODateTimeFormat.dateByOrdinal | private static boolean dateByOrdinal(
DateTimeFormatterBuilder bld,
Collection<DateTimeFieldType> fields,
boolean extended,
boolean strictISO) {
boolean reducedPrec = false;
if (fields.remove(DateTimeFieldType.year())) {
bld.append(Constants.ye);
if (fields.remove(DateTimeFieldType.dayOfYear())) {
// YYYY-DDD/YYYYDDD
appendSeparator(bld, extended);
bld.appendDayOfYear(3);
} else {
// YYYY/YYYY
reducedPrec = true;
}
} else if (fields.remove(DateTimeFieldType.dayOfYear())) {
// -DDD/-DDD
bld.appendLiteral('-');
bld.appendDayOfYear(3);
}
return reducedPrec;
} | java | private static boolean dateByOrdinal(
DateTimeFormatterBuilder bld,
Collection<DateTimeFieldType> fields,
boolean extended,
boolean strictISO) {
boolean reducedPrec = false;
if (fields.remove(DateTimeFieldType.year())) {
bld.append(Constants.ye);
if (fields.remove(DateTimeFieldType.dayOfYear())) {
// YYYY-DDD/YYYYDDD
appendSeparator(bld, extended);
bld.appendDayOfYear(3);
} else {
// YYYY/YYYY
reducedPrec = true;
}
} else if (fields.remove(DateTimeFieldType.dayOfYear())) {
// -DDD/-DDD
bld.appendLiteral('-');
bld.appendDayOfYear(3);
}
return reducedPrec;
} | [
"private",
"static",
"boolean",
"dateByOrdinal",
"(",
"DateTimeFormatterBuilder",
"bld",
",",
"Collection",
"<",
"DateTimeFieldType",
">",
"fields",
",",
"boolean",
"extended",
",",
"boolean",
"strictISO",
")",
"{",
"boolean",
"reducedPrec",
"=",
"false",
";",
"if... | Creates a date using the ordinal date format.
Specification reference: 5.2.2.
@param bld the builder
@param fields the fields
@param extended true to use extended format
@param strictISO true to only allow ISO formats
@since 1.1 | [
"Creates",
"a",
"date",
"using",
"the",
"ordinal",
"date",
"format",
".",
"Specification",
"reference",
":",
"5",
".",
"2",
".",
"2",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/ISODateTimeFormat.java#L281-L305 |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EditOnlineDataExample.java | EditOnlineDataExample.findSomeStringProperties | public static void findSomeStringProperties(ApiConnection connection)
throws MediaWikiApiErrorException, IOException {
WikibaseDataFetcher wbdf = new WikibaseDataFetcher(connection, siteIri);
wbdf.getFilter().excludeAllProperties();
wbdf.getFilter().setLanguageFilter(Collections.singleton("en"));
ArrayList<PropertyIdValue> stringProperties = new ArrayList<>();
System.out
.println("*** Trying to find string properties for the example ... ");
int propertyNumber = 1;
while (stringProperties.size() < 5) {
ArrayList<String> fetchProperties = new ArrayList<>();
for (int i = propertyNumber; i < propertyNumber + 10; i++) {
fetchProperties.add("P" + i);
}
propertyNumber += 10;
Map<String, EntityDocument> results = wbdf
.getEntityDocuments(fetchProperties);
for (EntityDocument ed : results.values()) {
PropertyDocument pd = (PropertyDocument) ed;
if (DatatypeIdValue.DT_STRING.equals(pd.getDatatype().getIri())
&& pd.getLabels().containsKey("en")) {
stringProperties.add(pd.getEntityId());
System.out.println("* Found string property "
+ pd.getEntityId().getId() + " ("
+ pd.getLabels().get("en") + ")");
}
}
}
stringProperty1 = stringProperties.get(0);
stringProperty2 = stringProperties.get(1);
stringProperty3 = stringProperties.get(2);
stringProperty4 = stringProperties.get(3);
stringProperty5 = stringProperties.get(4);
System.out.println("*** Done.");
} | java | public static void findSomeStringProperties(ApiConnection connection)
throws MediaWikiApiErrorException, IOException {
WikibaseDataFetcher wbdf = new WikibaseDataFetcher(connection, siteIri);
wbdf.getFilter().excludeAllProperties();
wbdf.getFilter().setLanguageFilter(Collections.singleton("en"));
ArrayList<PropertyIdValue> stringProperties = new ArrayList<>();
System.out
.println("*** Trying to find string properties for the example ... ");
int propertyNumber = 1;
while (stringProperties.size() < 5) {
ArrayList<String> fetchProperties = new ArrayList<>();
for (int i = propertyNumber; i < propertyNumber + 10; i++) {
fetchProperties.add("P" + i);
}
propertyNumber += 10;
Map<String, EntityDocument> results = wbdf
.getEntityDocuments(fetchProperties);
for (EntityDocument ed : results.values()) {
PropertyDocument pd = (PropertyDocument) ed;
if (DatatypeIdValue.DT_STRING.equals(pd.getDatatype().getIri())
&& pd.getLabels().containsKey("en")) {
stringProperties.add(pd.getEntityId());
System.out.println("* Found string property "
+ pd.getEntityId().getId() + " ("
+ pd.getLabels().get("en") + ")");
}
}
}
stringProperty1 = stringProperties.get(0);
stringProperty2 = stringProperties.get(1);
stringProperty3 = stringProperties.get(2);
stringProperty4 = stringProperties.get(3);
stringProperty5 = stringProperties.get(4);
System.out.println("*** Done.");
} | [
"public",
"static",
"void",
"findSomeStringProperties",
"(",
"ApiConnection",
"connection",
")",
"throws",
"MediaWikiApiErrorException",
",",
"IOException",
"{",
"WikibaseDataFetcher",
"wbdf",
"=",
"new",
"WikibaseDataFetcher",
"(",
"connection",
",",
"siteIri",
")",
";... | Finds properties of datatype string on test.wikidata.org. Since the test
site changes all the time, we cannot hardcode a specific property here.
Instead, we just look through all properties starting from P1 to find the
first few properties of type string that have an English label. These
properties are used for testing in this code.
@param connection
@throws MediaWikiApiErrorException
@throws IOException | [
"Finds",
"properties",
"of",
"datatype",
"string",
"on",
"test",
".",
"wikidata",
".",
"org",
".",
"Since",
"the",
"test",
"site",
"changes",
"all",
"the",
"time",
"we",
"cannot",
"hardcode",
"a",
"specific",
"property",
"here",
".",
"Instead",
"we",
"just... | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EditOnlineDataExample.java#L231-L269 |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.asMinusFunction | public static MatrixFunction asMinusFunction(final double arg) {
return new MatrixFunction() {
@Override
public double evaluate(int i, int j, double value) {
return value - arg;
}
};
} | java | public static MatrixFunction asMinusFunction(final double arg) {
return new MatrixFunction() {
@Override
public double evaluate(int i, int j, double value) {
return value - arg;
}
};
} | [
"public",
"static",
"MatrixFunction",
"asMinusFunction",
"(",
"final",
"double",
"arg",
")",
"{",
"return",
"new",
"MatrixFunction",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"evaluate",
"(",
"int",
"i",
",",
"int",
"j",
",",
"double",
"value",
"... | Creates a minus function that subtracts given {@code value} from it's argument.
@param arg a value to be subtracted from function's argument
@return a closure that does {@code _ - _} | [
"Creates",
"a",
"minus",
"function",
"that",
"subtracts",
"given",
"{",
"@code",
"value",
"}",
"from",
"it",
"s",
"argument",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L455-L462 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.listIncompleteUploads | public Iterable<Result<Upload>> listIncompleteUploads(String bucketName, String prefix)
throws XmlPullParserException {
return listIncompleteUploads(bucketName, prefix, true, true);
} | java | public Iterable<Result<Upload>> listIncompleteUploads(String bucketName, String prefix)
throws XmlPullParserException {
return listIncompleteUploads(bucketName, prefix, true, true);
} | [
"public",
"Iterable",
"<",
"Result",
"<",
"Upload",
">",
">",
"listIncompleteUploads",
"(",
"String",
"bucketName",
",",
"String",
"prefix",
")",
"throws",
"XmlPullParserException",
"{",
"return",
"listIncompleteUploads",
"(",
"bucketName",
",",
"prefix",
",",
"tr... | Lists incomplete uploads of objects in given bucket and prefix.
@param bucketName Bucket name.
@param prefix filters the list of uploads to include only those that start with prefix.
@return an iterator of Upload.
@throws XmlPullParserException upon parsing response xml
@see #listIncompleteUploads(String, String, boolean) | [
"Lists",
"incomplete",
"uploads",
"of",
"objects",
"in",
"given",
"bucket",
"and",
"prefix",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L4503-L4506 |
logic-ng/LogicNG | src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java | ExtendedFormulaFactory.shrinkSet | private static <T> void shrinkSet(final Set<T> set, int newSize) {
if (!(set instanceof LinkedHashSet))
throw new IllegalStateException("Cannot shrink a set which is not of type LinkedHashSet");
if (newSize > set.size())
throw new IllegalStateException("Cannot shrink a set of size " + set.size() + " to new size " + newSize);
Iterator<T> entryIterator = set.iterator();
int count = 0;
while (count < newSize) {
entryIterator.next();
count++;
}
while (entryIterator.hasNext()) {
entryIterator.next();
entryIterator.remove();
}
} | java | private static <T> void shrinkSet(final Set<T> set, int newSize) {
if (!(set instanceof LinkedHashSet))
throw new IllegalStateException("Cannot shrink a set which is not of type LinkedHashSet");
if (newSize > set.size())
throw new IllegalStateException("Cannot shrink a set of size " + set.size() + " to new size " + newSize);
Iterator<T> entryIterator = set.iterator();
int count = 0;
while (count < newSize) {
entryIterator.next();
count++;
}
while (entryIterator.hasNext()) {
entryIterator.next();
entryIterator.remove();
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"shrinkSet",
"(",
"final",
"Set",
"<",
"T",
">",
"set",
",",
"int",
"newSize",
")",
"{",
"if",
"(",
"!",
"(",
"set",
"instanceof",
"LinkedHashSet",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"C... | Shrinks a given set to a given size
@param set the set to be shrunk
@param newSize the new size, the set shall be shrunk to | [
"Shrinks",
"a",
"given",
"set",
"to",
"a",
"given",
"size"
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java#L82-L97 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/BatchKernelImpl.java | BatchKernelImpl.createPartitionWorkUnit | @Override
public BatchPartitionWorkUnit createPartitionWorkUnit(PartitionPlanConfig config,
Step step,
PartitionReplyQueue partitionReplyQueue,
boolean isRemoteDispatch) {
JSLJob partitionJobModel = ParallelStepBuilder.buildPartitionLevelJSLJob(config.getTopLevelExecutionId(),
config.getJobProperties(),
step,
config.getPartitionNumber());
RuntimePartitionExecution partitionExecution = jobExecutionHelper.createPartitionExecution(config, partitionJobModel, isRemoteDispatch);
BatchPartitionWorkUnit batchWorkUnit = new BatchPartitionWorkUnit(this, partitionExecution, config, jobExecutionStartCallbacks, jobExecutionEndCallbacks, partitionReplyQueue, tranMgr);
registerExecutingSubWorkUnit(partitionExecution.getTopLevelExecutionId(), batchWorkUnit);
return batchWorkUnit;
} | java | @Override
public BatchPartitionWorkUnit createPartitionWorkUnit(PartitionPlanConfig config,
Step step,
PartitionReplyQueue partitionReplyQueue,
boolean isRemoteDispatch) {
JSLJob partitionJobModel = ParallelStepBuilder.buildPartitionLevelJSLJob(config.getTopLevelExecutionId(),
config.getJobProperties(),
step,
config.getPartitionNumber());
RuntimePartitionExecution partitionExecution = jobExecutionHelper.createPartitionExecution(config, partitionJobModel, isRemoteDispatch);
BatchPartitionWorkUnit batchWorkUnit = new BatchPartitionWorkUnit(this, partitionExecution, config, jobExecutionStartCallbacks, jobExecutionEndCallbacks, partitionReplyQueue, tranMgr);
registerExecutingSubWorkUnit(partitionExecution.getTopLevelExecutionId(), batchWorkUnit);
return batchWorkUnit;
} | [
"@",
"Override",
"public",
"BatchPartitionWorkUnit",
"createPartitionWorkUnit",
"(",
"PartitionPlanConfig",
"config",
",",
"Step",
"step",
",",
"PartitionReplyQueue",
"partitionReplyQueue",
",",
"boolean",
"isRemoteDispatch",
")",
"{",
"JSLJob",
"partitionJobModel",
"=",
... | Build a list of batch work units and set them up in STARTING state but
don't start them yet. | [
"Build",
"a",
"list",
"of",
"batch",
"work",
"units",
"and",
"set",
"them",
"up",
"in",
"STARTING",
"state",
"but",
"don",
"t",
"start",
"them",
"yet",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/BatchKernelImpl.java#L401-L419 |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/cluster/impl/ClusterLocator.java | ClusterLocator.locateGroup | public void locateGroup(String groupAddress, Handler<AsyncResult<String>> doneHandler) {
Set<String> registry = vertx.sharedData().getSet(groupAddress);
synchronized (registry) {
if (!registry.isEmpty()) {
locateNode(groupAddress, new HashSet<>(registry), doneHandler);
}
}
} | java | public void locateGroup(String groupAddress, Handler<AsyncResult<String>> doneHandler) {
Set<String> registry = vertx.sharedData().getSet(groupAddress);
synchronized (registry) {
if (!registry.isEmpty()) {
locateNode(groupAddress, new HashSet<>(registry), doneHandler);
}
}
} | [
"public",
"void",
"locateGroup",
"(",
"String",
"groupAddress",
",",
"Handler",
"<",
"AsyncResult",
"<",
"String",
">",
">",
"doneHandler",
")",
"{",
"Set",
"<",
"String",
">",
"registry",
"=",
"vertx",
".",
"sharedData",
"(",
")",
".",
"getSet",
"(",
"g... | Locates the local address of the nearest group node if one exists.
@param groupAddress The full address of the group to search.
@param doneHandler A handler to be called once the address has been located. | [
"Locates",
"the",
"local",
"address",
"of",
"the",
"nearest",
"group",
"node",
"if",
"one",
"exists",
"."
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/cluster/impl/ClusterLocator.java#L73-L80 |
protostuff/protostuff | protostuff-api/src/main/java/io/protostuff/IntSerializer.java | IntSerializer.writeInt64LE | public static void writeInt64LE(final long value, final byte[] buffer, int offset)
{
buffer[offset++] = (byte) (value >>> 0);
buffer[offset++] = (byte) (value >>> 8);
buffer[offset++] = (byte) (value >>> 16);
buffer[offset++] = (byte) (value >>> 24);
buffer[offset++] = (byte) (value >>> 32);
buffer[offset++] = (byte) (value >>> 40);
buffer[offset++] = (byte) (value >>> 48);
buffer[offset] = (byte) (value >>> 56);
} | java | public static void writeInt64LE(final long value, final byte[] buffer, int offset)
{
buffer[offset++] = (byte) (value >>> 0);
buffer[offset++] = (byte) (value >>> 8);
buffer[offset++] = (byte) (value >>> 16);
buffer[offset++] = (byte) (value >>> 24);
buffer[offset++] = (byte) (value >>> 32);
buffer[offset++] = (byte) (value >>> 40);
buffer[offset++] = (byte) (value >>> 48);
buffer[offset] = (byte) (value >>> 56);
} | [
"public",
"static",
"void",
"writeInt64LE",
"(",
"final",
"long",
"value",
",",
"final",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"buffer",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"0",
")",
";",
"buf... | Writes the 64-bit int into the buffer starting with the least significant byte. | [
"Writes",
"the",
"64",
"-",
"bit",
"int",
"into",
"the",
"buffer",
"starting",
"with",
"the",
"least",
"significant",
"byte",
"."
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-api/src/main/java/io/protostuff/IntSerializer.java#L104-L114 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_redirection_id_changeRedirection_POST | public OvhTaskSpecialAccount domain_redirection_id_changeRedirection_POST(String domain, String id, String to) throws IOException {
String qPath = "/email/domain/{domain}/redirection/{id}/changeRedirection";
StringBuilder sb = path(qPath, domain, id);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "to", to);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | java | public OvhTaskSpecialAccount domain_redirection_id_changeRedirection_POST(String domain, String id, String to) throws IOException {
String qPath = "/email/domain/{domain}/redirection/{id}/changeRedirection";
StringBuilder sb = path(qPath, domain, id);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "to", to);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | [
"public",
"OvhTaskSpecialAccount",
"domain_redirection_id_changeRedirection_POST",
"(",
"String",
"domain",
",",
"String",
"id",
",",
"String",
"to",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/redirection/{id}/changeRedirection\"",
";... | Change redirection
REST: POST /email/domain/{domain}/redirection/{id}/changeRedirection
@param to [required] Target of account
@param domain [required] Name of your domain name
@param id [required] | [
"Change",
"redirection"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1008-L1015 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java | MarshallableTypeHints.markMarshallable | public void markMarshallable(Class<?> type, boolean isMarshallable) {
MarshallingType marshallType = typeHints.get(type);
if (marshallableUpdateRequired(isMarshallable, marshallType)) {
boolean replaced = typeHints.replace(type, marshallType, new MarshallingType(
Boolean.valueOf(isMarshallable), marshallType.sizePredictor));
if (replaced && trace) {
log.tracef("Replacing '%s' type to be marshallable=%b",
type.getName(), isMarshallable);
}
} else if (marshallType == null) {
if (trace) {
log.tracef("Cache '%s' type to be marshallable=%b",
type.getName(), isMarshallable);
}
typeHints.put(type, new MarshallingType(
Boolean.valueOf(isMarshallable), new AdaptiveBufferSizePredictor()));
}
} | java | public void markMarshallable(Class<?> type, boolean isMarshallable) {
MarshallingType marshallType = typeHints.get(type);
if (marshallableUpdateRequired(isMarshallable, marshallType)) {
boolean replaced = typeHints.replace(type, marshallType, new MarshallingType(
Boolean.valueOf(isMarshallable), marshallType.sizePredictor));
if (replaced && trace) {
log.tracef("Replacing '%s' type to be marshallable=%b",
type.getName(), isMarshallable);
}
} else if (marshallType == null) {
if (trace) {
log.tracef("Cache '%s' type to be marshallable=%b",
type.getName(), isMarshallable);
}
typeHints.put(type, new MarshallingType(
Boolean.valueOf(isMarshallable), new AdaptiveBufferSizePredictor()));
}
} | [
"public",
"void",
"markMarshallable",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"boolean",
"isMarshallable",
")",
"{",
"MarshallingType",
"marshallType",
"=",
"typeHints",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"marshallableUpdateRequired",
"(",
"isMars... | Marks a particular type as being marshallable or not being not marshallable.
@param type Class to mark as serializable or non-serializable
@param isMarshallable Whether the type can be marshalled or not. | [
"Marks",
"a",
"particular",
"type",
"as",
"being",
"marshallable",
"or",
"not",
"being",
"not",
"marshallable",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java#L98-L116 |
windup/windup | reporting/impl/src/main/java/org/jboss/windup/reporting/rules/generation/techreport/TechReportService.java | TechReportService.normalizePlacement | private static TechReportPlacement normalizePlacement(GraphContext graphContext, TechReportPlacement placement)
{
TagGraphService tagService = new TagGraphService(graphContext);
final TechReportPlacement normalPlacement = new TechReportPlacement();
normalPlacement.sector = getNonPlaceParent(tagService, placement.sector);
normalPlacement.box = getNonPlaceParent(tagService, placement.box);
normalPlacement.row = getNonPlaceParent(tagService, placement.row);
return normalPlacement;
} | java | private static TechReportPlacement normalizePlacement(GraphContext graphContext, TechReportPlacement placement)
{
TagGraphService tagService = new TagGraphService(graphContext);
final TechReportPlacement normalPlacement = new TechReportPlacement();
normalPlacement.sector = getNonPlaceParent(tagService, placement.sector);
normalPlacement.box = getNonPlaceParent(tagService, placement.box);
normalPlacement.row = getNonPlaceParent(tagService, placement.row);
return normalPlacement;
} | [
"private",
"static",
"TechReportPlacement",
"normalizePlacement",
"(",
"GraphContext",
"graphContext",
",",
"TechReportPlacement",
"placement",
")",
"{",
"TagGraphService",
"tagService",
"=",
"new",
"TagGraphService",
"(",
"graphContext",
")",
";",
"final",
"TechReportPla... | This relies on the tag structure in the XML when the place:* mapping tags have exactly one parent outside the place: group, which is the tag
they are mapped to. | [
"This",
"relies",
"on",
"the",
"tag",
"structure",
"in",
"the",
"XML",
"when",
"the",
"place",
":",
"*",
"mapping",
"tags",
"have",
"exactly",
"one",
"parent",
"outside",
"the",
"place",
":",
"group",
"which",
"is",
"the",
"tag",
"they",
"are",
"mapped",... | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/impl/src/main/java/org/jboss/windup/reporting/rules/generation/techreport/TechReportService.java#L130-L139 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.removeAllFrom | public static <T, R extends Collection<T>> R removeAllFrom(Iterable<? extends T> iterable, R targetCollection)
{
Iterate.removeAllIterable(iterable, targetCollection);
return targetCollection;
} | java | public static <T, R extends Collection<T>> R removeAllFrom(Iterable<? extends T> iterable, R targetCollection)
{
Iterate.removeAllIterable(iterable, targetCollection);
return targetCollection;
} | [
"public",
"static",
"<",
"T",
",",
"R",
"extends",
"Collection",
"<",
"T",
">",
">",
"R",
"removeAllFrom",
"(",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"iterable",
",",
"R",
"targetCollection",
")",
"{",
"Iterate",
".",
"removeAllIterable",
"(",
"iter... | Remove all elements present in Iterable from the target collection, return the target collection. | [
"Remove",
"all",
"elements",
"present",
"in",
"Iterable",
"from",
"the",
"target",
"collection",
"return",
"the",
"target",
"collection",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L1142-L1146 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.replaceExtension | @Pure
public static File replaceExtension(File filename, String extension) {
if (filename == null) {
return null;
}
if (extension == null) {
return filename;
}
final File dir = filename.getParentFile();
final String name = filename.getName();
final int idx = name.lastIndexOf(getFileExtensionCharacter());
final StringBuilder n = new StringBuilder();
if (idx < 0) {
n.append(name);
} else {
n.append(name.substring(0, idx));
}
if (!name.endsWith(EXTENSION_SEPARATOR) && !extension.startsWith(EXTENSION_SEPARATOR)) {
n.append(EXTENSION_SEPARATOR);
}
n.append(extension);
return new File(dir, n.toString());
} | java | @Pure
public static File replaceExtension(File filename, String extension) {
if (filename == null) {
return null;
}
if (extension == null) {
return filename;
}
final File dir = filename.getParentFile();
final String name = filename.getName();
final int idx = name.lastIndexOf(getFileExtensionCharacter());
final StringBuilder n = new StringBuilder();
if (idx < 0) {
n.append(name);
} else {
n.append(name.substring(0, idx));
}
if (!name.endsWith(EXTENSION_SEPARATOR) && !extension.startsWith(EXTENSION_SEPARATOR)) {
n.append(EXTENSION_SEPARATOR);
}
n.append(extension);
return new File(dir, n.toString());
} | [
"@",
"Pure",
"public",
"static",
"File",
"replaceExtension",
"(",
"File",
"filename",
",",
"String",
"extension",
")",
"{",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"extension",
"==",
"null",
")",
"{",
"retu... | Replace the extension of the specified filename by the given extension.
If the filename has no extension, the specified one will be added.
@param filename is the filename to parse.
@param extension is the extension to remove if it is existing.
@return the filename without the extension. | [
"Replace",
"the",
"extension",
"of",
"the",
"specified",
"filename",
"by",
"the",
"given",
"extension",
".",
"If",
"the",
"filename",
"has",
"no",
"extension",
"the",
"specified",
"one",
"will",
"be",
"added",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L1296-L1318 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/util/DatabaseManagerSwing.java | DatabaseManagerSwing.setStatusLine | void setStatusLine(String busyBaseString, int rowCount) {
iReadyStatus.setSelected(busyBaseString != null);
if (busyBaseString == null) {
String additionalMsg = "";
if (schemaFilter != null) {
additionalMsg = " / Tree showing objects in schema '"
+ schemaFilter + "'";
}
if (rowCount > 1) {
additionalMsg += " / " + rowCount + " rows retrieved";
}
jStatusLine.setText(" " + READY_STATUS + additionalMsg);
} else {
jStatusLine.setText(" " + busyBaseString + "...");
}
} | java | void setStatusLine(String busyBaseString, int rowCount) {
iReadyStatus.setSelected(busyBaseString != null);
if (busyBaseString == null) {
String additionalMsg = "";
if (schemaFilter != null) {
additionalMsg = " / Tree showing objects in schema '"
+ schemaFilter + "'";
}
if (rowCount > 1) {
additionalMsg += " / " + rowCount + " rows retrieved";
}
jStatusLine.setText(" " + READY_STATUS + additionalMsg);
} else {
jStatusLine.setText(" " + busyBaseString + "...");
}
} | [
"void",
"setStatusLine",
"(",
"String",
"busyBaseString",
",",
"int",
"rowCount",
")",
"{",
"iReadyStatus",
".",
"setSelected",
"(",
"busyBaseString",
"!=",
"null",
")",
";",
"if",
"(",
"busyBaseString",
"==",
"null",
")",
"{",
"String",
"additionalMsg",
"=",
... | Added: (weconsultants@users) Sets up\changes the running status icon | [
"Added",
":",
"(",
"weconsultants"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/util/DatabaseManagerSwing.java#L2345-L2365 |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerNew.java | OMMapManagerNew.binarySearch | private int binarySearch(OMMapBufferEntry[] fileEntries, long beginOffset, int beginPosition, int endPosition) {
int midPosition;
while (beginPosition <= endPosition) {
midPosition = (beginPosition + endPosition) >>> 1;
final OMMapBufferEntry entry = fileEntries[midPosition];
if (entry.beginOffset + entry.size > beginOffset && entry.beginOffset <= beginOffset) {
// FOUND: USE IT
return midPosition;
}
if (beginPosition == endPosition) {
// NOT FOUND
return -1;
}
if (beginOffset > entry.beginOffset)
beginPosition = midPosition + 1;
else
endPosition = midPosition;
}
// NOT FOUND
return -1;
} | java | private int binarySearch(OMMapBufferEntry[] fileEntries, long beginOffset, int beginPosition, int endPosition) {
int midPosition;
while (beginPosition <= endPosition) {
midPosition = (beginPosition + endPosition) >>> 1;
final OMMapBufferEntry entry = fileEntries[midPosition];
if (entry.beginOffset + entry.size > beginOffset && entry.beginOffset <= beginOffset) {
// FOUND: USE IT
return midPosition;
}
if (beginPosition == endPosition) {
// NOT FOUND
return -1;
}
if (beginOffset > entry.beginOffset)
beginPosition = midPosition + 1;
else
endPosition = midPosition;
}
// NOT FOUND
return -1;
} | [
"private",
"int",
"binarySearch",
"(",
"OMMapBufferEntry",
"[",
"]",
"fileEntries",
",",
"long",
"beginOffset",
",",
"int",
"beginPosition",
",",
"int",
"endPosition",
")",
"{",
"int",
"midPosition",
";",
"while",
"(",
"beginPosition",
"<=",
"endPosition",
")",
... | This method is used in
com.orientechnologies.orient.core.storage.fs.OMMapManagerNew#searchAmongExisting(com.orientechnologies.orient
.core.storage.fs.OFileMMap, com.orientechnologies.orient.core.storage.fs.OMMapBufferEntry[], long, int) to search necessary
entry.
@param fileEntries
already mapped entries.
@param beginOffset
position in file that should be mmaped.
@param beginPosition
first position in fileEntries.
@param endPosition
last position in fileEntries.
@return -1 if entries is not found. Otherwise returns middle position of file entries to perform new binary search step. | [
"This",
"method",
"is",
"used",
"in",
"com",
".",
"orientechnologies",
".",
"orient",
".",
"core",
".",
"storage",
".",
"fs",
".",
"OMMapManagerNew#searchAmongExisting",
"(",
"com",
".",
"orientechnologies",
".",
"orient",
".",
"core",
".",
"storage",
".",
"... | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerNew.java#L263-L289 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java | GoogleMapShapeConverter.createMultiPolygon | public MultiPolygon createMultiPolygon(List<Polygon> polygonList,
boolean hasZ, boolean hasM) {
MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM);
for (Polygon polygon : polygonList) {
multiPolygon.addPolygon(polygon);
}
return multiPolygon;
} | java | public MultiPolygon createMultiPolygon(List<Polygon> polygonList,
boolean hasZ, boolean hasM) {
MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM);
for (Polygon polygon : polygonList) {
multiPolygon.addPolygon(polygon);
}
return multiPolygon;
} | [
"public",
"MultiPolygon",
"createMultiPolygon",
"(",
"List",
"<",
"Polygon",
">",
"polygonList",
",",
"boolean",
"hasZ",
",",
"boolean",
"hasM",
")",
"{",
"MultiPolygon",
"multiPolygon",
"=",
"new",
"MultiPolygon",
"(",
"hasZ",
",",
"hasM",
")",
";",
"for",
... | Convert a list of {@link Polygon} to a {@link MultiPolygon}
@param polygonList polygon list
@param hasZ has z flag
@param hasM has m flag
@return multi polygon | [
"Convert",
"a",
"list",
"of",
"{",
"@link",
"Polygon",
"}",
"to",
"a",
"{",
"@link",
"MultiPolygon",
"}"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1055-L1065 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/UniverseApi.java | UniverseApi.getUniverseStationsStationId | public StationResponse getUniverseStationsStationId(Integer stationId, String datasource, String ifNoneMatch)
throws ApiException {
ApiResponse<StationResponse> resp = getUniverseStationsStationIdWithHttpInfo(stationId, datasource, ifNoneMatch);
return resp.getData();
} | java | public StationResponse getUniverseStationsStationId(Integer stationId, String datasource, String ifNoneMatch)
throws ApiException {
ApiResponse<StationResponse> resp = getUniverseStationsStationIdWithHttpInfo(stationId, datasource, ifNoneMatch);
return resp.getData();
} | [
"public",
"StationResponse",
"getUniverseStationsStationId",
"(",
"Integer",
"stationId",
",",
"String",
"datasource",
",",
"String",
"ifNoneMatch",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"StationResponse",
">",
"resp",
"=",
"getUniverseStationsStationIdW... | Get station information Get information on a station --- This route
expires daily at 11:05
@param stationId
station_id integer (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param ifNoneMatch
ETag from a previous request. A 304 will be returned if this
matches the current ETag (optional)
@return StationResponse
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Get",
"station",
"information",
"Get",
"information",
"on",
"a",
"station",
"---",
"This",
"route",
"expires",
"daily",
"at",
"11",
":",
"05"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/UniverseApi.java#L3082-L3086 |
jledit/jledit | core/src/main/java/org/jledit/terminal/JlEditTerminalFactory.java | JlEditTerminalFactory.get | public static Terminal get(Terminal terminal, boolean preExists) throws Exception {
if (UnixTerminal.class.isAssignableFrom(terminal.getClass())) {
return new JlEditUnixTerminal((UnixTerminal) terminal, preExists);
} else if (WindowsTerminal.class.isAssignableFrom(terminal.getClass())) {
return new JlEditWindowsTerminal((AnsiWindowsTerminal) terminal, preExists);
} else {
return terminal;
}
} | java | public static Terminal get(Terminal terminal, boolean preExists) throws Exception {
if (UnixTerminal.class.isAssignableFrom(terminal.getClass())) {
return new JlEditUnixTerminal((UnixTerminal) terminal, preExists);
} else if (WindowsTerminal.class.isAssignableFrom(terminal.getClass())) {
return new JlEditWindowsTerminal((AnsiWindowsTerminal) terminal, preExists);
} else {
return terminal;
}
} | [
"public",
"static",
"Terminal",
"get",
"(",
"Terminal",
"terminal",
",",
"boolean",
"preExists",
")",
"throws",
"Exception",
"{",
"if",
"(",
"UnixTerminal",
".",
"class",
".",
"isAssignableFrom",
"(",
"terminal",
".",
"getClass",
"(",
")",
")",
")",
"{",
"... | Wraps a {@link Terminal}.
@param terminal
@param preExists
@return
@throws Exception | [
"Wraps",
"a",
"{"
] | train | https://github.com/jledit/jledit/blob/ced2c4b44330664adb65f8be4c8fff780ccaa6fd/core/src/main/java/org/jledit/terminal/JlEditTerminalFactory.java#L64-L72 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneUncalibrated.java | EstimateSceneUncalibrated.scoreForTriangulation | double scoreForTriangulation( Motion motion ) {
DMatrixRMaj H = new DMatrixRMaj(3,3);
View viewA = motion.viewSrc;
View viewB = motion.viewDst;
// Compute initial estimate for H
pairs.reset();
for (int i = 0; i < motion.associated.size(); i++) {
AssociatedIndex ai = motion.associated.get(i);
pairs.grow().set(
viewA.observationPixels.get(ai.src),
viewB.observationPixels.get(ai.dst));
}
if(!computeH.process(pairs.toList(),H))
return -1;
// remove bias from linear model
if( !refineH.fitModel(pairs.toList(),H,H) )
return -1;
// Compute 50% errors to avoid bias from outliers
MultiViewOps.errorsHomographySymm(pairs.toList(),H,null,errors);
errors.sort();
return errors.getFraction(0.5)*Math.max(5,pairs.size-20);
} | java | double scoreForTriangulation( Motion motion ) {
DMatrixRMaj H = new DMatrixRMaj(3,3);
View viewA = motion.viewSrc;
View viewB = motion.viewDst;
// Compute initial estimate for H
pairs.reset();
for (int i = 0; i < motion.associated.size(); i++) {
AssociatedIndex ai = motion.associated.get(i);
pairs.grow().set(
viewA.observationPixels.get(ai.src),
viewB.observationPixels.get(ai.dst));
}
if(!computeH.process(pairs.toList(),H))
return -1;
// remove bias from linear model
if( !refineH.fitModel(pairs.toList(),H,H) )
return -1;
// Compute 50% errors to avoid bias from outliers
MultiViewOps.errorsHomographySymm(pairs.toList(),H,null,errors);
errors.sort();
return errors.getFraction(0.5)*Math.max(5,pairs.size-20);
} | [
"double",
"scoreForTriangulation",
"(",
"Motion",
"motion",
")",
"{",
"DMatrixRMaj",
"H",
"=",
"new",
"DMatrixRMaj",
"(",
"3",
",",
"3",
")",
";",
"View",
"viewA",
"=",
"motion",
".",
"viewSrc",
";",
"View",
"viewB",
"=",
"motion",
".",
"viewDst",
";",
... | Compute score to decide which motion to initialize structure from. A homography is fit to the
observations and the error compute. The homography should be a poor fit if the scene had 3D structure.
The 50% homography error is then scaled by the number of pairs to bias the score good matches
@param motion input
@return fit score. Larger is better. | [
"Compute",
"score",
"to",
"decide",
"which",
"motion",
"to",
"initialize",
"structure",
"from",
".",
"A",
"homography",
"is",
"fit",
"to",
"the",
"observations",
"and",
"the",
"error",
"compute",
".",
"The",
"homography",
"should",
"be",
"a",
"poor",
"fit",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneUncalibrated.java#L217-L245 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java | ServerAzureADAdministratorsInner.deleteAsync | public Observable<ServerAzureADAdministratorInner> deleteAsync(String resourceGroupName, String serverName) {
return deleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerAzureADAdministratorInner>, ServerAzureADAdministratorInner>() {
@Override
public ServerAzureADAdministratorInner call(ServiceResponse<ServerAzureADAdministratorInner> response) {
return response.body();
}
});
} | java | public Observable<ServerAzureADAdministratorInner> deleteAsync(String resourceGroupName, String serverName) {
return deleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerAzureADAdministratorInner>, ServerAzureADAdministratorInner>() {
@Override
public ServerAzureADAdministratorInner call(ServiceResponse<ServerAzureADAdministratorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerAzureADAdministratorInner",
">",
"deleteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"deleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
".",
"map",
"(",
... | Deletes an existing server Active Directory Administrator.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Deletes",
"an",
"existing",
"server",
"Active",
"Directory",
"Administrator",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java#L296-L303 |
apache/groovy | subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java | DateTimeExtensions.leftShift | public static LocalDateTime leftShift(final LocalTime self, LocalDate date) {
return LocalDateTime.of(date, self);
} | java | public static LocalDateTime leftShift(final LocalTime self, LocalDate date) {
return LocalDateTime.of(date, self);
} | [
"public",
"static",
"LocalDateTime",
"leftShift",
"(",
"final",
"LocalTime",
"self",
",",
"LocalDate",
"date",
")",
"{",
"return",
"LocalDateTime",
".",
"of",
"(",
"date",
",",
"self",
")",
";",
"}"
] | Returns a {@link java.time.LocalDateTime} of this time and the provided {@link java.time.LocalDate}.
@param self a LocalTime
@param date a LocalDate
@return a LocalDateTime
@since 2.5.0 | [
"Returns",
"a",
"{",
"@link",
"java",
".",
"time",
".",
"LocalDateTime",
"}",
"of",
"this",
"time",
"and",
"the",
"provided",
"{",
"@link",
"java",
".",
"time",
".",
"LocalDate",
"}",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L949-L951 |
alkacon/opencms-core | src-modules/org/opencms/workplace/help/CmsHelpNavigationListView.java | CmsHelpNavigationListView.calculateEndLevel | private int calculateEndLevel() {
int result = 0;
if (m_navRootPath != null) {
// where are we? (start level)
StringTokenizer counter = new StringTokenizer(m_navRootPath, "/", false);
// one less as level 0 nav elements accepted is one level (depth 1).
result = counter.countTokens() - 1;
if (!CmsResource.isFolder(m_navRootPath)) {
// cut stuff like system/workpalce/locale/de/help/index.html
result--;
}
result += m_depth;
}
if (result < 0) {
result = 0;
}
return result;
} | java | private int calculateEndLevel() {
int result = 0;
if (m_navRootPath != null) {
// where are we? (start level)
StringTokenizer counter = new StringTokenizer(m_navRootPath, "/", false);
// one less as level 0 nav elements accepted is one level (depth 1).
result = counter.countTokens() - 1;
if (!CmsResource.isFolder(m_navRootPath)) {
// cut stuff like system/workpalce/locale/de/help/index.html
result--;
}
result += m_depth;
}
if (result < 0) {
result = 0;
}
return result;
} | [
"private",
"int",
"calculateEndLevel",
"(",
")",
"{",
"int",
"result",
"=",
"0",
";",
"if",
"(",
"m_navRootPath",
"!=",
"null",
")",
"{",
"// where are we? (start level)",
"StringTokenizer",
"counter",
"=",
"new",
"StringTokenizer",
"(",
"m_navRootPath",
",",
"\... | Calculates and returns the navigation end level.<p>
@return the navigation end level | [
"Calculates",
"and",
"returns",
"the",
"navigation",
"end",
"level",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/help/CmsHelpNavigationListView.java#L185-L204 |
xsonorg/xson | src/main/java/org/xson/core/asm/Type.java | Type.getClassName | public String getClassName() {
switch (sort) {
case VOID:
return "void";
case BOOLEAN:
return "boolean";
case CHAR:
return "char";
case BYTE:
return "byte";
case SHORT:
return "short";
case INT:
return "int";
case FLOAT:
return "float";
case LONG:
return "long";
case DOUBLE:
return "double";
case ARRAY:
StringBuffer b = new StringBuffer(getElementType().getClassName());
for (int i = getDimensions(); i > 0; --i) {
b.append("[]");
}
return b.toString();
// case OBJECT:
default:
return new String(buf, off, len).replace('/', '.');
}
} | java | public String getClassName() {
switch (sort) {
case VOID:
return "void";
case BOOLEAN:
return "boolean";
case CHAR:
return "char";
case BYTE:
return "byte";
case SHORT:
return "short";
case INT:
return "int";
case FLOAT:
return "float";
case LONG:
return "long";
case DOUBLE:
return "double";
case ARRAY:
StringBuffer b = new StringBuffer(getElementType().getClassName());
for (int i = getDimensions(); i > 0; --i) {
b.append("[]");
}
return b.toString();
// case OBJECT:
default:
return new String(buf, off, len).replace('/', '.');
}
} | [
"public",
"String",
"getClassName",
"(",
")",
"{",
"switch",
"(",
"sort",
")",
"{",
"case",
"VOID",
":",
"return",
"\"void\"",
";",
"case",
"BOOLEAN",
":",
"return",
"\"boolean\"",
";",
"case",
"CHAR",
":",
"return",
"\"char\"",
";",
"case",
"BYTE",
":",... | Returns the name of the class corresponding to this type.
@return the fully qualified name of the class corresponding to this type. | [
"Returns",
"the",
"name",
"of",
"the",
"class",
"corresponding",
"to",
"this",
"type",
"."
] | train | https://github.com/xsonorg/xson/blob/ce1e197ec4ef9be448ed6ca96513e886151f83a9/src/main/java/org/xson/core/asm/Type.java#L426-L456 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_debt_GET | public OvhDebt order_orderId_debt_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/debt";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDebt.class);
} | java | public OvhDebt order_orderId_debt_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/debt";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDebt.class);
} | [
"public",
"OvhDebt",
"order_orderId_debt_GET",
"(",
"Long",
"orderId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/debt\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"orderId",
")",
";",
"String",
"resp",
"... | Get this object properties
REST: GET /me/order/{orderId}/debt
@param orderId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2028-L2033 |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionConfigurationException.java | SessionConfigurationException.fromThrowable | public static SessionConfigurationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionConfigurationException && Objects.equals(message, cause.getMessage()))
? (SessionConfigurationException) cause
: new SessionConfigurationException(message, cause);
} | java | public static SessionConfigurationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionConfigurationException && Objects.equals(message, cause.getMessage()))
? (SessionConfigurationException) cause
: new SessionConfigurationException(message, cause);
} | [
"public",
"static",
"SessionConfigurationException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionConfigurationException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
... | Converts a Throwable to a SessionConfigurationException with the specified detail message. If the
Throwable is a SessionConfigurationException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionConfigurationException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionConfigurationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionConfigurationException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionConfigurationException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
... | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionConfigurationException.java#L62-L66 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/GeneratorSet.java | GeneratorSet.setGenerator | public void setGenerator( String functionName, ITestCaseGenerator generator)
{
String functionKey = getFunctionKey( functionName);
if( generator == null)
{
generators_.remove( functionKey);
}
else
{
generators_.put( functionKey, generator);
}
} | java | public void setGenerator( String functionName, ITestCaseGenerator generator)
{
String functionKey = getFunctionKey( functionName);
if( generator == null)
{
generators_.remove( functionKey);
}
else
{
generators_.put( functionKey, generator);
}
} | [
"public",
"void",
"setGenerator",
"(",
"String",
"functionName",
",",
"ITestCaseGenerator",
"generator",
")",
"{",
"String",
"functionKey",
"=",
"getFunctionKey",
"(",
"functionName",
")",
";",
"if",
"(",
"generator",
"==",
"null",
")",
"{",
"generators_",
".",
... | Changes the test case generator for the given system function. | [
"Changes",
"the",
"test",
"case",
"generator",
"for",
"the",
"given",
"system",
"function",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/GeneratorSet.java#L74-L85 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java | WorkflowsInner.validateWorkflowAsync | public Observable<Void> validateWorkflowAsync(String resourceGroupName, String workflowName, WorkflowInner validate) {
return validateWorkflowWithServiceResponseAsync(resourceGroupName, workflowName, validate).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> validateWorkflowAsync(String resourceGroupName, String workflowName, WorkflowInner validate) {
return validateWorkflowWithServiceResponseAsync(resourceGroupName, workflowName, validate).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"validateWorkflowAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
",",
"WorkflowInner",
"validate",
")",
"{",
"return",
"validateWorkflowWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workflow... | Validates the workflow.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param validate The workflow.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Validates",
"the",
"workflow",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L1785-L1792 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/Validation.java | Validation.checkExistenceOfPolymerID | private static void checkExistenceOfPolymerID(String str, List<String> listPolymerIDs) throws PolymerIDsException {
if (!(listPolymerIDs.contains(str))) {
LOG.info("Polymer Id does not exist");
throw new PolymerIDsException("Polymer ID does not exist");
}
} | java | private static void checkExistenceOfPolymerID(String str, List<String> listPolymerIDs) throws PolymerIDsException {
if (!(listPolymerIDs.contains(str))) {
LOG.info("Polymer Id does not exist");
throw new PolymerIDsException("Polymer ID does not exist");
}
} | [
"private",
"static",
"void",
"checkExistenceOfPolymerID",
"(",
"String",
"str",
",",
"List",
"<",
"String",
">",
"listPolymerIDs",
")",
"throws",
"PolymerIDsException",
"{",
"if",
"(",
"!",
"(",
"listPolymerIDs",
".",
"contains",
"(",
"str",
")",
")",
")",
"... | method to check if the given polymer id exists in the given list of
polymer ids
@param str
polymer id
@param listPolymerIDs
List of polymer ids
@return true if the polymer id exists, false otherwise
@throws PolymerIDsException
if the polymer id does not exist | [
"method",
"to",
"check",
"if",
"the",
"given",
"polymer",
"id",
"exists",
"in",
"the",
"given",
"list",
"of",
"polymer",
"ids"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/Validation.java#L435-L440 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getWvWMatchScore | public void getWvWMatchScore(String[] ids, Callback<List<WvWMatchScore>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getWvWMatchScoreUsingID(processIds(ids)).enqueue(callback);
} | java | public void getWvWMatchScore(String[] ids, Callback<List<WvWMatchScore>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getWvWMatchScoreUsingID(processIds(ids)).enqueue(callback);
} | [
"public",
"void",
"getWvWMatchScore",
"(",
"String",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"WvWMatchScore",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(... | For more info on WvW matches API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/matches">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of wvw match id(s)
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@throws GuildWars2Exception empty ID list
@see WvWMatchScore WvW match score info | [
"For",
"more",
"info",
"on",
"WvW",
"matches",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"wvw",
"/",
"matches",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2680-L2683 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/MergeRequestApi.java | MergeRequestApi.unapproveMergeRequest | public MergeRequest unapproveMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
if (mergeRequestIid == null) {
throw new RuntimeException("mergeRequestIid cannot be null");
}
Response response = post(Response.Status.OK, (Form)null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "unapprove");
return (response.readEntity(MergeRequest.class));
} | java | public MergeRequest unapproveMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
if (mergeRequestIid == null) {
throw new RuntimeException("mergeRequestIid cannot be null");
}
Response response = post(Response.Status.OK, (Form)null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "unapprove");
return (response.readEntity(MergeRequest.class));
} | [
"public",
"MergeRequest",
"unapproveMergeRequest",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"mergeRequestIid",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"mergeRequestIid",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"mergeReq... | Unapprove a merge request.
Note: This API endpoint is only available on 8.9 EE and above.
<pre><code>GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/unapprove</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param mergeRequestIid the internal ID of the merge request
@return a MergeRequest instance with approval information included
@throws GitLabApiException if any exception occurs | [
"Unapprove",
"a",
"merge",
"request",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/MergeRequestApi.java#L742-L750 |
btaz/data-util | src/main/java/com/btaz/util/tf/Template.java | Template.readResourceAsStream | public static String readResourceAsStream(String path) {
try {
InputStream inputStream = ResourceUtil.getResourceAsStream(path);
return ResourceUtil.readFromInputStreamIntoString(inputStream);
} catch (Exception e) {
throw new DataUtilException("Failed to load resource", e);
}
} | java | public static String readResourceAsStream(String path) {
try {
InputStream inputStream = ResourceUtil.getResourceAsStream(path);
return ResourceUtil.readFromInputStreamIntoString(inputStream);
} catch (Exception e) {
throw new DataUtilException("Failed to load resource", e);
}
} | [
"public",
"static",
"String",
"readResourceAsStream",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"InputStream",
"inputStream",
"=",
"ResourceUtil",
".",
"getResourceAsStream",
"(",
"path",
")",
";",
"return",
"ResourceUtil",
".",
"readFromInputStreamIntoString",
"... | This method looks for a file on the provided path, attempts to load it as a stream and returns it as a string
@param path path
@return {@code String} text | [
"This",
"method",
"looks",
"for",
"a",
"file",
"on",
"the",
"provided",
"path",
"attempts",
"to",
"load",
"it",
"as",
"a",
"stream",
"and",
"returns",
"it",
"as",
"a",
"string"
] | train | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/tf/Template.java#L47-L54 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbsite_gslbservice_binding.java | gslbsite_gslbservice_binding.count_filtered | public static long count_filtered(nitro_service service, String sitename, String filter) throws Exception{
gslbsite_gslbservice_binding obj = new gslbsite_gslbservice_binding();
obj.set_sitename(sitename);
options option = new options();
option.set_count(true);
option.set_filter(filter);
gslbsite_gslbservice_binding[] response = (gslbsite_gslbservice_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, String sitename, String filter) throws Exception{
gslbsite_gslbservice_binding obj = new gslbsite_gslbservice_binding();
obj.set_sitename(sitename);
options option = new options();
option.set_count(true);
option.set_filter(filter);
gslbsite_gslbservice_binding[] response = (gslbsite_gslbservice_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"String",
"sitename",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"gslbsite_gslbservice_binding",
"obj",
"=",
"new",
"gslbsite_gslbservice_binding",
"(",
")",
";",
"obj... | Use this API to count the filtered set of gslbsite_gslbservice_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"gslbsite_gslbservice_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbsite_gslbservice_binding.java#L214-L225 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/ClientNotificationArea.java | ClientNotificationArea.addNotfication | public void addNotfication(Notification notification) {
Object source = notification.getSource();
NotificationRecord nr;
if (source instanceof ObjectName) {
nr = new NotificationRecord(notification, (ObjectName) source);
} else {
nr = new NotificationRecord(notification, (source != null) ? source.toString() : null);
}
addNotficationRecord(nr);
} | java | public void addNotfication(Notification notification) {
Object source = notification.getSource();
NotificationRecord nr;
if (source instanceof ObjectName) {
nr = new NotificationRecord(notification, (ObjectName) source);
} else {
nr = new NotificationRecord(notification, (source != null) ? source.toString() : null);
}
addNotficationRecord(nr);
} | [
"public",
"void",
"addNotfication",
"(",
"Notification",
"notification",
")",
"{",
"Object",
"source",
"=",
"notification",
".",
"getSource",
"(",
")",
";",
"NotificationRecord",
"nr",
";",
"if",
"(",
"source",
"instanceof",
"ObjectName",
")",
"{",
"nr",
"=",
... | This method will be called by the NotificationListener once the MBeanServer pushes a notification. | [
"This",
"method",
"will",
"be",
"called",
"by",
"the",
"NotificationListener",
"once",
"the",
"MBeanServer",
"pushes",
"a",
"notification",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/ClientNotificationArea.java#L146-L155 |
crawljax/crawljax | core/src/main/java/com/crawljax/util/XMLObject.java | XMLObject.objectToXML | public static void objectToXML(Object object, String fileName) throws FileNotFoundException {
FileOutputStream fo = new FileOutputStream(fileName);
XMLEncoder encoder = new XMLEncoder(fo);
encoder.writeObject(object);
encoder.close();
} | java | public static void objectToXML(Object object, String fileName) throws FileNotFoundException {
FileOutputStream fo = new FileOutputStream(fileName);
XMLEncoder encoder = new XMLEncoder(fo);
encoder.writeObject(object);
encoder.close();
} | [
"public",
"static",
"void",
"objectToXML",
"(",
"Object",
"object",
",",
"String",
"fileName",
")",
"throws",
"FileNotFoundException",
"{",
"FileOutputStream",
"fo",
"=",
"new",
"FileOutputStream",
"(",
"fileName",
")",
";",
"XMLEncoder",
"encoder",
"=",
"new",
... | Converts an object to an XML file.
@param object The object to convert.
@param fileName The filename where to save it to.
@throws FileNotFoundException On error. | [
"Converts",
"an",
"object",
"to",
"an",
"XML",
"file",
"."
] | train | https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/util/XMLObject.java#L25-L30 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.uploadCertificateAsync | public Observable<UploadCertificateResponseInner> uploadCertificateAsync(String deviceName, String resourceGroupName, UploadCertificateRequest parameters) {
return uploadCertificateWithServiceResponseAsync(deviceName, resourceGroupName, parameters).map(new Func1<ServiceResponse<UploadCertificateResponseInner>, UploadCertificateResponseInner>() {
@Override
public UploadCertificateResponseInner call(ServiceResponse<UploadCertificateResponseInner> response) {
return response.body();
}
});
} | java | public Observable<UploadCertificateResponseInner> uploadCertificateAsync(String deviceName, String resourceGroupName, UploadCertificateRequest parameters) {
return uploadCertificateWithServiceResponseAsync(deviceName, resourceGroupName, parameters).map(new Func1<ServiceResponse<UploadCertificateResponseInner>, UploadCertificateResponseInner>() {
@Override
public UploadCertificateResponseInner call(ServiceResponse<UploadCertificateResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UploadCertificateResponseInner",
">",
"uploadCertificateAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"UploadCertificateRequest",
"parameters",
")",
"{",
"return",
"uploadCertificateWithServiceResponseAsync",
"(",
... | Uploads registration certificate for the device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param parameters The upload certificate request.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UploadCertificateResponseInner object | [
"Uploads",
"registration",
"certificate",
"for",
"the",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L2125-L2132 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.findPolymorphicSignatureInstance | Symbol findPolymorphicSignatureInstance(Env<AttrContext> env,
final Symbol spMethod,
List<Type> argtypes) {
Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
(MethodSymbol)spMethod, currentResolutionContext, argtypes);
for (Symbol sym : polymorphicSignatureScope.getSymbolsByName(spMethod.name)) {
// Check that there is already a method symbol for the method
// type and owner
if (types.isSameType(mtype, sym.type) &&
spMethod.owner == sym.owner) {
return sym;
}
}
// Create the desired method
// Retain static modifier is to support invocations to
// MethodHandle.linkTo* methods
long flags = ABSTRACT | HYPOTHETICAL |
spMethod.flags() & (Flags.AccessFlags | Flags.STATIC);
Symbol msym = new MethodSymbol(flags, spMethod.name, mtype, spMethod.owner) {
@Override
public Symbol baseSymbol() {
return spMethod;
}
};
if (!mtype.isErroneous()) { // Cache only if kosher.
polymorphicSignatureScope.enter(msym);
}
return msym;
} | java | Symbol findPolymorphicSignatureInstance(Env<AttrContext> env,
final Symbol spMethod,
List<Type> argtypes) {
Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
(MethodSymbol)spMethod, currentResolutionContext, argtypes);
for (Symbol sym : polymorphicSignatureScope.getSymbolsByName(spMethod.name)) {
// Check that there is already a method symbol for the method
// type and owner
if (types.isSameType(mtype, sym.type) &&
spMethod.owner == sym.owner) {
return sym;
}
}
// Create the desired method
// Retain static modifier is to support invocations to
// MethodHandle.linkTo* methods
long flags = ABSTRACT | HYPOTHETICAL |
spMethod.flags() & (Flags.AccessFlags | Flags.STATIC);
Symbol msym = new MethodSymbol(flags, spMethod.name, mtype, spMethod.owner) {
@Override
public Symbol baseSymbol() {
return spMethod;
}
};
if (!mtype.isErroneous()) { // Cache only if kosher.
polymorphicSignatureScope.enter(msym);
}
return msym;
} | [
"Symbol",
"findPolymorphicSignatureInstance",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"final",
"Symbol",
"spMethod",
",",
"List",
"<",
"Type",
">",
"argtypes",
")",
"{",
"Type",
"mtype",
"=",
"infer",
".",
"instantiatePolymorphicSignatureInstance",
"(",
... | Find or create an implicit method of exactly the given type (after erasure).
Searches in a side table, not the main scope of the site.
This emulates the lookup process required by JSR 292 in JVM.
@param env Attribution environment
@param spMethod signature polymorphic method - i.e. MH.invokeExact
@param argtypes The required argument types | [
"Find",
"or",
"create",
"an",
"implicit",
"method",
"of",
"exactly",
"the",
"given",
"type",
"(",
"after",
"erasure",
")",
".",
"Searches",
"in",
"a",
"side",
"table",
"not",
"the",
"main",
"scope",
"of",
"the",
"site",
".",
"This",
"emulates",
"the",
... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2653-L2682 |
gwtplus/google-gin | src/main/java/com/google/gwt/inject/client/assistedinject/GinFactoryModuleBuilder.java | GinFactoryModuleBuilder.implement | public <T> GinFactoryModuleBuilder implement(Key<T> source, TypeLiteral<? extends T> target) {
bindings.addBinding(source, target);
return this;
} | java | public <T> GinFactoryModuleBuilder implement(Key<T> source, TypeLiteral<? extends T> target) {
bindings.addBinding(source, target);
return this;
} | [
"public",
"<",
"T",
">",
"GinFactoryModuleBuilder",
"implement",
"(",
"Key",
"<",
"T",
">",
"source",
",",
"TypeLiteral",
"<",
"?",
"extends",
"T",
">",
"target",
")",
"{",
"bindings",
".",
"addBinding",
"(",
"source",
",",
"target",
")",
";",
"return",
... | See the factory configuration examples at {@link GinFactoryModuleBuilder}. | [
"See",
"the",
"factory",
"configuration",
"examples",
"at",
"{"
] | train | https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/client/assistedinject/GinFactoryModuleBuilder.java#L315-L318 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jbatch.misc_fat/util/src/fat/util/JobWaiter.java | JobWaiter.completeNewJobWithRestart | public JobExecution completeNewJobWithRestart(String jobXMLName, Properties jobParameters, int restartAttempts) throws IllegalStateException {
long executionId = jobOp.start(jobXMLName, jobParameters);
JobExecution jobExec = waitForFinish(executionId);
if (jobExec.getBatchStatus().equals(BatchStatus.FAILED)) {
for (int i = 0; i < restartAttempts; i++) {
jobParameters.put("restartCount", Integer.toString(i + 1));
executionId = jobOp.restart(executionId, jobParameters);
jobExec = waitForFinish(executionId);
if (jobExec.getBatchStatus().equals(BatchStatus.COMPLETED)) {
logger.finer("Job " + executionId + " successfully completed.");
return jobExec;
}
}
throw new IllegalStateException("Job " + executionId + " failed to complete within the allowed number of restarts (" + restartAttempts + ")."
+ " Last execution status is: " + jobExec.getBatchStatus());
} else {
throw new IllegalStateException("Job " + executionId + " expected to fail and be restartable, but status is: " + jobExec.getBatchStatus());
}
} | java | public JobExecution completeNewJobWithRestart(String jobXMLName, Properties jobParameters, int restartAttempts) throws IllegalStateException {
long executionId = jobOp.start(jobXMLName, jobParameters);
JobExecution jobExec = waitForFinish(executionId);
if (jobExec.getBatchStatus().equals(BatchStatus.FAILED)) {
for (int i = 0; i < restartAttempts; i++) {
jobParameters.put("restartCount", Integer.toString(i + 1));
executionId = jobOp.restart(executionId, jobParameters);
jobExec = waitForFinish(executionId);
if (jobExec.getBatchStatus().equals(BatchStatus.COMPLETED)) {
logger.finer("Job " + executionId + " successfully completed.");
return jobExec;
}
}
throw new IllegalStateException("Job " + executionId + " failed to complete within the allowed number of restarts (" + restartAttempts + ")."
+ " Last execution status is: " + jobExec.getBatchStatus());
} else {
throw new IllegalStateException("Job " + executionId + " expected to fail and be restartable, but status is: " + jobExec.getBatchStatus());
}
} | [
"public",
"JobExecution",
"completeNewJobWithRestart",
"(",
"String",
"jobXMLName",
",",
"Properties",
"jobParameters",
",",
"int",
"restartAttempts",
")",
"throws",
"IllegalStateException",
"{",
"long",
"executionId",
"=",
"jobOp",
".",
"start",
"(",
"jobXMLName",
",... | Wait for {@code JobWaiter#timeout} seconds for BOTH of:
1) BatchStatus to be one of: STOPPED ,FAILED , COMPLETED, ABANDONED
AND
2) exitStatus to be non-null
The job is expected to fail on the first attempt, and then a number of restarts up to the
restartAttempts parameter will be tried. The job may complete before that many restarts
are attempted.
Returns JobExecution if it ends in <b>COMPLETED</b> status, otherwise throws
<b>IllegalStateException</b>
@param jobXMLName
@param jobParameters
@param restartAttempts
@return JobExecution (for successfully completing job)
@throws IllegalStateException | [
"Wait",
"for",
"{",
"@code",
"JobWaiter#timeout",
"}",
"seconds",
"for",
"BOTH",
"of",
":"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jbatch.misc_fat/util/src/fat/util/JobWaiter.java#L134-L158 |
Berico-Technologies/CLAVIN | src/main/java/com/bericotech/clavin/index/WhitespaceLowerCaseAnalyzer.java | WhitespaceLowerCaseAnalyzer.createComponents | @Override
protected TokenStreamComponents createComponents(final String fieldName, final Reader reader) {
return new TokenStreamComponents(new WhitespaceLowerCaseTokenizer(matchVersion, reader));
} | java | @Override
protected TokenStreamComponents createComponents(final String fieldName, final Reader reader) {
return new TokenStreamComponents(new WhitespaceLowerCaseTokenizer(matchVersion, reader));
} | [
"@",
"Override",
"protected",
"TokenStreamComponents",
"createComponents",
"(",
"final",
"String",
"fieldName",
",",
"final",
"Reader",
"reader",
")",
"{",
"return",
"new",
"TokenStreamComponents",
"(",
"new",
"WhitespaceLowerCaseTokenizer",
"(",
"matchVersion",
",",
... | Provides tokenizer access for the analyzer.
@param fieldName field to be tokenized
@param reader | [
"Provides",
"tokenizer",
"access",
"for",
"the",
"analyzer",
"."
] | train | https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/index/WhitespaceLowerCaseAnalyzer.java#L60-L63 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/CmsElementUtil.java | CmsElementUtil.getElementContent | private String getElementContent(CmsContainerElementBean element, CmsResource formatter, CmsContainer container)
throws CmsException, ServletException, IOException {
element.initResource(m_cms);
TemplateBean templateBean = CmsADESessionCache.getCache(m_req, m_cms).getTemplateBean(
m_cms.addSiteRoot(m_currentPageUri),
true);
String oldUri = m_cms.getRequestContext().getUri();
try {
m_cms.getRequestContext().setUri(m_currentPageUri);
CmsContainerBean containerBean = null;
if ((m_standardContext.getPage() != null)
&& m_standardContext.getPage().getContainers().containsKey(container.getName())) {
containerBean = m_standardContext.getPage().getContainers().get(container.getName());
} else {
containerBean = new CmsContainerBean(
container.getName(),
container.getType(),
container.getParentInstanceId(),
container.isRootContainer(),
container.getMaxElements(),
Collections.<CmsContainerElementBean> emptyList());
}
if (containerBean.getWidth() == null) {
containerBean.setWidth(String.valueOf(container.getWidth()));
}
containerBean.setDetailOnly(container.isDetailOnly());
m_standardContext.setContainer(containerBean);
m_standardContext.setElement(element);
m_standardContext.setEdited(true);
// to enable 'old' direct edit features for content-collector-elements,
// set the direct-edit-provider-attribute in the request
I_CmsDirectEditProvider eb = new CmsAdvancedDirectEditProvider();
eb.init(m_cms, CmsDirectEditMode.TRUE, element.getSitePath());
m_req.setAttribute(I_CmsDirectEditProvider.ATTRIBUTE_DIRECT_EDIT_PROVIDER, eb);
m_req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN, templateBean);
String encoding = m_res.getCharacterEncoding();
return (new String(
OpenCms.getResourceManager().getLoader(formatter).dump(m_cms, formatter, null, m_locale, m_req, m_res),
encoding)).trim();
} finally {
m_cms.getRequestContext().setUri(oldUri);
}
} | java | private String getElementContent(CmsContainerElementBean element, CmsResource formatter, CmsContainer container)
throws CmsException, ServletException, IOException {
element.initResource(m_cms);
TemplateBean templateBean = CmsADESessionCache.getCache(m_req, m_cms).getTemplateBean(
m_cms.addSiteRoot(m_currentPageUri),
true);
String oldUri = m_cms.getRequestContext().getUri();
try {
m_cms.getRequestContext().setUri(m_currentPageUri);
CmsContainerBean containerBean = null;
if ((m_standardContext.getPage() != null)
&& m_standardContext.getPage().getContainers().containsKey(container.getName())) {
containerBean = m_standardContext.getPage().getContainers().get(container.getName());
} else {
containerBean = new CmsContainerBean(
container.getName(),
container.getType(),
container.getParentInstanceId(),
container.isRootContainer(),
container.getMaxElements(),
Collections.<CmsContainerElementBean> emptyList());
}
if (containerBean.getWidth() == null) {
containerBean.setWidth(String.valueOf(container.getWidth()));
}
containerBean.setDetailOnly(container.isDetailOnly());
m_standardContext.setContainer(containerBean);
m_standardContext.setElement(element);
m_standardContext.setEdited(true);
// to enable 'old' direct edit features for content-collector-elements,
// set the direct-edit-provider-attribute in the request
I_CmsDirectEditProvider eb = new CmsAdvancedDirectEditProvider();
eb.init(m_cms, CmsDirectEditMode.TRUE, element.getSitePath());
m_req.setAttribute(I_CmsDirectEditProvider.ATTRIBUTE_DIRECT_EDIT_PROVIDER, eb);
m_req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN, templateBean);
String encoding = m_res.getCharacterEncoding();
return (new String(
OpenCms.getResourceManager().getLoader(formatter).dump(m_cms, formatter, null, m_locale, m_req, m_res),
encoding)).trim();
} finally {
m_cms.getRequestContext().setUri(oldUri);
}
} | [
"private",
"String",
"getElementContent",
"(",
"CmsContainerElementBean",
"element",
",",
"CmsResource",
"formatter",
",",
"CmsContainer",
"container",
")",
"throws",
"CmsException",
",",
"ServletException",
",",
"IOException",
"{",
"element",
".",
"initResource",
"(",
... | Returns the content of an element when rendered with the given formatter.<p>
@param element the element bean
@param formatter the formatter uri
@param container the container for which the element content should be retrieved
@return generated html code
@throws CmsException if an cms related error occurs
@throws ServletException if a jsp related error occurs
@throws IOException if a jsp related error occurs | [
"Returns",
"the",
"content",
"of",
"an",
"element",
"when",
"rendered",
"with",
"the",
"given",
"formatter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsElementUtil.java#L1037-L1080 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_output_graylog_stream_streamId_alert_POST | public OvhOperation serviceName_output_graylog_stream_streamId_alert_POST(String serviceName, String streamId, Long backlog, OvhStreamAlertConditionConditionTypeEnum conditionType, OvhStreamAlertConditionConstraintTypeEnum constraintType, String field, Long grace, String queryFilter, Boolean repeatNotificationsEnabled, Long threshold, OvhStreamAlertConditionThresholdTypeEnum thresholdType, Long time, String title, String value) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/alert";
StringBuilder sb = path(qPath, serviceName, streamId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "backlog", backlog);
addBody(o, "conditionType", conditionType);
addBody(o, "constraintType", constraintType);
addBody(o, "field", field);
addBody(o, "grace", grace);
addBody(o, "queryFilter", queryFilter);
addBody(o, "repeatNotificationsEnabled", repeatNotificationsEnabled);
addBody(o, "threshold", threshold);
addBody(o, "thresholdType", thresholdType);
addBody(o, "time", time);
addBody(o, "title", title);
addBody(o, "value", value);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | java | public OvhOperation serviceName_output_graylog_stream_streamId_alert_POST(String serviceName, String streamId, Long backlog, OvhStreamAlertConditionConditionTypeEnum conditionType, OvhStreamAlertConditionConstraintTypeEnum constraintType, String field, Long grace, String queryFilter, Boolean repeatNotificationsEnabled, Long threshold, OvhStreamAlertConditionThresholdTypeEnum thresholdType, Long time, String title, String value) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/alert";
StringBuilder sb = path(qPath, serviceName, streamId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "backlog", backlog);
addBody(o, "conditionType", conditionType);
addBody(o, "constraintType", constraintType);
addBody(o, "field", field);
addBody(o, "grace", grace);
addBody(o, "queryFilter", queryFilter);
addBody(o, "repeatNotificationsEnabled", repeatNotificationsEnabled);
addBody(o, "threshold", threshold);
addBody(o, "thresholdType", thresholdType);
addBody(o, "time", time);
addBody(o, "title", title);
addBody(o, "value", value);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | [
"public",
"OvhOperation",
"serviceName_output_graylog_stream_streamId_alert_POST",
"(",
"String",
"serviceName",
",",
"String",
"streamId",
",",
"Long",
"backlog",
",",
"OvhStreamAlertConditionConditionTypeEnum",
"conditionType",
",",
"OvhStreamAlertConditionConstraintTypeEnum",
"c... | Register a new alert on specified graylog stream
REST: POST /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/alert
@param serviceName [required] Service name
@param streamId [required] Stream ID
@param thresholdType [required] Threshold type
@param grace [required] Grace period
@param constraintType [required] Constraint type
@param conditionType [required] Condition type
@param repeatNotificationsEnabled [required] Repeat notifications enabled
@param value [required] Value
@param backlog [required] Backlog
@param threshold [required] Threshold
@param time [required] Time
@param title [required] Title
@param field [required] Field
@param queryFilter [required] Query filter | [
"Register",
"a",
"new",
"alert",
"on",
"specified",
"graylog",
"stream"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1359-L1377 |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java | ControllerRegistry.createControllerRoutes | @SuppressWarnings("unchecked")
private List<Route> createControllerRoutes(Map<Method, Class<? extends Annotation>> controllerMethods) {
List<Route> routes = new ArrayList<>();
Class<? extends Controller> controllerClass = (Class<? extends Controller>) controllerMethods.keySet().iterator().next().getDeclaringClass();
Set<String> controllerPaths = getControllerPaths(controllerClass);
Collection<Method> methods = sortControllerMethods(controllerMethods.keySet());
for (Method method : methods) {
Class<? extends Annotation> httpMethodAnnotationClass = controllerMethods.get(method);
Annotation httpMethodAnnotation = method.getAnnotation(httpMethodAnnotationClass);
String httpMethod = httpMethodAnnotation.annotationType().getAnnotation(HttpMethod.class).value();
String[] methodPaths = ClassUtils.executeDeclaredMethod(httpMethodAnnotation, "value");
if (controllerPaths.isEmpty()) {
// add an empty string to allow controllerPaths iteration
controllerPaths.add("");
}
for (String controllerPath : controllerPaths) {
if (methodPaths.length == 0) {
// controllerMethod does not specify a path, inherit from controller
String fullPath = StringUtils.addStart(controllerPath, "/");
// create the route handler
RouteHandler handler = new ControllerHandler(application, method);
// create the route
Route route = new Route(httpMethod, fullPath, handler)
.bind("__controllerClass", controllerClass)
.bind("__controllerMethod", method);
// add the route to the list of routes
routes.add(route);
} else {
// controllerMethod specifies one or more paths, concatenate with controller paths
for (String methodPath : methodPaths) {
String path = Stream.of(StringUtils.removeEnd(controllerPath, "/"), StringUtils.removeStart(methodPath, "/"))
.filter(Objects::nonNull)
.collect(Collectors.joining("/"));
String fullPath = StringUtils.addStart(path, "/");
// create the route handler
RouteHandler handler = new ControllerHandler(application, method);
// create the route
Route route = new Route(httpMethod, fullPath, handler)
.bind("__controllerClass", controllerClass)
.bind("__controllerMethod", method);
// add the route to the list of routes
routes.add(route);
}
}
}
}
return routes;
} | java | @SuppressWarnings("unchecked")
private List<Route> createControllerRoutes(Map<Method, Class<? extends Annotation>> controllerMethods) {
List<Route> routes = new ArrayList<>();
Class<? extends Controller> controllerClass = (Class<? extends Controller>) controllerMethods.keySet().iterator().next().getDeclaringClass();
Set<String> controllerPaths = getControllerPaths(controllerClass);
Collection<Method> methods = sortControllerMethods(controllerMethods.keySet());
for (Method method : methods) {
Class<? extends Annotation> httpMethodAnnotationClass = controllerMethods.get(method);
Annotation httpMethodAnnotation = method.getAnnotation(httpMethodAnnotationClass);
String httpMethod = httpMethodAnnotation.annotationType().getAnnotation(HttpMethod.class).value();
String[] methodPaths = ClassUtils.executeDeclaredMethod(httpMethodAnnotation, "value");
if (controllerPaths.isEmpty()) {
// add an empty string to allow controllerPaths iteration
controllerPaths.add("");
}
for (String controllerPath : controllerPaths) {
if (methodPaths.length == 0) {
// controllerMethod does not specify a path, inherit from controller
String fullPath = StringUtils.addStart(controllerPath, "/");
// create the route handler
RouteHandler handler = new ControllerHandler(application, method);
// create the route
Route route = new Route(httpMethod, fullPath, handler)
.bind("__controllerClass", controllerClass)
.bind("__controllerMethod", method);
// add the route to the list of routes
routes.add(route);
} else {
// controllerMethod specifies one or more paths, concatenate with controller paths
for (String methodPath : methodPaths) {
String path = Stream.of(StringUtils.removeEnd(controllerPath, "/"), StringUtils.removeStart(methodPath, "/"))
.filter(Objects::nonNull)
.collect(Collectors.joining("/"));
String fullPath = StringUtils.addStart(path, "/");
// create the route handler
RouteHandler handler = new ControllerHandler(application, method);
// create the route
Route route = new Route(httpMethod, fullPath, handler)
.bind("__controllerClass", controllerClass)
.bind("__controllerMethod", method);
// add the route to the list of routes
routes.add(route);
}
}
}
}
return routes;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"List",
"<",
"Route",
">",
"createControllerRoutes",
"(",
"Map",
"<",
"Method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
">",
"controllerMethods",
")",
"{",
"List",
"<",
"Route",
">"... | Create controller routes from controller methods.
@param controllerMethods
@return | [
"Create",
"controller",
"routes",
"from",
"controller",
"methods",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java#L180-L238 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static <T extends Collection<String>> T readLines(URL url, Charset charset, T collection) throws IORuntimeException {
InputStream in = null;
try {
in = url.openStream();
return IoUtil.readLines(in, charset, collection);
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(in);
}
} | java | public static <T extends Collection<String>> T readLines(URL url, Charset charset, T collection) throws IORuntimeException {
InputStream in = null;
try {
in = url.openStream();
return IoUtil.readLines(in, charset, collection);
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(in);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"String",
">",
">",
"T",
"readLines",
"(",
"URL",
"url",
",",
"Charset",
"charset",
",",
"T",
"collection",
")",
"throws",
"IORuntimeException",
"{",
"InputStream",
"in",
"=",
"null",
";",
"try",
... | 从文件中读取每一行数据
@param <T> 集合类型
@param url 文件的URL
@param charset 字符集
@param collection 集合
@return 文件中的每行内容的集合
@throws IORuntimeException IO异常
@since 3.1.1 | [
"从文件中读取每一行数据"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2276-L2286 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.generateMFAToken | public MFAToken generateMFAToken(long userId,Integer expiresIn, Boolean reusable) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
URIBuilder url = new URIBuilder(settings.getURL(Constants.GENERATE_MFA_TOKEN_URL, Long.toString(userId)));
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, Object> mfaParams = new HashMap<String, Object>();
mfaParams.put("expires_in", expiresIn);
mfaParams.put("reusable", reusable);
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
String body = JSONUtils.buildJSON(mfaParams);
bearerRequest.setBody(body);
MFAToken mfaToken = null;
OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuth2JSONResourceResponse.class);
if (oAuth2Response.getResponseCode() == 201) {
JSONObject data = oAuth2Response.getJSONObjectFromContent();
mfaToken = new MFAToken(data);
} else {
error = oAuth2Response.getError();
errorDescription = oAuth2Response.getErrorDescription();
}
return mfaToken;
} | java | public MFAToken generateMFAToken(long userId,Integer expiresIn, Boolean reusable) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
URIBuilder url = new URIBuilder(settings.getURL(Constants.GENERATE_MFA_TOKEN_URL, Long.toString(userId)));
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, Object> mfaParams = new HashMap<String, Object>();
mfaParams.put("expires_in", expiresIn);
mfaParams.put("reusable", reusable);
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
String body = JSONUtils.buildJSON(mfaParams);
bearerRequest.setBody(body);
MFAToken mfaToken = null;
OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuth2JSONResourceResponse.class);
if (oAuth2Response.getResponseCode() == 201) {
JSONObject data = oAuth2Response.getJSONObjectFromContent();
mfaToken = new MFAToken(data);
} else {
error = oAuth2Response.getError();
errorDescription = oAuth2Response.getErrorDescription();
}
return mfaToken;
} | [
"public",
"MFAToken",
"generateMFAToken",
"(",
"long",
"userId",
",",
"Integer",
"expiresIn",
",",
"Boolean",
"reusable",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"cleanError",
"(",
")",
";",
"prepareToken",
... | Generates an access token for a user
@param userId
Id of the user
@param expiresIn
Set the duration of the token in seconds. (default: 259200 seconds = 72h)
72 hours is the max value.
@param reusable
Defines if the token reusable. (default: false) If set to true, token can be used for multiple apps, until it expires.
@return Created MFAToken
@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 <a target="_blank" href="https://developers.onelogin.com/api-docs/1/multi-factor-authentication/generate-mfa-token">Generate MFA Token documentation</a> | [
"Generates",
"an",
"access",
"token",
"for",
"a",
"user"
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L726-L758 |
windup/windup | exec/api/src/main/java/org/jboss/windup/exec/configuration/WindupConfiguration.java | WindupConfiguration.getWindupConfigurationOptions | public static Iterable<ConfigurationOption> getWindupConfigurationOptions(Furnace furnace)
{
List<ConfigurationOption> results = new ArrayList<>();
for (ConfigurationOption option : furnace.getAddonRegistry().getServices(ConfigurationOption.class))
{
results.add(option);
}
Collections.sort(results, new Comparator<ConfigurationOption>()
{
@Override
public int compare(ConfigurationOption o1, ConfigurationOption o2)
{
// if the 1st is required and...
if (o1.isRequired())
{
// the 2nd isn't, the 1st is "before" than the 2nd
if (!o2.isRequired()) return -1;
// otherwise if also the 2nd is required, then order is priority-based
else return o2.getPriority() - o1.getPriority();
}
// if the 1st is not required and...
else
{
// the 2nd is, the 1st is "after" than the 2nd
if (o2.isRequired()) return 1;
// otherwise also the 2nd isn't and order is priority-based
else return o2.getPriority() - o1.getPriority();
}
}
});
return results;
} | java | public static Iterable<ConfigurationOption> getWindupConfigurationOptions(Furnace furnace)
{
List<ConfigurationOption> results = new ArrayList<>();
for (ConfigurationOption option : furnace.getAddonRegistry().getServices(ConfigurationOption.class))
{
results.add(option);
}
Collections.sort(results, new Comparator<ConfigurationOption>()
{
@Override
public int compare(ConfigurationOption o1, ConfigurationOption o2)
{
// if the 1st is required and...
if (o1.isRequired())
{
// the 2nd isn't, the 1st is "before" than the 2nd
if (!o2.isRequired()) return -1;
// otherwise if also the 2nd is required, then order is priority-based
else return o2.getPriority() - o1.getPriority();
}
// if the 1st is not required and...
else
{
// the 2nd is, the 1st is "after" than the 2nd
if (o2.isRequired()) return 1;
// otherwise also the 2nd isn't and order is priority-based
else return o2.getPriority() - o1.getPriority();
}
}
});
return results;
} | [
"public",
"static",
"Iterable",
"<",
"ConfigurationOption",
">",
"getWindupConfigurationOptions",
"(",
"Furnace",
"furnace",
")",
"{",
"List",
"<",
"ConfigurationOption",
">",
"results",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"ConfigurationOptio... | Returns all of the {@link ConfigurationOption} in all currently available {@link Addon}s. | [
"Returns",
"all",
"of",
"the",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/exec/api/src/main/java/org/jboss/windup/exec/configuration/WindupConfiguration.java#L162-L193 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/ProtectionIntentsInner.java | ProtectionIntentsInner.createOrUpdate | public ProtectionIntentResourceInner createOrUpdate(String vaultName, String resourceGroupName, String fabricName, String intentObjectName, ProtectionIntentResourceInner parameters) {
return createOrUpdateWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, intentObjectName, parameters).toBlocking().single().body();
} | java | public ProtectionIntentResourceInner createOrUpdate(String vaultName, String resourceGroupName, String fabricName, String intentObjectName, ProtectionIntentResourceInner parameters) {
return createOrUpdateWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, intentObjectName, parameters).toBlocking().single().body();
} | [
"public",
"ProtectionIntentResourceInner",
"createOrUpdate",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
",",
"String",
"fabricName",
",",
"String",
"intentObjectName",
",",
"ProtectionIntentResourceInner",
"parameters",
")",
"{",
"return",
"createOrUpda... | Create Intent for Enabling backup of an item. This is a synchronous operation.
@param vaultName The name of the recovery services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param fabricName Fabric name associated with the backup item.
@param intentObjectName Intent object name.
@param parameters resource backed up item
@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 ProtectionIntentResourceInner object if successful. | [
"Create",
"Intent",
"for",
"Enabling",
"backup",
"of",
"an",
"item",
".",
"This",
"is",
"a",
"synchronous",
"operation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/ProtectionIntentsInner.java#L178-L180 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalInfo.java | DateIntervalInfo.parseSkeleton | static void parseSkeleton(String skeleton, int[] skeletonFieldWidth) {
int PATTERN_CHAR_BASE = 0x41;
for ( int i = 0; i < skeleton.length(); ++i ) {
++skeletonFieldWidth[skeleton.charAt(i) - PATTERN_CHAR_BASE];
}
} | java | static void parseSkeleton(String skeleton, int[] skeletonFieldWidth) {
int PATTERN_CHAR_BASE = 0x41;
for ( int i = 0; i < skeleton.length(); ++i ) {
++skeletonFieldWidth[skeleton.charAt(i) - PATTERN_CHAR_BASE];
}
} | [
"static",
"void",
"parseSkeleton",
"(",
"String",
"skeleton",
",",
"int",
"[",
"]",
"skeletonFieldWidth",
")",
"{",
"int",
"PATTERN_CHAR_BASE",
"=",
"0x41",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"skeleton",
".",
"length",
"(",
")",
";",... | Parse skeleton, save each field's width.
It is used for looking for best match skeleton,
and adjust pattern field width.
@param skeleton skeleton to be parsed
@param skeletonFieldWidth parsed skeleton field width | [
"Parse",
"skeleton",
"save",
"each",
"field",
"s",
"width",
".",
"It",
"is",
"used",
"for",
"looking",
"for",
"best",
"match",
"skeleton",
"and",
"adjust",
"pattern",
"field",
"width",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalInfo.java#L1008-L1013 |
drewnoakes/metadata-extractor | Source/com/drew/metadata/exif/ExifReader.java | ExifReader.extract | public void extract(@NotNull final RandomAccessReader reader, @NotNull final Metadata metadata)
{
extract(reader, metadata, 0);
} | java | public void extract(@NotNull final RandomAccessReader reader, @NotNull final Metadata metadata)
{
extract(reader, metadata, 0);
} | [
"public",
"void",
"extract",
"(",
"@",
"NotNull",
"final",
"RandomAccessReader",
"reader",
",",
"@",
"NotNull",
"final",
"Metadata",
"metadata",
")",
"{",
"extract",
"(",
"reader",
",",
"metadata",
",",
"0",
")",
";",
"}"
] | Reads TIFF formatted Exif data from start of the specified {@link RandomAccessReader}. | [
"Reads",
"TIFF",
"formatted",
"Exif",
"data",
"from",
"start",
"of",
"the",
"specified",
"{"
] | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/exif/ExifReader.java#L69-L72 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optParcelableArrayList | @Nullable
// Since Bundle#getParcelableArrayList returns concrete ArrayList type, so this method follows that implementation.
public static <T extends Parcelable> ArrayList<T> optParcelableArrayList(@Nullable Bundle bundle, @Nullable String key) {
return optParcelableArrayList(bundle, key, new ArrayList<T>());
} | java | @Nullable
// Since Bundle#getParcelableArrayList returns concrete ArrayList type, so this method follows that implementation.
public static <T extends Parcelable> ArrayList<T> optParcelableArrayList(@Nullable Bundle bundle, @Nullable String key) {
return optParcelableArrayList(bundle, key, new ArrayList<T>());
} | [
"@",
"Nullable",
"// Since Bundle#getParcelableArrayList returns concrete ArrayList type, so this method follows that implementation.",
"public",
"static",
"<",
"T",
"extends",
"Parcelable",
">",
"ArrayList",
"<",
"T",
">",
"optParcelableArrayList",
"(",
"@",
"Nullable",
"Bundle"... | Returns a optional {@link android.os.Parcelable} {@link java.util.ArrayList}. In other words, returns the value mapped by key if it exists and is a {@link android.os.Parcelable} {@link java.util.ArrayList}.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return null.
@param key a key for the value.
@return a {@link android.os.Parcelable} {@link java.util.ArrayList} value if exists, null otherwise.
@see android.os.Bundle#getParcelableArrayList(String) | [
"Returns",
"a",
"optional",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L749-L753 |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/LockCommand.java | LockCommand.isReadOnly | private boolean isReadOnly(Session session, String path)
{
try
{
session.checkPermission(path, PermissionType.SET_PROPERTY);
return false;
}
catch (AccessControlException e)
{
return true;
}
catch (RepositoryException e)
{
return false;
}
} | java | private boolean isReadOnly(Session session, String path)
{
try
{
session.checkPermission(path, PermissionType.SET_PROPERTY);
return false;
}
catch (AccessControlException e)
{
return true;
}
catch (RepositoryException e)
{
return false;
}
} | [
"private",
"boolean",
"isReadOnly",
"(",
"Session",
"session",
",",
"String",
"path",
")",
"{",
"try",
"{",
"session",
".",
"checkPermission",
"(",
"path",
",",
"PermissionType",
".",
"SET_PROPERTY",
")",
";",
"return",
"false",
";",
"}",
"catch",
"(",
"Ac... | Check node permission
@param session current jcr user session
@param path node path
@return true if node is read only otherwise false | [
"Check",
"node",
"permission"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/LockCommand.java#L269-L284 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiCollaboration.java | BoxApiCollaboration.getAddRequest | @Deprecated
public BoxRequestsShare.AddCollaboration getAddRequest(String folderId, BoxCollaboration.Role role, BoxCollaborator collaborator) {
return getAddToFolderRequest(folderId, role, collaborator);
} | java | @Deprecated
public BoxRequestsShare.AddCollaboration getAddRequest(String folderId, BoxCollaboration.Role role, BoxCollaborator collaborator) {
return getAddToFolderRequest(folderId, role, collaborator);
} | [
"@",
"Deprecated",
"public",
"BoxRequestsShare",
".",
"AddCollaboration",
"getAddRequest",
"(",
"String",
"folderId",
",",
"BoxCollaboration",
".",
"Role",
"role",
",",
"BoxCollaborator",
"collaborator",
")",
"{",
"return",
"getAddToFolderRequest",
"(",
"folderId",
",... | A request that adds a {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} as a collaborator to a folder.
Deprecated use getAddToFolderRequest(BoxCollaborationItem collaborationItem, BoxCollaboration.Role role, String login)
@param folderId id of the folder to be collaborated.
@param role role of the collaboration
@param collaborator the {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} to add as a collaborator
@return request to add/create a collaboration | [
"A",
"request",
"that",
"adds",
"a",
"{"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiCollaboration.java#L62-L65 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java | CloudMe.buildSoapRequest | private HttpPost buildSoapRequest( String action, String innerXml )
{
HttpPost httpPost = new HttpPost( BASE_URL );
httpPost.setHeader( "soapaction", action );
httpPost.setHeader( "Content-Type", "text/xml; charset=utf-8" );
final StringBuilder soap = new StringBuilder();
soap.append( SOAP_HEADER );
soap.append( "<" ).append( action ).append( ">" );
soap.append( innerXml );
soap.append( "</" ).append( action ).append( ">" );
soap.append( SOAP_FOOTER );
HttpEntity entity;
try {
entity = new StringEntity( soap.toString(), PcsUtils.UTF8.name() );
} catch ( UnsupportedEncodingException e ) {
throw new CStorageException( e.getMessage(), e );
}
httpPost.setEntity( entity );
return httpPost;
} | java | private HttpPost buildSoapRequest( String action, String innerXml )
{
HttpPost httpPost = new HttpPost( BASE_URL );
httpPost.setHeader( "soapaction", action );
httpPost.setHeader( "Content-Type", "text/xml; charset=utf-8" );
final StringBuilder soap = new StringBuilder();
soap.append( SOAP_HEADER );
soap.append( "<" ).append( action ).append( ">" );
soap.append( innerXml );
soap.append( "</" ).append( action ).append( ">" );
soap.append( SOAP_FOOTER );
HttpEntity entity;
try {
entity = new StringEntity( soap.toString(), PcsUtils.UTF8.name() );
} catch ( UnsupportedEncodingException e ) {
throw new CStorageException( e.getMessage(), e );
}
httpPost.setEntity( entity );
return httpPost;
} | [
"private",
"HttpPost",
"buildSoapRequest",
"(",
"String",
"action",
",",
"String",
"innerXml",
")",
"{",
"HttpPost",
"httpPost",
"=",
"new",
"HttpPost",
"(",
"BASE_URL",
")",
";",
"httpPost",
".",
"setHeader",
"(",
"\"soapaction\"",
",",
"action",
")",
";",
... | Builds a SOAP request (NB: part of the CloudMe API is REST-based).
@param action
@param innerXml
@return HttpPost | [
"Builds",
"a",
"SOAP",
"request",
"(",
"NB",
":",
"part",
"of",
"the",
"CloudMe",
"API",
"is",
"REST",
"-",
"based",
")",
"."
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java#L694-L718 |
cantrowitz/RxBroadcast | rxbroadcast/src/main/java/com/cantrowitz/rxbroadcast/RxBroadcast.java | RxBroadcast.fromLocalBroadcast | public static Observable<Intent> fromLocalBroadcast(
Context context,
IntentFilter intentFilter) {
LocalBroadcastRegistrar localBroadcastRegistrar = new LocalBroadcastRegistrar(
intentFilter,
LocalBroadcastManager.getInstance(context));
return createBroadcastObservable(localBroadcastRegistrar, NO_OP_ORDERED_BROADCAST_STRATEGY);
} | java | public static Observable<Intent> fromLocalBroadcast(
Context context,
IntentFilter intentFilter) {
LocalBroadcastRegistrar localBroadcastRegistrar = new LocalBroadcastRegistrar(
intentFilter,
LocalBroadcastManager.getInstance(context));
return createBroadcastObservable(localBroadcastRegistrar, NO_OP_ORDERED_BROADCAST_STRATEGY);
} | [
"public",
"static",
"Observable",
"<",
"Intent",
">",
"fromLocalBroadcast",
"(",
"Context",
"context",
",",
"IntentFilter",
"intentFilter",
")",
"{",
"LocalBroadcastRegistrar",
"localBroadcastRegistrar",
"=",
"new",
"LocalBroadcastRegistrar",
"(",
"intentFilter",
",",
"... | Create {@link Observable} that wraps {@link BroadcastReceiver} and emits received intents.
<p>
This uses a {@link LocalBroadcastManager}
@param context the context the {@link BroadcastReceiver} will be created from
@param intentFilter the filter for the particular intent
@return {@link Observable} of {@link Intent} that matches the filter | [
"Create",
"{",
"@link",
"Observable",
"}",
"that",
"wraps",
"{",
"@link",
"BroadcastReceiver",
"}",
"and",
"emits",
"received",
"intents",
".",
"<p",
">",
"This",
"uses",
"a",
"{",
"@link",
"LocalBroadcastManager",
"}"
] | train | https://github.com/cantrowitz/RxBroadcast/blob/8b479d0e28617e9b86fa4d462c6675c131b0c5d0/rxbroadcast/src/main/java/com/cantrowitz/rxbroadcast/RxBroadcast.java#L134-L141 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/XMLConverter.java | XMLConverter._serializeList | private String _serializeList(List list, Map<Object, String> done, String id) throws ConverterException {
// <ARRAY ID="1" SIZE="1"><ITEM INDEX="1" TYPE="STRING">hello world</ITEM></ARRAY>
StringBuilder sb = new StringBuilder(goIn() + "<ARRAY ID=\"" + id + "\" SIZE=" + del + list.size() + del + ">");
int index;
ListIterator it = list.listIterator();
while (it.hasNext()) {
// <ITEM INDEX="1" TYPE="STRING">hello world</ITEM>
index = it.nextIndex();
String value = _serialize(it.next(), done);
sb.append(goIn() + "<ITEM INDEX=\"" + (index + 1) + "\" TYPE=\"" + type + "\">");
sb.append(value);
sb.append(goIn() + "</ITEM>");
}
sb.append(goIn() + "</ARRAY>");
type = "ARRAY";
return sb.toString();
} | java | private String _serializeList(List list, Map<Object, String> done, String id) throws ConverterException {
// <ARRAY ID="1" SIZE="1"><ITEM INDEX="1" TYPE="STRING">hello world</ITEM></ARRAY>
StringBuilder sb = new StringBuilder(goIn() + "<ARRAY ID=\"" + id + "\" SIZE=" + del + list.size() + del + ">");
int index;
ListIterator it = list.listIterator();
while (it.hasNext()) {
// <ITEM INDEX="1" TYPE="STRING">hello world</ITEM>
index = it.nextIndex();
String value = _serialize(it.next(), done);
sb.append(goIn() + "<ITEM INDEX=\"" + (index + 1) + "\" TYPE=\"" + type + "\">");
sb.append(value);
sb.append(goIn() + "</ITEM>");
}
sb.append(goIn() + "</ARRAY>");
type = "ARRAY";
return sb.toString();
} | [
"private",
"String",
"_serializeList",
"(",
"List",
"list",
",",
"Map",
"<",
"Object",
",",
"String",
">",
"done",
",",
"String",
"id",
")",
"throws",
"ConverterException",
"{",
"// <ARRAY ID=\"1\" SIZE=\"1\"><ITEM INDEX=\"1\" TYPE=\"STRING\">hello world</ITEM></ARRAY>",
... | serialize a List (as Array)
@param list List to serialize
@param done
@return serialized list
@throws ConverterException | [
"serialize",
"a",
"List",
"(",
"as",
"Array",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/XMLConverter.java#L148-L165 |
codescape/bitvunit | bitvunit-core/src/main/java/de/codescape/bitvunit/report/XmlReportWriter.java | XmlReportWriter.printRules | private void printRules(RuleSet ruleSet, PrintWriter out) {
out.println("<Rules>");
for (Rule rule : ruleSet.getRules()) {
out.println("<Rule name='" + rule.getName() + "' priority='" + rule.getPriority() + "'/>");
}
out.println("</Rules>");
} | java | private void printRules(RuleSet ruleSet, PrintWriter out) {
out.println("<Rules>");
for (Rule rule : ruleSet.getRules()) {
out.println("<Rule name='" + rule.getName() + "' priority='" + rule.getPriority() + "'/>");
}
out.println("</Rules>");
} | [
"private",
"void",
"printRules",
"(",
"RuleSet",
"ruleSet",
",",
"PrintWriter",
"out",
")",
"{",
"out",
".",
"println",
"(",
"\"<Rules>\"",
")",
";",
"for",
"(",
"Rule",
"rule",
":",
"ruleSet",
".",
"getRules",
"(",
")",
")",
"{",
"out",
".",
"println"... | Writes the part where all used rules from the {@link RuleSet} are listed.
@param ruleSet {@link RuleSet} that was used
@param out target where the report is written to | [
"Writes",
"the",
"part",
"where",
"all",
"used",
"rules",
"from",
"the",
"{",
"@link",
"RuleSet",
"}",
"are",
"listed",
"."
] | train | https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/report/XmlReportWriter.java#L78-L84 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.equalTo | public final boolean equalTo(MemorySegment seg2, int offset1, int offset2, int length) {
int i = 0;
// we assume unaligned accesses are supported.
// Compare 8 bytes at a time.
while (i <= length - 8) {
if (getLong(offset1 + i) != seg2.getLong(offset2 + i)) {
return false;
}
i += 8;
}
// cover the last (length % 8) elements.
while (i < length) {
if (get(offset1 + i) != seg2.get(offset2 + i)) {
return false;
}
i += 1;
}
return true;
} | java | public final boolean equalTo(MemorySegment seg2, int offset1, int offset2, int length) {
int i = 0;
// we assume unaligned accesses are supported.
// Compare 8 bytes at a time.
while (i <= length - 8) {
if (getLong(offset1 + i) != seg2.getLong(offset2 + i)) {
return false;
}
i += 8;
}
// cover the last (length % 8) elements.
while (i < length) {
if (get(offset1 + i) != seg2.get(offset2 + i)) {
return false;
}
i += 1;
}
return true;
} | [
"public",
"final",
"boolean",
"equalTo",
"(",
"MemorySegment",
"seg2",
",",
"int",
"offset1",
",",
"int",
"offset2",
",",
"int",
"length",
")",
"{",
"int",
"i",
"=",
"0",
";",
"// we assume unaligned accesses are supported.",
"// Compare 8 bytes at a time.",
"while"... | Equals two memory segment regions.
@param seg2 Segment to equal this segment with
@param offset1 Offset of this segment to start equaling
@param offset2 Offset of seg2 to start equaling
@param length Length of the equaled memory region
@return true if equal, false otherwise | [
"Equals",
"two",
"memory",
"segment",
"regions",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L1407-L1428 |
haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/RotateFilter.java | RotateFilter.doFilter | protected RenderedImage doFilter(BufferedImage pImage, ServletRequest pRequest, ImageServletResponse pResponse) {
// Get angle
double ang = getAngle(pRequest);
// Get bounds
Rectangle2D rect = getBounds(pRequest, pImage, ang);
int width = (int) rect.getWidth();
int height = (int) rect.getHeight();
// Create result image
BufferedImage res = ImageUtil.createTransparent(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = res.createGraphics();
// Get background color and clear
String str = pRequest.getParameter(PARAM_BGCOLOR);
if (!StringUtil.isEmpty(str)) {
Color bgcolor = StringUtil.toColor(str);
g.setBackground(bgcolor);
g.clearRect(0, 0, width, height);
}
// Set mHints (why do I always get jagged edgdes?)
RenderingHints hints = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
hints.add(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
hints.add(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
hints.add(new RenderingHints(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC));
g.setRenderingHints(hints);
// Rotate around center
AffineTransform at = AffineTransform
.getRotateInstance(ang, width / 2.0, height / 2.0);
// Move to center
at.translate(width / 2.0 - pImage.getWidth() / 2.0,
height / 2.0 - pImage.getHeight() / 2.0);
// Draw it, centered
g.drawImage(pImage, at, null);
return res;
} | java | protected RenderedImage doFilter(BufferedImage pImage, ServletRequest pRequest, ImageServletResponse pResponse) {
// Get angle
double ang = getAngle(pRequest);
// Get bounds
Rectangle2D rect = getBounds(pRequest, pImage, ang);
int width = (int) rect.getWidth();
int height = (int) rect.getHeight();
// Create result image
BufferedImage res = ImageUtil.createTransparent(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = res.createGraphics();
// Get background color and clear
String str = pRequest.getParameter(PARAM_BGCOLOR);
if (!StringUtil.isEmpty(str)) {
Color bgcolor = StringUtil.toColor(str);
g.setBackground(bgcolor);
g.clearRect(0, 0, width, height);
}
// Set mHints (why do I always get jagged edgdes?)
RenderingHints hints = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
hints.add(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
hints.add(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
hints.add(new RenderingHints(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC));
g.setRenderingHints(hints);
// Rotate around center
AffineTransform at = AffineTransform
.getRotateInstance(ang, width / 2.0, height / 2.0);
// Move to center
at.translate(width / 2.0 - pImage.getWidth() / 2.0,
height / 2.0 - pImage.getHeight() / 2.0);
// Draw it, centered
g.drawImage(pImage, at, null);
return res;
} | [
"protected",
"RenderedImage",
"doFilter",
"(",
"BufferedImage",
"pImage",
",",
"ServletRequest",
"pRequest",
",",
"ImageServletResponse",
"pResponse",
")",
"{",
"// Get angle\r",
"double",
"ang",
"=",
"getAngle",
"(",
"pRequest",
")",
";",
"// Get bounds\r",
"Rectangl... | Reads the image from the requested URL, rotates it, and returns
it in the
Servlet stream. See above for details on parameters. | [
"Reads",
"the",
"image",
"from",
"the",
"requested",
"URL",
"rotates",
"it",
"and",
"returns",
"it",
"in",
"the",
"Servlet",
"stream",
".",
"See",
"above",
"for",
"details",
"on",
"parameters",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/RotateFilter.java#L106-L147 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java | MediaNegotiator.receiveSessionInitiateAction | private IQ receiveSessionInitiateAction(Jingle jingle, JingleDescription description) {
IQ response = null;
List<PayloadType> offeredPayloads = description.getAudioPayloadTypesList();
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
synchronized (remoteAudioPts) {
remoteAudioPts.addAll(offeredPayloads);
}
// If there are suitable/matching payload types then accept this content.
if (bestCommonAudioPt != null) {
// Let the transport negotiators sort-out connectivity and content-accept instead.
// response = createAudioPayloadTypesOffer();
setNegotiatorState(JingleNegotiatorState.PENDING);
} else {
// Don't really know what to send here. XEP-166 is not clear.
setNegotiatorState(JingleNegotiatorState.FAILED);
}
return response;
} | java | private IQ receiveSessionInitiateAction(Jingle jingle, JingleDescription description) {
IQ response = null;
List<PayloadType> offeredPayloads = description.getAudioPayloadTypesList();
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
synchronized (remoteAudioPts) {
remoteAudioPts.addAll(offeredPayloads);
}
// If there are suitable/matching payload types then accept this content.
if (bestCommonAudioPt != null) {
// Let the transport negotiators sort-out connectivity and content-accept instead.
// response = createAudioPayloadTypesOffer();
setNegotiatorState(JingleNegotiatorState.PENDING);
} else {
// Don't really know what to send here. XEP-166 is not clear.
setNegotiatorState(JingleNegotiatorState.FAILED);
}
return response;
} | [
"private",
"IQ",
"receiveSessionInitiateAction",
"(",
"Jingle",
"jingle",
",",
"JingleDescription",
"description",
")",
"{",
"IQ",
"response",
"=",
"null",
";",
"List",
"<",
"PayloadType",
">",
"offeredPayloads",
"=",
"description",
".",
"getAudioPayloadTypesList",
... | Receive a session-initiate packet.
@param jingle
@param description
@return the iq | [
"Receive",
"a",
"session",
"-",
"initiate",
"packet",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java#L239-L260 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java | BundlePackager.addExtraHeaderToBundleManifest | public static void addExtraHeaderToBundleManifest(File baseDir, String header, String value) throws IOException {
Properties props = new Properties();
File extra = new File(baseDir, EXTRA_HEADERS_FILE);
extra.getParentFile().mkdirs();
// If the file exist it loads it, if not nothing happens.
props = Instructions.merge(props, extra);
if (value != null) {
props.setProperty(header, value);
} else {
props.remove(header);
}
FileOutputStream fos = null;
try {
fos = new FileOutputStream(extra);
props.store(fos, "");
} finally {
IOUtils.closeQuietly(fos);
}
} | java | public static void addExtraHeaderToBundleManifest(File baseDir, String header, String value) throws IOException {
Properties props = new Properties();
File extra = new File(baseDir, EXTRA_HEADERS_FILE);
extra.getParentFile().mkdirs();
// If the file exist it loads it, if not nothing happens.
props = Instructions.merge(props, extra);
if (value != null) {
props.setProperty(header, value);
} else {
props.remove(header);
}
FileOutputStream fos = null;
try {
fos = new FileOutputStream(extra);
props.store(fos, "");
} finally {
IOUtils.closeQuietly(fos);
}
} | [
"public",
"static",
"void",
"addExtraHeaderToBundleManifest",
"(",
"File",
"baseDir",
",",
"String",
"header",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"File",
"extra",
"=",
"new... | This method is used by plugin willing to add custom header to the bundle manifest.
@param baseDir the project directory
@param header the header to add
@param value the value to write
@throws IOException if the header cannot be added | [
"This",
"method",
"is",
"used",
"by",
"plugin",
"willing",
"to",
"add",
"custom",
"header",
"to",
"the",
"bundle",
"manifest",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java#L161-L179 |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.asMinusFunction | public static VectorFunction asMinusFunction(final double arg) {
return new VectorFunction() {
@Override
public double evaluate(int i, double value) {
return value - arg;
}
};
} | java | public static VectorFunction asMinusFunction(final double arg) {
return new VectorFunction() {
@Override
public double evaluate(int i, double value) {
return value - arg;
}
};
} | [
"public",
"static",
"VectorFunction",
"asMinusFunction",
"(",
"final",
"double",
"arg",
")",
"{",
"return",
"new",
"VectorFunction",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"evaluate",
"(",
"int",
"i",
",",
"double",
"value",
")",
"{",
"return",
... | Creates a minus function that subtracts given {@code value} from it's argument.
@param arg a value to be subtracted from function's argument
@return a closure that does {@code _ - _} | [
"Creates",
"a",
"minus",
"function",
"that",
"subtracts",
"given",
"{",
"@code",
"value",
"}",
"from",
"it",
"s",
"argument",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L170-L177 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java | VideoHook.resizeIfNeeded | private void resizeIfNeeded()
{
// resize the window if we need to
int oldRenderWidth = Display.getWidth();
int oldRenderHeight = Display.getHeight();
if( this.renderWidth == oldRenderWidth && this.renderHeight == oldRenderHeight )
return;
try {
int old_x = Display.getX();
int old_y = Display.getY();
Display.setLocation(old_x, old_y);
Display.setDisplayMode(new DisplayMode(this.renderWidth, this.renderHeight));
System.out.println("Resized the window");
} catch (LWJGLException e) {
System.out.println("Failed to resize the window!");
e.printStackTrace();
}
forceResize(this.renderWidth, this.renderHeight);
} | java | private void resizeIfNeeded()
{
// resize the window if we need to
int oldRenderWidth = Display.getWidth();
int oldRenderHeight = Display.getHeight();
if( this.renderWidth == oldRenderWidth && this.renderHeight == oldRenderHeight )
return;
try {
int old_x = Display.getX();
int old_y = Display.getY();
Display.setLocation(old_x, old_y);
Display.setDisplayMode(new DisplayMode(this.renderWidth, this.renderHeight));
System.out.println("Resized the window");
} catch (LWJGLException e) {
System.out.println("Failed to resize the window!");
e.printStackTrace();
}
forceResize(this.renderWidth, this.renderHeight);
} | [
"private",
"void",
"resizeIfNeeded",
"(",
")",
"{",
"// resize the window if we need to",
"int",
"oldRenderWidth",
"=",
"Display",
".",
"getWidth",
"(",
")",
";",
"int",
"oldRenderHeight",
"=",
"Display",
".",
"getHeight",
"(",
")",
";",
"if",
"(",
"this",
"."... | Resizes the window and the Minecraft rendering if necessary. Set renderWidth and renderHeight first. | [
"Resizes",
"the",
"window",
"and",
"the",
"Minecraft",
"rendering",
"if",
"necessary",
".",
"Set",
"renderWidth",
"and",
"renderHeight",
"first",
"."
] | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java#L173-L192 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.forEachToken | public static void forEachToken(String string, String separator, Procedure<String> procedure)
{
for (StringTokenizer stringTokenizer = new StringTokenizer(string, separator); stringTokenizer.hasMoreTokens(); )
{
String token = stringTokenizer.nextToken();
procedure.value(token);
}
} | java | public static void forEachToken(String string, String separator, Procedure<String> procedure)
{
for (StringTokenizer stringTokenizer = new StringTokenizer(string, separator); stringTokenizer.hasMoreTokens(); )
{
String token = stringTokenizer.nextToken();
procedure.value(token);
}
} | [
"public",
"static",
"void",
"forEachToken",
"(",
"String",
"string",
",",
"String",
"separator",
",",
"Procedure",
"<",
"String",
">",
"procedure",
")",
"{",
"for",
"(",
"StringTokenizer",
"stringTokenizer",
"=",
"new",
"StringTokenizer",
"(",
"string",
",",
"... | For each token in a string separated by the specified separator, execute the specified StringProcedure
by calling the valueOfString method. | [
"For",
"each",
"token",
"in",
"a",
"string",
"separated",
"by",
"the",
"specified",
"separator",
"execute",
"the",
"specified",
"StringProcedure",
"by",
"calling",
"the",
"valueOfString",
"method",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L285-L292 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java | StorageAccountsInner.delete | public void delete(String resourceGroupName, String accountName, String storageAccountName) {
deleteWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).toBlocking().single().body();
} | java | public void delete(String resourceGroupName, String accountName, String storageAccountName) {
deleteWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).toBlocking().single().body();
} | [
"public",
"void",
"delete",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"storageAccountName",
")",
"{",
"deleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"storageAccountName",
")",
".",
"toBlocking"... | Updates the specified Data Lake Analytics account to remove an Azure Storage account.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param storageAccountName The name of the Azure Storage account to remove
@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 | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"remove",
"an",
"Azure",
"Storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java#L775-L777 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/license_file.java | license_file.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
license_file_responses result = (license_file_responses) service.get_payload_formatter().string_to_resource(license_file_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.license_file_response_array);
}
license_file[] result_license_file = new license_file[result.license_file_response_array.length];
for(int i = 0; i < result.license_file_response_array.length; i++)
{
result_license_file[i] = result.license_file_response_array[i].license_file[0];
}
return result_license_file;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
license_file_responses result = (license_file_responses) service.get_payload_formatter().string_to_resource(license_file_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.license_file_response_array);
}
license_file[] result_license_file = new license_file[result.license_file_response_array.length];
for(int i = 0; i < result.license_file_response_array.length; i++)
{
result_license_file[i] = result.license_file_response_array[i].license_file[0];
}
return result_license_file;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"license_file_responses",
"result",
"=",
"(",
"license_file_responses",
")",
"service",
".",
"get_payload_form... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/license_file.java#L265-L282 |
javalite/activejdbc | javalite-common/src/main/java/org/javalite/common/Inflector.java | Inflector.gsub | public static String gsub(String word, String rule, String replacement) {
Pattern pattern = Pattern.compile(rule, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(word);
return matcher.find() ? matcher.replaceFirst(replacement) : null;
} | java | public static String gsub(String word, String rule, String replacement) {
Pattern pattern = Pattern.compile(rule, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(word);
return matcher.find() ? matcher.replaceFirst(replacement) : null;
} | [
"public",
"static",
"String",
"gsub",
"(",
"String",
"word",
",",
"String",
"rule",
",",
"String",
"replacement",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"rule",
",",
"Pattern",
".",
"CASE_INSENSITIVE",
")",
";",
"Matcher",
"ma... | Replaces a found pattern in a word and returns a transformed word.
@param word
@param rule
@param replacement
@return Replaces a found pattern in a word and returns a transformed word. Null is pattern does not match. | [
"Replaces",
"a",
"found",
"pattern",
"in",
"a",
"word",
"and",
"returns",
"a",
"transformed",
"word",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Inflector.java#L119-L123 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceFormatter.java | BaseTraceFormatter.formatVerboseMessage | public String formatVerboseMessage(LogRecord logRecord, String msg) {
return formatVerboseMessage(logRecord, msg, true);
} | java | public String formatVerboseMessage(LogRecord logRecord, String msg) {
return formatVerboseMessage(logRecord, msg, true);
} | [
"public",
"String",
"formatVerboseMessage",
"(",
"LogRecord",
"logRecord",
",",
"String",
"msg",
")",
"{",
"return",
"formatVerboseMessage",
"(",
"logRecord",
",",
"msg",
",",
"true",
")",
";",
"}"
] | Format a translatable verbose message. This produces the same result
as {@link #formatMessage} unless any parameters need to be modified
by {@link #formatVerboseObj}. The previously formatted message may be
reused if specified and no parameters need to be modified.
@param logRecord
@param msg the result of {@link #formatMessage}, or null if that method
was not previously called
@return | [
"Format",
"a",
"translatable",
"verbose",
"message",
".",
"This",
"produces",
"the",
"same",
"result",
"as",
"{",
"@link",
"#formatMessage",
"}",
"unless",
"any",
"parameters",
"need",
"to",
"be",
"modified",
"by",
"{",
"@link",
"#formatVerboseObj",
"}",
".",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceFormatter.java#L307-L309 |
actframework/actframework | src/main/java/act/ws/WebSocketConnectionManager.java | WebSocketConnectionManager.sendJsonToUrl | public void sendJsonToUrl(Object data, String url) {
sendToUrl(JSON.toJSONString(data), url);
} | java | public void sendJsonToUrl(Object data, String url) {
sendToUrl(JSON.toJSONString(data), url);
} | [
"public",
"void",
"sendJsonToUrl",
"(",
"Object",
"data",
",",
"String",
"url",
")",
"{",
"sendToUrl",
"(",
"JSON",
".",
"toJSONString",
"(",
"data",
")",
",",
"url",
")",
";",
"}"
] | Send JSON representation of given data object to all connections
connected to given URL
@param data the data object
@param url the url | [
"Send",
"JSON",
"representation",
"of",
"given",
"data",
"object",
"to",
"all",
"connections",
"connected",
"to",
"given",
"URL"
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketConnectionManager.java#L129-L131 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.executePostRequest | protected Optional<Response> executePostRequest(URI uri, Object obj)
{
return executePostRequest(uri, obj, (Map<String, Object>)null);
} | java | protected Optional<Response> executePostRequest(URI uri, Object obj)
{
return executePostRequest(uri, obj, (Map<String, Object>)null);
} | [
"protected",
"Optional",
"<",
"Response",
">",
"executePostRequest",
"(",
"URI",
"uri",
",",
"Object",
"obj",
")",
"{",
"return",
"executePostRequest",
"(",
"uri",
",",
"obj",
",",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"null",
")",
";",
"... | Execute a POST request.
@param uri The URI to call
@param obj The object to use for the POST
@return The response to the POST | [
"Execute",
"a",
"POST",
"request",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L417-L420 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/log/LogHelper.java | LogHelper.isEnabled | public static boolean isEnabled (@Nonnull final Logger aLogger, @Nonnull final IErrorLevel aErrorLevel)
{
return getFuncIsEnabled (aLogger, aErrorLevel).isEnabled ();
} | java | public static boolean isEnabled (@Nonnull final Logger aLogger, @Nonnull final IErrorLevel aErrorLevel)
{
return getFuncIsEnabled (aLogger, aErrorLevel).isEnabled ();
} | [
"public",
"static",
"boolean",
"isEnabled",
"(",
"@",
"Nonnull",
"final",
"Logger",
"aLogger",
",",
"@",
"Nonnull",
"final",
"IErrorLevel",
"aErrorLevel",
")",
"{",
"return",
"getFuncIsEnabled",
"(",
"aLogger",
",",
"aErrorLevel",
")",
".",
"isEnabled",
"(",
"... | Check if logging is enabled for the passed logger based on the error level
provided
@param aLogger
The logger. May not be <code>null</code>.
@param aErrorLevel
The error level. May not be <code>null</code>.
@return <code>true</code> if the respective log level is allowed,
<code>false</code> if not | [
"Check",
"if",
"logging",
"is",
"enabled",
"for",
"the",
"passed",
"logger",
"based",
"on",
"the",
"error",
"level",
"provided"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/log/LogHelper.java#L168-L171 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/resources/BundleHandler.java | BundleHandler.getString | public static String getString(int handle, String key) {
ResourceBundle bundle;
String s;
synchronized (mutex) {
if (handle < 0 || handle >= bundleList.size() || key == null) {
bundle = null;
} else {
bundle = (ResourceBundle) bundleList.get(handle);
}
}
if (bundle == null) {
s = null;
} else {
try {
s = bundle.getString(key);
} catch (Exception e) {
s = null;
}
}
return s;
} | java | public static String getString(int handle, String key) {
ResourceBundle bundle;
String s;
synchronized (mutex) {
if (handle < 0 || handle >= bundleList.size() || key == null) {
bundle = null;
} else {
bundle = (ResourceBundle) bundleList.get(handle);
}
}
if (bundle == null) {
s = null;
} else {
try {
s = bundle.getString(key);
} catch (Exception e) {
s = null;
}
}
return s;
} | [
"public",
"static",
"String",
"getString",
"(",
"int",
"handle",
",",
"String",
"key",
")",
"{",
"ResourceBundle",
"bundle",
";",
"String",
"s",
";",
"synchronized",
"(",
"mutex",
")",
"{",
"if",
"(",
"handle",
"<",
"0",
"||",
"handle",
">=",
"bundleList... | Retrieves, from the <code>ResourceBundle</code> object corresponding
to the specified handle, the <code>String</code> value corresponding
to the specified key. <code>null</code> is retrieved if either there
is no <code>ResourceBundle</code> object for the handle or there is no
<code>String</code> value for the specified key. <p>
@param handle an <code>int</code> handle to a
<code>ResourceBundle</code> object
@param key A <code>String</code> key to a <code>String</code> value
@return The String value correspoding to the specified handle and key. | [
"Retrieves",
"from",
"the",
"<code",
">",
"ResourceBundle<",
"/",
"code",
">",
"object",
"corresponding",
"to",
"the",
"specified",
"handle",
"the",
"<code",
">",
"String<",
"/",
"code",
">",
"value",
"corresponding",
"to",
"the",
"specified",
"key",
".",
"<... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/resources/BundleHandler.java#L170-L194 |
mozilla/rhino | src/org/mozilla/javascript/Context.java | Context.stringIsCompilableUnit | public final boolean stringIsCompilableUnit(String source) {
boolean errorseen = false;
CompilerEnvirons compilerEnv = new CompilerEnvirons();
compilerEnv.initFromContext(this);
// no source name or source text manager, because we're just
// going to throw away the result.
compilerEnv.setGeneratingSource(false);
Parser p = new Parser(compilerEnv, DefaultErrorReporter.instance);
try {
p.parse(source, null, 1);
} catch (EvaluatorException ee) {
errorseen = true;
}
// Return false only if an error occurred as a result of reading past
// the end of the file, i.e. if the source could be fixed by
// appending more source.
return !(errorseen && p.eof());
} | java | public final boolean stringIsCompilableUnit(String source) {
boolean errorseen = false;
CompilerEnvirons compilerEnv = new CompilerEnvirons();
compilerEnv.initFromContext(this);
// no source name or source text manager, because we're just
// going to throw away the result.
compilerEnv.setGeneratingSource(false);
Parser p = new Parser(compilerEnv, DefaultErrorReporter.instance);
try {
p.parse(source, null, 1);
} catch (EvaluatorException ee) {
errorseen = true;
}
// Return false only if an error occurred as a result of reading past
// the end of the file, i.e. if the source could be fixed by
// appending more source.
return !(errorseen && p.eof());
} | [
"public",
"final",
"boolean",
"stringIsCompilableUnit",
"(",
"String",
"source",
")",
"{",
"boolean",
"errorseen",
"=",
"false",
";",
"CompilerEnvirons",
"compilerEnv",
"=",
"new",
"CompilerEnvirons",
"(",
")",
";",
"compilerEnv",
".",
"initFromContext",
"(",
"thi... | Check whether a string is ready to be compiled.
<p>
stringIsCompilableUnit is intended to support interactive compilation of
JavaScript. If compiling the string would result in an error
that might be fixed by appending more source, this method
returns false. In every other case, it returns true.
<p>
Interactive shells may accumulate source lines, using this
method after each new line is appended to check whether the
statement being entered is complete.
@param source the source buffer to check
@return whether the source is ready for compilation
@since 1.4 Release 2 | [
"Check",
"whether",
"a",
"string",
"is",
"ready",
"to",
"be",
"compiled",
".",
"<p",
">",
"stringIsCompilableUnit",
"is",
"intended",
"to",
"support",
"interactive",
"compilation",
"of",
"JavaScript",
".",
"If",
"compiling",
"the",
"string",
"would",
"result",
... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1422-L1439 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/ser/SerIteratorFactory.java | SerIteratorFactory.createIterable | public SerIterable createIterable(MetaProperty<?> prop, Class<?> beanClass, boolean allowPrimitiveArrays) {
if (allowPrimitiveArrays &&
prop.propertyType().isArray() &&
prop.propertyType().getComponentType().isPrimitive() &&
prop.propertyType().getComponentType() != byte.class) {
return arrayPrimitive(prop.propertyType().getComponentType());
}
return createIterable(prop, beanClass);
} | java | public SerIterable createIterable(MetaProperty<?> prop, Class<?> beanClass, boolean allowPrimitiveArrays) {
if (allowPrimitiveArrays &&
prop.propertyType().isArray() &&
prop.propertyType().getComponentType().isPrimitive() &&
prop.propertyType().getComponentType() != byte.class) {
return arrayPrimitive(prop.propertyType().getComponentType());
}
return createIterable(prop, beanClass);
} | [
"public",
"SerIterable",
"createIterable",
"(",
"MetaProperty",
"<",
"?",
">",
"prop",
",",
"Class",
"<",
"?",
">",
"beanClass",
",",
"boolean",
"allowPrimitiveArrays",
")",
"{",
"if",
"(",
"allowPrimitiveArrays",
"&&",
"prop",
".",
"propertyType",
"(",
")",
... | Creates an iterator wrapper for a meta-property value.
@param prop the meta-property defining the value, not null
@param beanClass the class of the bean, not the meta-property, for better generics, not null
@param allowPrimitiveArrays whether to allow primitive arrays
@return the iterable, null if not a collection-like type | [
"Creates",
"an",
"iterator",
"wrapper",
"for",
"a",
"meta",
"-",
"property",
"value",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/SerIteratorFactory.java#L295-L303 |
openengsb/openengsb | components/ekb/persistence-query-edb/src/main/java/org/openengsb/core/ekb/persistence/query/edb/internal/QueryInterfaceService.java | QueryInterfaceService.createModelOfEDBObject | private Object createModelOfEDBObject(EDBObject object, Map<ModelDescription, Class<?>> cache) {
try {
ModelDescription description = getDescriptionFromObject(object);
Class<?> modelClass;
if (cache.containsKey(description)) {
modelClass = cache.get(description);
} else {
modelClass = modelRegistry.loadModel(description);
cache.put(description, modelClass);
}
return edbConverter.convertEDBObjectToModel(modelClass, object);
} catch (IllegalArgumentException | ClassNotFoundException e) {
LOGGER.warn("Unable to create model of the object {}", object.getOID(), e);
return null;
}
} | java | private Object createModelOfEDBObject(EDBObject object, Map<ModelDescription, Class<?>> cache) {
try {
ModelDescription description = getDescriptionFromObject(object);
Class<?> modelClass;
if (cache.containsKey(description)) {
modelClass = cache.get(description);
} else {
modelClass = modelRegistry.loadModel(description);
cache.put(description, modelClass);
}
return edbConverter.convertEDBObjectToModel(modelClass, object);
} catch (IllegalArgumentException | ClassNotFoundException e) {
LOGGER.warn("Unable to create model of the object {}", object.getOID(), e);
return null;
}
} | [
"private",
"Object",
"createModelOfEDBObject",
"(",
"EDBObject",
"object",
",",
"Map",
"<",
"ModelDescription",
",",
"Class",
"<",
"?",
">",
">",
"cache",
")",
"{",
"try",
"{",
"ModelDescription",
"description",
"=",
"getDescriptionFromObject",
"(",
"object",
")... | Converts an EDBObject instance into a model. For this, the method need to retrieve the model class to be able to
instantiate the corresponding model objects. If the conversion fails, null is returned. | [
"Converts",
"an",
"EDBObject",
"instance",
"into",
"a",
"model",
".",
"For",
"this",
"the",
"method",
"need",
"to",
"retrieve",
"the",
"model",
"class",
"to",
"be",
"able",
"to",
"instantiate",
"the",
"corresponding",
"model",
"objects",
".",
"If",
"the",
... | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-query-edb/src/main/java/org/openengsb/core/ekb/persistence/query/edb/internal/QueryInterfaceService.java#L175-L190 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java | ReservoirLongsSketch.heapify | public static ReservoirLongsSketch heapify(final Memory srcMem) {
Family.RESERVOIR.checkFamilyID(srcMem.getByte(FAMILY_BYTE));
final int numPreLongs = extractPreLongs(srcMem);
final ResizeFactor rf = ResizeFactor.getRF(extractResizeFactor(srcMem));
final int serVer = extractSerVer(srcMem);
final boolean isEmpty = (extractFlags(srcMem) & EMPTY_FLAG_MASK) != 0;
final long itemsSeen = (isEmpty ? 0 : extractN(srcMem));
int k = extractK(srcMem);
// Check values
final boolean preLongsEqMin = (numPreLongs == Family.RESERVOIR.getMinPreLongs());
final boolean preLongsEqMax = (numPreLongs == Family.RESERVOIR.getMaxPreLongs());
if (!preLongsEqMin & !preLongsEqMax) {
throw new SketchesArgumentException("Possible corruption: Non-empty sketch with only "
+ Family.RESERVOIR.getMinPreLongs() + "preLongs");
}
if (serVer != SER_VER) {
if (serVer == 1) {
final short encK = extractEncodedReservoirSize(srcMem);
k = ReservoirSize.decodeValue(encK);
} else {
throw new SketchesArgumentException(
"Possible Corruption: Ser Ver must be " + SER_VER + ": " + serVer);
}
}
if (isEmpty) {
return new ReservoirLongsSketch(k, rf);
}
final int preLongBytes = numPreLongs << 3;
final int numSketchLongs = (int) Math.min(itemsSeen, k);
int allocatedSize = k; // default to full reservoir
if (itemsSeen < k) {
// under-full so determine size to allocate, using ceilingLog2(totalSeen) as minimum
// casts to int are safe since under-full
final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(k), "heapify");
final int minLgSize = Util.toLog2(Util.ceilingPowerOf2((int) itemsSeen), "heapify");
final int initialLgSize = SamplingUtil.startingSubMultiple(ceilingLgK, rf.lg(),
Math.max(minLgSize, MIN_LG_ARR_LONGS));
allocatedSize = SamplingUtil.getAdjustedSize(k, 1 << initialLgSize);
}
final long[] data = new long[allocatedSize];
srcMem.getLongArray(preLongBytes, data, 0, numSketchLongs);
return new ReservoirLongsSketch(data, itemsSeen, rf, k);
} | java | public static ReservoirLongsSketch heapify(final Memory srcMem) {
Family.RESERVOIR.checkFamilyID(srcMem.getByte(FAMILY_BYTE));
final int numPreLongs = extractPreLongs(srcMem);
final ResizeFactor rf = ResizeFactor.getRF(extractResizeFactor(srcMem));
final int serVer = extractSerVer(srcMem);
final boolean isEmpty = (extractFlags(srcMem) & EMPTY_FLAG_MASK) != 0;
final long itemsSeen = (isEmpty ? 0 : extractN(srcMem));
int k = extractK(srcMem);
// Check values
final boolean preLongsEqMin = (numPreLongs == Family.RESERVOIR.getMinPreLongs());
final boolean preLongsEqMax = (numPreLongs == Family.RESERVOIR.getMaxPreLongs());
if (!preLongsEqMin & !preLongsEqMax) {
throw new SketchesArgumentException("Possible corruption: Non-empty sketch with only "
+ Family.RESERVOIR.getMinPreLongs() + "preLongs");
}
if (serVer != SER_VER) {
if (serVer == 1) {
final short encK = extractEncodedReservoirSize(srcMem);
k = ReservoirSize.decodeValue(encK);
} else {
throw new SketchesArgumentException(
"Possible Corruption: Ser Ver must be " + SER_VER + ": " + serVer);
}
}
if (isEmpty) {
return new ReservoirLongsSketch(k, rf);
}
final int preLongBytes = numPreLongs << 3;
final int numSketchLongs = (int) Math.min(itemsSeen, k);
int allocatedSize = k; // default to full reservoir
if (itemsSeen < k) {
// under-full so determine size to allocate, using ceilingLog2(totalSeen) as minimum
// casts to int are safe since under-full
final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(k), "heapify");
final int minLgSize = Util.toLog2(Util.ceilingPowerOf2((int) itemsSeen), "heapify");
final int initialLgSize = SamplingUtil.startingSubMultiple(ceilingLgK, rf.lg(),
Math.max(minLgSize, MIN_LG_ARR_LONGS));
allocatedSize = SamplingUtil.getAdjustedSize(k, 1 << initialLgSize);
}
final long[] data = new long[allocatedSize];
srcMem.getLongArray(preLongBytes, data, 0, numSketchLongs);
return new ReservoirLongsSketch(data, itemsSeen, rf, k);
} | [
"public",
"static",
"ReservoirLongsSketch",
"heapify",
"(",
"final",
"Memory",
"srcMem",
")",
"{",
"Family",
".",
"RESERVOIR",
".",
"checkFamilyID",
"(",
"srcMem",
".",
"getByte",
"(",
"FAMILY_BYTE",
")",
")",
";",
"final",
"int",
"numPreLongs",
"=",
"extractP... | Returns a sketch instance of this class from the given srcMem, which must be a Memory
representation of this sketch class.
@param srcMem a Memory representation of a sketch of this class. <a href=
"{@docRoot}/resources/dictionary.html#mem">See Memory</a>
@return a sketch instance of this class | [
"Returns",
"a",
"sketch",
"instance",
"of",
"this",
"class",
"from",
"the",
"given",
"srcMem",
"which",
"must",
"be",
"a",
"Memory",
"representation",
"of",
"this",
"sketch",
"class",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java#L179-L230 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosPeopleApi.java | PhotosPeopleApi.deleteCoords | public Response deleteCoords(String photoId, String userId) throws JinxException {
JinxUtils.validateParams(photoId, userId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.people.deleteCoords");
params.put("photo_id", photoId);
params.put("user_id", userId);
return jinx.flickrPost(params, Response.class);
} | java | public Response deleteCoords(String photoId, String userId) throws JinxException {
JinxUtils.validateParams(photoId, userId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.people.deleteCoords");
params.put("photo_id", photoId);
params.put("user_id", userId);
return jinx.flickrPost(params, Response.class);
} | [
"public",
"Response",
"deleteCoords",
"(",
"String",
"photoId",
",",
"String",
"userId",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
",",
"userId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"="... | Remove the bounding box from a person in a photo
<br>
This method requires authentication with 'write' permission.
@param photoId (Required) The id of the photo to edit a person in.
@param userId (Required) The user id of the person whose bounding box you want to remove.
@return object with the status of the requested operation.
@throws JinxException if any required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.people.deleteCoords.html">flickr.photos.people.deleteCoords</a> | [
"Remove",
"the",
"bounding",
"box",
"from",
"a",
"person",
"in",
"a",
"photo",
"<br",
">",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosPeopleApi.java#L116-L123 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java | DatabaseUtils.dumpCursor | public static void dumpCursor(Cursor cursor, PrintStream stream) {
stream.println(">>>>> Dumping cursor " + cursor);
if (cursor != null) {
int startPos = cursor.getPosition();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
dumpCurrentRow(cursor, stream);
}
cursor.moveToPosition(startPos);
}
stream.println("<<<<<");
} | java | public static void dumpCursor(Cursor cursor, PrintStream stream) {
stream.println(">>>>> Dumping cursor " + cursor);
if (cursor != null) {
int startPos = cursor.getPosition();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
dumpCurrentRow(cursor, stream);
}
cursor.moveToPosition(startPos);
}
stream.println("<<<<<");
} | [
"public",
"static",
"void",
"dumpCursor",
"(",
"Cursor",
"cursor",
",",
"PrintStream",
"stream",
")",
"{",
"stream",
".",
"println",
"(",
"\">>>>> Dumping cursor \"",
"+",
"cursor",
")",
";",
"if",
"(",
"cursor",
"!=",
"null",
")",
"{",
"int",
"startPos",
... | Prints the contents of a Cursor to a PrintSteam. The position is restored
after printing.
@param cursor the cursor to print
@param stream the stream to print to | [
"Prints",
"the",
"contents",
"of",
"a",
"Cursor",
"to",
"a",
"PrintSteam",
".",
"The",
"position",
"is",
"restored",
"after",
"printing",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L484-L496 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java | ID3v2Header.checkHeader | private boolean checkHeader(RandomAccessInputStream raf) throws IOException
{
raf.seek(HEAD_LOCATION);
byte[] buf = new byte[HEAD_SIZE];
if (raf.read(buf) != HEAD_SIZE)
{
throw new IOException("Error encountered finding id3v2 header");
}
String result = new String(buf, ENC_TYPE);
if (result.substring(0, TAG_START.length()).equals(TAG_START))
{
if ((((int)buf[3]&0xFF) < 0xff) && (((int)buf[4]&0xFF) < 0xff))
{
if ((((int)buf[6]&0xFF) < 0x80) && (((int)buf[7]&0xFF) < 0x80) && (((int)buf[8]&0xFF) < 0x80) && (((int)buf[9]&0xFF) < 0x80))
{
return true;
}
}
}
return false;
} | java | private boolean checkHeader(RandomAccessInputStream raf) throws IOException
{
raf.seek(HEAD_LOCATION);
byte[] buf = new byte[HEAD_SIZE];
if (raf.read(buf) != HEAD_SIZE)
{
throw new IOException("Error encountered finding id3v2 header");
}
String result = new String(buf, ENC_TYPE);
if (result.substring(0, TAG_START.length()).equals(TAG_START))
{
if ((((int)buf[3]&0xFF) < 0xff) && (((int)buf[4]&0xFF) < 0xff))
{
if ((((int)buf[6]&0xFF) < 0x80) && (((int)buf[7]&0xFF) < 0x80) && (((int)buf[8]&0xFF) < 0x80) && (((int)buf[9]&0xFF) < 0x80))
{
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"checkHeader",
"(",
"RandomAccessInputStream",
"raf",
")",
"throws",
"IOException",
"{",
"raf",
".",
"seek",
"(",
"HEAD_LOCATION",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"HEAD_SIZE",
"]",
";",
"if",
"(",
"raf",
... | Checks to see if there is an id3v2 header in the file provided to the
constructor.
@return true if an id3v2 header exists in the file
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"an",
"id3v2",
"header",
"in",
"the",
"file",
"provided",
"to",
"the",
"constructor",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java#L80-L103 |
google/closure-compiler | src/com/google/javascript/jscomp/ProcessClosurePrimitives.java | ProcessClosurePrimitives.processAddDependency | private void processAddDependency(Node n, Node parent) {
CodingConvention convention = compiler.getCodingConvention();
List<String> typeDecls =
convention.identifyTypeDeclarationCall(n);
// TODO(nnaze): Use of addDependency() should someday cause a warning
// as we migrate users to explicit goog.forwardDeclare() calls.
if (typeDecls != null) {
for (String typeDecl : typeDecls) {
compiler.forwardDeclareType(typeDecl);
}
}
// We can't modify parent, so just create a node that will
// get compiled out.
Node emptyNode = IR.number(0);
parent.replaceChild(n, emptyNode);
compiler.reportChangeToEnclosingScope(emptyNode);
} | java | private void processAddDependency(Node n, Node parent) {
CodingConvention convention = compiler.getCodingConvention();
List<String> typeDecls =
convention.identifyTypeDeclarationCall(n);
// TODO(nnaze): Use of addDependency() should someday cause a warning
// as we migrate users to explicit goog.forwardDeclare() calls.
if (typeDecls != null) {
for (String typeDecl : typeDecls) {
compiler.forwardDeclareType(typeDecl);
}
}
// We can't modify parent, so just create a node that will
// get compiled out.
Node emptyNode = IR.number(0);
parent.replaceChild(n, emptyNode);
compiler.reportChangeToEnclosingScope(emptyNode);
} | [
"private",
"void",
"processAddDependency",
"(",
"Node",
"n",
",",
"Node",
"parent",
")",
"{",
"CodingConvention",
"convention",
"=",
"compiler",
".",
"getCodingConvention",
"(",
")",
";",
"List",
"<",
"String",
">",
"typeDecls",
"=",
"convention",
".",
"identi... | Process a goog.addDependency() call and record any forward declarations. | [
"Process",
"a",
"goog",
".",
"addDependency",
"()",
"call",
"and",
"record",
"any",
"forward",
"declarations",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java#L906-L924 |
mapbox/mapbox-navigation-android | libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java | OfflineNavigator.retrieveRouteFor | void retrieveRouteFor(OfflineRoute offlineRoute, OnOfflineRouteFoundCallback callback) {
new OfflineRouteRetrievalTask(navigator, callback).execute(offlineRoute);
} | java | void retrieveRouteFor(OfflineRoute offlineRoute, OnOfflineRouteFoundCallback callback) {
new OfflineRouteRetrievalTask(navigator, callback).execute(offlineRoute);
} | [
"void",
"retrieveRouteFor",
"(",
"OfflineRoute",
"offlineRoute",
",",
"OnOfflineRouteFoundCallback",
"callback",
")",
"{",
"new",
"OfflineRouteRetrievalTask",
"(",
"navigator",
",",
"callback",
")",
".",
"execute",
"(",
"offlineRoute",
")",
";",
"}"
] | Uses libvalhalla and local tile data to generate mapbox-directions-api-like json
@param offlineRoute an offline navigation route
@param callback which receives a RouterResult object with the json and a success/fail bool | [
"Uses",
"libvalhalla",
"and",
"local",
"tile",
"data",
"to",
"generate",
"mapbox",
"-",
"directions",
"-",
"api",
"-",
"like",
"json"
] | train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java#L31-L33 |
pravega/pravega | common/src/main/java/io/pravega/common/util/btree/PageWrapper.java | PageWrapper.wrapExisting | static PageWrapper wrapExisting(BTreePage page, PageWrapper parent, PagePointer pointer) {
return new PageWrapper(page, parent, pointer, false);
} | java | static PageWrapper wrapExisting(BTreePage page, PageWrapper parent, PagePointer pointer) {
return new PageWrapper(page, parent, pointer, false);
} | [
"static",
"PageWrapper",
"wrapExisting",
"(",
"BTreePage",
"page",
",",
"PageWrapper",
"parent",
",",
"PagePointer",
"pointer",
")",
"{",
"return",
"new",
"PageWrapper",
"(",
"page",
",",
"parent",
",",
"pointer",
",",
"false",
")",
";",
"}"
] | Creates a new instance of the PageWrapper class for an existing Page.
@param page Page to wrap.
@param parent Page's Parent.
@param pointer Page Pointer. | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"PageWrapper",
"class",
"for",
"an",
"existing",
"Page",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/PageWrapper.java#L58-L60 |
cchantep/acolyte | jdbc-driver/src/main/java/acolyte/jdbc/Connection.java | Connection.createStatement | public Statement createStatement(final int resultSetType,
final int resultSetConcurrency,
final int resultSetHoldability)
throws SQLException {
if (resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
throw new SQLFeatureNotSupportedException("Unsupported result set holdability");
} // end of if
return createStatement(resultSetType, resultSetConcurrency);
} | java | public Statement createStatement(final int resultSetType,
final int resultSetConcurrency,
final int resultSetHoldability)
throws SQLException {
if (resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
throw new SQLFeatureNotSupportedException("Unsupported result set holdability");
} // end of if
return createStatement(resultSetType, resultSetConcurrency);
} | [
"public",
"Statement",
"createStatement",
"(",
"final",
"int",
"resultSetType",
",",
"final",
"int",
"resultSetConcurrency",
",",
"final",
"int",
"resultSetHoldability",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"resultSetHoldability",
"!=",
"ResultSet",
".",
"... | {@inheritDoc}
@throws java.sql.SQLFeatureNotSupportedException if |resultSetHoldability| is not ResultSet.CLOSE_CURSORS_AT_COMMIT | [
"{"
] | train | https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-driver/src/main/java/acolyte/jdbc/Connection.java#L488-L498 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java | WikipediaTemplateInfo.revisionContainsTemplateNameWithoutIndex | public boolean revisionContainsTemplateNameWithoutIndex(int revId, String templateName) throws WikiApiException{
if(revApi==null){
revApi = new RevisionApi(wiki.getDatabaseConfiguration());
}
if(parser==null){
//TODO switch to SWEBLE
MediaWikiParserFactory pf = new MediaWikiParserFactory(
wiki.getDatabaseConfiguration().getLanguage());
pf.setTemplateParserClass(ShowTemplateNamesAndParameters.class);
parser = pf.createParser();
}
List<Template> tplList = parser.parse(revApi.getRevision(revId).getRevisionText()).getTemplates();
for(Template tpl:tplList){
if(tpl.getName().equalsIgnoreCase(templateName)){
return true;
}
}
return false;
} | java | public boolean revisionContainsTemplateNameWithoutIndex(int revId, String templateName) throws WikiApiException{
if(revApi==null){
revApi = new RevisionApi(wiki.getDatabaseConfiguration());
}
if(parser==null){
//TODO switch to SWEBLE
MediaWikiParserFactory pf = new MediaWikiParserFactory(
wiki.getDatabaseConfiguration().getLanguage());
pf.setTemplateParserClass(ShowTemplateNamesAndParameters.class);
parser = pf.createParser();
}
List<Template> tplList = parser.parse(revApi.getRevision(revId).getRevisionText()).getTemplates();
for(Template tpl:tplList){
if(tpl.getName().equalsIgnoreCase(templateName)){
return true;
}
}
return false;
} | [
"public",
"boolean",
"revisionContainsTemplateNameWithoutIndex",
"(",
"int",
"revId",
",",
"String",
"templateName",
")",
"throws",
"WikiApiException",
"{",
"if",
"(",
"revApi",
"==",
"null",
")",
"{",
"revApi",
"=",
"new",
"RevisionApi",
"(",
"wiki",
".",
"getD... | Does the same as revisionContainsTemplateName() without using a template index
@param revId
@param templateName
@return
@throws WikiApiException | [
"Does",
"the",
"same",
"as",
"revisionContainsTemplateName",
"()",
"without",
"using",
"a",
"template",
"index"
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L1303-L1322 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AnalysisContext.java | AnalysisContext.lookupClass | public JavaClass lookupClass(@Nonnull @DottedClassName String className) throws ClassNotFoundException {
try {
if (className.length() == 0) {
throw new IllegalArgumentException("Class name is empty");
}
if (!ClassName.isValidClassName(className)) {
throw new ClassNotFoundException("Invalid class name: " + className);
}
return Global.getAnalysisCache().getClassAnalysis(JavaClass.class,
DescriptorFactory.instance().getClassDescriptor(ClassName.toSlashedClassName(className)));
} catch (CheckedAnalysisException e) {
throw new ClassNotFoundException("Class not found: " + className, e);
}
} | java | public JavaClass lookupClass(@Nonnull @DottedClassName String className) throws ClassNotFoundException {
try {
if (className.length() == 0) {
throw new IllegalArgumentException("Class name is empty");
}
if (!ClassName.isValidClassName(className)) {
throw new ClassNotFoundException("Invalid class name: " + className);
}
return Global.getAnalysisCache().getClassAnalysis(JavaClass.class,
DescriptorFactory.instance().getClassDescriptor(ClassName.toSlashedClassName(className)));
} catch (CheckedAnalysisException e) {
throw new ClassNotFoundException("Class not found: " + className, e);
}
} | [
"public",
"JavaClass",
"lookupClass",
"(",
"@",
"Nonnull",
"@",
"DottedClassName",
"String",
"className",
")",
"throws",
"ClassNotFoundException",
"{",
"try",
"{",
"if",
"(",
"className",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"Illegal... | Lookup a class.
<em>Use this method instead of Repository.lookupClass().</em>
@param className
the name of the class
@return the JavaClass representing the class
@throws ClassNotFoundException
(but not really) | [
"Lookup",
"a",
"class",
".",
"<em",
">",
"Use",
"this",
"method",
"instead",
"of",
"Repository",
".",
"lookupClass",
"()",
".",
"<",
"/",
"em",
">"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AnalysisContext.java#L948-L961 |
Karumi/HeaderRecyclerView | library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java | HeaderRecyclerViewAdapter.onCreateViewHolder | @Override public final VH onCreateViewHolder(ViewGroup parent, int viewType) {
VH viewHolder;
if (isHeaderType(viewType)) {
viewHolder = onCreateHeaderViewHolder(parent, viewType);
} else if (isFooterType(viewType)) {
viewHolder = onCreateFooterViewHolder(parent, viewType);
} else {
viewHolder = onCreateItemViewHolder(parent, viewType);
}
return viewHolder;
} | java | @Override public final VH onCreateViewHolder(ViewGroup parent, int viewType) {
VH viewHolder;
if (isHeaderType(viewType)) {
viewHolder = onCreateHeaderViewHolder(parent, viewType);
} else if (isFooterType(viewType)) {
viewHolder = onCreateFooterViewHolder(parent, viewType);
} else {
viewHolder = onCreateItemViewHolder(parent, viewType);
}
return viewHolder;
} | [
"@",
"Override",
"public",
"final",
"VH",
"onCreateViewHolder",
"(",
"ViewGroup",
"parent",
",",
"int",
"viewType",
")",
"{",
"VH",
"viewHolder",
";",
"if",
"(",
"isHeaderType",
"(",
"viewType",
")",
")",
"{",
"viewHolder",
"=",
"onCreateHeaderViewHolder",
"("... | Invokes onCreateHeaderViewHolder, onCreateItemViewHolder or onCreateFooterViewHolder methods
based on the view type param. | [
"Invokes",
"onCreateHeaderViewHolder",
"onCreateItemViewHolder",
"or",
"onCreateFooterViewHolder",
"methods",
"based",
"on",
"the",
"view",
"type",
"param",
"."
] | train | https://github.com/Karumi/HeaderRecyclerView/blob/c018472a1b15de661d8aec153bd5f555ef1e9a37/library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java#L49-L59 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.getWorkerPool | public WorkerPoolResourceInner getWorkerPool(String resourceGroupName, String name, String workerPoolName) {
return getWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName).toBlocking().single().body();
} | java | public WorkerPoolResourceInner getWorkerPool(String resourceGroupName, String name, String workerPoolName) {
return getWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName).toBlocking().single().body();
} | [
"public",
"WorkerPoolResourceInner",
"getWorkerPool",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"workerPoolName",
")",
"{",
"return",
"getWorkerPoolWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"workerPoolName",
")"... | Get properties of a worker pool.
Get properties of a worker pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@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 WorkerPoolResourceInner object if successful. | [
"Get",
"properties",
"of",
"a",
"worker",
"pool",
".",
"Get",
"properties",
"of",
"a",
"worker",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5092-L5094 |
bazaarvoice/emodb | job/src/main/java/com/bazaarvoice/emodb/job/service/DefaultJobService.java | DefaultJobService.recordFinalStatus | private <Q, R> void recordFinalStatus(JobIdentifier<Q, R> jobId, JobStatus<Q, R> jobStatus) {
try {
_jobStatusDAO.updateJobStatus(jobId, jobStatus);
} catch (Exception e) {
_log.error("Failed to record final status for job: [id={}, status={}]", jobId, jobStatus.getStatus(), e);
}
} | java | private <Q, R> void recordFinalStatus(JobIdentifier<Q, R> jobId, JobStatus<Q, R> jobStatus) {
try {
_jobStatusDAO.updateJobStatus(jobId, jobStatus);
} catch (Exception e) {
_log.error("Failed to record final status for job: [id={}, status={}]", jobId, jobStatus.getStatus(), e);
}
} | [
"private",
"<",
"Q",
",",
"R",
">",
"void",
"recordFinalStatus",
"(",
"JobIdentifier",
"<",
"Q",
",",
"R",
">",
"jobId",
",",
"JobStatus",
"<",
"Q",
",",
"R",
">",
"jobStatus",
")",
"{",
"try",
"{",
"_jobStatusDAO",
".",
"updateJobStatus",
"(",
"jobId"... | Attempts to record the final status for a job. Logs any errors, but always returns without throwing an
exception.
@param jobId The job ID
@param jobStatus The job's status
@param <Q> The job's request type
@param <R> The job's result type. | [
"Attempts",
"to",
"record",
"the",
"final",
"status",
"for",
"a",
"job",
".",
"Logs",
"any",
"errors",
"but",
"always",
"returns",
"without",
"throwing",
"an",
"exception",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/job/src/main/java/com/bazaarvoice/emodb/job/service/DefaultJobService.java#L337-L343 |
UrielCh/ovh-java-sdk | ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java | ApiOvhCaasregistry.serviceName_namespaces_namespaceId_images_imageId_permissions_POST | public OvhPermissions serviceName_namespaces_namespaceId_images_imageId_permissions_POST(String serviceName, String namespaceId, String imageId, OvhInputPermissions body) throws IOException {
String qPath = "/caas/registry/{serviceName}/namespaces/{namespaceId}/images/{imageId}/permissions";
StringBuilder sb = path(qPath, serviceName, namespaceId, imageId);
String resp = exec(qPath, "POST", sb.toString(), body);
return convertTo(resp, OvhPermissions.class);
} | java | public OvhPermissions serviceName_namespaces_namespaceId_images_imageId_permissions_POST(String serviceName, String namespaceId, String imageId, OvhInputPermissions body) throws IOException {
String qPath = "/caas/registry/{serviceName}/namespaces/{namespaceId}/images/{imageId}/permissions";
StringBuilder sb = path(qPath, serviceName, namespaceId, imageId);
String resp = exec(qPath, "POST", sb.toString(), body);
return convertTo(resp, OvhPermissions.class);
} | [
"public",
"OvhPermissions",
"serviceName_namespaces_namespaceId_images_imageId_permissions_POST",
"(",
"String",
"serviceName",
",",
"String",
"namespaceId",
",",
"String",
"imageId",
",",
"OvhInputPermissions",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
... | Create image permissions
REST: POST /caas/registry/{serviceName}/namespaces/{namespaceId}/images/{imageId}/permissions
@param imageId [required] Image id
@param namespaceId [required] Namespace id
@param body [required] Permissions of a user over a namespace
@param serviceName [required] Service name
API beta | [
"Create",
"image",
"permissions"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java#L339-L344 |
landawn/AbacusUtil | src/com/landawn/abacus/util/CSVUtil.java | CSVUtil.exportCSV | public static long exportCSV(final File out, final PreparedStatement stmt, final long offset, final long count, final boolean writeTitle,
final boolean quoted) throws UncheckedSQLException, UncheckedIOException {
return exportCSV(out, stmt, null, offset, count, writeTitle, quoted);
} | java | public static long exportCSV(final File out, final PreparedStatement stmt, final long offset, final long count, final boolean writeTitle,
final boolean quoted) throws UncheckedSQLException, UncheckedIOException {
return exportCSV(out, stmt, null, offset, count, writeTitle, quoted);
} | [
"public",
"static",
"long",
"exportCSV",
"(",
"final",
"File",
"out",
",",
"final",
"PreparedStatement",
"stmt",
",",
"final",
"long",
"offset",
",",
"final",
"long",
"count",
",",
"final",
"boolean",
"writeTitle",
",",
"final",
"boolean",
"quoted",
")",
"th... | Exports the data from database to CVS.
@param out
@param stmt
@param offset
@param count
@param writeTitle
@param quoted
@return | [
"Exports",
"the",
"data",
"from",
"database",
"to",
"CVS",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CSVUtil.java#L765-L768 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.