repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src-modules/org/opencms/workplace/search/CmsSearchResourcesCollector.java | CmsSearchResourcesCollector.getSearchBean | private CmsSearch getSearchBean(Map<String, String> params) {
if (m_searchBean == null) {
m_searchBean = new CmsSearch();
m_searchBean.init(getWp().getCms());
m_searchBean.setParameters(getSearchParameters(params));
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_searchBean.getIndex())) {
m_searchBean.setIndex(getWp().getSettings().getUserSettings().getWorkplaceSearchIndexName());
}
m_searchBean.setMatchesPerPage(getWp().getSettings().getUserSettings().getExplorerFileEntries());
m_searchBean.setSearchPage(Integer.parseInt(params.get(I_CmsListResourceCollector.PARAM_PAGE)));
// set search roots
List<String> resources = getResourceNamesFromParam(params);
String[] searchRoots = new String[resources.size()];
resources.toArray(searchRoots);
for (int i = 0; i < searchRoots.length; i++) {
searchRoots[i] = getWp().getCms().addSiteRoot(searchRoots[i]);
}
m_searchBean.setSearchRoots(searchRoots);
} else {
int page = Integer.parseInt(params.get(I_CmsListResourceCollector.PARAM_PAGE));
if (m_searchBean.getSearchPage() != page) {
m_searchBean.setSearchPage(page);
m_searchResults = null;
}
}
return m_searchBean;
} | java | private CmsSearch getSearchBean(Map<String, String> params) {
if (m_searchBean == null) {
m_searchBean = new CmsSearch();
m_searchBean.init(getWp().getCms());
m_searchBean.setParameters(getSearchParameters(params));
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_searchBean.getIndex())) {
m_searchBean.setIndex(getWp().getSettings().getUserSettings().getWorkplaceSearchIndexName());
}
m_searchBean.setMatchesPerPage(getWp().getSettings().getUserSettings().getExplorerFileEntries());
m_searchBean.setSearchPage(Integer.parseInt(params.get(I_CmsListResourceCollector.PARAM_PAGE)));
// set search roots
List<String> resources = getResourceNamesFromParam(params);
String[] searchRoots = new String[resources.size()];
resources.toArray(searchRoots);
for (int i = 0; i < searchRoots.length; i++) {
searchRoots[i] = getWp().getCms().addSiteRoot(searchRoots[i]);
}
m_searchBean.setSearchRoots(searchRoots);
} else {
int page = Integer.parseInt(params.get(I_CmsListResourceCollector.PARAM_PAGE));
if (m_searchBean.getSearchPage() != page) {
m_searchBean.setSearchPage(page);
m_searchResults = null;
}
}
return m_searchBean;
} | [
"private",
"CmsSearch",
"getSearchBean",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"if",
"(",
"m_searchBean",
"==",
"null",
")",
"{",
"m_searchBean",
"=",
"new",
"CmsSearch",
"(",
")",
";",
"m_searchBean",
".",
"init",
"(",
"getW... | Returns the search bean object.<p>
@param params the parameter map
@return the used search bean | [
"Returns",
"the",
"search",
"bean",
"object",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/search/CmsSearchResourcesCollector.java#L264-L291 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/images/ImageHandlerBuilder.java | ImageHandlerBuilder.uniqueImagename | String uniqueImagename(String folder, String filename) {
String buildFileName = filename;//.replace(' ', '_');
while ( (new File(folder , buildFileName)).exists())
buildFileName = fn.increment();
return buildFileName;//output.getPath();
} | java | String uniqueImagename(String folder, String filename) {
String buildFileName = filename;//.replace(' ', '_');
while ( (new File(folder , buildFileName)).exists())
buildFileName = fn.increment();
return buildFileName;//output.getPath();
} | [
"String",
"uniqueImagename",
"(",
"String",
"folder",
",",
"String",
"filename",
")",
"{",
"String",
"buildFileName",
"=",
"filename",
";",
"//.replace(' ', '_');",
"while",
"(",
"(",
"new",
"File",
"(",
"folder",
",",
"buildFileName",
")",
")",
".",
"exists",... | Calculates a unique filename located in the image upload folder.
WARNING: not threadsafe! Another file with the calculated name might very well get written onto disk first after this name is found
@param filename
@return Outputs the relative path of the calculated filename. | [
"Calculates",
"a",
"unique",
"filename",
"located",
"in",
"the",
"image",
"upload",
"folder",
"."
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/images/ImageHandlerBuilder.java#L327-L334 |
xcesco/kripton | kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteEvent.java | SQLiteEvent.createInsertWithUid | public static SQLiteEvent createInsertWithUid(String result) {
return new SQLiteEvent(SqlModificationType.INSERT, null, null, result);
} | java | public static SQLiteEvent createInsertWithUid(String result) {
return new SQLiteEvent(SqlModificationType.INSERT, null, null, result);
} | [
"public",
"static",
"SQLiteEvent",
"createInsertWithUid",
"(",
"String",
"result",
")",
"{",
"return",
"new",
"SQLiteEvent",
"(",
"SqlModificationType",
".",
"INSERT",
",",
"null",
",",
"null",
",",
"result",
")",
";",
"}"
] | Creates the insert.
@param result
the result
@return the SQ lite event | [
"Creates",
"the",
"insert",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteEvent.java#L68-L70 |
openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.upgradeVnfr | @Help(help = "Upgrades a VNFR to a defined VNFD in a running NSR with specific id")
public void upgradeVnfr(final String idNsr, final String idVnfr, final String idVnfd)
throws SDKException {
HashMap<String, Serializable> jsonBody = new HashMap<>();
jsonBody.put("vnfdId", idVnfd);
String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/upgrade";
requestPost(url, jsonBody);
} | java | @Help(help = "Upgrades a VNFR to a defined VNFD in a running NSR with specific id")
public void upgradeVnfr(final String idNsr, final String idVnfr, final String idVnfd)
throws SDKException {
HashMap<String, Serializable> jsonBody = new HashMap<>();
jsonBody.put("vnfdId", idVnfd);
String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/upgrade";
requestPost(url, jsonBody);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Upgrades a VNFR to a defined VNFD in a running NSR with specific id\"",
")",
"public",
"void",
"upgradeVnfr",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfr",
",",
"final",
"String",
"idVnfd",
")",
"throws",
"SDKExce... | Upgrades a VNFR of a defined VNFD in a running NSR.
@param idNsr the ID of the NetworkServiceRecord
@param idVnfr the ID of the VNFR to be upgraded
@param idVnfd the VNFD ID to which the VNFR shall be upgraded
@throws SDKException if the request fails | [
"Upgrades",
"a",
"VNFR",
"of",
"a",
"defined",
"VNFD",
"in",
"a",
"running",
"NSR",
"."
] | train | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L691-L698 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java | ManagedClustersInner.getAccessProfile | public ManagedClusterAccessProfileInner getAccessProfile(String resourceGroupName, String resourceName, String roleName) {
return getAccessProfileWithServiceResponseAsync(resourceGroupName, resourceName, roleName).toBlocking().single().body();
} | java | public ManagedClusterAccessProfileInner getAccessProfile(String resourceGroupName, String resourceName, String roleName) {
return getAccessProfileWithServiceResponseAsync(resourceGroupName, resourceName, roleName).toBlocking().single().body();
} | [
"public",
"ManagedClusterAccessProfileInner",
"getAccessProfile",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"roleName",
")",
"{",
"return",
"getAccessProfileWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
... | Gets an access profile of a managed cluster.
Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the managed cluster resource.
@param roleName The name of the role for managed cluster accessProfile resource.
@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 ManagedClusterAccessProfileInner object if successful. | [
"Gets",
"an",
"access",
"profile",
"of",
"a",
"managed",
"cluster",
".",
"Gets",
"the",
"accessProfile",
"for",
"the",
"specified",
"role",
"name",
"of",
"the",
"managed",
"cluster",
"with",
"a",
"specified",
"resource",
"group",
"and",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L479-L481 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java | MessageMap.setChoices | private void setChoices(BigInteger multiChoice, JSchema schema, JSVariant var) {
for (int i = 0; i < var.getCaseCount(); i++) {
BigInteger count = ((JSType)var.getCase(i)).getMultiChoiceCount();
if (multiChoice.compareTo(count) >= 0)
multiChoice = multiChoice.subtract(count);
else {
// We now have the case of our particular Variant in i. We set that in
// choiceCodes and then recursively visit the Variants dominated by ours.
choiceCodes[var.getIndex()] = i;
JSVariant[] subVars = var.getDominatedVariants(i);
setChoices(multiChoice, count, schema, subVars);
return;
}
}
// We should never get here
throw new RuntimeException("Bad multiChoice code");
} | java | private void setChoices(BigInteger multiChoice, JSchema schema, JSVariant var) {
for (int i = 0; i < var.getCaseCount(); i++) {
BigInteger count = ((JSType)var.getCase(i)).getMultiChoiceCount();
if (multiChoice.compareTo(count) >= 0)
multiChoice = multiChoice.subtract(count);
else {
// We now have the case of our particular Variant in i. We set that in
// choiceCodes and then recursively visit the Variants dominated by ours.
choiceCodes[var.getIndex()] = i;
JSVariant[] subVars = var.getDominatedVariants(i);
setChoices(multiChoice, count, schema, subVars);
return;
}
}
// We should never get here
throw new RuntimeException("Bad multiChoice code");
} | [
"private",
"void",
"setChoices",
"(",
"BigInteger",
"multiChoice",
",",
"JSchema",
"schema",
",",
"JSVariant",
"var",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"var",
".",
"getCaseCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"BigInteg... | Set the choices implied by the multiChoice code or contribution to a single JSVariant | [
"Set",
"the",
"choices",
"implied",
"by",
"the",
"multiChoice",
"code",
"or",
"contribution",
"to",
"a",
"single",
"JSVariant"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java#L123-L139 |
google/error-prone-javac | src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java | Module.isOpen | public boolean isOpen(String pn, String target) {
return isOpen(pn)
|| opens.containsKey(pn) && opens.get(pn).contains(target);
} | java | public boolean isOpen(String pn, String target) {
return isOpen(pn)
|| opens.containsKey(pn) && opens.get(pn).contains(target);
} | [
"public",
"boolean",
"isOpen",
"(",
"String",
"pn",
",",
"String",
"target",
")",
"{",
"return",
"isOpen",
"(",
"pn",
")",
"||",
"opens",
".",
"containsKey",
"(",
"pn",
")",
"&&",
"opens",
".",
"get",
"(",
"pn",
")",
".",
"contains",
"(",
"target",
... | Tests if the package of the given name is open to the target
in a qualified fashion. | [
"Tests",
"if",
"the",
"package",
"of",
"the",
"given",
"name",
"is",
"open",
"to",
"the",
"target",
"in",
"a",
"qualified",
"fashion",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java#L172-L175 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java | ReidSolomonCodes.computeECC | public void computeECC( GrowQueue_I8 input , GrowQueue_I8 output ) {
int N = generator.size-1;
input.extend(input.size+N);
Arrays.fill(input.data,input.size-N,input.size,(byte)0);
math.polyDivide(input,generator,tmp0,output);
input.size -= N;
} | java | public void computeECC( GrowQueue_I8 input , GrowQueue_I8 output ) {
int N = generator.size-1;
input.extend(input.size+N);
Arrays.fill(input.data,input.size-N,input.size,(byte)0);
math.polyDivide(input,generator,tmp0,output);
input.size -= N;
} | [
"public",
"void",
"computeECC",
"(",
"GrowQueue_I8",
"input",
",",
"GrowQueue_I8",
"output",
")",
"{",
"int",
"N",
"=",
"generator",
".",
"size",
"-",
"1",
";",
"input",
".",
"extend",
"(",
"input",
".",
"size",
"+",
"N",
")",
";",
"Arrays",
".",
"fi... | Given the input message compute the error correction code for it
@param input Input message. Modified internally then returned to its initial state
@param output error correction code | [
"Given",
"the",
"input",
"message",
"compute",
"the",
"error",
"correction",
"code",
"for",
"it"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java#L62-L71 |
lucee/Lucee | core/src/main/java/lucee/runtime/coder/Base64Coder.java | Base64Coder.decodeToString | public static String decodeToString(String encoded, String charset) throws CoderException, UnsupportedEncodingException {
byte[] dec = decode(Caster.toString(encoded, null));
return new String(dec, charset);
} | java | public static String decodeToString(String encoded, String charset) throws CoderException, UnsupportedEncodingException {
byte[] dec = decode(Caster.toString(encoded, null));
return new String(dec, charset);
} | [
"public",
"static",
"String",
"decodeToString",
"(",
"String",
"encoded",
",",
"String",
"charset",
")",
"throws",
"CoderException",
",",
"UnsupportedEncodingException",
"{",
"byte",
"[",
"]",
"dec",
"=",
"decode",
"(",
"Caster",
".",
"toString",
"(",
"encoded",... | decodes a Base64 String to a Plain String
@param encoded
@return
@throws ExpressionException | [
"decodes",
"a",
"Base64",
"String",
"to",
"a",
"Plain",
"String"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/coder/Base64Coder.java#L39-L42 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/powerassert/SourceText.java | SourceText.getNormalizedColumn | public int getNormalizedColumn(int line, int column) {
int deltaLine = line - firstLine;
if (deltaLine < 0 || deltaLine >= lineOffsets.size()) // wrong line information
return -1;
int deltaColumn = column - lineOffsets.get(deltaLine);
if (deltaColumn < 0) // wrong column information
return -1;
return textOffsets.get(deltaLine) + deltaColumn;
} | java | public int getNormalizedColumn(int line, int column) {
int deltaLine = line - firstLine;
if (deltaLine < 0 || deltaLine >= lineOffsets.size()) // wrong line information
return -1;
int deltaColumn = column - lineOffsets.get(deltaLine);
if (deltaColumn < 0) // wrong column information
return -1;
return textOffsets.get(deltaLine) + deltaColumn;
} | [
"public",
"int",
"getNormalizedColumn",
"(",
"int",
"line",
",",
"int",
"column",
")",
"{",
"int",
"deltaLine",
"=",
"line",
"-",
"firstLine",
";",
"if",
"(",
"deltaLine",
"<",
"0",
"||",
"deltaLine",
">=",
"lineOffsets",
".",
"size",
"(",
")",
")",
"/... | Returns the column in <tt>getNormalizedText()</tt> corresponding
to the given line and column in the original source text. The
first character in the normalized text has column 1.
@param line a line number
@param column a column number
@return the column in getNormalizedText() corresponding to the given line
and column in the original source text | [
"Returns",
"the",
"column",
"in",
"<tt",
">",
"getNormalizedText",
"()",
"<",
"/",
"tt",
">",
"corresponding",
"to",
"the",
"given",
"line",
"and",
"column",
"in",
"the",
"original",
"source",
"text",
".",
"The",
"first",
"character",
"in",
"the",
"normali... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/powerassert/SourceText.java#L100-L109 |
finmath/finmath-lib | src/main/java6/net/finmath/marketdata/model/curves/DiscountCurve.java | DiscountCurve.createDiscountFactorsFromForwardRates | public static DiscountCurveInterface createDiscountFactorsFromForwardRates(String name, TimeDiscretizationInterface tenor, double[] forwardRates) {
DiscountCurve discountFactors = new DiscountCurve(name);
double df = 1.0;
for(int timeIndex=0; timeIndex<tenor.getNumberOfTimeSteps();timeIndex++) {
df /= 1.0 + forwardRates[timeIndex] * tenor.getTimeStep(timeIndex);
discountFactors.addDiscountFactor(tenor.getTime(timeIndex+1), df, tenor.getTime(timeIndex+1) > 0);
}
return discountFactors;
} | java | public static DiscountCurveInterface createDiscountFactorsFromForwardRates(String name, TimeDiscretizationInterface tenor, double[] forwardRates) {
DiscountCurve discountFactors = new DiscountCurve(name);
double df = 1.0;
for(int timeIndex=0; timeIndex<tenor.getNumberOfTimeSteps();timeIndex++) {
df /= 1.0 + forwardRates[timeIndex] * tenor.getTimeStep(timeIndex);
discountFactors.addDiscountFactor(tenor.getTime(timeIndex+1), df, tenor.getTime(timeIndex+1) > 0);
}
return discountFactors;
} | [
"public",
"static",
"DiscountCurveInterface",
"createDiscountFactorsFromForwardRates",
"(",
"String",
"name",
",",
"TimeDiscretizationInterface",
"tenor",
",",
"double",
"[",
"]",
"forwardRates",
")",
"{",
"DiscountCurve",
"discountFactors",
"=",
"new",
"DiscountCurve",
"... | Create a discount curve from given time discretization and forward rates.
This function is provided for "single interest rate curve" frameworks.
@param name The name of this discount curve.
@param tenor Time discretization for the forward rates
@param forwardRates Array of forward rates.
@return A new discount factor object. | [
"Create",
"a",
"discount",
"curve",
"from",
"given",
"time",
"discretization",
"and",
"forward",
"rates",
".",
"This",
"function",
"is",
"provided",
"for",
"single",
"interest",
"rate",
"curve",
"frameworks",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/DiscountCurve.java#L377-L387 |
Coveros/selenified | src/main/java/com/coveros/selenified/application/App.java | App.isNotConfirmation | private boolean isNotConfirmation(String action, String expected) {
// wait for element to be present
if (!is.confirmationPresent()) {
waitFor.confirmationPresent();
}
if (!is.confirmationPresent()) {
reporter.fail(action, expected, "Unable to click confirmation as it is not present");
return true; // indicates element not present
}
return false;
} | java | private boolean isNotConfirmation(String action, String expected) {
// wait for element to be present
if (!is.confirmationPresent()) {
waitFor.confirmationPresent();
}
if (!is.confirmationPresent()) {
reporter.fail(action, expected, "Unable to click confirmation as it is not present");
return true; // indicates element not present
}
return false;
} | [
"private",
"boolean",
"isNotConfirmation",
"(",
"String",
"action",
",",
"String",
"expected",
")",
"{",
"// wait for element to be present",
"if",
"(",
"!",
"is",
".",
"confirmationPresent",
"(",
")",
")",
"{",
"waitFor",
".",
"confirmationPresent",
"(",
")",
"... | Determines if a confirmation is present or not, and can be interacted
with. If it's not present, an indication that the confirmation can't be
clicked on is written to the log file
@param action - the action occurring
@param expected - the expected result
@return Boolean: is a confirmation actually present or not. | [
"Determines",
"if",
"a",
"confirmation",
"is",
"present",
"or",
"not",
"and",
"can",
"be",
"interacted",
"with",
".",
"If",
"it",
"s",
"not",
"present",
"an",
"indication",
"that",
"the",
"confirmation",
"can",
"t",
"be",
"clicked",
"on",
"is",
"written",
... | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/App.java#L809-L819 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgBlock.java | DwgBlock.readDwgBlockV15 | public void readDwgBlockV15(int[] data, int offset) throws Exception {
int bitPos = offset;
bitPos = readObjectHeaderV15(data, bitPos);
Vector v = DwgUtil.getTextString(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
String text = (String)v.get(1);
name = text;
bitPos = readObjectTailV15(data, bitPos);
} | java | public void readDwgBlockV15(int[] data, int offset) throws Exception {
int bitPos = offset;
bitPos = readObjectHeaderV15(data, bitPos);
Vector v = DwgUtil.getTextString(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
String text = (String)v.get(1);
name = text;
bitPos = readObjectTailV15(data, bitPos);
} | [
"public",
"void",
"readDwgBlockV15",
"(",
"int",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"throws",
"Exception",
"{",
"int",
"bitPos",
"=",
"offset",
";",
"bitPos",
"=",
"readObjectHeaderV15",
"(",
"data",
",",
"bitPos",
")",
";",
"Vector",
"v",
"=",... | Read a Block in the DWG format Version 15
@param data Array of unsigned bytes obtained from the DWG binary file
@param offset The current bit offset where the value begins
@throws Exception If an unexpected bit value is found in the DWG file. Occurs
when we are looking for LwPolylines. | [
"Read",
"a",
"Block",
"in",
"the",
"DWG",
"format",
"Version",
"15"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgBlock.java#L42-L50 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_GET | public OvhDHCPStaticAddress serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_GET(String serviceName, String lanName, String dhcpName, String MACAddress) throws IOException {
String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}";
StringBuilder sb = path(qPath, serviceName, lanName, dhcpName, MACAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDHCPStaticAddress.class);
} | java | public OvhDHCPStaticAddress serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_GET(String serviceName, String lanName, String dhcpName, String MACAddress) throws IOException {
String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}";
StringBuilder sb = path(qPath, serviceName, lanName, dhcpName, MACAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDHCPStaticAddress.class);
} | [
"public",
"OvhDHCPStaticAddress",
"serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_GET",
"(",
"String",
"serviceName",
",",
"String",
"lanName",
",",
"String",
"dhcpName",
",",
"String",
"MACAddress",
")",
"throws",
"IOException",
"{",
"String",
"qP... | Get this object properties
REST: GET /xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}
@param serviceName [required] The internal name of your XDSL offer
@param lanName [required] Name of the LAN
@param dhcpName [required] Name of the DHCP
@param MACAddress [required] The MAC address of the device | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1090-L1095 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryTreeDump.java | QueryTreeDump.appendPath | private static void appendPath(QPath relPath, StringBuilder buffer) {
QPathEntry[] elements = relPath.getEntries();
String slash = "";
for (int i = 0; i < elements.length; i++) {
buffer.append(slash);
slash = "/";
buffer.append(elements[i].getAsString(true));
}
} | java | private static void appendPath(QPath relPath, StringBuilder buffer) {
QPathEntry[] elements = relPath.getEntries();
String slash = "";
for (int i = 0; i < elements.length; i++) {
buffer.append(slash);
slash = "/";
buffer.append(elements[i].getAsString(true));
}
} | [
"private",
"static",
"void",
"appendPath",
"(",
"QPath",
"relPath",
",",
"StringBuilder",
"buffer",
")",
"{",
"QPathEntry",
"[",
"]",
"elements",
"=",
"relPath",
".",
"getEntries",
"(",
")",
";",
"String",
"slash",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i... | Appends the relative path to the <code>buffer</code> using '/' as the
delimiter for path elements.
@param relPath a relative path.
@param buffer the buffer where to append the path. | [
"Appends",
"the",
"relative",
"path",
"to",
"the",
"<code",
">",
"buffer<",
"/",
"code",
">",
"using",
"/",
"as",
"the",
"delimiter",
"for",
"path",
"elements",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryTreeDump.java#L307-L315 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ObjectUtils.java | ObjectUtils.identityToString | public static void identityToString(final Appendable appendable, final Object object) throws IOException {
Validate.notNull(object, "Cannot get the toString of a null identity");
appendable.append(object.getClass().getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(object)));
} | java | public static void identityToString(final Appendable appendable, final Object object) throws IOException {
Validate.notNull(object, "Cannot get the toString of a null identity");
appendable.append(object.getClass().getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(object)));
} | [
"public",
"static",
"void",
"identityToString",
"(",
"final",
"Appendable",
"appendable",
",",
"final",
"Object",
"object",
")",
"throws",
"IOException",
"{",
"Validate",
".",
"notNull",
"(",
"object",
",",
"\"Cannot get the toString of a null identity\"",
")",
";",
... | <p>Appends the toString that would be produced by {@code Object}
if a class did not override toString itself. {@code null}
will throw a NullPointerException for either of the two parameters. </p>
<pre>
ObjectUtils.identityToString(appendable, "") = appendable.append("java.lang.String@1e23"
ObjectUtils.identityToString(appendable, Boolean.TRUE) = appendable.append("java.lang.Boolean@7fa"
ObjectUtils.identityToString(appendable, Boolean.TRUE) = appendable.append("java.lang.Boolean@7fa")
</pre>
@param appendable the appendable to append to
@param object the object to create a toString for
@throws IOException if an I/O error occurs
@since 3.2 | [
"<p",
">",
"Appends",
"the",
"toString",
"that",
"would",
"be",
"produced",
"by",
"{",
"@code",
"Object",
"}",
"if",
"a",
"class",
"did",
"not",
"override",
"toString",
"itself",
".",
"{",
"@code",
"null",
"}",
"will",
"throw",
"a",
"NullPointerException",... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ObjectUtils.java#L357-L362 |
albfernandez/javadbf | src/main/java/com/linuxense/javadbf/Utils.java | Utils.textPadding | @Deprecated
public static byte[] textPadding(String text, String characterSetName, int length, int alignment, byte paddingByte)
throws UnsupportedEncodingException {
DBFAlignment align = DBFAlignment.RIGHT;
if (alignment == ALIGN_LEFT) {
align = DBFAlignment.LEFT;
}
return textPadding(text, characterSetName, length, align, paddingByte);
} | java | @Deprecated
public static byte[] textPadding(String text, String characterSetName, int length, int alignment, byte paddingByte)
throws UnsupportedEncodingException {
DBFAlignment align = DBFAlignment.RIGHT;
if (alignment == ALIGN_LEFT) {
align = DBFAlignment.LEFT;
}
return textPadding(text, characterSetName, length, align, paddingByte);
} | [
"@",
"Deprecated",
"public",
"static",
"byte",
"[",
"]",
"textPadding",
"(",
"String",
"text",
",",
"String",
"characterSetName",
",",
"int",
"length",
",",
"int",
"alignment",
",",
"byte",
"paddingByte",
")",
"throws",
"UnsupportedEncodingException",
"{",
"DBFA... | Text is truncated if exceed field capacity. Uses spaces as padding
@param text the text to write
@param characterSetName The charset to use
@param length field length
@param alignment where to align the data
@param paddingByte the byte to use for padding
@return byte[] to store in the file
@throws UnsupportedEncodingException if characterSetName doesn't exists
@deprecated Use {@link DBFUtils#textPadding(String, Charset, int, DBFAlignment, byte)} | [
"Text",
"is",
"truncated",
"if",
"exceed",
"field",
"capacity",
".",
"Uses",
"spaces",
"as",
"padding"
] | train | https://github.com/albfernandez/javadbf/blob/ac9867b46786cb055bce9323e2cf074365207693/src/main/java/com/linuxense/javadbf/Utils.java#L264-L273 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/cli/CLIUtils.java | CLIUtils.generateArgline | public static String generateArgline(final String scriptpath, final String[] args, final Boolean unsafe) {
return generateArgline(scriptpath, args, " ", unsafe);
} | java | public static String generateArgline(final String scriptpath, final String[] args, final Boolean unsafe) {
return generateArgline(scriptpath, args, " ", unsafe);
} | [
"public",
"static",
"String",
"generateArgline",
"(",
"final",
"String",
"scriptpath",
",",
"final",
"String",
"[",
"]",
"args",
",",
"final",
"Boolean",
"unsafe",
")",
"{",
"return",
"generateArgline",
"(",
"scriptpath",
",",
"args",
",",
"\" \"",
",",
"uns... | Create an appropriately quoted argline to use given the command (script path) and argument strings.
@param scriptpath path to command or script
@param args arguments to pass to the command
@param unsafe whether to use backwards-compatible, known-insecure quoting
@return a String of the command followed by the arguments, where each item which has spaces is appropriately
quoted. Pre-quoted items are not changed during "unsafe" quoting. | [
"Create",
"an",
"appropriately",
"quoted",
"argline",
"to",
"use",
"given",
"the",
"command",
"(",
"script",
"path",
")",
"and",
"argument",
"strings",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/cli/CLIUtils.java#L66-L68 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java | FastDateFormat.getDateTimeInstance | public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
return cache.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale);
} | java | public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
return cache.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale);
} | [
"public",
"static",
"FastDateFormat",
"getDateTimeInstance",
"(",
"final",
"int",
"dateStyle",
",",
"final",
"int",
"timeStyle",
",",
"final",
"TimeZone",
"timeZone",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"cache",
".",
"getDateTimeInstance",
"(",
... | 获得 {@link FastDateFormat} 实例<br>
支持缓存
@param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
@param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
@param timeZone 时区{@link TimeZone}
@param locale {@link Locale} 日期地理位置
@return 本地化 {@link FastDateFormat} | [
"获得",
"{",
"@link",
"FastDateFormat",
"}",
"实例<br",
">",
"支持缓存"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L260-L262 |
zaproxy/zaproxy | src/org/zaproxy/zap/view/StandardFieldsDialog.java | StandardFieldsDialog.addTableField | public void addTableField(String fieldLabel, JTable field, List<JButton> buttons) {
validateNotTabbed();
JScrollPane scrollPane = new JScrollPane();
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setViewportView(field);
field.setFillsViewportHeight(true);
// Tables are a special case - they don't have labels and are accessed via the model
if (this.fieldList.contains(field)) {
throw new IllegalArgumentException("Field already added: " + field);
}
if (buttons == null || buttons.size() == 0) {
if (fieldLabel == null) {
this.getMainPanel().add(scrollPane,
LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D,
GridBagConstraints.BOTH, new Insets(4,4,4,4)));
} else {
this.addField(fieldLabel, field, scrollPane, 1.0D);
}
} else {
JPanel tablePanel = new JPanel();
tablePanel.setLayout(new GridBagLayout());
tablePanel.add(scrollPane,
LayoutHelper.getGBC(0, 0, 1, 1.0D, 1.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4)));
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridBagLayout());
int buttonId = 0;
for (JButton button : buttons) {
buttonPanel.add(button,
LayoutHelper.getGBC(0, buttonId++, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2)));
}
// Add spacer to force buttons to the top
buttonPanel.add(new JLabel(),
LayoutHelper.getGBC(0, buttonId++, 1, 0D, 1.0D, GridBagConstraints.BOTH, new Insets(2,2,2,2)));
tablePanel.add(buttonPanel,
LayoutHelper.getGBC(1, 0, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2)));
if (fieldLabel == null) {
this.getMainPanel().add(tablePanel,
LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D,
GridBagConstraints.BOTH, new Insets(4,4,4,4)));
} else {
this.addField(fieldLabel, field, tablePanel, 1.0D);
}
}
this.fieldList.add(field);
} | java | public void addTableField(String fieldLabel, JTable field, List<JButton> buttons) {
validateNotTabbed();
JScrollPane scrollPane = new JScrollPane();
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setViewportView(field);
field.setFillsViewportHeight(true);
// Tables are a special case - they don't have labels and are accessed via the model
if (this.fieldList.contains(field)) {
throw new IllegalArgumentException("Field already added: " + field);
}
if (buttons == null || buttons.size() == 0) {
if (fieldLabel == null) {
this.getMainPanel().add(scrollPane,
LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D,
GridBagConstraints.BOTH, new Insets(4,4,4,4)));
} else {
this.addField(fieldLabel, field, scrollPane, 1.0D);
}
} else {
JPanel tablePanel = new JPanel();
tablePanel.setLayout(new GridBagLayout());
tablePanel.add(scrollPane,
LayoutHelper.getGBC(0, 0, 1, 1.0D, 1.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4)));
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridBagLayout());
int buttonId = 0;
for (JButton button : buttons) {
buttonPanel.add(button,
LayoutHelper.getGBC(0, buttonId++, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2)));
}
// Add spacer to force buttons to the top
buttonPanel.add(new JLabel(),
LayoutHelper.getGBC(0, buttonId++, 1, 0D, 1.0D, GridBagConstraints.BOTH, new Insets(2,2,2,2)));
tablePanel.add(buttonPanel,
LayoutHelper.getGBC(1, 0, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2)));
if (fieldLabel == null) {
this.getMainPanel().add(tablePanel,
LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D,
GridBagConstraints.BOTH, new Insets(4,4,4,4)));
} else {
this.addField(fieldLabel, field, tablePanel, 1.0D);
}
}
this.fieldList.add(field);
} | [
"public",
"void",
"addTableField",
"(",
"String",
"fieldLabel",
",",
"JTable",
"field",
",",
"List",
"<",
"JButton",
">",
"buttons",
")",
"{",
"validateNotTabbed",
"(",
")",
";",
"JScrollPane",
"scrollPane",
"=",
"new",
"JScrollPane",
"(",
")",
";",
"scrollP... | Add a table field.
@param fieldLabel If null then the table will be full width
@param field the table field
@param buttons if not null then the buttons will be added to the right of the table | [
"Add",
"a",
"table",
"field",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/StandardFieldsDialog.java#L900-L949 |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java | UserGroupManager.createPredefinedUserGroup | @Nonnull
public IUserGroup createPredefinedUserGroup (@Nonnull @Nonempty final String sID,
@Nonnull @Nonempty final String sName,
@Nullable final String sDescription,
@Nullable final Map <String, String> aCustomAttrs)
{
// Create user group
final UserGroup aUserGroup = new UserGroup (StubObject.createForCurrentUserAndID (sID, aCustomAttrs),
sName,
sDescription);
m_aRWLock.writeLocked ( () -> {
// Store
internalCreateItem (aUserGroup);
});
AuditHelper.onAuditCreateSuccess (UserGroup.OT,
aUserGroup.getID (),
"predefined-usergroup",
sName,
sDescription,
aCustomAttrs);
// Execute callback as the very last action
m_aCallbacks.forEach (aCB -> aCB.onUserGroupCreated (aUserGroup, true));
return aUserGroup;
} | java | @Nonnull
public IUserGroup createPredefinedUserGroup (@Nonnull @Nonempty final String sID,
@Nonnull @Nonempty final String sName,
@Nullable final String sDescription,
@Nullable final Map <String, String> aCustomAttrs)
{
// Create user group
final UserGroup aUserGroup = new UserGroup (StubObject.createForCurrentUserAndID (sID, aCustomAttrs),
sName,
sDescription);
m_aRWLock.writeLocked ( () -> {
// Store
internalCreateItem (aUserGroup);
});
AuditHelper.onAuditCreateSuccess (UserGroup.OT,
aUserGroup.getID (),
"predefined-usergroup",
sName,
sDescription,
aCustomAttrs);
// Execute callback as the very last action
m_aCallbacks.forEach (aCB -> aCB.onUserGroupCreated (aUserGroup, true));
return aUserGroup;
} | [
"@",
"Nonnull",
"public",
"IUserGroup",
"createPredefinedUserGroup",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sID",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"@",
"Nullable",
"final",
"String",
"sDescription",
",",
... | Create a predefined user group.
@param sID
The ID to use
@param sName
The name of the user group to create. May neither be
<code>null</code> nor empty.
@param sDescription
The optional description of the user group. May be <code>null</code>
.
@param aCustomAttrs
A set of custom attributes. May be <code>null</code>.
@return The created user group. | [
"Create",
"a",
"predefined",
"user",
"group",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java#L171-L197 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/utilities/scaling/outlier/MixtureModelOutlierScaling.java | MixtureModelOutlierScaling.calcPosterior | protected static double calcPosterior(double f, double alpha, double mu, double sigma, double lambda) {
final double pi = calcP_i(f, mu, sigma);
final double qi = calcQ_i(f, lambda);
return (alpha * pi) / (alpha * pi + (1.0 - alpha) * qi);
} | java | protected static double calcPosterior(double f, double alpha, double mu, double sigma, double lambda) {
final double pi = calcP_i(f, mu, sigma);
final double qi = calcQ_i(f, lambda);
return (alpha * pi) / (alpha * pi + (1.0 - alpha) * qi);
} | [
"protected",
"static",
"double",
"calcPosterior",
"(",
"double",
"f",
",",
"double",
"alpha",
",",
"double",
"mu",
",",
"double",
"sigma",
",",
"double",
"lambda",
")",
"{",
"final",
"double",
"pi",
"=",
"calcP_i",
"(",
"f",
",",
"mu",
",",
"sigma",
")... | Compute the a posterior probability for the given parameters.
@param f value
@param alpha Alpha (mixing) parameter
@param mu Mu (for gaussian)
@param sigma Sigma (for gaussian)
@param lambda Lambda (for exponential)
@return Probability | [
"Compute",
"the",
"a",
"posterior",
"probability",
"for",
"the",
"given",
"parameters",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/utilities/scaling/outlier/MixtureModelOutlierScaling.java#L129-L133 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/BBR.java | BBR.setTolerance | public void setTolerance(double tolerance)
{
if (Double.isNaN(tolerance) || Double.isInfinite(tolerance) || tolerance <= 0)
throw new IllegalArgumentException("Tolerance must be positive, not " + tolerance);
this.tolerance = tolerance;
} | java | public void setTolerance(double tolerance)
{
if (Double.isNaN(tolerance) || Double.isInfinite(tolerance) || tolerance <= 0)
throw new IllegalArgumentException("Tolerance must be positive, not " + tolerance);
this.tolerance = tolerance;
} | [
"public",
"void",
"setTolerance",
"(",
"double",
"tolerance",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"tolerance",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"tolerance",
")",
"||",
"tolerance",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentE... | Sets the convergence tolerance target. Relative changes that are smaller
than the given tolerance will determine convergence.
<br><br>
The default value used is that suggested in the original paper of 0.0005
@param tolerance the positive convergence tolerance goal | [
"Sets",
"the",
"convergence",
"tolerance",
"target",
".",
"Relative",
"changes",
"that",
"are",
"smaller",
"than",
"the",
"given",
"tolerance",
"will",
"determine",
"convergence",
".",
"<br",
">",
"<br",
">",
"The",
"default",
"value",
"used",
"is",
"that",
... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/BBR.java#L217-L222 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesInner.java | DatabasesInner.beginUpgradeDataWarehouse | public void beginUpgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) {
beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body();
} | java | public void beginUpgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) {
beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body();
} | [
"public",
"void",
"beginUpgradeDataWarehouse",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"beginUpgradeDataWarehouseWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseName",
")... | Upgrades a data warehouse.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database to be upgraded.
@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 | [
"Upgrades",
"a",
"data",
"warehouse",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesInner.java#L227-L229 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/tools/BigramExtractor.java | BigramExtractor.processBigram | private void processBigram(String left, String right) {
TokenStats leftStats = getStatsFor(left);
TokenStats rightStats = getStatsFor(right);
// mark that both appeared
leftStats.count++;
rightStats.count++;
// Mark the respective positions of each
leftStats.leftCount++;
rightStats.rightCount++;
// Increase the number of bigrams seen
numBigramsInCorpus++;
// Update the bigram statistics
// Map the two token's indices into a single long
long bigram = (((long)leftStats.index) << 32) | rightStats.index;
Number curBigramCount = bigramCounts.get(bigram);
int i = (curBigramCount == null) ? 1 : 1 + curBigramCount.intValue();
// Compact the count into the smallest numeric type that can represent
// it. This hopefully results in some space savings.
Number val = null;
if (i < Byte.MAX_VALUE)
val = Byte.valueOf((byte)i);
else if (i < Short.MAX_VALUE)
val = Short.valueOf((short)i);
else
val = Integer.valueOf(i);
bigramCounts.put(bigram, val);
} | java | private void processBigram(String left, String right) {
TokenStats leftStats = getStatsFor(left);
TokenStats rightStats = getStatsFor(right);
// mark that both appeared
leftStats.count++;
rightStats.count++;
// Mark the respective positions of each
leftStats.leftCount++;
rightStats.rightCount++;
// Increase the number of bigrams seen
numBigramsInCorpus++;
// Update the bigram statistics
// Map the two token's indices into a single long
long bigram = (((long)leftStats.index) << 32) | rightStats.index;
Number curBigramCount = bigramCounts.get(bigram);
int i = (curBigramCount == null) ? 1 : 1 + curBigramCount.intValue();
// Compact the count into the smallest numeric type that can represent
// it. This hopefully results in some space savings.
Number val = null;
if (i < Byte.MAX_VALUE)
val = Byte.valueOf((byte)i);
else if (i < Short.MAX_VALUE)
val = Short.valueOf((short)i);
else
val = Integer.valueOf(i);
bigramCounts.put(bigram, val);
} | [
"private",
"void",
"processBigram",
"(",
"String",
"left",
",",
"String",
"right",
")",
"{",
"TokenStats",
"leftStats",
"=",
"getStatsFor",
"(",
"left",
")",
";",
"TokenStats",
"rightStats",
"=",
"getStatsFor",
"(",
"right",
")",
";",
"// mark that both appeared... | Updates the statistics for the bigram formed from the provided left and
right token.
@param left the left token in the bigram
@param right the right token in the bigram | [
"Updates",
"the",
"statistics",
"for",
"the",
"bigram",
"formed",
"from",
"the",
"provided",
"left",
"and",
"right",
"token",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/tools/BigramExtractor.java#L177-L210 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/CSSFactory.java | CSSFactory.parseString | public static final StyleSheet parseString(String css, URL base, NetworkProcessor network) throws IOException,
CSSException {
URL baseurl = base;
if (baseurl == null)
baseurl = new URL("file:///base/url/is/not/specified"); //prevent errors if there are still some relative URLs used
return getCSSParserFactory().parse(css, network, null, SourceType.EMBEDDED, baseurl);
} | java | public static final StyleSheet parseString(String css, URL base, NetworkProcessor network) throws IOException,
CSSException {
URL baseurl = base;
if (baseurl == null)
baseurl = new URL("file:///base/url/is/not/specified"); //prevent errors if there are still some relative URLs used
return getCSSParserFactory().parse(css, network, null, SourceType.EMBEDDED, baseurl);
} | [
"public",
"static",
"final",
"StyleSheet",
"parseString",
"(",
"String",
"css",
",",
"URL",
"base",
",",
"NetworkProcessor",
"network",
")",
"throws",
"IOException",
",",
"CSSException",
"{",
"URL",
"baseurl",
"=",
"base",
";",
"if",
"(",
"baseurl",
"==",
"n... | Parses text into a StyleSheet
@param css
Text with CSS declarations
@param base
The URL to be used as a base for loading external resources. Base URL may
be {@code null} if there are no external resources in the CSS string
referenced by relative URLs.
@param network
Network processor for retrieving the URL resources
@return Parsed StyleSheet
@throws IOException
When exception during read occurs
@throws CSSException
When exception during parse occurs | [
"Parses",
"text",
"into",
"a",
"StyleSheet"
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L541-L547 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/ringbuffer/impl/operations/ReplicationOperation.java | ReplicationOperation.getRingbufferConfig | private RingbufferConfig getRingbufferConfig(RingbufferService service, ObjectNamespace ns) {
final String serviceName = ns.getServiceName();
if (RingbufferService.SERVICE_NAME.equals(serviceName)) {
return service.getRingbufferConfig(ns.getObjectName());
} else if (MapService.SERVICE_NAME.equals(serviceName)) {
final MapService mapService = getNodeEngine().getService(MapService.SERVICE_NAME);
final MapEventJournal journal = mapService.getMapServiceContext().getEventJournal();
final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
return journal.toRingbufferConfig(journalConfig, ns);
} else if (CacheService.SERVICE_NAME.equals(serviceName)) {
final CacheService cacheService = getNodeEngine().getService(CacheService.SERVICE_NAME);
final CacheEventJournal journal = cacheService.getEventJournal();
final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
return journal.toRingbufferConfig(journalConfig, ns);
} else {
throw new IllegalArgumentException("Unsupported ringbuffer service name " + serviceName);
}
} | java | private RingbufferConfig getRingbufferConfig(RingbufferService service, ObjectNamespace ns) {
final String serviceName = ns.getServiceName();
if (RingbufferService.SERVICE_NAME.equals(serviceName)) {
return service.getRingbufferConfig(ns.getObjectName());
} else if (MapService.SERVICE_NAME.equals(serviceName)) {
final MapService mapService = getNodeEngine().getService(MapService.SERVICE_NAME);
final MapEventJournal journal = mapService.getMapServiceContext().getEventJournal();
final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
return journal.toRingbufferConfig(journalConfig, ns);
} else if (CacheService.SERVICE_NAME.equals(serviceName)) {
final CacheService cacheService = getNodeEngine().getService(CacheService.SERVICE_NAME);
final CacheEventJournal journal = cacheService.getEventJournal();
final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
return journal.toRingbufferConfig(journalConfig, ns);
} else {
throw new IllegalArgumentException("Unsupported ringbuffer service name " + serviceName);
}
} | [
"private",
"RingbufferConfig",
"getRingbufferConfig",
"(",
"RingbufferService",
"service",
",",
"ObjectNamespace",
"ns",
")",
"{",
"final",
"String",
"serviceName",
"=",
"ns",
".",
"getServiceName",
"(",
")",
";",
"if",
"(",
"RingbufferService",
".",
"SERVICE_NAME",... | Returns the ringbuffer config for the provided namespace. The namespace
provides information whether the requested ringbuffer is a ringbuffer
that the user is directly interacting with through a ringbuffer proxy
or if this is a backing ringbuffer for an event journal.
If a ringbuffer configuration for an event journal is requested, this
method will expect the configuration for the relevant map or cache
to be available.
@param service the ringbuffer service
@param ns the object namespace for which we are creating a ringbuffer
@return the ringbuffer configuration
@throws CacheNotExistsException if a config for a cache event journal was requested
and the cache configuration was not found | [
"Returns",
"the",
"ringbuffer",
"config",
"for",
"the",
"provided",
"namespace",
".",
"The",
"namespace",
"provides",
"information",
"whether",
"the",
"requested",
"ringbuffer",
"is",
"a",
"ringbuffer",
"that",
"the",
"user",
"is",
"directly",
"interacting",
"with... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/ringbuffer/impl/operations/ReplicationOperation.java#L82-L99 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java | LabAccountsInner.listByResourceGroupAsync | public Observable<Page<LabAccountInner>> listByResourceGroupAsync(final String resourceGroupName, final String expand, final String filter, final Integer top, final String orderby) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, expand, filter, top, orderby)
.map(new Func1<ServiceResponse<Page<LabAccountInner>>, Page<LabAccountInner>>() {
@Override
public Page<LabAccountInner> call(ServiceResponse<Page<LabAccountInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<LabAccountInner>> listByResourceGroupAsync(final String resourceGroupName, final String expand, final String filter, final Integer top, final String orderby) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, expand, filter, top, orderby)
.map(new Func1<ServiceResponse<Page<LabAccountInner>>, Page<LabAccountInner>>() {
@Override
public Page<LabAccountInner> call(ServiceResponse<Page<LabAccountInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"LabAccountInner",
">",
">",
"listByResourceGroupAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"expand",
",",
"final",
"String",
"filter",
",",
"final",
"Integer",
"top",
",",
"final",
"Str... | List lab accounts in a resource group.
@param resourceGroupName The name of the resource group.
@param expand Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'
@param filter The filter to apply to the operation.
@param top The maximum number of resources to return from the operation.
@param orderby The ordering expression for the results, using OData notation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<LabAccountInner> object | [
"List",
"lab",
"accounts",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java#L518-L526 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafety.java | ThreadSafety.checkInvocation | public Violation checkInvocation(Type methodType, Symbol symbol) {
if (methodType == null) {
return Violation.absent();
}
List<TypeVariableSymbol> typeParameters = symbol.getTypeParameters();
if (typeParameters.stream().noneMatch(this::hasThreadSafeTypeParameterAnnotation)) {
// fast path
return Violation.absent();
}
ImmutableMap<TypeVariableSymbol, Type> instantiation =
getInstantiation(state.getTypes(), methodType);
// javac does not instantiate all types, so filter out ones that were not instantiated. Ideally
// we wouldn't have to do this.
typeParameters =
typeParameters.stream().filter(instantiation::containsKey).collect(toImmutableList());
return checkInstantiation(
typeParameters, typeParameters.stream().map(instantiation::get).collect(toImmutableList()));
} | java | public Violation checkInvocation(Type methodType, Symbol symbol) {
if (methodType == null) {
return Violation.absent();
}
List<TypeVariableSymbol> typeParameters = symbol.getTypeParameters();
if (typeParameters.stream().noneMatch(this::hasThreadSafeTypeParameterAnnotation)) {
// fast path
return Violation.absent();
}
ImmutableMap<TypeVariableSymbol, Type> instantiation =
getInstantiation(state.getTypes(), methodType);
// javac does not instantiate all types, so filter out ones that were not instantiated. Ideally
// we wouldn't have to do this.
typeParameters =
typeParameters.stream().filter(instantiation::containsKey).collect(toImmutableList());
return checkInstantiation(
typeParameters, typeParameters.stream().map(instantiation::get).collect(toImmutableList()));
} | [
"public",
"Violation",
"checkInvocation",
"(",
"Type",
"methodType",
",",
"Symbol",
"symbol",
")",
"{",
"if",
"(",
"methodType",
"==",
"null",
")",
"{",
"return",
"Violation",
".",
"absent",
"(",
")",
";",
"}",
"List",
"<",
"TypeVariableSymbol",
">",
"type... | Checks the instantiation of any thread-safe type parameters in the current invocation. | [
"Checks",
"the",
"instantiation",
"of",
"any",
"thread",
"-",
"safe",
"type",
"parameters",
"in",
"the",
"current",
"invocation",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafety.java#L873-L892 |
h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/ast/prims/search/AstWhichFunc.java | AstWhichFunc.colwiseWhichVal | private ValFrame colwiseWhichVal(Frame fr, final boolean na_rm) {
Frame res = new Frame();
Vec vec1 = Vec.makeCon(null, 0);
assert vec1.length() == 1;
for (int i = 0; i < fr.numCols(); i++) {
Vec v = fr.vec(i);
double searchValue = op(v);
boolean valid = (v.isNumeric() || v.isTime() || v.isBinary()) && v.length() > 0 && (na_rm || v.naCnt() == 0);
FindIndexCol findIndexCol = new FindIndexCol(searchValue).doAll(new byte[]{Vec.T_NUM}, v);
Vec newvec = vec1.makeCon(valid ? findIndexCol._valIndex : Double.NaN, v.isTime()? Vec.T_TIME : Vec.T_NUM);
res.add(fr.name(i), newvec);
}
vec1.remove();
return new ValFrame(res);
} | java | private ValFrame colwiseWhichVal(Frame fr, final boolean na_rm) {
Frame res = new Frame();
Vec vec1 = Vec.makeCon(null, 0);
assert vec1.length() == 1;
for (int i = 0; i < fr.numCols(); i++) {
Vec v = fr.vec(i);
double searchValue = op(v);
boolean valid = (v.isNumeric() || v.isTime() || v.isBinary()) && v.length() > 0 && (na_rm || v.naCnt() == 0);
FindIndexCol findIndexCol = new FindIndexCol(searchValue).doAll(new byte[]{Vec.T_NUM}, v);
Vec newvec = vec1.makeCon(valid ? findIndexCol._valIndex : Double.NaN, v.isTime()? Vec.T_TIME : Vec.T_NUM);
res.add(fr.name(i), newvec);
}
vec1.remove();
return new ValFrame(res);
} | [
"private",
"ValFrame",
"colwiseWhichVal",
"(",
"Frame",
"fr",
",",
"final",
"boolean",
"na_rm",
")",
"{",
"Frame",
"res",
"=",
"new",
"Frame",
"(",
")",
";",
"Vec",
"vec1",
"=",
"Vec",
".",
"makeCon",
"(",
"null",
",",
"0",
")",
";",
"assert",
"vec1"... | Compute column-wise (i.e.value index of each column), and return a frame having a single row. | [
"Compute",
"column",
"-",
"wise",
"(",
"i",
".",
"e",
".",
"value",
"index",
"of",
"each",
"column",
")",
"and",
"return",
"a",
"frame",
"having",
"a",
"single",
"row",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/ast/prims/search/AstWhichFunc.java#L180-L197 |
ecclesia/kipeto | kipeto-tools/src/main/java/de/ecclesia/kipeto/tools/blueprint/BlueprintFactory.java | BlueprintFactory.fromDir | public Blueprint fromDir(String programId, String description, File rootDir) {
return new Blueprint(programId, description, processDir(rootDir), null);
} | java | public Blueprint fromDir(String programId, String description, File rootDir) {
return new Blueprint(programId, description, processDir(rootDir), null);
} | [
"public",
"Blueprint",
"fromDir",
"(",
"String",
"programId",
",",
"String",
"description",
",",
"File",
"rootDir",
")",
"{",
"return",
"new",
"Blueprint",
"(",
"programId",
",",
"description",
",",
"processDir",
"(",
"rootDir",
")",
",",
"null",
")",
";",
... | Erstellt einen Blueprint aus dem übergebenen RootDir. Blobs und Directorys werden sofort im übergebenen
Repository gespeichert. Der Blueprint selbst wird <b>nicht</b> von gepeichert.<br/>
<br/>
Alle Dateien werden GZIP komprimiert
@param programId
Name
@param description
Beschreibung
@param rootDir
Einstiegsverzeichnis
@return | [
"Erstellt",
"einen",
"Blueprint",
"aus",
"dem",
"übergebenen",
"RootDir",
".",
"Blobs",
"und",
"Directorys",
"werden",
"sofort",
"im",
"übergebenen",
"Repository",
"gespeichert",
".",
"Der",
"Blueprint",
"selbst",
"wird",
"<b",
">",
"nicht<",
"/",
"b",
">",
"v... | train | https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-tools/src/main/java/de/ecclesia/kipeto/tools/blueprint/BlueprintFactory.java#L71-L73 |
meltmedia/cadmium | email/src/main/java/com/meltmedia/cadmium/email/EmailUtil.java | EmailUtil.newHtmlAttachmentBodyPart | public static MimeBodyPart newHtmlAttachmentBodyPart( URL contentUrl, String contentId )
throws MessagingException
{
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setDataHandler(new DataHandler(contentUrl));
if( contentId != null ) {
mimeBodyPart.setHeader("Content-ID", contentId);
}
return mimeBodyPart;
} | java | public static MimeBodyPart newHtmlAttachmentBodyPart( URL contentUrl, String contentId )
throws MessagingException
{
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setDataHandler(new DataHandler(contentUrl));
if( contentId != null ) {
mimeBodyPart.setHeader("Content-ID", contentId);
}
return mimeBodyPart;
} | [
"public",
"static",
"MimeBodyPart",
"newHtmlAttachmentBodyPart",
"(",
"URL",
"contentUrl",
",",
"String",
"contentId",
")",
"throws",
"MessagingException",
"{",
"MimeBodyPart",
"mimeBodyPart",
"=",
"new",
"MimeBodyPart",
"(",
")",
";",
"mimeBodyPart",
".",
"setDataHan... | Creates a body part for an attachment that is used by an html body part. | [
"Creates",
"a",
"body",
"part",
"for",
"an",
"attachment",
"that",
"is",
"used",
"by",
"an",
"html",
"body",
"part",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/email/src/main/java/com/meltmedia/cadmium/email/EmailUtil.java#L102-L111 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/command/CpCommand.java | CpCommand.copyFileToLocal | private void copyFileToLocal(AlluxioURI srcPath, AlluxioURI dstPath)
throws AlluxioException, IOException {
File dstFile = new File(dstPath.getPath());
String randomSuffix =
String.format(".%s_copyToLocal_", RandomStringUtils.randomAlphanumeric(8));
File outputFile;
if (dstFile.isDirectory()) {
outputFile = new File(PathUtils.concatPath(dstFile.getAbsolutePath(), srcPath.getName()));
} else {
outputFile = dstFile;
}
File tmpDst = new File(outputFile.getPath() + randomSuffix);
try (Closer closer = Closer.create()) {
FileInStream is = closer.register(mFileSystem.openFile(srcPath));
FileOutputStream out = closer.register(new FileOutputStream(tmpDst));
byte[] buf = new byte[mCopyToLocalBufferSize];
int t = is.read(buf);
while (t != -1) {
out.write(buf, 0, t);
t = is.read(buf);
}
if (!tmpDst.renameTo(outputFile)) {
throw new IOException(
"Failed to rename " + tmpDst.getPath() + " to destination " + outputFile.getPath());
}
System.out.println("Copied " + srcPath + " to " + "file://" + outputFile.getPath());
} finally {
tmpDst.delete();
}
} | java | private void copyFileToLocal(AlluxioURI srcPath, AlluxioURI dstPath)
throws AlluxioException, IOException {
File dstFile = new File(dstPath.getPath());
String randomSuffix =
String.format(".%s_copyToLocal_", RandomStringUtils.randomAlphanumeric(8));
File outputFile;
if (dstFile.isDirectory()) {
outputFile = new File(PathUtils.concatPath(dstFile.getAbsolutePath(), srcPath.getName()));
} else {
outputFile = dstFile;
}
File tmpDst = new File(outputFile.getPath() + randomSuffix);
try (Closer closer = Closer.create()) {
FileInStream is = closer.register(mFileSystem.openFile(srcPath));
FileOutputStream out = closer.register(new FileOutputStream(tmpDst));
byte[] buf = new byte[mCopyToLocalBufferSize];
int t = is.read(buf);
while (t != -1) {
out.write(buf, 0, t);
t = is.read(buf);
}
if (!tmpDst.renameTo(outputFile)) {
throw new IOException(
"Failed to rename " + tmpDst.getPath() + " to destination " + outputFile.getPath());
}
System.out.println("Copied " + srcPath + " to " + "file://" + outputFile.getPath());
} finally {
tmpDst.delete();
}
} | [
"private",
"void",
"copyFileToLocal",
"(",
"AlluxioURI",
"srcPath",
",",
"AlluxioURI",
"dstPath",
")",
"throws",
"AlluxioException",
",",
"IOException",
"{",
"File",
"dstFile",
"=",
"new",
"File",
"(",
"dstPath",
".",
"getPath",
"(",
")",
")",
";",
"String",
... | Copies a file specified by argv from the filesystem to the local filesystem. This is the
utility function.
@param srcPath The source {@link AlluxioURI} (has to be a file)
@param dstPath The {@link AlluxioURI} of the destination in the local filesystem | [
"Copies",
"a",
"file",
"specified",
"by",
"argv",
"from",
"the",
"filesystem",
"to",
"the",
"local",
"filesystem",
".",
"This",
"is",
"the",
"utility",
"function",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/CpCommand.java#L756-L786 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.getChar | private static char getChar(final String signature, int pos) {
return pos < signature.length() ? signature.charAt(pos) : (char) 0;
} | java | private static char getChar(final String signature, int pos) {
return pos < signature.length() ? signature.charAt(pos) : (char) 0;
} | [
"private",
"static",
"char",
"getChar",
"(",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"return",
"pos",
"<",
"signature",
".",
"length",
"(",
")",
"?",
"signature",
".",
"charAt",
"(",
"pos",
")",
":",
"(",
"char",
")",
"0",
";",
... | Returns the signature car at the given index.
@param signature
a signature.
@param pos
an index in signature.
@return the character at the given index, or 0 if there is no such
character. | [
"Returns",
"the",
"signature",
"car",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L1006-L1008 |
windup/windup | decompiler/api/src/main/java/org/jboss/windup/decompiler/decompiler/AbstractDecompiler.java | AbstractDecompiler.decompileArchive | @Override
public DecompilationResult decompileArchive(Path archive, Path outputDir, DecompilationListener listener) throws DecompilationException
{
return decompileArchive(archive, outputDir, null, listener);
} | java | @Override
public DecompilationResult decompileArchive(Path archive, Path outputDir, DecompilationListener listener) throws DecompilationException
{
return decompileArchive(archive, outputDir, null, listener);
} | [
"@",
"Override",
"public",
"DecompilationResult",
"decompileArchive",
"(",
"Path",
"archive",
",",
"Path",
"outputDir",
",",
"DecompilationListener",
"listener",
")",
"throws",
"DecompilationException",
"{",
"return",
"decompileArchive",
"(",
"archive",
",",
"outputDir"... | Decompiles all .class files and nested archives in the given archive.
<p>
Nested archives will be decompiled into directories matching the name of the archive, e.g.
<code>foo.ear/bar.jar/src/com/foo/bar/Baz.java</code>.
<p>
Required directories will be created as needed.
@param archive The archive containing source files and archives.
@param outputDir The directory where decompiled .java files will be placed.
@returns Result with all decompilation failures. Never throws. | [
"Decompiles",
"all",
".",
"class",
"files",
"and",
"nested",
"archives",
"in",
"the",
"given",
"archive",
".",
"<p",
">",
"Nested",
"archives",
"will",
"be",
"decompiled",
"into",
"directories",
"matching",
"the",
"name",
"of",
"the",
"archive",
"e",
".",
... | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/decompiler/api/src/main/java/org/jboss/windup/decompiler/decompiler/AbstractDecompiler.java#L149-L153 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONSerializer.java | JSONSerializer.toJSON | private static JSON toJSON( JSONString string, JsonConfig jsonConfig ) {
return toJSON( string.toJSONString(), jsonConfig );
} | java | private static JSON toJSON( JSONString string, JsonConfig jsonConfig ) {
return toJSON( string.toJSONString(), jsonConfig );
} | [
"private",
"static",
"JSON",
"toJSON",
"(",
"JSONString",
"string",
",",
"JsonConfig",
"jsonConfig",
")",
"{",
"return",
"toJSON",
"(",
"string",
".",
"toJSONString",
"(",
")",
",",
"jsonConfig",
")",
";",
"}"
] | Creates a JSONObject, JSONArray or a JSONNull from a JSONString.
@throws JSONException if the string is not a valid JSON string | [
"Creates",
"a",
"JSONObject",
"JSONArray",
"or",
"a",
"JSONNull",
"from",
"a",
"JSONString",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONSerializer.java#L125-L127 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.describeImageInStream | public ImageDescription describeImageInStream(byte[] image, DescribeImageInStreamOptionalParameter describeImageInStreamOptionalParameter) {
return describeImageInStreamWithServiceResponseAsync(image, describeImageInStreamOptionalParameter).toBlocking().single().body();
} | java | public ImageDescription describeImageInStream(byte[] image, DescribeImageInStreamOptionalParameter describeImageInStreamOptionalParameter) {
return describeImageInStreamWithServiceResponseAsync(image, describeImageInStreamOptionalParameter).toBlocking().single().body();
} | [
"public",
"ImageDescription",
"describeImageInStream",
"(",
"byte",
"[",
"]",
"image",
",",
"DescribeImageInStreamOptionalParameter",
"describeImageInStreamOptionalParameter",
")",
"{",
"return",
"describeImageInStreamWithServiceResponseAsync",
"(",
"image",
",",
"describeImageIn... | This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL.A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
@param image An image stream.
@param describeImageInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ComputerVisionErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ImageDescription object if successful. | [
"This",
"operation",
"generates",
"a",
"description",
"of",
"an",
"image",
"in",
"human",
"readable",
"language",
"with",
"complete",
"sentences",
".",
"The",
"description",
"is",
"based",
"on",
"a",
"collection",
"of",
"content",
"tags",
"which",
"are",
"also... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L578-L580 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java | ObjectArrayList.removeFromTo | public void removeFromTo(int from, int to) {
checkRangeFromTo(from, to, size);
int numMoved = size - to - 1;
if (numMoved >= 0) {
System.arraycopy(elements, to+1, elements, from, numMoved);
fillFromToWith(from+numMoved, size-1, null); //delta
}
int width = to-from+1;
if (width>0) size -= width;
} | java | public void removeFromTo(int from, int to) {
checkRangeFromTo(from, to, size);
int numMoved = size - to - 1;
if (numMoved >= 0) {
System.arraycopy(elements, to+1, elements, from, numMoved);
fillFromToWith(from+numMoved, size-1, null); //delta
}
int width = to-from+1;
if (width>0) size -= width;
} | [
"public",
"void",
"removeFromTo",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
")",
";",
"int",
"numMoved",
"=",
"size",
"-",
"to",
"-",
"1",
";",
"if",
"(",
"numMoved",
">=",
"0",
")",
... | Removes from the receiver all elements whose index is between
<code>from</code>, inclusive and <code>to</code>, inclusive. Shifts any succeeding
elements to the left (reduces their index).
This call shortens the list by <tt>(to - from + 1)</tt> elements.
@param from index of first element to be removed.
@param to index of last element to be removed.
@exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>). | [
"Removes",
"from",
"the",
"receiver",
"all",
"elements",
"whose",
"index",
"is",
"between",
"<code",
">",
"from<",
"/",
"code",
">",
"inclusive",
"and",
"<code",
">",
"to<",
"/",
"code",
">",
"inclusive",
".",
"Shifts",
"any",
"succeeding",
"elements",
"to... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java#L665-L674 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java | TasksImpl.listWithServiceResponseAsync | public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> listWithServiceResponseAsync(final String jobId, final TaskListOptions taskListOptions) {
return listSinglePageAsync(jobId, taskListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
TaskListNextOptions taskListNextOptions = null;
if (taskListOptions != null) {
taskListNextOptions = new TaskListNextOptions();
taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId());
taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId());
taskListNextOptions.withOcpDate(taskListOptions.ocpDate());
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, taskListNextOptions));
}
});
} | java | public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> listWithServiceResponseAsync(final String jobId, final TaskListOptions taskListOptions) {
return listSinglePageAsync(jobId, taskListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
TaskListNextOptions taskListNextOptions = null;
if (taskListOptions != null) {
taskListNextOptions = new TaskListNextOptions();
taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId());
taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId());
taskListNextOptions.withOcpDate(taskListOptions.ocpDate());
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, taskListNextOptions));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudTask",
">",
",",
"TaskListHeaders",
">",
">",
"listWithServiceResponseAsync",
"(",
"final",
"String",
"jobId",
",",
"final",
"TaskListOptions",
"taskListOptions",
")",
"{",
"return",
... | Lists all of the tasks that are associated with the specified job.
For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks.
@param jobId The ID of the job.
@param taskListOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CloudTask> object | [
"Lists",
"all",
"of",
"the",
"tasks",
"that",
"are",
"associated",
"with",
"the",
"specified",
"job",
".",
"For",
"multi",
"-",
"instance",
"tasks",
"information",
"such",
"as",
"affinityId",
"executionInfo",
"and",
"nodeInfo",
"refer",
"to",
"the",
"primary",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L556-L575 |
james-hu/jabb-core | src/main/java/net/sf/jabb/spring/service/AbstractThreadPoolService.java | AbstractThreadPoolService.setConfigurations | protected void setConfigurations(String commonPrefix, PropertySourcesPropertyResolver resolver){
setConfigurationsCommonPrefix(commonPrefix);
setConfigurations(resolver);
setDefaultCoreSize(resolver.getProperty(commonPrefix + "defaultCoreSize", Integer.class, defaultCoreSize));
setDefaultMaxSize(resolver.getProperty(commonPrefix + "defaultMaxSize", Integer.class, defaultMaxSize));
setDefaultKeepAliveSeconds(resolver.getProperty(commonPrefix + "defaultKeepAliveSeconds", Long.class, defaultKeepAliveSeconds));
setDefaultQueueSize(resolver.getProperty(commonPrefix + "defaultQueueSize", Integer.class, defaultQueueSize));
setDefaultAllowCoreThreadTimeout(resolver.getProperty(commonPrefix + "defaultAllowCoreThreadTimeout", Boolean.class, defaultAllowCoreThreadTimeout));
setShutdownWaitSeconds(resolver.getProperty(commonPrefix + "shutdownWaitSeconds", Long.class, shutdownWaitSeconds));
} | java | protected void setConfigurations(String commonPrefix, PropertySourcesPropertyResolver resolver){
setConfigurationsCommonPrefix(commonPrefix);
setConfigurations(resolver);
setDefaultCoreSize(resolver.getProperty(commonPrefix + "defaultCoreSize", Integer.class, defaultCoreSize));
setDefaultMaxSize(resolver.getProperty(commonPrefix + "defaultMaxSize", Integer.class, defaultMaxSize));
setDefaultKeepAliveSeconds(resolver.getProperty(commonPrefix + "defaultKeepAliveSeconds", Long.class, defaultKeepAliveSeconds));
setDefaultQueueSize(resolver.getProperty(commonPrefix + "defaultQueueSize", Integer.class, defaultQueueSize));
setDefaultAllowCoreThreadTimeout(resolver.getProperty(commonPrefix + "defaultAllowCoreThreadTimeout", Boolean.class, defaultAllowCoreThreadTimeout));
setShutdownWaitSeconds(resolver.getProperty(commonPrefix + "shutdownWaitSeconds", Long.class, shutdownWaitSeconds));
} | [
"protected",
"void",
"setConfigurations",
"(",
"String",
"commonPrefix",
",",
"PropertySourcesPropertyResolver",
"resolver",
")",
"{",
"setConfigurationsCommonPrefix",
"(",
"commonPrefix",
")",
";",
"setConfigurations",
"(",
"resolver",
")",
";",
"setDefaultCoreSize",
"("... | Set configurations. This methods sets/overrides both the default configurations and the per-pool configurations.
@param commonPrefix the common prefix in the keys, for example, "threadPools."
@param resolver the configuration properties resolver | [
"Set",
"configurations",
".",
"This",
"methods",
"sets",
"/",
"overrides",
"both",
"the",
"default",
"configurations",
"and",
"the",
"per",
"-",
"pool",
"configurations",
"."
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/service/AbstractThreadPoolService.java#L165-L175 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java | EscapedFunctions.sqllocate | public static String sqllocate(List<?> parsedArgs) throws SQLException {
if (parsedArgs.size() == 2) {
return "position(" + parsedArgs.get(0) + " in " + parsedArgs.get(1) + ")";
} else if (parsedArgs.size() == 3) {
String tmp = "position(" + parsedArgs.get(0) + " in substring(" + parsedArgs.get(1) + " from "
+ parsedArgs.get(2) + "))";
return "(" + parsedArgs.get(2) + "*sign(" + tmp + ")+" + tmp + ")";
} else {
throw new PSQLException(GT.tr("{0} function takes two or three arguments.", "locate"),
PSQLState.SYNTAX_ERROR);
}
} | java | public static String sqllocate(List<?> parsedArgs) throws SQLException {
if (parsedArgs.size() == 2) {
return "position(" + parsedArgs.get(0) + " in " + parsedArgs.get(1) + ")";
} else if (parsedArgs.size() == 3) {
String tmp = "position(" + parsedArgs.get(0) + " in substring(" + parsedArgs.get(1) + " from "
+ parsedArgs.get(2) + "))";
return "(" + parsedArgs.get(2) + "*sign(" + tmp + ")+" + tmp + ")";
} else {
throw new PSQLException(GT.tr("{0} function takes two or three arguments.", "locate"),
PSQLState.SYNTAX_ERROR);
}
} | [
"public",
"static",
"String",
"sqllocate",
"(",
"List",
"<",
"?",
">",
"parsedArgs",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"parsedArgs",
".",
"size",
"(",
")",
"==",
"2",
")",
"{",
"return",
"\"position(\"",
"+",
"parsedArgs",
".",
"get",
"(",
... | locate translation.
@param parsedArgs arguments
@return sql call
@throws SQLException if something wrong happens | [
"locate",
"translation",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java#L302-L313 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/TransformationsInner.java | TransformationsInner.getAsync | public Observable<TransformationInner> getAsync(String resourceGroupName, String jobName, String transformationName) {
return getWithServiceResponseAsync(resourceGroupName, jobName, transformationName).map(new Func1<ServiceResponseWithHeaders<TransformationInner, TransformationsGetHeaders>, TransformationInner>() {
@Override
public TransformationInner call(ServiceResponseWithHeaders<TransformationInner, TransformationsGetHeaders> response) {
return response.body();
}
});
} | java | public Observable<TransformationInner> getAsync(String resourceGroupName, String jobName, String transformationName) {
return getWithServiceResponseAsync(resourceGroupName, jobName, transformationName).map(new Func1<ServiceResponseWithHeaders<TransformationInner, TransformationsGetHeaders>, TransformationInner>() {
@Override
public TransformationInner call(ServiceResponseWithHeaders<TransformationInner, TransformationsGetHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TransformationInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"String",
"transformationName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"jobName",
",",
"t... | Gets details about the specified transformation.
@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 transformationName The name of the transformation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TransformationInner object | [
"Gets",
"details",
"about",
"the",
"specified",
"transformation",
"."
] | 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/TransformationsInner.java#L519-L526 |
infinispan/infinispan | core/src/main/java/org/infinispan/statetransfer/StateTransferInterceptor.java | StateTransferInterceptor.handleNonTxWriteCommand | private Object handleNonTxWriteCommand(InvocationContext ctx, WriteCommand command) {
if (trace) log.tracef("handleNonTxWriteCommand for command %s, topology id %d", command, command.getTopologyId());
updateTopologyId(command);
// Only catch OutdatedTopologyExceptions on the originator
if (!ctx.isOriginLocal()) {
return invokeNext(ctx, command);
}
return invokeNextAndHandle(ctx, command, handleNonTxWriteReturn);
} | java | private Object handleNonTxWriteCommand(InvocationContext ctx, WriteCommand command) {
if (trace) log.tracef("handleNonTxWriteCommand for command %s, topology id %d", command, command.getTopologyId());
updateTopologyId(command);
// Only catch OutdatedTopologyExceptions on the originator
if (!ctx.isOriginLocal()) {
return invokeNext(ctx, command);
}
return invokeNextAndHandle(ctx, command, handleNonTxWriteReturn);
} | [
"private",
"Object",
"handleNonTxWriteCommand",
"(",
"InvocationContext",
"ctx",
",",
"WriteCommand",
"command",
")",
"{",
"if",
"(",
"trace",
")",
"log",
".",
"tracef",
"(",
"\"handleNonTxWriteCommand for command %s, topology id %d\"",
",",
"command",
",",
"command",
... | For non-tx write commands, we retry the command locally if the topology changed.
But we only retry on the originator, and only if the command doesn't have
the {@code CACHE_MODE_LOCAL} flag. | [
"For",
"non",
"-",
"tx",
"write",
"commands",
"we",
"retry",
"the",
"command",
"locally",
"if",
"the",
"topology",
"changed",
".",
"But",
"we",
"only",
"retry",
"on",
"the",
"originator",
"and",
"only",
"if",
"the",
"command",
"doesn",
"t",
"have",
"the"... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/statetransfer/StateTransferInterceptor.java#L299-L310 |
jbundle/jbundle | app/program/screen/src/main/java/org/jbundle/app/program/screen/JavaButton.java | JavaButton.controlToField | public int controlToField()
{
int iErrorCode = super.controlToField();
if (m_classInfo != null)
{
TaskScheduler js = BaseApplet.getSharedInstance().getApplication().getTaskScheduler();
String strJob = Utility.addURLParam(null, DBParams.SCREEN, ".app.program.manual.util.WriteClassesScreen");
strJob = Utility.addURLParam(strJob, "fileName", m_classInfo.getField(ClassInfo.CLASS_SOURCE_FILE).toString());
strJob = Utility.addURLParam(strJob, "package", m_classInfo.getField(ClassInfo.CLASS_PACKAGE).toString());
strJob = Utility.addURLParam(strJob, "project", Converter.stripNonNumber(m_classInfo.getField(ClassInfo.CLASS_PROJECT_ID).toString()));
strJob = Utility.addURLParam(strJob, DBParams.TASK, DBConstants.SAPPLET); // Screen class
js.addTask(strJob);
//BasePanel parentScreen = Screen.makeWindow(this.getParentScreen().getTask().getApplication());
//WriteJava screen = new WriteJava(null, null, parentScreen, null, ScreenConstants.DISPLAY_FIELD_DESC, m_classInfo.getField(ClassInfo.CLASS_SOURCE_FILE), m_classInfo.getField(ClassInfo.CLASS_PACKAGE));
//screen.writeFileDesc(); // Write the code
//BasePanel panel = screen.getRootScreen();
//panel.free();
}
return iErrorCode;
} | java | public int controlToField()
{
int iErrorCode = super.controlToField();
if (m_classInfo != null)
{
TaskScheduler js = BaseApplet.getSharedInstance().getApplication().getTaskScheduler();
String strJob = Utility.addURLParam(null, DBParams.SCREEN, ".app.program.manual.util.WriteClassesScreen");
strJob = Utility.addURLParam(strJob, "fileName", m_classInfo.getField(ClassInfo.CLASS_SOURCE_FILE).toString());
strJob = Utility.addURLParam(strJob, "package", m_classInfo.getField(ClassInfo.CLASS_PACKAGE).toString());
strJob = Utility.addURLParam(strJob, "project", Converter.stripNonNumber(m_classInfo.getField(ClassInfo.CLASS_PROJECT_ID).toString()));
strJob = Utility.addURLParam(strJob, DBParams.TASK, DBConstants.SAPPLET); // Screen class
js.addTask(strJob);
//BasePanel parentScreen = Screen.makeWindow(this.getParentScreen().getTask().getApplication());
//WriteJava screen = new WriteJava(null, null, parentScreen, null, ScreenConstants.DISPLAY_FIELD_DESC, m_classInfo.getField(ClassInfo.CLASS_SOURCE_FILE), m_classInfo.getField(ClassInfo.CLASS_PACKAGE));
//screen.writeFileDesc(); // Write the code
//BasePanel panel = screen.getRootScreen();
//panel.free();
}
return iErrorCode;
} | [
"public",
"int",
"controlToField",
"(",
")",
"{",
"int",
"iErrorCode",
"=",
"super",
".",
"controlToField",
"(",
")",
";",
"if",
"(",
"m_classInfo",
"!=",
"null",
")",
"{",
"TaskScheduler",
"js",
"=",
"BaseApplet",
".",
"getSharedInstance",
"(",
")",
".",
... | Move the control's value to the field.
@return An error value. | [
"Move",
"the",
"control",
"s",
"value",
"to",
"the",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/screen/JavaButton.java#L66-L85 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate3NonNegative | public static int[] validate3NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate3(data, paramName);
} | java | public static int[] validate3NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate3(data, paramName);
} | [
"public",
"static",
"int",
"[",
"]",
"validate3NonNegative",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"validateNonNegative",
"(",
"data",
",",
"paramName",
")",
";",
"return",
"validate3",
"(",
"data",
",",
"paramName",
")",
";",... | Reformats the input array to a length 3 array and checks that all values >= 0.
If the array is length 1, returns [a, a, a]
If the array is length 3, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 3 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"3",
"array",
"and",
"checks",
"that",
"all",
"values",
">",
"=",
"0",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L230-L233 |
phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.newLineAtOffset | public void newLineAtOffset (final float tx, final float ty) throws IOException
{
if (!inTextMode)
{
throw new IllegalStateException ("Error: must call beginText() before newLineAtOffset()");
}
writeOperand (tx);
writeOperand (ty);
writeOperator ((byte) 'T', (byte) 'd');
} | java | public void newLineAtOffset (final float tx, final float ty) throws IOException
{
if (!inTextMode)
{
throw new IllegalStateException ("Error: must call beginText() before newLineAtOffset()");
}
writeOperand (tx);
writeOperand (ty);
writeOperator ((byte) 'T', (byte) 'd');
} | [
"public",
"void",
"newLineAtOffset",
"(",
"final",
"float",
"tx",
",",
"final",
"float",
"ty",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: must call beginText() before newLineAtOf... | The Td operator. Move to the start of the next line, offset from the start
of the current line by (tx, ty).
@param tx
The x translation.
@param ty
The y translation.
@throws IOException
If there is an error writing to the stream.
@throws IllegalStateException
If the method was not allowed to be called at this time. | [
"The",
"Td",
"operator",
".",
"Move",
"to",
"the",
"start",
"of",
"the",
"next",
"line",
"offset",
"from",
"the",
"start",
"of",
"the",
"current",
"line",
"by",
"(",
"tx",
"ty",
")",
"."
] | train | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L443-L452 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosCommentsApi.java | PhotosCommentsApi.getList | public Comments getList(String photoId, String minCommentDate, String maxCommentDate, boolean sign) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.comments.getList");
params.put("photo_id", photoId);
if (!JinxUtils.isNullOrEmpty(minCommentDate)) {
params.put("min_comment_date", minCommentDate);
}
if (!JinxUtils.isNullOrEmpty(maxCommentDate)) {
params.put("max_comment_date", maxCommentDate);
}
return jinx.flickrGet(params, Comments.class, sign);
} | java | public Comments getList(String photoId, String minCommentDate, String maxCommentDate, boolean sign) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.comments.getList");
params.put("photo_id", photoId);
if (!JinxUtils.isNullOrEmpty(minCommentDate)) {
params.put("min_comment_date", minCommentDate);
}
if (!JinxUtils.isNullOrEmpty(maxCommentDate)) {
params.put("max_comment_date", maxCommentDate);
}
return jinx.flickrGet(params, Comments.class, sign);
} | [
"public",
"Comments",
"getList",
"(",
"String",
"photoId",
",",
"String",
"minCommentDate",
",",
"String",
"maxCommentDate",
",",
"boolean",
"sign",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
")",
";",
"Map",
"<",
... | Returns the comments for a photo
<br>
This method does not require authentication. You can choose to sign the call by passing true or false
as the value of the sign parameter.
<br>
@param photoId (Required) The id of the photo to fetch comments for.
@param minCommentDate (Optional) Minimum date that a a comment was added. The date should be in the form of a unix timestamp.
@param maxCommentDate (Optional) Maximum date that a comment was added. The date should be in the form of a unix timestamp.
@param sign if true, the request will be signed.
@return object with a list of comments for the specified photo.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.comments.getList.html">flickr.photos.comments.getList</a> | [
"Returns",
"the",
"comments",
"for",
"a",
"photo",
"<br",
">",
"This",
"method",
"does",
"not",
"require",
"authentication",
".",
"You",
"can",
"choose",
"to",
"sign",
"the",
"call",
"by",
"passing",
"true",
"or",
"false",
"as",
"the",
"value",
"of",
"th... | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosCommentsApi.java#L121-L133 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurealert.java | br_configurealert.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_configurealert_responses result = (br_configurealert_responses) service.get_payload_formatter().string_to_resource(br_configurealert_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.br_configurealert_response_array);
}
br_configurealert[] result_br_configurealert = new br_configurealert[result.br_configurealert_response_array.length];
for(int i = 0; i < result.br_configurealert_response_array.length; i++)
{
result_br_configurealert[i] = result.br_configurealert_response_array[i].br_configurealert[0];
}
return result_br_configurealert;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_configurealert_responses result = (br_configurealert_responses) service.get_payload_formatter().string_to_resource(br_configurealert_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.br_configurealert_response_array);
}
br_configurealert[] result_br_configurealert = new br_configurealert[result.br_configurealert_response_array.length];
for(int i = 0; i < result.br_configurealert_response_array.length; i++)
{
result_br_configurealert[i] = result.br_configurealert_response_array[i].br_configurealert[0];
}
return result_br_configurealert;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"br_configurealert_responses",
"result",
"=",
"(",
"br_configurealert_responses",
")",
"service",
".",
"get_pa... | <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/br/br_configurealert.java#L178-L195 |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/text/TokenStream.java | TokenStream.consumeLong | public long consumeLong() throws ParsingException, IllegalStateException {
if (completed) throwNoMoreContent();
// Get the value from the current token ...
String value = currentToken().value();
try {
long result = Long.parseLong(value);
moveToNextToken();
return result;
} catch (NumberFormatException e) {
Position position = currentToken().position();
String msg = CommonI18n.expectingValidLongAtLineAndColumn.text(value, position.getLine(), position.getColumn());
throw new ParsingException(position, msg);
}
} | java | public long consumeLong() throws ParsingException, IllegalStateException {
if (completed) throwNoMoreContent();
// Get the value from the current token ...
String value = currentToken().value();
try {
long result = Long.parseLong(value);
moveToNextToken();
return result;
} catch (NumberFormatException e) {
Position position = currentToken().position();
String msg = CommonI18n.expectingValidLongAtLineAndColumn.text(value, position.getLine(), position.getColumn());
throw new ParsingException(position, msg);
}
} | [
"public",
"long",
"consumeLong",
"(",
")",
"throws",
"ParsingException",
",",
"IllegalStateException",
"{",
"if",
"(",
"completed",
")",
"throwNoMoreContent",
"(",
")",
";",
"// Get the value from the current token ...",
"String",
"value",
"=",
"currentToken",
"(",
")... | Convert the value of this token to a long, return it, and move to the next token.
@return the current token's value, converted to an integer
@throws ParsingException if there is no such token to consume, or if the token cannot be converted to a long
@throws IllegalStateException if this method was called before the stream was {@link #start() started} | [
"Convert",
"the",
"value",
"of",
"this",
"token",
"to",
"a",
"long",
"return",
"it",
"and",
"move",
"to",
"the",
"next",
"token",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/text/TokenStream.java#L502-L515 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/RowColumnOps.java | RowColumnOps.addMultCol | public static void addMultCol(Matrix A, int j, int start, int to, double t, double[] c)
{
for(int i = start; i < to; i++)
A.increment(i, j, c[i]*t);
} | java | public static void addMultCol(Matrix A, int j, int start, int to, double t, double[] c)
{
for(int i = start; i < to; i++)
A.increment(i, j, c[i]*t);
} | [
"public",
"static",
"void",
"addMultCol",
"(",
"Matrix",
"A",
",",
"int",
"j",
",",
"int",
"start",
",",
"int",
"to",
",",
"double",
"t",
",",
"double",
"[",
"]",
"c",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"to",
";",
... | Updates the values of column <tt>j</tt> in the given matrix to be A[:,j] = A[:,j]+c[:]*<tt>t</tt>.<br>
The Matrix <tt>A</tt> and array <tt>c</tt> do not need to have the same dimensions, so long as they both have indices in the given range.
@param A the matrix to perform he update on
@param j the row to update
@param start the first index of the row to update from (inclusive)
@param to the last index of the row to update (exclusive)
@param t the constant to multiply all elements of <tt>c</tt> by
@param c the array of values to pairwise multiply by <tt>t</tt> before adding to the elements of A | [
"Updates",
"the",
"values",
"of",
"column",
"<tt",
">",
"j<",
"/",
"tt",
">",
"in",
"the",
"given",
"matrix",
"to",
"be",
"A",
"[",
":",
"j",
"]",
"=",
"A",
"[",
":",
"j",
"]",
"+",
"c",
"[",
":",
"]",
"*",
"<tt",
">",
"t<",
"/",
"tt",
">... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L327-L331 |
graphhopper/map-matching | hmm-lib/src/main/java/com/bmw/hmm/ViterbiAlgorithm.java | ViterbiAlgorithm.hmmBreak | private boolean hmmBreak(Map<S, Double> message) {
for (double logProbability : message.values()) {
if (logProbability != Double.NEGATIVE_INFINITY) {
return false;
}
}
return true;
} | java | private boolean hmmBreak(Map<S, Double> message) {
for (double logProbability : message.values()) {
if (logProbability != Double.NEGATIVE_INFINITY) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"hmmBreak",
"(",
"Map",
"<",
"S",
",",
"Double",
">",
"message",
")",
"{",
"for",
"(",
"double",
"logProbability",
":",
"message",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"logProbability",
"!=",
"Double",
".",
"NEGATIVE_INFINI... | Returns whether the specified message is either empty or only contains state candidates
with zero probability and thus causes the HMM to break. | [
"Returns",
"whether",
"the",
"specified",
"message",
"is",
"either",
"empty",
"or",
"only",
"contains",
"state",
"candidates",
"with",
"zero",
"probability",
"and",
"thus",
"causes",
"the",
"HMM",
"to",
"break",
"."
] | train | https://github.com/graphhopper/map-matching/blob/32cd83f14cb990c2be83c8781f22dfb59e0dbeb4/hmm-lib/src/main/java/com/bmw/hmm/ViterbiAlgorithm.java#L298-L305 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/EpicsApi.java | EpicsApi.updateIssue | public EpicIssue updateIssue(Object groupIdOrPath, Integer epicIid, Integer issueIid, Integer moveBeforeId, Integer moveAfterId) throws GitLabApiException {
GitLabApiForm form = new GitLabApiForm()
.withParam("move_before_id", moveBeforeId)
.withParam("move_after_id", moveAfterId);
Response response = post(Response.Status.OK, form,
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "issues", issueIid);
return (response.readEntity(EpicIssue.class));
} | java | public EpicIssue updateIssue(Object groupIdOrPath, Integer epicIid, Integer issueIid, Integer moveBeforeId, Integer moveAfterId) throws GitLabApiException {
GitLabApiForm form = new GitLabApiForm()
.withParam("move_before_id", moveBeforeId)
.withParam("move_after_id", moveAfterId);
Response response = post(Response.Status.OK, form,
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "issues", issueIid);
return (response.readEntity(EpicIssue.class));
} | [
"public",
"EpicIssue",
"updateIssue",
"(",
"Object",
"groupIdOrPath",
",",
"Integer",
"epicIid",
",",
"Integer",
"issueIid",
",",
"Integer",
"moveBeforeId",
",",
"Integer",
"moveAfterId",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"form",
"=",
"new",... | Updates an epic - issue association.
<pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_iid/issues/:issue_id</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param epicIid the Epic IID that the issue is assigned to
@param issueIid the issue IID to update
@param moveBeforeId the ID of the issue - epic association that should be placed before the link in the question (optional)
@param moveAfterId the ID of the issue - epic association that should be placed after the link in the question (optional)
@return an EpicIssue instance containing info on the newly assigned epic issue
@throws GitLabApiException if any exception occurs | [
"Updates",
"an",
"epic",
"-",
"issue",
"association",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/EpicsApi.java#L452-L459 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ReflectiveVisitorHelper.java | ReflectiveVisitorHelper.getMethod | private Method getMethod(Class visitorClass, Object argument) {
ClassVisitMethods visitMethods = (ClassVisitMethods) this.visitorClassVisitMethods
.get(visitorClass);
return visitMethods.getVisitMethod(argument != null ? argument
.getClass() : null);
} | java | private Method getMethod(Class visitorClass, Object argument) {
ClassVisitMethods visitMethods = (ClassVisitMethods) this.visitorClassVisitMethods
.get(visitorClass);
return visitMethods.getVisitMethod(argument != null ? argument
.getClass() : null);
} | [
"private",
"Method",
"getMethod",
"(",
"Class",
"visitorClass",
",",
"Object",
"argument",
")",
"{",
"ClassVisitMethods",
"visitMethods",
"=",
"(",
"ClassVisitMethods",
")",
"this",
".",
"visitorClassVisitMethods",
".",
"get",
"(",
"visitorClass",
")",
";",
"retur... | Determines the most appropriate visit method for the given visitor class
and argument. | [
"Determines",
"the",
"most",
"appropriate",
"visit",
"method",
"for",
"the",
"given",
"visitor",
"class",
"and",
"argument",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ReflectiveVisitorHelper.java#L114-L119 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-store/xwiki-commons-crypto-store-filesystem/src/main/java/org/xwiki/crypto/store/filesystem/internal/AbstractX509FileSystemStore.java | AbstractX509FileSystemStore.writeHeader | private static void writeHeader(BufferedWriter out, String type) throws IOException
{
out.write(PEM_BEGIN + type + DASHES);
out.newLine();
} | java | private static void writeHeader(BufferedWriter out, String type) throws IOException
{
out.write(PEM_BEGIN + type + DASHES);
out.newLine();
} | [
"private",
"static",
"void",
"writeHeader",
"(",
"BufferedWriter",
"out",
",",
"String",
"type",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"PEM_BEGIN",
"+",
"type",
"+",
"DASHES",
")",
";",
"out",
".",
"newLine",
"(",
")",
";",
"}"
] | Write a PEM like header.
@param out the output buffered writer to write to.
@param type the type to be written in the header.
@throws IOException on error. | [
"Write",
"a",
"PEM",
"like",
"header",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-store/xwiki-commons-crypto-store-filesystem/src/main/java/org/xwiki/crypto/store/filesystem/internal/AbstractX509FileSystemStore.java#L117-L121 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/KnowledgeSwitchYardScanner.java | KnowledgeSwitchYardScanner.toManifestModel | protected ManifestModel toManifestModel(Manifest[] manifestAnnotations, KnowledgeNamespace knowledgeNamespace) {
if (manifestAnnotations == null || manifestAnnotations.length == 0) {
return null;
}
Manifest manifestAnnotation = manifestAnnotations[0];
ManifestModel manifestModel = new V1ManifestModel(knowledgeNamespace.uri());
Container[] container = manifestAnnotation.container();
if (container != null && container.length > 0) {
manifestModel.setContainer(toContainerModel(container[0], knowledgeNamespace));
}
manifestModel.setResources(toResourcesModel(manifestAnnotation.resources(), knowledgeNamespace));
return manifestModel;
} | java | protected ManifestModel toManifestModel(Manifest[] manifestAnnotations, KnowledgeNamespace knowledgeNamespace) {
if (manifestAnnotations == null || manifestAnnotations.length == 0) {
return null;
}
Manifest manifestAnnotation = manifestAnnotations[0];
ManifestModel manifestModel = new V1ManifestModel(knowledgeNamespace.uri());
Container[] container = manifestAnnotation.container();
if (container != null && container.length > 0) {
manifestModel.setContainer(toContainerModel(container[0], knowledgeNamespace));
}
manifestModel.setResources(toResourcesModel(manifestAnnotation.resources(), knowledgeNamespace));
return manifestModel;
} | [
"protected",
"ManifestModel",
"toManifestModel",
"(",
"Manifest",
"[",
"]",
"manifestAnnotations",
",",
"KnowledgeNamespace",
"knowledgeNamespace",
")",
"{",
"if",
"(",
"manifestAnnotations",
"==",
"null",
"||",
"manifestAnnotations",
".",
"length",
"==",
"0",
")",
... | Converts manifest annotations to manifest model.
@param manifestAnnotations annotations
@param knowledgeNamespace knowledgeNamespace
@return model | [
"Converts",
"manifest",
"annotations",
"to",
"manifest",
"model",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/KnowledgeSwitchYardScanner.java#L210-L222 |
strator-dev/greenpepper | greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/phpDriver/PHPDriverHelper.java | PHPDriverHelper.createTmpPhpFileFromResource | public static File createTmpPhpFileFromResource(String resourceName, boolean deleteOnExit) throws IOException {
InputStream is = getInstance().getClass().getResourceAsStream(resourceName);
if (is == null) {
throw new IOException("Unable to find php file " + resourceName);
}
return copyFile(is, deleteOnExit);
} | java | public static File createTmpPhpFileFromResource(String resourceName, boolean deleteOnExit) throws IOException {
InputStream is = getInstance().getClass().getResourceAsStream(resourceName);
if (is == null) {
throw new IOException("Unable to find php file " + resourceName);
}
return copyFile(is, deleteOnExit);
} | [
"public",
"static",
"File",
"createTmpPhpFileFromResource",
"(",
"String",
"resourceName",
",",
"boolean",
"deleteOnExit",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"getInstance",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getResourceAsStream",
... | <p>createTmpPhpFileFromResource.</p>
@param resourceName a {@link java.lang.String} object.
@param deleteOnExit a boolean.
@return a {@link java.io.File} object.
@throws java.io.IOException if any. | [
"<p",
">",
"createTmpPhpFileFromResource",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/phpDriver/PHPDriverHelper.java#L127-L133 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java | ConstantsSummaryBuilder.buildConstantSummary | public void buildConstantSummary(XMLNode node, Content contentTree) throws DocletException {
contentTree = writer.getHeader();
buildChildren(node, contentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
} | java | public void buildConstantSummary(XMLNode node, Content contentTree) throws DocletException {
contentTree = writer.getHeader();
buildChildren(node, contentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
} | [
"public",
"void",
"buildConstantSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"throws",
"DocletException",
"{",
"contentTree",
"=",
"writer",
".",
"getHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"contentTree",
")",
";",
"... | Build the constant summary.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation | [
"Build",
"the",
"constant",
"summary",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java#L154-L159 |
google/closure-templates | java/src/com/google/template/soy/soytree/TagName.java | TagName.checkCloseTagClosesOptional | public static boolean checkCloseTagClosesOptional(TagName closeTag, TagName optionalOpenTag) {
// TODO(b/120994894): Replace this with checkArgument() when HtmlTagEntry can be replaced.
if (!optionalOpenTag.isStatic() || !optionalOpenTag.isDefinitelyOptional()) {
return false;
}
if (!closeTag.isStatic()) {
return true;
}
String openTagName = optionalOpenTag.getStaticTagNameAsLowerCase();
String closeTagName = closeTag.getStaticTagNameAsLowerCase();
checkArgument(!openTagName.equals(closeTagName));
if ("p".equals(openTagName)) {
return !PTAG_CLOSE_EXCEPTIONS.contains(closeTagName);
}
return OPTIONAL_TAG_CLOSE_TAG_RULES.containsEntry(openTagName, closeTagName);
} | java | public static boolean checkCloseTagClosesOptional(TagName closeTag, TagName optionalOpenTag) {
// TODO(b/120994894): Replace this with checkArgument() when HtmlTagEntry can be replaced.
if (!optionalOpenTag.isStatic() || !optionalOpenTag.isDefinitelyOptional()) {
return false;
}
if (!closeTag.isStatic()) {
return true;
}
String openTagName = optionalOpenTag.getStaticTagNameAsLowerCase();
String closeTagName = closeTag.getStaticTagNameAsLowerCase();
checkArgument(!openTagName.equals(closeTagName));
if ("p".equals(openTagName)) {
return !PTAG_CLOSE_EXCEPTIONS.contains(closeTagName);
}
return OPTIONAL_TAG_CLOSE_TAG_RULES.containsEntry(openTagName, closeTagName);
} | [
"public",
"static",
"boolean",
"checkCloseTagClosesOptional",
"(",
"TagName",
"closeTag",
",",
"TagName",
"optionalOpenTag",
")",
"{",
"// TODO(b/120994894): Replace this with checkArgument() when HtmlTagEntry can be replaced.",
"if",
"(",
"!",
"optionalOpenTag",
".",
"isStatic",... | Checks if the an open tag can be auto-closed by a following close tag which does not have the
same tag name as the open tag.
<p>We throws an {@code IllegalArgumentException} if two inputs have the same tag names, since
this should never happen (should be handled by previous logic in {@code
StrictHtmlValidationPass}).
<p>This implements half of the content model described in <a
href="https://www.w3.org/TR/html5/syntax.html#optional-tags">https://www.w3.org/TR/html5/syntax.html#optional-tags</a>.
Notably we do nothing when we see cases like "li element is immediately followed by another li
element". The validation logic relies on auto-closing open tags when we see close tags. Since
only {@code </ul>} and {@code </ol>} are allowed to close {@code <li>}, we believe this should
still give us a confident error message. We might consider adding support for popping open tags
when we visit open tags in the future. | [
"Checks",
"if",
"the",
"an",
"open",
"tag",
"can",
"be",
"auto",
"-",
"closed",
"by",
"a",
"following",
"close",
"tag",
"which",
"does",
"not",
"have",
"the",
"same",
"tag",
"name",
"as",
"the",
"open",
"tag",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TagName.java#L276-L291 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.onError | @Override
public void onError(ChannelHandlerContext ctx, boolean outbound, Throwable cause) {
Http2Exception embedded = getEmbeddedHttp2Exception(cause);
if (isStreamError(embedded)) {
onStreamError(ctx, outbound, cause, (StreamException) embedded);
} else if (embedded instanceof CompositeStreamException) {
CompositeStreamException compositException = (CompositeStreamException) embedded;
for (StreamException streamException : compositException) {
onStreamError(ctx, outbound, cause, streamException);
}
} else {
onConnectionError(ctx, outbound, cause, embedded);
}
ctx.flush();
} | java | @Override
public void onError(ChannelHandlerContext ctx, boolean outbound, Throwable cause) {
Http2Exception embedded = getEmbeddedHttp2Exception(cause);
if (isStreamError(embedded)) {
onStreamError(ctx, outbound, cause, (StreamException) embedded);
} else if (embedded instanceof CompositeStreamException) {
CompositeStreamException compositException = (CompositeStreamException) embedded;
for (StreamException streamException : compositException) {
onStreamError(ctx, outbound, cause, streamException);
}
} else {
onConnectionError(ctx, outbound, cause, embedded);
}
ctx.flush();
} | [
"@",
"Override",
"public",
"void",
"onError",
"(",
"ChannelHandlerContext",
"ctx",
",",
"boolean",
"outbound",
",",
"Throwable",
"cause",
")",
"{",
"Http2Exception",
"embedded",
"=",
"getEmbeddedHttp2Exception",
"(",
"cause",
")",
";",
"if",
"(",
"isStreamError",
... | Central handler for all exceptions caught during HTTP/2 processing. | [
"Central",
"handler",
"for",
"all",
"exceptions",
"caught",
"during",
"HTTP",
"/",
"2",
"processing",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L622-L636 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/multibuffer/MultiBufferProductPlan.java | MultiBufferProductPlan.blocksAccessed | @Override
public long blocksAccessed() {
// this guesses at the # of chunks
int avail = tx.bufferMgr().available();
long size = new MaterializePlan(rhs, tx).blocksAccessed();
long numchunks = size / avail;
return rhs.blocksAccessed() + (lhs.blocksAccessed() * numchunks);
} | java | @Override
public long blocksAccessed() {
// this guesses at the # of chunks
int avail = tx.bufferMgr().available();
long size = new MaterializePlan(rhs, tx).blocksAccessed();
long numchunks = size / avail;
return rhs.blocksAccessed() + (lhs.blocksAccessed() * numchunks);
} | [
"@",
"Override",
"public",
"long",
"blocksAccessed",
"(",
")",
"{",
"// this guesses at the # of chunks\r",
"int",
"avail",
"=",
"tx",
".",
"bufferMgr",
"(",
")",
".",
"available",
"(",
")",
";",
"long",
"size",
"=",
"new",
"MaterializePlan",
"(",
"rhs",
","... | Returns an estimate of the number of block accesses required to execute
the query. The formula is:
<pre>
B(product(p1, p2)) = B(p2) + B(p1) * C(p2)
</pre>
where C(p2) is the number of chunks of p2. The method uses the current
number of available buffers to calculate C(p2), and so this value may
differ when the query scan is opened.
@see Plan#blocksAccessed() | [
"Returns",
"an",
"estimate",
"of",
"the",
"number",
"of",
"block",
"accesses",
"required",
"to",
"execute",
"the",
"query",
".",
"The",
"formula",
"is",
":"
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/multibuffer/MultiBufferProductPlan.java#L91-L98 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/services/process/ProcessExecutor.java | ProcessExecutor.lockActivityInstance | public Integer lockActivityInstance(Long actInstId)
throws DataAccessException {
try {
if (!isInTransaction()) throw
new DataAccessException("Cannot lock activity instance without a transaction");
return engineImpl.getDataAccess().lockActivityInstance(actInstId);
} catch (SQLException e) {
throw new DataAccessException(0, "Failed to lock activity instance", e);
}
} | java | public Integer lockActivityInstance(Long actInstId)
throws DataAccessException {
try {
if (!isInTransaction()) throw
new DataAccessException("Cannot lock activity instance without a transaction");
return engineImpl.getDataAccess().lockActivityInstance(actInstId);
} catch (SQLException e) {
throw new DataAccessException(0, "Failed to lock activity instance", e);
}
} | [
"public",
"Integer",
"lockActivityInstance",
"(",
"Long",
"actInstId",
")",
"throws",
"DataAccessException",
"{",
"try",
"{",
"if",
"(",
"!",
"isInTransaction",
"(",
")",
")",
"throw",
"new",
"DataAccessException",
"(",
"\"Cannot lock activity instance without a transac... | This method must be called within the same transaction scope (namely engine is already started
@param actInstId
@throws DataAccessException | [
"This",
"method",
"must",
"be",
"called",
"within",
"the",
"same",
"transaction",
"scope",
"(",
"namely",
"engine",
"is",
"already",
"started"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/process/ProcessExecutor.java#L1168-L1177 |
vibur/vibur-object-pool | src/main/java/org/vibur/objectpool/ConcurrentPool.java | ConcurrentPool.readyToRestore | private boolean readyToRestore(T object, boolean valid) {
try {
boolean ready = false;
try {
ready = valid && poolObjectFactory.readyToRestore(object);
} finally {
if (!ready) {
poolObjectFactory.destroy(object);
}
}
if (!ready) {
createdTotal.decrementAndGet();
}
return ready;
} catch (RuntimeException | Error e) {
recoverInnerState();
throw e;
}
} | java | private boolean readyToRestore(T object, boolean valid) {
try {
boolean ready = false;
try {
ready = valid && poolObjectFactory.readyToRestore(object);
} finally {
if (!ready) {
poolObjectFactory.destroy(object);
}
}
if (!ready) {
createdTotal.decrementAndGet();
}
return ready;
} catch (RuntimeException | Error e) {
recoverInnerState();
throw e;
}
} | [
"private",
"boolean",
"readyToRestore",
"(",
"T",
"object",
",",
"boolean",
"valid",
")",
"{",
"try",
"{",
"boolean",
"ready",
"=",
"false",
";",
"try",
"{",
"ready",
"=",
"valid",
"&&",
"poolObjectFactory",
".",
"readyToRestore",
"(",
"object",
")",
";",
... | Verifies whether the given object is valid and whether it can be restored back to the pool. Returns {@code true}
if the object is valid; otherwise returns {@code false}.
@param object the object that is to be restored to the pool and that needs to be validated
@param valid if {@code false}, the object is treated as invalid; otherwise a secondary validation on the object
will be performed
@return see above | [
"Verifies",
"whether",
"the",
"given",
"object",
"is",
"valid",
"and",
"whether",
"it",
"can",
"be",
"restored",
"back",
"to",
"the",
"pool",
".",
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"object",
"is",
"valid",
";",
"otherwise",
"returns",
"{... | train | https://github.com/vibur/vibur-object-pool/blob/53444319374dedfe7bbee9adb537bdaf66b82a73/src/main/java/org/vibur/objectpool/ConcurrentPool.java#L311-L330 |
rterp/GMapsFX | GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptObject.java | JavascriptObject.setProperty | protected void setProperty(String propertyName, JavascriptObject propertyValue) {
jsObject.setMember(propertyName, propertyValue.getJSObject());
} | java | protected void setProperty(String propertyName, JavascriptObject propertyValue) {
jsObject.setMember(propertyName, propertyValue.getJSObject());
} | [
"protected",
"void",
"setProperty",
"(",
"String",
"propertyName",
",",
"JavascriptObject",
"propertyValue",
")",
"{",
"jsObject",
".",
"setMember",
"(",
"propertyName",
",",
"propertyValue",
".",
"getJSObject",
"(",
")",
")",
";",
"}"
] | Sets a property on this Javascript object for which the value is a
Javascript object itself.
@param propertyName The name of the property.
@param propertyValue The value of the property. | [
"Sets",
"a",
"property",
"on",
"this",
"Javascript",
"object",
"for",
"which",
"the",
"value",
"is",
"a",
"Javascript",
"object",
"itself",
"."
] | train | https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptObject.java#L156-L158 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java | JaxbUtils.unmarshal | public static <T> T unmarshal(Class<T> cl, String s) throws JAXBException {
return unmarshal(cl, new StringReader(s));
} | java | public static <T> T unmarshal(Class<T> cl, String s) throws JAXBException {
return unmarshal(cl, new StringReader(s));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"String",
"s",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshal",
"(",
"cl",
",",
"new",
"StringReader",
"(",
"s",
")",
")",
";",
"}"
] | Convert a string to an object of a given class.
@param cl Type of object
@param s Input string
@return Object of the given type | [
"Convert",
"a",
"string",
"to",
"an",
"object",
"of",
"a",
"given",
"class",
"."
] | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L242-L244 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.initialiseSendWindow | public synchronized void initialiseSendWindow(long sendWindow, long definedSendWindow)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "initialiseSendWindow", new Object[] {Long.valueOf(sendWindow), Long.valueOf(definedSendWindow)} );
// Prior to V7 the sendWindow was not persisted unless it was modified due to a change in
// reachability, otherwise it was stored as INFINITY (Long.MAX_VALUE). Therefore, if the
// defined sendWindow was modified we could be in the situation where before a restart we
// had 1000 messages indoubt, then shut the ME down, changes the defined sendWindow to 50
// and restarted. At that point we'd set the sendWindow to 50 and suddenly we'd have 950
// available messages again (not indoubt). We'd then be allowed to reallocate them elsewhere!
// Luckily, the ability to modify the sendWindow wasn't correctly exposed prior to V7 (it's
// now a custom property), so no-one could have modified it. So, we can interpret a value
// of INFINITY as the original sendWindow value, which is 1000. And use that when we see it.
if( sendWindow == RangeList.INFINITY )
{
this.definedSendWindow = definedSendWindow;
this.sendWindow = 1000; // Original default sendWindow
// Now persist the 1000 to make it clearer
persistSendWindow(this.sendWindow, null);
}
else
{
this.sendWindow = sendWindow;
this.definedSendWindow = definedSendWindow;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseSendWindow");
} | java | public synchronized void initialiseSendWindow(long sendWindow, long definedSendWindow)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "initialiseSendWindow", new Object[] {Long.valueOf(sendWindow), Long.valueOf(definedSendWindow)} );
// Prior to V7 the sendWindow was not persisted unless it was modified due to a change in
// reachability, otherwise it was stored as INFINITY (Long.MAX_VALUE). Therefore, if the
// defined sendWindow was modified we could be in the situation where before a restart we
// had 1000 messages indoubt, then shut the ME down, changes the defined sendWindow to 50
// and restarted. At that point we'd set the sendWindow to 50 and suddenly we'd have 950
// available messages again (not indoubt). We'd then be allowed to reallocate them elsewhere!
// Luckily, the ability to modify the sendWindow wasn't correctly exposed prior to V7 (it's
// now a custom property), so no-one could have modified it. So, we can interpret a value
// of INFINITY as the original sendWindow value, which is 1000. And use that when we see it.
if( sendWindow == RangeList.INFINITY )
{
this.definedSendWindow = definedSendWindow;
this.sendWindow = 1000; // Original default sendWindow
// Now persist the 1000 to make it clearer
persistSendWindow(this.sendWindow, null);
}
else
{
this.sendWindow = sendWindow;
this.definedSendWindow = definedSendWindow;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseSendWindow");
} | [
"public",
"synchronized",
"void",
"initialiseSendWindow",
"(",
"long",
"sendWindow",
",",
"long",
"definedSendWindow",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(... | this value straight away and also that we don't need to persist it | [
"this",
"value",
"straight",
"away",
"and",
"also",
"that",
"we",
"don",
"t",
"need",
"to",
"persist",
"it"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L1900-L1933 |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java | Pixel.setRGB | public void setRGB(int r, int g, int b){
setValue(Pixel.rgb(r, g, b));
} | java | public void setRGB(int r, int g, int b){
setValue(Pixel.rgb(r, g, b));
} | [
"public",
"void",
"setRGB",
"(",
"int",
"r",
",",
"int",
"g",
",",
"int",
"b",
")",
"{",
"setValue",
"(",
"Pixel",
".",
"rgb",
"(",
"r",
",",
"g",
",",
"b",
")",
")",
";",
"}"
] | Sets an opaque RGB value at the position currently referenced by this Pixel.
Each channel value is assumed to be 8bit and otherwise truncated.
@param r red
@param g green
@param b blue
@throws ArrayIndexOutOfBoundsException if this Pixel's index is not in
range of the Img's data array.
@see #setARGB(int, int, int, int)
@see #setRGB_preserveAlpha(int, int, int)
@see #argb(int, int, int, int)
@see #argb_bounded(int, int, int, int)
@see #argb_fast(int, int, int, int)
@see #setValue(int)
@since 1.0 | [
"Sets",
"an",
"opaque",
"RGB",
"value",
"at",
"the",
"position",
"currently",
"referenced",
"by",
"this",
"Pixel",
".",
"Each",
"channel",
"value",
"is",
"assumed",
"to",
"be",
"8bit",
"and",
"otherwise",
"truncated",
"."
] | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L366-L368 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/view/PaymentUtils.java | PaymentUtils.formatPriceStringUsingFree | static String formatPriceStringUsingFree(long amount, @NonNull Currency currency, String free) {
if (amount == 0) {
return free;
}
NumberFormat currencyFormat = NumberFormat.getCurrencyInstance();
DecimalFormatSymbols decimalFormatSymbols = ((java.text.DecimalFormat) currencyFormat)
.getDecimalFormatSymbols();
decimalFormatSymbols.setCurrencySymbol(currency.getSymbol(Locale.getDefault()));
((java.text.DecimalFormat) currencyFormat).setDecimalFormatSymbols(decimalFormatSymbols);
return formatPriceString(amount, currency);
} | java | static String formatPriceStringUsingFree(long amount, @NonNull Currency currency, String free) {
if (amount == 0) {
return free;
}
NumberFormat currencyFormat = NumberFormat.getCurrencyInstance();
DecimalFormatSymbols decimalFormatSymbols = ((java.text.DecimalFormat) currencyFormat)
.getDecimalFormatSymbols();
decimalFormatSymbols.setCurrencySymbol(currency.getSymbol(Locale.getDefault()));
((java.text.DecimalFormat) currencyFormat).setDecimalFormatSymbols(decimalFormatSymbols);
return formatPriceString(amount, currency);
} | [
"static",
"String",
"formatPriceStringUsingFree",
"(",
"long",
"amount",
",",
"@",
"NonNull",
"Currency",
"currency",
",",
"String",
"free",
")",
"{",
"if",
"(",
"amount",
"==",
"0",
")",
"{",
"return",
"free",
";",
"}",
"NumberFormat",
"currencyFormat",
"="... | Formats a monetary amount into a human friendly string where zero is returned
as free. | [
"Formats",
"a",
"monetary",
"amount",
"into",
"a",
"human",
"friendly",
"string",
"where",
"zero",
"is",
"returned",
"as",
"free",
"."
] | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/view/PaymentUtils.java#L16-L27 |
adohe/etcd4j | src/main/java/com/xqbase/etcd4j/EtcdClient.java | EtcdClient.cad | public EtcdResult cad(String key, Map<String, String> params) throws EtcdClientException {
URI uri = buildUriWithKeyAndParams(key, params);
HttpDelete httpDelete = new HttpDelete(uri);
return syncExecute(httpDelete, new int[] {200, 412}, 101);
} | java | public EtcdResult cad(String key, Map<String, String> params) throws EtcdClientException {
URI uri = buildUriWithKeyAndParams(key, params);
HttpDelete httpDelete = new HttpDelete(uri);
return syncExecute(httpDelete, new int[] {200, 412}, 101);
} | [
"public",
"EtcdResult",
"cad",
"(",
"String",
"key",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"EtcdClientException",
"{",
"URI",
"uri",
"=",
"buildUriWithKeyAndParams",
"(",
"key",
",",
"params",
")",
";",
"HttpDelete",
"httpDe... | Atomic Compare-and-Delete
@param key the key
@param params comparable conditions
@return operation result
@throws EtcdClientException | [
"Atomic",
"Compare",
"-",
"and",
"-",
"Delete"
] | train | https://github.com/adohe/etcd4j/blob/8d30ae9aa5da32d8e78287d61e69861c63538629/src/main/java/com/xqbase/etcd4j/EtcdClient.java#L281-L286 |
kaazing/gateway | mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioChildDatagramPipelineSink.java | NioChildDatagramPipelineSink.eventSunk | public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e)
throws Exception {
final NioChildDatagramChannel childChannel = (NioChildDatagramChannel) e.getChannel();
final ChannelFuture childFuture = e.getFuture();
if (e instanceof ChannelStateEvent) {
final ChannelStateEvent stateEvent = (ChannelStateEvent) e;
final ChannelState state = stateEvent.getState();
final Object value = stateEvent.getValue();
switch (state) {
case OPEN:
if (Boolean.FALSE.equals(value)) {
childChannel.worker.close(childChannel, childFuture);
}
break;
}
} else if (e instanceof MessageEvent) {
// Making sure that child channel WriteFuture is fired on child channel's worker thread
final MessageEvent childMessageEvent = (MessageEvent) e;
ParentMessageEvent parentMessageEvent = new ParentMessageEvent(childMessageEvent);
ChannelFuture parentFuture = parentMessageEvent.getFuture();
parentFuture.addListener(f -> {
childChannel.getWorker().executeInIoThread(() -> {
if (f.isSuccess()) {
childFuture.setSuccess();
} else {
childFuture.setFailure(f.getCause());
}
});
});
// Write to parent channel
NioDatagramChannel parentChannel = (NioDatagramChannel) childChannel.getParent();
boolean offered = parentChannel.writeBufferQueue.offer(parentMessageEvent);
assert offered;
parentChannel.worker.writeFromUserCode(parentChannel);
}
} | java | public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e)
throws Exception {
final NioChildDatagramChannel childChannel = (NioChildDatagramChannel) e.getChannel();
final ChannelFuture childFuture = e.getFuture();
if (e instanceof ChannelStateEvent) {
final ChannelStateEvent stateEvent = (ChannelStateEvent) e;
final ChannelState state = stateEvent.getState();
final Object value = stateEvent.getValue();
switch (state) {
case OPEN:
if (Boolean.FALSE.equals(value)) {
childChannel.worker.close(childChannel, childFuture);
}
break;
}
} else if (e instanceof MessageEvent) {
// Making sure that child channel WriteFuture is fired on child channel's worker thread
final MessageEvent childMessageEvent = (MessageEvent) e;
ParentMessageEvent parentMessageEvent = new ParentMessageEvent(childMessageEvent);
ChannelFuture parentFuture = parentMessageEvent.getFuture();
parentFuture.addListener(f -> {
childChannel.getWorker().executeInIoThread(() -> {
if (f.isSuccess()) {
childFuture.setSuccess();
} else {
childFuture.setFailure(f.getCause());
}
});
});
// Write to parent channel
NioDatagramChannel parentChannel = (NioDatagramChannel) childChannel.getParent();
boolean offered = parentChannel.writeBufferQueue.offer(parentMessageEvent);
assert offered;
parentChannel.worker.writeFromUserCode(parentChannel);
}
} | [
"public",
"void",
"eventSunk",
"(",
"final",
"ChannelPipeline",
"pipeline",
",",
"final",
"ChannelEvent",
"e",
")",
"throws",
"Exception",
"{",
"final",
"NioChildDatagramChannel",
"childChannel",
"=",
"(",
"NioChildDatagramChannel",
")",
"e",
".",
"getChannel",
"(",... | Handle downstream event.
@param pipeline the {@link ChannelPipeline} that passes down the
downstream event.
@param e The downstream event. | [
"Handle",
"downstream",
"event",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioChildDatagramPipelineSink.java#L57-L94 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java | FileDownloadUtils.prepareURLConnection | public static URLConnection prepareURLConnection(String url, int timeout) throws IOException {
URLConnection connection = new URL(url).openConnection();
connection.setReadTimeout(timeout);
connection.setConnectTimeout(timeout);
return connection;
} | java | public static URLConnection prepareURLConnection(String url, int timeout) throws IOException {
URLConnection connection = new URL(url).openConnection();
connection.setReadTimeout(timeout);
connection.setConnectTimeout(timeout);
return connection;
} | [
"public",
"static",
"URLConnection",
"prepareURLConnection",
"(",
"String",
"url",
",",
"int",
"timeout",
")",
"throws",
"IOException",
"{",
"URLConnection",
"connection",
"=",
"new",
"URL",
"(",
"url",
")",
".",
"openConnection",
"(",
")",
";",
"connection",
... | Prepare {@link URLConnection} with customised timeouts.
@param url The URL
@param timeout The timeout in millis for both the connection timeout and
the response read timeout. Note that the total timeout is effectively two
times the given timeout.
<p>
Example of code. <code>
UrlConnection conn = prepareURLConnection("http://www.google.com/", 20000);
conn.connect();
conn.getInputStream();
</code>
<p>
<bold>NB. User should execute connect() method before getting input
stream.</bold>
@return
@throws IOException
@author Jacek Grzebyta | [
"Prepare",
"{",
"@link",
"URLConnection",
"}",
"with",
"customised",
"timeouts",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java#L243-L248 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/routes/RouteTrie.java | RouteTrie.findExact | public final Route findExact(final char[] arr, HttpMethod method) {
TrieNode current = root;
//for(char c : arr) {
for (int i = 0; i < arr.length; i++) {
char c = arr[i];
if(current.nodes[c] == null)
return null;
else
current = current.nodes[c];
}
// return routes.get(current.routeIndex);//current.route != null;
//return enumRoutes.get(current.routeIndex).get(method);
return current.routes[method.ordinal()];
} | java | public final Route findExact(final char[] arr, HttpMethod method) {
TrieNode current = root;
//for(char c : arr) {
for (int i = 0; i < arr.length; i++) {
char c = arr[i];
if(current.nodes[c] == null)
return null;
else
current = current.nodes[c];
}
// return routes.get(current.routeIndex);//current.route != null;
//return enumRoutes.get(current.routeIndex).get(method);
return current.routes[method.ordinal()];
} | [
"public",
"final",
"Route",
"findExact",
"(",
"final",
"char",
"[",
"]",
"arr",
",",
"HttpMethod",
"method",
")",
"{",
"TrieNode",
"current",
"=",
"root",
";",
"//for(char c : arr) {",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"lengt... | /*public final Route findExact(final char[] arr) {
TrieNode current = root;
for(char c : arr) {
if(current.nodes[c] == null)
return null;
else
current = current.nodes[c];
}
return routes.get(current.routeIndex);//current.route != null;
} | [
"/",
"*",
"public",
"final",
"Route",
"findExact",
"(",
"final",
"char",
"[]",
"arr",
")",
"{",
"TrieNode",
"current",
"=",
"root",
";",
"for",
"(",
"char",
"c",
":",
"arr",
")",
"{",
"if",
"(",
"current",
".",
"nodes",
"[",
"c",
"]",
"==",
"null... | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/routes/RouteTrie.java#L113-L126 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java | BeanO.setState | protected final synchronized void setState(int oldState, int newState)
throws InvalidBeanOStateException, BeanNotReentrantException // LIDB2775-23.7
{
//------------------------------------------------------------------------
// Inlined assertState(oldState); for performance. d154342.6
//------------------------------------------------------------------------
if (state != oldState) {
throw new InvalidBeanOStateException(getStateName(state),
getStateName(oldState));
}
if (TraceComponent.isAnyTracingEnabled() && // d527372
TEBeanLifeCycleInfo.isTraceEnabled())
TEBeanLifeCycleInfo.traceBeanState(state, getStateName(state), newState,
getStateName(newState)); // d167264
//------------------------------------------------------------------------
// Inlined setState(newState); for performance. d154342.6
//------------------------------------------------------------------------
state = newState;
} | java | protected final synchronized void setState(int oldState, int newState)
throws InvalidBeanOStateException, BeanNotReentrantException // LIDB2775-23.7
{
//------------------------------------------------------------------------
// Inlined assertState(oldState); for performance. d154342.6
//------------------------------------------------------------------------
if (state != oldState) {
throw new InvalidBeanOStateException(getStateName(state),
getStateName(oldState));
}
if (TraceComponent.isAnyTracingEnabled() && // d527372
TEBeanLifeCycleInfo.isTraceEnabled())
TEBeanLifeCycleInfo.traceBeanState(state, getStateName(state), newState,
getStateName(newState)); // d167264
//------------------------------------------------------------------------
// Inlined setState(newState); for performance. d154342.6
//------------------------------------------------------------------------
state = newState;
} | [
"protected",
"final",
"synchronized",
"void",
"setState",
"(",
"int",
"oldState",
",",
"int",
"newState",
")",
"throws",
"InvalidBeanOStateException",
",",
"BeanNotReentrantException",
"// LIDB2775-23.7",
"{",
"//-------------------------------------------------------------------... | Set the current state of this <code>BeanO</code>. <p>
The current state of this <code>BeanO</code> must be old state,
else this method fails. <p>
@param oldState the old state <p>
@param newState the new state <p> | [
"Set",
"the",
"current",
"state",
"of",
"this",
"<code",
">",
"BeanO<",
"/",
"code",
">",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java#L254-L274 |
agaricusb/SpecialSourceMP | src/main/java/net/md_5/specialsource/mavenplugin/InstallRemappedFileMojo.java | InstallRemappedFileMojo.installChecksums | protected void installChecksums( Artifact artifact, Collection metadataFiles )
throws MojoExecutionException
{
if ( !createChecksum )
{
return;
}
File artifactFile = getLocalRepoFile( artifact );
installChecksums( artifactFile );
Collection metadatas = artifact.getMetadataList();
if ( metadatas != null )
{
for ( Iterator it = metadatas.iterator(); it.hasNext(); )
{
ArtifactMetadata metadata = (ArtifactMetadata) it.next();
File metadataFile = getLocalRepoFile( metadata );
metadataFiles.add( metadataFile );
}
}
} | java | protected void installChecksums( Artifact artifact, Collection metadataFiles )
throws MojoExecutionException
{
if ( !createChecksum )
{
return;
}
File artifactFile = getLocalRepoFile( artifact );
installChecksums( artifactFile );
Collection metadatas = artifact.getMetadataList();
if ( metadatas != null )
{
for ( Iterator it = metadatas.iterator(); it.hasNext(); )
{
ArtifactMetadata metadata = (ArtifactMetadata) it.next();
File metadataFile = getLocalRepoFile( metadata );
metadataFiles.add( metadataFile );
}
}
} | [
"protected",
"void",
"installChecksums",
"(",
"Artifact",
"artifact",
",",
"Collection",
"metadataFiles",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"!",
"createChecksum",
")",
"{",
"return",
";",
"}",
"File",
"artifactFile",
"=",
"getLocalRepoFile",
... | Installs the checksums for the specified artifact if this has been enabled in the plugin configuration. This
method creates checksums for files that have already been installed to the local repo to account for on-the-fly
generated/updated files. For example, in Maven 2.0.4- the <code>ProjectArtifactMetadata</code> did not install
the original POM file (cf. MNG-2820). While the plugin currently requires Maven 2.0.6, we continue to hash the
installed POM for robustness with regard to future changes like re-introducing some kind of POM filtering.
@param artifact The artifact for which to create checksums, must not be <code>null</code>.
@param metadataFiles The set where additional metadata files will be registered for later checksum installation,
must not be <code>null</code>.
@throws MojoExecutionException If the checksums could not be installed. | [
"Installs",
"the",
"checksums",
"for",
"the",
"specified",
"artifact",
"if",
"this",
"has",
"been",
"enabled",
"in",
"the",
"plugin",
"configuration",
".",
"This",
"method",
"creates",
"checksums",
"for",
"files",
"that",
"have",
"already",
"been",
"installed",
... | train | https://github.com/agaricusb/SpecialSourceMP/blob/350daa04831fb93a51a57a30009c572ade0a88bf/src/main/java/net/md_5/specialsource/mavenplugin/InstallRemappedFileMojo.java#L510-L531 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java | BigtableDataClient.readRowAsync | public ApiFuture<Row> readRowAsync(String tableId, String rowKey) {
return readRowAsync(tableId, ByteString.copyFromUtf8(rowKey), null);
} | java | public ApiFuture<Row> readRowAsync(String tableId, String rowKey) {
return readRowAsync(tableId, ByteString.copyFromUtf8(rowKey), null);
} | [
"public",
"ApiFuture",
"<",
"Row",
">",
"readRowAsync",
"(",
"String",
"tableId",
",",
"String",
"rowKey",
")",
"{",
"return",
"readRowAsync",
"(",
"tableId",
",",
"ByteString",
".",
"copyFromUtf8",
"(",
"rowKey",
")",
",",
"null",
")",
";",
"}"
] | Convenience method for asynchronously reading a single row. If the row does not exist, the
future's value will be null.
<p>Sample code:
<pre>{@code
try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
String tableId = "[TABLE]";
ApiFuture<Row> futureResult = bigtableDataClient.readRowAsync(tableId, "key");
ApiFutures.addCallback(futureResult, new ApiFutureCallback<Row>() {
public void onFailure(Throwable t) {
if (t instanceof NotFoundException) {
System.out.println("Tried to read a non-existent table");
} else {
t.printStackTrace();
}
}
public void onSuccess(Row result) {
if (result != null) {
System.out.println("Got row: " + result);
}
}
}, MoreExecutors.directExecutor());
}
}</pre> | [
"Convenience",
"method",
"for",
"asynchronously",
"reading",
"a",
"single",
"row",
".",
"If",
"the",
"row",
"does",
"not",
"exist",
"the",
"future",
"s",
"value",
"will",
"be",
"null",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L304-L306 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxTrash.java | BoxTrash.deleteFile | public void deleteFile(String fileID) {
URL url = FILE_INFO_URL_TEMPLATE.build(this.api.getBaseURL(), fileID);
BoxAPIRequest request = new BoxAPIRequest(this.api, url, "DELETE");
BoxAPIResponse response = request.send();
response.disconnect();
} | java | public void deleteFile(String fileID) {
URL url = FILE_INFO_URL_TEMPLATE.build(this.api.getBaseURL(), fileID);
BoxAPIRequest request = new BoxAPIRequest(this.api, url, "DELETE");
BoxAPIResponse response = request.send();
response.disconnect();
} | [
"public",
"void",
"deleteFile",
"(",
"String",
"fileID",
")",
"{",
"URL",
"url",
"=",
"FILE_INFO_URL_TEMPLATE",
".",
"build",
"(",
"this",
".",
"api",
".",
"getBaseURL",
"(",
")",
",",
"fileID",
")",
";",
"BoxAPIRequest",
"request",
"=",
"new",
"BoxAPIRequ... | Permanently deletes a trashed file.
@param fileID the ID of the trashed folder to permanently delete. | [
"Permanently",
"deletes",
"a",
"trashed",
"file",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxTrash.java#L145-L150 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.deleteItem | public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<Item> items = new ArrayList<>(itemIds.size());
for (String id : itemIds) {
items.add(new Item(id));
}
PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
} | java | public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<Item> items = new ArrayList<>(itemIds.size());
for (String id : itemIds) {
items.add(new Item(id));
}
PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
} | [
"public",
"void",
"deleteItem",
"(",
"Collection",
"<",
"String",
">",
"itemIds",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"List",
"<",
"Item",
">",
"items",
"=",
"new",
"Array... | Delete the items with the specified id's from the node.
@param itemIds The list of id's of items to delete
@throws XMPPErrorException
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Delete",
"the",
"items",
"with",
"the",
"specified",
"id",
"s",
"from",
"the",
"node",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L373-L381 |
roboconf/roboconf-platform | core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java | RabbitMqUtils.declareGlobalExchanges | public static void declareGlobalExchanges( String domain, Channel channel )
throws IOException {
// "topic" is a keyword for RabbitMQ.
channel.exchangeDeclare( buildExchangeNameForTheDm( domain ), "topic" );
channel.exchangeDeclare( buildExchangeNameForInterApp( domain ), "topic" );
} | java | public static void declareGlobalExchanges( String domain, Channel channel )
throws IOException {
// "topic" is a keyword for RabbitMQ.
channel.exchangeDeclare( buildExchangeNameForTheDm( domain ), "topic" );
channel.exchangeDeclare( buildExchangeNameForInterApp( domain ), "topic" );
} | [
"public",
"static",
"void",
"declareGlobalExchanges",
"(",
"String",
"domain",
",",
"Channel",
"channel",
")",
"throws",
"IOException",
"{",
"// \"topic\" is a keyword for RabbitMQ.",
"channel",
".",
"exchangeDeclare",
"(",
"buildExchangeNameForTheDm",
"(",
"domain",
")",... | Declares the global exchanges (those that do not depend on an application).
<p>
It includes the DM exchange and the one for inter-application exchanges.
</p>
@param channel the RabbitMQ channel
@throws IOException if an error occurs | [
"Declares",
"the",
"global",
"exchanges",
"(",
"those",
"that",
"do",
"not",
"depend",
"on",
"an",
"application",
")",
".",
"<p",
">",
"It",
"includes",
"the",
"DM",
"exchange",
"and",
"the",
"one",
"for",
"inter",
"-",
"application",
"exchanges",
".",
"... | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java#L201-L207 |
liferay/com-liferay-commerce | commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java | CommerceWishListPersistenceImpl.findByUUID_G | @Override
public CommerceWishList findByUUID_G(String uuid, long groupId)
throws NoSuchWishListException {
CommerceWishList commerceWishList = fetchByUUID_G(uuid, groupId);
if (commerceWishList == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchWishListException(msg.toString());
}
return commerceWishList;
} | java | @Override
public CommerceWishList findByUUID_G(String uuid, long groupId)
throws NoSuchWishListException {
CommerceWishList commerceWishList = fetchByUUID_G(uuid, groupId);
if (commerceWishList == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchWishListException(msg.toString());
}
return commerceWishList;
} | [
"@",
"Override",
"public",
"CommerceWishList",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchWishListException",
"{",
"CommerceWishList",
"commerceWishList",
"=",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"if",
... | Returns the commerce wish list where uuid = ? and groupId = ? or throws a {@link NoSuchWishListException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce wish list
@throws NoSuchWishListException if a matching commerce wish list could not be found | [
"Returns",
"the",
"commerce",
"wish",
"list",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchWishListException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java#L668-L694 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapCircle.java | MapCircle.intersects | @Override
@Pure
public boolean intersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
if (boundsIntersects(rectangle)) {
final double x = getX();
final double y = getY();
final Rectangle2afp<?, ?, ?, ?, ?, ?> box = rectangle.toBoundingBox();
final double minx = box.getMinX();
final double miny = box.getMinY();
final double maxx = box.getMaxX();
final double maxy = box.getMaxY();
return MathUtil.min(
Segment2afp.calculatesDistanceSegmentPoint(minx, miny, maxx, miny, x, y),
Segment2afp.calculatesDistanceSegmentPoint(minx, miny, minx, maxy, x, y),
Segment2afp.calculatesDistanceSegmentPoint(maxx, miny, maxx, maxy, x, y),
Segment2afp.calculatesDistanceSegmentPoint(minx, maxy, maxx, maxy, x, y)) <= this.radius;
}
return false;
} | java | @Override
@Pure
public boolean intersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
if (boundsIntersects(rectangle)) {
final double x = getX();
final double y = getY();
final Rectangle2afp<?, ?, ?, ?, ?, ?> box = rectangle.toBoundingBox();
final double minx = box.getMinX();
final double miny = box.getMinY();
final double maxx = box.getMaxX();
final double maxy = box.getMaxY();
return MathUtil.min(
Segment2afp.calculatesDistanceSegmentPoint(minx, miny, maxx, miny, x, y),
Segment2afp.calculatesDistanceSegmentPoint(minx, miny, minx, maxy, x, y),
Segment2afp.calculatesDistanceSegmentPoint(maxx, miny, maxx, maxy, x, y),
Segment2afp.calculatesDistanceSegmentPoint(minx, maxy, maxx, maxy, x, y)) <= this.radius;
}
return false;
} | [
"@",
"Override",
"@",
"Pure",
"public",
"boolean",
"intersects",
"(",
"Shape2D",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
"extends",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
">",
"re... | Replies if this element has an intersection
with the specified rectangle.
@return <code>true</code> if this MapElement is intersecting the specified area,
otherwise <code>false</code> | [
"Replies",
"if",
"this",
"element",
"has",
"an",
"intersection",
"with",
"the",
"specified",
"rectangle",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapCircle.java#L324-L343 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jspeex/SpeexMediaManager.java | SpeexMediaManager.createMediaSession | @Override
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
return new AudioMediaSession(payloadType, remote, local, null,null);
} | java | @Override
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
return new AudioMediaSession(payloadType, remote, local, null,null);
} | [
"@",
"Override",
"public",
"JingleMediaSession",
"createMediaSession",
"(",
"PayloadType",
"payloadType",
",",
"final",
"TransportCandidate",
"remote",
",",
"final",
"TransportCandidate",
"local",
",",
"final",
"JingleSession",
"jingleSession",
")",
"{",
"return",
"new"... | Returns a new jingleMediaSession.
@param payloadType payloadType
@param remote remote Candidate
@param local local Candidate
@return JingleMediaSession | [
"Returns",
"a",
"new",
"jingleMediaSession",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jspeex/SpeexMediaManager.java#L63-L66 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java | IntInterval.fromTo | public static IntInterval fromTo(int from, int to)
{
if (from <= to)
{
return IntInterval.fromToBy(from, to, 1);
}
return IntInterval.fromToBy(from, to, -1);
} | java | public static IntInterval fromTo(int from, int to)
{
if (from <= to)
{
return IntInterval.fromToBy(from, to, 1);
}
return IntInterval.fromToBy(from, to, -1);
} | [
"public",
"static",
"IntInterval",
"fromTo",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"from",
"<=",
"to",
")",
"{",
"return",
"IntInterval",
".",
"fromToBy",
"(",
"from",
",",
"to",
",",
"1",
")",
";",
"}",
"return",
"IntInterval",
... | Returns an IntInterval starting from the value from to the specified value to with a step value of 1. | [
"Returns",
"an",
"IntInterval",
"starting",
"from",
"the",
"value",
"from",
"to",
"the",
"specified",
"value",
"to",
"with",
"a",
"step",
"value",
"of",
"1",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java#L165-L172 |
maddingo/sojo | src/main/java/net/sf/sojo/core/reflect/ReflectionMethodHelper.java | ReflectionMethodHelper.getAllMethodsByClass | public static Method[] getAllMethodsByClass (Class<?> pvClass) {
return getAllMethodsByClassIntern(pvClass, new HashSet<Method>()).toArray(new Method [0]);
} | java | public static Method[] getAllMethodsByClass (Class<?> pvClass) {
return getAllMethodsByClassIntern(pvClass, new HashSet<Method>()).toArray(new Method [0]);
} | [
"public",
"static",
"Method",
"[",
"]",
"getAllMethodsByClass",
"(",
"Class",
"<",
"?",
">",
"pvClass",
")",
"{",
"return",
"getAllMethodsByClassIntern",
"(",
"pvClass",
",",
"new",
"HashSet",
"<",
"Method",
">",
"(",
")",
")",
".",
"toArray",
"(",
"new",
... | Get all set/get methods from a Class. With methods from all super classes.
@param pvClass Analyse Class.
@return All methods found. | [
"Get",
"all",
"set",
"/",
"get",
"methods",
"from",
"a",
"Class",
".",
"With",
"methods",
"from",
"all",
"super",
"classes",
"."
] | train | https://github.com/maddingo/sojo/blob/99e9e0a146b502deb7f507fe0623227402ed675b/src/main/java/net/sf/sojo/core/reflect/ReflectionMethodHelper.java#L127-L129 |
uaihebert/uaiMockServer | src/main/java/com/uaihebert/uaimockserver/log/backend/Log.java | Log.infoFormatted | public static void infoFormatted(final String text, final Object... parameterArray) {
final String formattedText = String.format(text, parameterArray);
logWriterInstance.info(formattedText);
UaiWebSocketLogManager.addLogText("[INFO] " + formattedText);
} | java | public static void infoFormatted(final String text, final Object... parameterArray) {
final String formattedText = String.format(text, parameterArray);
logWriterInstance.info(formattedText);
UaiWebSocketLogManager.addLogText("[INFO] " + formattedText);
} | [
"public",
"static",
"void",
"infoFormatted",
"(",
"final",
"String",
"text",
",",
"final",
"Object",
"...",
"parameterArray",
")",
"{",
"final",
"String",
"formattedText",
"=",
"String",
".",
"format",
"(",
"text",
",",
"parameterArray",
")",
";",
"logWriterIn... | Wil log a text with the INFO level. The text with be formatted using the String.format(...) | [
"Wil",
"log",
"a",
"text",
"with",
"the",
"INFO",
"level",
".",
"The",
"text",
"with",
"be",
"formatted",
"using",
"the",
"String",
".",
"format",
"(",
"...",
")"
] | train | https://github.com/uaihebert/uaiMockServer/blob/8b0090d4018c2f430cfbbb3ae249347652802f2b/src/main/java/com/uaihebert/uaimockserver/log/backend/Log.java#L52-L58 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.onSetCaching | private void onSetCaching(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String caching = cfProperties.getProperty(CassandraConstants.CACHING);
if (caching != null)
{
if (builder != null)
{
appendPropertyToBuilder(builder, caching, CassandraConstants.CACHING);
}
else
{
cfDef.setCaching(caching);
}
}
} | java | private void onSetCaching(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String caching = cfProperties.getProperty(CassandraConstants.CACHING);
if (caching != null)
{
if (builder != null)
{
appendPropertyToBuilder(builder, caching, CassandraConstants.CACHING);
}
else
{
cfDef.setCaching(caching);
}
}
} | [
"private",
"void",
"onSetCaching",
"(",
"CfDef",
"cfDef",
",",
"Properties",
"cfProperties",
",",
"StringBuilder",
"builder",
")",
"{",
"String",
"caching",
"=",
"cfProperties",
".",
"getProperty",
"(",
"CassandraConstants",
".",
"CACHING",
")",
";",
"if",
"(",
... | On set caching.
@param cfDef
the cf def
@param cfProperties
the cf properties
@param builder
the builder | [
"On",
"set",
"caching",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2470-L2484 |
phax/ph-oton | ph-oton-core/src/main/java/com/helger/photon/core/systemmsg/SystemMessageData.java | SystemMessageData.setSystemMessage | @Nonnull
public EChange setSystemMessage (@Nonnull final ESystemMessageType eMessageType, @Nullable final String sMessage)
{
ValueEnforcer.notNull (eMessageType, "MessageType");
if (m_eMessageType.equals (eMessageType) && EqualsHelper.equals (m_sMessage, sMessage))
return EChange.UNCHANGED;
internalSetMessageType (eMessageType);
internalSetMessage (sMessage);
setLastUpdate (PDTFactory.getCurrentLocalDateTime ());
return EChange.CHANGED;
} | java | @Nonnull
public EChange setSystemMessage (@Nonnull final ESystemMessageType eMessageType, @Nullable final String sMessage)
{
ValueEnforcer.notNull (eMessageType, "MessageType");
if (m_eMessageType.equals (eMessageType) && EqualsHelper.equals (m_sMessage, sMessage))
return EChange.UNCHANGED;
internalSetMessageType (eMessageType);
internalSetMessage (sMessage);
setLastUpdate (PDTFactory.getCurrentLocalDateTime ());
return EChange.CHANGED;
} | [
"@",
"Nonnull",
"public",
"EChange",
"setSystemMessage",
"(",
"@",
"Nonnull",
"final",
"ESystemMessageType",
"eMessageType",
",",
"@",
"Nullable",
"final",
"String",
"sMessage",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eMessageType",
",",
"\"MessageType\"",
... | Set the system message type and text, and update the last modification
date.
@param eMessageType
Message type. May not be <code>null</code>.
@param sMessage
The message text. May be <code>null</code>.
@return {@link EChange} | [
"Set",
"the",
"system",
"message",
"type",
"and",
"text",
"and",
"update",
"the",
"last",
"modification",
"date",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/systemmsg/SystemMessageData.java#L105-L118 |
jbundle/jbundle | thin/base/thread/src/main/java/org/jbundle/thin/base/thread/TaskScheduler.java | TaskScheduler.addTask | public void addTask(Object objJobDef)
{
synchronized (this)
{
gvJobs.addElement(objJobDef); // Vector is thread safe.
if (giCurrentThreads >= giMaxThreads)
return; // The max threads are running... let the scheduler process them in order
giCurrentThreads++; // I'm going to start another thread
}
TaskScheduler js = this.makeNewTaskScheduler(0);
// This should be done more efficiently... having the threads waiting in a pool to be awakened when needed.
Thread thread = new Thread(js, "TaskSchedulerThread");
thread.start();
} | java | public void addTask(Object objJobDef)
{
synchronized (this)
{
gvJobs.addElement(objJobDef); // Vector is thread safe.
if (giCurrentThreads >= giMaxThreads)
return; // The max threads are running... let the scheduler process them in order
giCurrentThreads++; // I'm going to start another thread
}
TaskScheduler js = this.makeNewTaskScheduler(0);
// This should be done more efficiently... having the threads waiting in a pool to be awakened when needed.
Thread thread = new Thread(js, "TaskSchedulerThread");
thread.start();
} | [
"public",
"void",
"addTask",
"(",
"Object",
"objJobDef",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"gvJobs",
".",
"addElement",
"(",
"objJobDef",
")",
";",
"// Vector is thread safe.",
"if",
"(",
"giCurrentThreads",
">=",
"giMaxThreads",
")",
"return",
... | Add a job to the queue.
@param objJobDef Can be a AutoTask object or a string describing the job to run (in the overriding class). | [
"Add",
"a",
"job",
"to",
"the",
"queue",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/thread/src/main/java/org/jbundle/thin/base/thread/TaskScheduler.java#L100-L113 |
DaGeRe/KoPeMe | kopeme-analysis/src/main/java/de/dagere/kopeme/instrumentation/KoPeMeClassFileTransformater.java | KoPeMeClassFileTransformater.around | private void around(final CtMethod m, final String before, final String after, final List<VarDeclarationData> declarations) throws CannotCompileException, NotFoundException {
String signature = Modifier.toString(m.getModifiers()) + " " + m.getReturnType().getName() + " " + m.getLongName();
LOG.info("--- Instrumenting " + signature);
for (VarDeclarationData declaration : declarations) {
m.addLocalVariable(declaration.getName(), pool.get(declaration.getType()));
}
m.insertBefore(before);
m.insertAfter(after);
} | java | private void around(final CtMethod m, final String before, final String after, final List<VarDeclarationData> declarations) throws CannotCompileException, NotFoundException {
String signature = Modifier.toString(m.getModifiers()) + " " + m.getReturnType().getName() + " " + m.getLongName();
LOG.info("--- Instrumenting " + signature);
for (VarDeclarationData declaration : declarations) {
m.addLocalVariable(declaration.getName(), pool.get(declaration.getType()));
}
m.insertBefore(before);
m.insertAfter(after);
} | [
"private",
"void",
"around",
"(",
"final",
"CtMethod",
"m",
",",
"final",
"String",
"before",
",",
"final",
"String",
"after",
",",
"final",
"List",
"<",
"VarDeclarationData",
">",
"declarations",
")",
"throws",
"CannotCompileException",
",",
"NotFoundException",
... | Method introducing code before and after a given javassist method.
@param m
@param before
@param after
@throws CannotCompileException
@throws NotFoundException | [
"Method",
"introducing",
"code",
"before",
"and",
"after",
"a",
"given",
"javassist",
"method",
"."
] | train | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-analysis/src/main/java/de/dagere/kopeme/instrumentation/KoPeMeClassFileTransformater.java#L82-L90 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker_snmpmanager.java | br_broker_snmpmanager.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_broker_snmpmanager_responses result = (br_broker_snmpmanager_responses) service.get_payload_formatter().string_to_resource(br_broker_snmpmanager_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.br_broker_snmpmanager_response_array);
}
br_broker_snmpmanager[] result_br_broker_snmpmanager = new br_broker_snmpmanager[result.br_broker_snmpmanager_response_array.length];
for(int i = 0; i < result.br_broker_snmpmanager_response_array.length; i++)
{
result_br_broker_snmpmanager[i] = result.br_broker_snmpmanager_response_array[i].br_broker_snmpmanager[0];
}
return result_br_broker_snmpmanager;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_broker_snmpmanager_responses result = (br_broker_snmpmanager_responses) service.get_payload_formatter().string_to_resource(br_broker_snmpmanager_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.br_broker_snmpmanager_response_array);
}
br_broker_snmpmanager[] result_br_broker_snmpmanager = new br_broker_snmpmanager[result.br_broker_snmpmanager_response_array.length];
for(int i = 0; i < result.br_broker_snmpmanager_response_array.length; i++)
{
result_br_broker_snmpmanager[i] = result.br_broker_snmpmanager_response_array[i].br_broker_snmpmanager[0];
}
return result_br_broker_snmpmanager;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"br_broker_snmpmanager_responses",
"result",
"=",
"(",
"br_broker_snmpmanager_responses",
")",
"service",
".",
... | <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/br_broker/br_broker_snmpmanager.java#L199-L216 |
vorburger/xtendbeans | ch.vorburger.xtendbeans/src/main/java/ch/vorburger/xtendbeans/AssertBeans.java | AssertBeans.assertEqualBeans | public static void assertEqualBeans(Object expected, Object actual) throws ComparisonFailure {
// Do *NOT* rely on expected/actual java.lang.Object.equals(Object);
// and obviously neither e.g. java.util.Objects.equals(Object, Object) based on. it
final String expectedAsText = generator.getExpression(expected);
assertEqualByText(expectedAsText, actual);
} | java | public static void assertEqualBeans(Object expected, Object actual) throws ComparisonFailure {
// Do *NOT* rely on expected/actual java.lang.Object.equals(Object);
// and obviously neither e.g. java.util.Objects.equals(Object, Object) based on. it
final String expectedAsText = generator.getExpression(expected);
assertEqualByText(expectedAsText, actual);
} | [
"public",
"static",
"void",
"assertEqualBeans",
"(",
"Object",
"expected",
",",
"Object",
"actual",
")",
"throws",
"ComparisonFailure",
"{",
"// Do *NOT* rely on expected/actual java.lang.Object.equals(Object);",
"// and obviously neither e.g. java.util.Objects.equals(Object, Object) b... | Asserts that two JavaBean or immutable Value Objects are equal. If they are not, throws an
{@link ComparisonFailure} with highly readable textual representations of the objects' properties.
@param expected
expected value
@param actual
the value to check against <code>expected</code> | [
"Asserts",
"that",
"two",
"JavaBean",
"or",
"immutable",
"Value",
"Objects",
"are",
"equal",
".",
"If",
"they",
"are",
"not",
"throws",
"an",
"{",
"@link",
"ComparisonFailure",
"}",
"with",
"highly",
"readable",
"textual",
"representations",
"of",
"the",
"obje... | train | https://github.com/vorburger/xtendbeans/blob/0442f7e0ee5ff16653c6ad89bbdf29d9b83f993d/ch.vorburger.xtendbeans/src/main/java/ch/vorburger/xtendbeans/AssertBeans.java#L56-L61 |
JavaMoney/jsr354-api | src/main/java/javax/money/Monetary.java | Monetary.getCurrencies | public static Set<CurrencyUnit> getCurrencies(Locale locale, String... providers) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrencies(locale, providers);
} | java | public static Set<CurrencyUnit> getCurrencies(Locale locale, String... providers) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrencies(locale, providers);
} | [
"public",
"static",
"Set",
"<",
"CurrencyUnit",
">",
"getCurrencies",
"(",
"Locale",
"locale",
",",
"String",
"...",
"providers",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"MONETARY_CURRENCIES_SINGLETON_SPI",
"(",
")",
")",
".",
"orElseThrow",
"(",... | Access a new instance based on the {@link Locale}. Currencies are
available as provided by {@link CurrencyProviderSpi} instances registered
with the {@link javax.money.spi.Bootstrap}.
@param locale the target {@link Locale}, typically representing an ISO
country, not {@code null}.
@param providers the (optional) specification of providers to consider.
@return the corresponding {@link CurrencyUnit} instance.
@throws UnknownCurrencyException if no such currency exists. | [
"Access",
"a",
"new",
"instance",
"based",
"on",
"the",
"{",
"@link",
"Locale",
"}",
".",
"Currencies",
"are",
"available",
"as",
"provided",
"by",
"{",
"@link",
"CurrencyProviderSpi",
"}",
"instances",
"registered",
"with",
"the",
"{",
"@link",
"javax",
"."... | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L420-L424 |
looly/hutool | hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitSetBloomFilter.java | BitSetBloomFilter.init | public void init(String path, String charset) throws IOException {
BufferedReader reader = FileUtil.getReader(path, charset);
try {
String line;
while(true) {
line = reader.readLine();
if(line == null) {
break;
}
this.add(line);
}
}finally {
IoUtil.close(reader);
}
} | java | public void init(String path, String charset) throws IOException {
BufferedReader reader = FileUtil.getReader(path, charset);
try {
String line;
while(true) {
line = reader.readLine();
if(line == null) {
break;
}
this.add(line);
}
}finally {
IoUtil.close(reader);
}
} | [
"public",
"void",
"init",
"(",
"String",
"path",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"reader",
"=",
"FileUtil",
".",
"getReader",
"(",
"path",
",",
"charset",
")",
";",
"try",
"{",
"String",
"line",
";",
"while",
... | 通过文件初始化过滤器.
@param path 文件路径
@param charset 字符集
@throws IOException IO异常 | [
"通过文件初始化过滤器",
"."
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitSetBloomFilter.java#L44-L58 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.setEnterpriseDate | public void setEnterpriseDate(int index, Date value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_DATE, index), value);
} | java | public void setEnterpriseDate(int index, Date value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_DATE, index), value);
} | [
"public",
"void",
"setEnterpriseDate",
"(",
"int",
"index",
",",
"Date",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"ENTERPRISE_DATE",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set an enterprise date value.
@param index date index (1-30)
@param value date value | [
"Set",
"an",
"enterprise",
"date",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1716-L1719 |
apache/groovy | src/main/groovy/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.withBuilder | public Object withBuilder(FactoryBuilderSupport builder, Closure closure) {
if (builder == null || closure == null) {
return null;
}
Object result = null;
Object previousContext = getProxyBuilder().getContext();
FactoryBuilderSupport previousProxyBuilder = localProxyBuilder.get();
try {
localProxyBuilder.set(builder);
closure.setDelegate(builder);
result = closure.call();
}
catch (RuntimeException e) {
// remove contexts created after we started
localProxyBuilder.set(previousProxyBuilder);
if (getProxyBuilder().getContexts().contains(previousContext)) {
Map<String, Object> context = getProxyBuilder().getContext();
while (context != null && context != previousContext) {
getProxyBuilder().popContext();
context = getProxyBuilder().getContext();
}
}
throw e;
}
finally {
localProxyBuilder.set(previousProxyBuilder);
}
return result;
} | java | public Object withBuilder(FactoryBuilderSupport builder, Closure closure) {
if (builder == null || closure == null) {
return null;
}
Object result = null;
Object previousContext = getProxyBuilder().getContext();
FactoryBuilderSupport previousProxyBuilder = localProxyBuilder.get();
try {
localProxyBuilder.set(builder);
closure.setDelegate(builder);
result = closure.call();
}
catch (RuntimeException e) {
// remove contexts created after we started
localProxyBuilder.set(previousProxyBuilder);
if (getProxyBuilder().getContexts().contains(previousContext)) {
Map<String, Object> context = getProxyBuilder().getContext();
while (context != null && context != previousContext) {
getProxyBuilder().popContext();
context = getProxyBuilder().getContext();
}
}
throw e;
}
finally {
localProxyBuilder.set(previousProxyBuilder);
}
return result;
} | [
"public",
"Object",
"withBuilder",
"(",
"FactoryBuilderSupport",
"builder",
",",
"Closure",
"closure",
")",
"{",
"if",
"(",
"builder",
"==",
"null",
"||",
"closure",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Object",
"result",
"=",
"null",
";",
... | Switches the builder's proxyBuilder during the execution of a closure.<br>
This is useful to temporary change the building context to another builder
without the need for a contrived setup. It will also take care of restoring
the previous proxyBuilder when the execution finishes, even if an exception
was thrown from inside the closure.
@param builder the temporary builder to switch to as proxyBuilder.
@param closure the closure to be executed under the temporary builder.
@return the execution result of the closure.
@throws RuntimeException - any exception the closure might have thrown during
execution. | [
"Switches",
"the",
"builder",
"s",
"proxyBuilder",
"during",
"the",
"execution",
"of",
"a",
"closure",
".",
"<br",
">",
"This",
"is",
"useful",
"to",
"temporary",
"change",
"the",
"building",
"context",
"to",
"another",
"builder",
"without",
"the",
"need",
"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L1205-L1235 |
alibaba/transmittable-thread-local | src/main/java/com/alibaba/ttl/TtlTimerTask.java | TtlTimerTask.get | @Nullable
public static TtlTimerTask get(@Nullable TimerTask timerTask) {
return get(timerTask, false, false);
} | java | @Nullable
public static TtlTimerTask get(@Nullable TimerTask timerTask) {
return get(timerTask, false, false);
} | [
"@",
"Nullable",
"public",
"static",
"TtlTimerTask",
"get",
"(",
"@",
"Nullable",
"TimerTask",
"timerTask",
")",
"{",
"return",
"get",
"(",
"timerTask",
",",
"false",
",",
"false",
")",
";",
"}"
] | Factory method, wrap input {@link TimerTask} to {@link TtlTimerTask}.
<p>
This method is idempotent.
@param timerTask input {@link TimerTask}
@return Wrapped {@link TimerTask} | [
"Factory",
"method",
"wrap",
"input",
"{",
"@link",
"TimerTask",
"}",
"to",
"{",
"@link",
"TtlTimerTask",
"}",
".",
"<p",
">",
"This",
"method",
"is",
"idempotent",
"."
] | train | https://github.com/alibaba/transmittable-thread-local/blob/30b4d99cdb7064b4c1797d2e40bfa07adce8e7f9/src/main/java/com/alibaba/ttl/TtlTimerTask.java#L91-L94 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/GeometryCollection.java | GeometryCollection.fromGeometries | public static GeometryCollection fromGeometries(@NonNull List<Geometry> geometries) {
return new GeometryCollection(TYPE, null, geometries);
} | java | public static GeometryCollection fromGeometries(@NonNull List<Geometry> geometries) {
return new GeometryCollection(TYPE, null, geometries);
} | [
"public",
"static",
"GeometryCollection",
"fromGeometries",
"(",
"@",
"NonNull",
"List",
"<",
"Geometry",
">",
"geometries",
")",
"{",
"return",
"new",
"GeometryCollection",
"(",
"TYPE",
",",
"null",
",",
"geometries",
")",
";",
"}"
] | Create a new instance of this class by giving the collection a list of {@link Geometry}.
@param geometries a non-null list of geometry which makes up this collection
@return a new instance of this class defined by the values passed inside this static factory
method
@since 1.0.0 | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"giving",
"the",
"collection",
"a",
"list",
"of",
"{",
"@link",
"Geometry",
"}",
"."
] | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/GeometryCollection.java#L100-L102 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/ECKey.java | ECKey.verifyMessage | public void verifyMessage(String message, String signatureBase64) throws SignatureException {
ECKey key = ECKey.signedMessageToKey(message, signatureBase64);
if (!key.pub.equals(pub))
throw new SignatureException("Signature did not match for message");
} | java | public void verifyMessage(String message, String signatureBase64) throws SignatureException {
ECKey key = ECKey.signedMessageToKey(message, signatureBase64);
if (!key.pub.equals(pub))
throw new SignatureException("Signature did not match for message");
} | [
"public",
"void",
"verifyMessage",
"(",
"String",
"message",
",",
"String",
"signatureBase64",
")",
"throws",
"SignatureException",
"{",
"ECKey",
"key",
"=",
"ECKey",
".",
"signedMessageToKey",
"(",
"message",
",",
"signatureBase64",
")",
";",
"if",
"(",
"!",
... | Convenience wrapper around {@link ECKey#signedMessageToKey(String, String)}. If the key derived from the
signature is not the same as this one, throws a SignatureException. | [
"Convenience",
"wrapper",
"around",
"{"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/ECKey.java#L935-L939 |
gliga/ekstazi | ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java | StaticSelectEkstaziMojo.checkSurefirePlugin | protected void checkSurefirePlugin(Plugin plugin, String[] nonSupportedVersions, String minSupported) throws MojoExecutionException {
// Check if plugin is available.
if (plugin == null) {
throw new MojoExecutionException("Surefire plugin not avaialble");
}
String version = plugin.getVersion();
for (String nonSupportedVersion : nonSupportedVersions) {
if (version.equals(nonSupportedVersion)) {
throw new MojoExecutionException("Not supported surefire version; version has to be " + minSupported + " or higher");
}
}
} | java | protected void checkSurefirePlugin(Plugin plugin, String[] nonSupportedVersions, String minSupported) throws MojoExecutionException {
// Check if plugin is available.
if (plugin == null) {
throw new MojoExecutionException("Surefire plugin not avaialble");
}
String version = plugin.getVersion();
for (String nonSupportedVersion : nonSupportedVersions) {
if (version.equals(nonSupportedVersion)) {
throw new MojoExecutionException("Not supported surefire version; version has to be " + minSupported + " or higher");
}
}
} | [
"protected",
"void",
"checkSurefirePlugin",
"(",
"Plugin",
"plugin",
",",
"String",
"[",
"]",
"nonSupportedVersions",
",",
"String",
"minSupported",
")",
"throws",
"MojoExecutionException",
"{",
"// Check if plugin is available.",
"if",
"(",
"plugin",
"==",
"null",
")... | Check if surefire plugin is available and if correct version is
used (we require 2.13 or higher, as previous versions do not
support excludesFile). | [
"Check",
"if",
"surefire",
"plugin",
"is",
"available",
"and",
"if",
"correct",
"version",
"is",
"used",
"(",
"we",
"require",
"2",
".",
"13",
"or",
"higher",
"as",
"previous",
"versions",
"do",
"not",
"support",
"excludesFile",
")",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java#L342-L353 |
spring-projects/spring-security-oauth | spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/OAuth2Request.java | OAuth2Request.createOAuth2Request | public OAuth2Request createOAuth2Request(Map<String, String> parameters) {
return new OAuth2Request(parameters, getClientId(), authorities, approved, getScope(), resourceIds,
redirectUri, responseTypes, extensions);
} | java | public OAuth2Request createOAuth2Request(Map<String, String> parameters) {
return new OAuth2Request(parameters, getClientId(), authorities, approved, getScope(), resourceIds,
redirectUri, responseTypes, extensions);
} | [
"public",
"OAuth2Request",
"createOAuth2Request",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"return",
"new",
"OAuth2Request",
"(",
"parameters",
",",
"getClientId",
"(",
")",
",",
"authorities",
",",
"approved",
",",
"getScope",
"(... | Update the request parameters and return a new object with the same properties except the parameters.
@param parameters new parameters replacing the existing ones
@return a new OAuth2Request | [
"Update",
"the",
"request",
"parameters",
"and",
"return",
"a",
"new",
"object",
"with",
"the",
"same",
"properties",
"except",
"the",
"parameters",
"."
] | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/OAuth2Request.java#L133-L136 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java | FailoverGroupsInner.forceFailoverAllowDataLoss | public FailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String serverName, String failoverGroupName) {
return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().last().body();
} | java | public FailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String serverName, String failoverGroupName) {
return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().last().body();
} | [
"public",
"FailoverGroupInner",
"forceFailoverAllowDataLoss",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"failoverGroupName",
")",
"{",
"return",
"forceFailoverAllowDataLossWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverNam... | Fails over from the current primary server to this server. This operation might result in data loss.
@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 containing the failover group.
@param failoverGroupName The name of the failover group.
@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 FailoverGroupInner object if successful. | [
"Fails",
"over",
"from",
"the",
"current",
"primary",
"server",
"to",
"this",
"server",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L1060-L1062 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java | JpaControllerManagement.handleRegisterRetrieved | private Action handleRegisterRetrieved(final Long actionId, final String message) {
final JpaAction action = getActionAndThrowExceptionIfNotFound(actionId);
// do a manual query with CriteriaBuilder to avoid unnecessary field
// queries and an extra
// count query made by spring-data when using pageable requests, we
// don't need an extra count
// query, we just want to check if the last action status is a retrieved
// or not.
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
final CriteriaQuery<Object[]> queryActionStatus = cb.createQuery(Object[].class);
final Root<JpaActionStatus> actionStatusRoot = queryActionStatus.from(JpaActionStatus.class);
final CriteriaQuery<Object[]> query = queryActionStatus
.multiselect(actionStatusRoot.get(JpaActionStatus_.id), actionStatusRoot.get(JpaActionStatus_.status))
.where(cb.equal(actionStatusRoot.get(JpaActionStatus_.action).get(JpaAction_.id), actionId))
.orderBy(cb.desc(actionStatusRoot.get(JpaActionStatus_.id)));
final List<Object[]> resultList = entityManager.createQuery(query).setFirstResult(0).setMaxResults(1)
.getResultList();
// if the latest status is not in retrieve state then we add a retrieved
// state again, we want
// to document a deployment retrieved status and a cancel retrieved
// status, but multiple
// retrieves after the other we don't want to store to protect to
// overflood action status in
// case controller retrieves a action multiple times.
if (resultList.isEmpty() || !Status.RETRIEVED.equals(resultList.get(0)[1])) {
// document that the status has been retrieved
actionStatusRepository
.save(new JpaActionStatus(action, Status.RETRIEVED, System.currentTimeMillis(), message));
// don't change the action status itself in case the action is in
// canceling state otherwise
// we modify the action status and the controller won't get the
// cancel job anymore.
if (!action.isCancelingOrCanceled()) {
action.setStatus(Status.RETRIEVED);
return actionRepository.save(action);
}
}
return action;
} | java | private Action handleRegisterRetrieved(final Long actionId, final String message) {
final JpaAction action = getActionAndThrowExceptionIfNotFound(actionId);
// do a manual query with CriteriaBuilder to avoid unnecessary field
// queries and an extra
// count query made by spring-data when using pageable requests, we
// don't need an extra count
// query, we just want to check if the last action status is a retrieved
// or not.
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
final CriteriaQuery<Object[]> queryActionStatus = cb.createQuery(Object[].class);
final Root<JpaActionStatus> actionStatusRoot = queryActionStatus.from(JpaActionStatus.class);
final CriteriaQuery<Object[]> query = queryActionStatus
.multiselect(actionStatusRoot.get(JpaActionStatus_.id), actionStatusRoot.get(JpaActionStatus_.status))
.where(cb.equal(actionStatusRoot.get(JpaActionStatus_.action).get(JpaAction_.id), actionId))
.orderBy(cb.desc(actionStatusRoot.get(JpaActionStatus_.id)));
final List<Object[]> resultList = entityManager.createQuery(query).setFirstResult(0).setMaxResults(1)
.getResultList();
// if the latest status is not in retrieve state then we add a retrieved
// state again, we want
// to document a deployment retrieved status and a cancel retrieved
// status, but multiple
// retrieves after the other we don't want to store to protect to
// overflood action status in
// case controller retrieves a action multiple times.
if (resultList.isEmpty() || !Status.RETRIEVED.equals(resultList.get(0)[1])) {
// document that the status has been retrieved
actionStatusRepository
.save(new JpaActionStatus(action, Status.RETRIEVED, System.currentTimeMillis(), message));
// don't change the action status itself in case the action is in
// canceling state otherwise
// we modify the action status and the controller won't get the
// cancel job anymore.
if (!action.isCancelingOrCanceled()) {
action.setStatus(Status.RETRIEVED);
return actionRepository.save(action);
}
}
return action;
} | [
"private",
"Action",
"handleRegisterRetrieved",
"(",
"final",
"Long",
"actionId",
",",
"final",
"String",
"message",
")",
"{",
"final",
"JpaAction",
"action",
"=",
"getActionAndThrowExceptionIfNotFound",
"(",
"actionId",
")",
";",
"// do a manual query with CriteriaBuilde... | Registers retrieved status for given {@link Target} and {@link Action} if
it does not exist yet.
@param actionId
to the handle status for
@param message
for the status
@return the updated action in case the status has been changed to
{@link Status#RETRIEVED} | [
"Registers",
"retrieved",
"status",
"for",
"given",
"{",
"@link",
"Target",
"}",
"and",
"{",
"@link",
"Action",
"}",
"if",
"it",
"does",
"not",
"exist",
"yet",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java#L808-L848 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.