repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
square/okhttp | okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.java | WebSocketWriter.writeClose | void writeClose(int code, ByteString reason) throws IOException {
ByteString payload = ByteString.EMPTY;
if (code != 0 || reason != null) {
if (code != 0) {
validateCloseCode(code);
}
Buffer buffer = new Buffer();
buffer.writeShort(code);
if (reason != null) {
buffer.write(reason);
}
payload = buffer.readByteString();
}
try {
writeControlFrame(OPCODE_CONTROL_CLOSE, payload);
} finally {
writerClosed = true;
}
} | java | void writeClose(int code, ByteString reason) throws IOException {
ByteString payload = ByteString.EMPTY;
if (code != 0 || reason != null) {
if (code != 0) {
validateCloseCode(code);
}
Buffer buffer = new Buffer();
buffer.writeShort(code);
if (reason != null) {
buffer.write(reason);
}
payload = buffer.readByteString();
}
try {
writeControlFrame(OPCODE_CONTROL_CLOSE, payload);
} finally {
writerClosed = true;
}
} | [
"void",
"writeClose",
"(",
"int",
"code",
",",
"ByteString",
"reason",
")",
"throws",
"IOException",
"{",
"ByteString",
"payload",
"=",
"ByteString",
".",
"EMPTY",
";",
"if",
"(",
"code",
"!=",
"0",
"||",
"reason",
"!=",
"null",
")",
"{",
"if",
"(",
"c... | Send a close frame with optional code and reason.
@param code Status code as defined by <a
href="http://tools.ietf.org/html/rfc6455#section-7.4">Section 7.4 of RFC 6455</a> or {@code 0}.
@param reason Reason for shutting down or {@code null}. | [
"Send",
"a",
"close",
"frame",
"with",
"optional",
"code",
"and",
"reason",
"."
] | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.java#L91-L110 |
camunda/camunda-spin | core/src/main/java/org/camunda/spin/impl/util/SpinIoUtil.java | SpinIoUtil.getStringFromReader | public static String getStringFromReader(Reader reader, boolean trim) throws IOException {
BufferedReader bufferedReader = null;
StringBuilder stringBuilder = new StringBuilder();
try {
bufferedReader = new BufferedReader(reader);
String line;
while ((line = bufferedReader.readLine()) != null) {
if (trim) {
stringBuilder.append(line.trim());
} else {
stringBuilder.append(line).append("\n");
}
}
} finally {
closeSilently(bufferedReader);
}
return stringBuilder.toString();
} | java | public static String getStringFromReader(Reader reader, boolean trim) throws IOException {
BufferedReader bufferedReader = null;
StringBuilder stringBuilder = new StringBuilder();
try {
bufferedReader = new BufferedReader(reader);
String line;
while ((line = bufferedReader.readLine()) != null) {
if (trim) {
stringBuilder.append(line.trim());
} else {
stringBuilder.append(line).append("\n");
}
}
} finally {
closeSilently(bufferedReader);
}
return stringBuilder.toString();
} | [
"public",
"static",
"String",
"getStringFromReader",
"(",
"Reader",
"reader",
",",
"boolean",
"trim",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"bufferedReader",
"=",
"null",
";",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
... | Convert an {@link Reader} to a {@link String}
@param reader the {@link Reader} to convert
@param trim trigger if whitespaces are trimmed in the output
@return the resulting {@link String}
@throws IOException | [
"Convert",
"an",
"{",
"@link",
"Reader",
"}",
"to",
"a",
"{",
"@link",
"String",
"}"
] | train | https://github.com/camunda/camunda-spin/blob/cfe65161eb97fd5023a945cb97c47fbfe69e9fdd/core/src/main/java/org/camunda/spin/impl/util/SpinIoUtil.java#L106-L124 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/LastaAction.java | LastaAction.forwardById | protected HtmlResponse forwardById(Class<?> actionType, Number... ids) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("ids", ids);
final Object[] objAry = (Object[]) ids; // to suppress warning
return forwardWith(actionType, moreUrl(objAry));
} | java | protected HtmlResponse forwardById(Class<?> actionType, Number... ids) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("ids", ids);
final Object[] objAry = (Object[]) ids; // to suppress warning
return forwardWith(actionType, moreUrl(objAry));
} | [
"protected",
"HtmlResponse",
"forwardById",
"(",
"Class",
"<",
"?",
">",
"actionType",
",",
"Number",
"...",
"ids",
")",
"{",
"assertArgumentNotNull",
"(",
"\"actionType\"",
",",
"actionType",
")",
";",
"assertArgumentNotNull",
"(",
"\"ids\"",
",",
"ids",
")",
... | Forward to the action (index method) by the IDs on URL.
<pre>
<span style="color: #3F7E5E">// e.g. /member/edit/3/</span>
return forwardById(MemberEditAction.class, 3);
<span style="color: #3F7E5E">// e.g. /member/edit/3/197/</span>
return forwardById(MemberEditAction.class, 3, 197);
<span style="color: #3F7E5E">// e.g. /member/3/</span>
return forwardById(MemberAction.class, 3);
</pre>
@param actionType The class type of action that it forwards to. (NotNull)
@param ids The varying array for IDs. (NotNull)
@return The HTML response for forward. (NotNull) | [
"Forward",
"to",
"the",
"action",
"(",
"index",
"method",
")",
"by",
"the",
"IDs",
"on",
"URL",
".",
"<pre",
">",
"<span",
"style",
"=",
"color",
":",
"#3F7E5E",
">",
"//",
"e",
".",
"g",
".",
"/",
"member",
"/",
"edit",
"/",
"3",
"/",
"<",
"/"... | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/LastaAction.java#L412-L417 |
jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.loginAndTakeBack | @SuppressWarnings("ACL.impersonate")
private void loginAndTakeBack(StaplerRequest req, StaplerResponse rsp, User u) throws ServletException, IOException {
HttpSession session = req.getSession(false);
if (session != null) {
// avoid session fixation
session.invalidate();
}
req.getSession(true);
// ... and let him login
Authentication a = new UsernamePasswordAuthenticationToken(u.getId(),req.getParameter("password1"));
a = this.getSecurityComponents().manager.authenticate(a);
SecurityContextHolder.getContext().setAuthentication(a);
SecurityListener.fireLoggedIn(u.getId());
// then back to top
req.getView(this,"success.jelly").forward(req,rsp);
} | java | @SuppressWarnings("ACL.impersonate")
private void loginAndTakeBack(StaplerRequest req, StaplerResponse rsp, User u) throws ServletException, IOException {
HttpSession session = req.getSession(false);
if (session != null) {
// avoid session fixation
session.invalidate();
}
req.getSession(true);
// ... and let him login
Authentication a = new UsernamePasswordAuthenticationToken(u.getId(),req.getParameter("password1"));
a = this.getSecurityComponents().manager.authenticate(a);
SecurityContextHolder.getContext().setAuthentication(a);
SecurityListener.fireLoggedIn(u.getId());
// then back to top
req.getView(this,"success.jelly").forward(req,rsp);
} | [
"@",
"SuppressWarnings",
"(",
"\"ACL.impersonate\"",
")",
"private",
"void",
"loginAndTakeBack",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
",",
"User",
"u",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"HttpSession",
"session",
"=",... | Lets the current user silently login as the given user and report back accordingly. | [
"Lets",
"the",
"current",
"user",
"silently",
"login",
"as",
"the",
"given",
"user",
"and",
"report",
"back",
"accordingly",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L269-L287 |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.findZip | public static void findZip(String zipName, InputStream zipInput, FileFilter searchFilter, List<String> results)
throws IOException {
ZipInputStream zin = new ZipInputStream(zipInput);
while (true) {
final ZipEntry en;
try {
en = zin.getNextEntry();
} catch (IOException | IllegalArgumentException e) {
throw new IOException("While handling file " + zipName, e);
}
if(en == null) {
break;
}
if (searchFilter.accept(new File(en.getName()))) {
results.add(zipName + ZIP_DELIMITER + en);
}
if (ZipUtils.isZip(en.getName())) {
findZip(zipName + ZIP_DELIMITER + en, zin, searchFilter, results);
}
}
} | java | public static void findZip(String zipName, InputStream zipInput, FileFilter searchFilter, List<String> results)
throws IOException {
ZipInputStream zin = new ZipInputStream(zipInput);
while (true) {
final ZipEntry en;
try {
en = zin.getNextEntry();
} catch (IOException | IllegalArgumentException e) {
throw new IOException("While handling file " + zipName, e);
}
if(en == null) {
break;
}
if (searchFilter.accept(new File(en.getName()))) {
results.add(zipName + ZIP_DELIMITER + en);
}
if (ZipUtils.isZip(en.getName())) {
findZip(zipName + ZIP_DELIMITER + en, zin, searchFilter, results);
}
}
} | [
"public",
"static",
"void",
"findZip",
"(",
"String",
"zipName",
",",
"InputStream",
"zipInput",
",",
"FileFilter",
"searchFilter",
",",
"List",
"<",
"String",
">",
"results",
")",
"throws",
"IOException",
"{",
"ZipInputStream",
"zin",
"=",
"new",
"ZipInputStrea... | Looks in the ZIP file available via zipInput for files matching the provided file-filter,
recursing into sub-ZIP files.
@param zipName Name of the file to read, mainly used for building the resulting pointer into the zip-file
@param zipInput An InputStream which is positioned at the beginning of the zip-file contents
@param searchFilter A {@link FileFilter} which determines if files in the zip-file are matched
@param results A existing list where found matches are added to.
@throws IOException
If the ZIP file cannot be read, e.g. if it is corrupted. | [
"Looks",
"in",
"the",
"ZIP",
"file",
"available",
"via",
"zipInput",
"for",
"files",
"matching",
"the",
"provided",
"file",
"-",
"filter",
"recursing",
"into",
"sub",
"-",
"ZIP",
"files",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L109-L129 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java | JobSchedulesImpl.listAsync | public ServiceFuture<List<CloudJobSchedule>> listAsync(final JobScheduleListOptions jobScheduleListOptions, final ListOperationCallback<CloudJobSchedule> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(jobScheduleListOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(String nextPageLink) {
JobScheduleListNextOptions jobScheduleListNextOptions = null;
if (jobScheduleListOptions != null) {
jobScheduleListNextOptions = new JobScheduleListNextOptions();
jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId());
jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId());
jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions);
}
},
serviceCallback);
} | java | public ServiceFuture<List<CloudJobSchedule>> listAsync(final JobScheduleListOptions jobScheduleListOptions, final ListOperationCallback<CloudJobSchedule> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(jobScheduleListOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(String nextPageLink) {
JobScheduleListNextOptions jobScheduleListNextOptions = null;
if (jobScheduleListOptions != null) {
jobScheduleListNextOptions = new JobScheduleListNextOptions();
jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId());
jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId());
jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"CloudJobSchedule",
">",
">",
"listAsync",
"(",
"final",
"JobScheduleListOptions",
"jobScheduleListOptions",
",",
"final",
"ListOperationCallback",
"<",
"CloudJobSchedule",
">",
"serviceCallback",
")",
"{",
"return",
"AzureSe... | Lists all of the job schedules in the specified account.
@param jobScheduleListOptions Additional parameters for the operation
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"all",
"of",
"the",
"job",
"schedules",
"in",
"the",
"specified",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L2322-L2339 |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java | MyEntitiesValidationReport.addAttribute | public MyEntitiesValidationReport addAttribute(String attributeName, AttributeState state) {
if (getImportOrder().isEmpty()) {
throw new IllegalStateException("Must add entity first");
}
String entityTypeId = getImportOrder().get(getImportOrder().size() - 1);
valid = valid && state.isValid();
switch (state) {
case IMPORTABLE:
addField(fieldsImportable, entityTypeId, attributeName);
break;
case UNKNOWN:
addField(fieldsUnknown, entityTypeId, attributeName);
break;
case AVAILABLE:
addField(fieldsAvailable, entityTypeId, attributeName);
break;
case REQUIRED:
addField(fieldsRequired, entityTypeId, attributeName);
break;
default:
throw new UnexpectedEnumException(state);
}
return this;
} | java | public MyEntitiesValidationReport addAttribute(String attributeName, AttributeState state) {
if (getImportOrder().isEmpty()) {
throw new IllegalStateException("Must add entity first");
}
String entityTypeId = getImportOrder().get(getImportOrder().size() - 1);
valid = valid && state.isValid();
switch (state) {
case IMPORTABLE:
addField(fieldsImportable, entityTypeId, attributeName);
break;
case UNKNOWN:
addField(fieldsUnknown, entityTypeId, attributeName);
break;
case AVAILABLE:
addField(fieldsAvailable, entityTypeId, attributeName);
break;
case REQUIRED:
addField(fieldsRequired, entityTypeId, attributeName);
break;
default:
throw new UnexpectedEnumException(state);
}
return this;
} | [
"public",
"MyEntitiesValidationReport",
"addAttribute",
"(",
"String",
"attributeName",
",",
"AttributeState",
"state",
")",
"{",
"if",
"(",
"getImportOrder",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Must add e... | Creates a new report, with an attribute added to the last added entity;
@param attributeName name of the attribute to add
@param state state of the attribute to add
@return this report | [
"Creates",
"a",
"new",
"report",
"with",
"an",
"attribute",
"added",
"to",
"the",
"last",
"added",
"entity",
";"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java#L90-L113 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_automaticCall_POST | public String billingAccount_line_serviceName_automaticCall_POST(String billingAccount, String serviceName, String bridgeNumberDialplan, String calledNumber, String callingNumber, OvhCallsGeneratorDialplanEnum dialplan, Boolean isAnonymous, String playbackAudioFileDialplan, Long timeout, String ttsTextDialplan) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/automaticCall";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "bridgeNumberDialplan", bridgeNumberDialplan);
addBody(o, "calledNumber", calledNumber);
addBody(o, "callingNumber", callingNumber);
addBody(o, "dialplan", dialplan);
addBody(o, "isAnonymous", isAnonymous);
addBody(o, "playbackAudioFileDialplan", playbackAudioFileDialplan);
addBody(o, "timeout", timeout);
addBody(o, "ttsTextDialplan", ttsTextDialplan);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, String.class);
} | java | public String billingAccount_line_serviceName_automaticCall_POST(String billingAccount, String serviceName, String bridgeNumberDialplan, String calledNumber, String callingNumber, OvhCallsGeneratorDialplanEnum dialplan, Boolean isAnonymous, String playbackAudioFileDialplan, Long timeout, String ttsTextDialplan) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/automaticCall";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "bridgeNumberDialplan", bridgeNumberDialplan);
addBody(o, "calledNumber", calledNumber);
addBody(o, "callingNumber", callingNumber);
addBody(o, "dialplan", dialplan);
addBody(o, "isAnonymous", isAnonymous);
addBody(o, "playbackAudioFileDialplan", playbackAudioFileDialplan);
addBody(o, "timeout", timeout);
addBody(o, "ttsTextDialplan", ttsTextDialplan);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, String.class);
} | [
"public",
"String",
"billingAccount_line_serviceName_automaticCall_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"bridgeNumberDialplan",
",",
"String",
"calledNumber",
",",
"String",
"callingNumber",
",",
"OvhCallsGeneratorDialplanEnum",
... | Make an automatic phone call. Return generated call identifier
REST: POST /telephony/{billingAccount}/line/{serviceName}/automaticCall
@param callingNumber [required] Optional, number where the call come from
@param dialplan [required] Dialplan used for the call
@param bridgeNumberDialplan [required] Number to call if transfer in dialplan selected
@param isAnonymous [required] For anonymous call
@param playbackAudioFileDialplan [required] Name of the audioFile (if needed) with extention. This audio file must have been upload previously
@param ttsTextDialplan [required] Text to read if TTS on dialplan selected
@param calledNumber [required] Number to call
@param timeout [required] Timeout (in seconds). Default is 20 seconds
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Make",
"an",
"automatic",
"phone",
"call",
".",
"Return",
"generated",
"call",
"identifier"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1760-L1774 |
LearnLib/learnlib | algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTLearner.java | AbstractTTTLearner.splitState | private void splitState(TTTTransition<I, D> transition, Word<I> tempDiscriminator, D oldOut, D newOut) {
assert !transition.isTree();
notifyPreSplit(transition, tempDiscriminator);
AbstractBaseDTNode<I, D> dtNode = transition.getNonTreeTarget();
assert dtNode.isLeaf();
TTTState<I, D> oldState = dtNode.getData();
assert oldState != null;
TTTState<I, D> newState = makeTree(transition);
AbstractBaseDTNode<I, D>.SplitResult children = split(dtNode, tempDiscriminator, oldOut, newOut);
dtNode.setTemp(true);
link(children.nodeOld, oldState);
link(children.nodeNew, newState);
if (dtNode.getParent() == null || !dtNode.getParent().isTemp()) {
blockList.insertBlock(dtNode);
}
notifyPostSplit(transition, tempDiscriminator);
} | java | private void splitState(TTTTransition<I, D> transition, Word<I> tempDiscriminator, D oldOut, D newOut) {
assert !transition.isTree();
notifyPreSplit(transition, tempDiscriminator);
AbstractBaseDTNode<I, D> dtNode = transition.getNonTreeTarget();
assert dtNode.isLeaf();
TTTState<I, D> oldState = dtNode.getData();
assert oldState != null;
TTTState<I, D> newState = makeTree(transition);
AbstractBaseDTNode<I, D>.SplitResult children = split(dtNode, tempDiscriminator, oldOut, newOut);
dtNode.setTemp(true);
link(children.nodeOld, oldState);
link(children.nodeNew, newState);
if (dtNode.getParent() == null || !dtNode.getParent().isTemp()) {
blockList.insertBlock(dtNode);
}
notifyPostSplit(transition, tempDiscriminator);
} | [
"private",
"void",
"splitState",
"(",
"TTTTransition",
"<",
"I",
",",
"D",
">",
"transition",
",",
"Word",
"<",
"I",
">",
"tempDiscriminator",
",",
"D",
"oldOut",
",",
"D",
"newOut",
")",
"{",
"assert",
"!",
"transition",
".",
"isTree",
"(",
")",
";",
... | Splits a state in the hypothesis, using a temporary discriminator. The state to be split is identified by an
incoming non-tree transition. This transition is subsequently turned into a spanning tree transition.
@param transition
the transition
@param tempDiscriminator
the temporary discriminator | [
"Splits",
"a",
"state",
"in",
"the",
"hypothesis",
"using",
"a",
"temporary",
"discriminator",
".",
"The",
"state",
"to",
"be",
"split",
"is",
"identified",
"by",
"an",
"incoming",
"non",
"-",
"tree",
"transition",
".",
"This",
"transition",
"is",
"subsequen... | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTLearner.java#L234-L257 |
apache/groovy | subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java | DateTimeExtensions.getShortName | public static String getShortName(final ZoneId self, Locale locale) {
return self.getDisplayName(TextStyle.SHORT, locale);
} | java | public static String getShortName(final ZoneId self, Locale locale) {
return self.getDisplayName(TextStyle.SHORT, locale);
} | [
"public",
"static",
"String",
"getShortName",
"(",
"final",
"ZoneId",
"self",
",",
"Locale",
"locale",
")",
"{",
"return",
"self",
".",
"getDisplayName",
"(",
"TextStyle",
".",
"SHORT",
",",
"locale",
")",
";",
"}"
] | Returns the name of this zone formatted according to the {@link java.time.format.TextStyle#SHORT} text style
for the provided {@link java.util.Locale}.
@param self a ZoneId
@param locale a Locale
@return the short display name of the ZoneId
@since 2.5.0 | [
"Returns",
"the",
"name",
"of",
"this",
"zone",
"formatted",
"according",
"to",
"the",
"{",
"@link",
"java",
".",
"time",
".",
"format",
".",
"TextStyle#SHORT",
"}",
"text",
"style",
"for",
"the",
"provided",
"{",
"@link",
"java",
".",
"util",
".",
"Loca... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L1822-L1824 |
overturetool/overture | core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java | TypeComparator.searchSubType | private Result searchSubType(PType sub, PType sup, boolean invignore)
{
TypePair pair = new TypePair(sub, sup);
int i = done.indexOf(pair);
if (i >= 0)
{
return done.get(i).result; // May be "Maybe".
} else
{
done.add(pair);
}
// The pair.result is "Maybe" until this call returns.
pair.result = subtest(sub, sup, invignore);
return pair.result;
} | java | private Result searchSubType(PType sub, PType sup, boolean invignore)
{
TypePair pair = new TypePair(sub, sup);
int i = done.indexOf(pair);
if (i >= 0)
{
return done.get(i).result; // May be "Maybe".
} else
{
done.add(pair);
}
// The pair.result is "Maybe" until this call returns.
pair.result = subtest(sub, sup, invignore);
return pair.result;
} | [
"private",
"Result",
"searchSubType",
"(",
"PType",
"sub",
",",
"PType",
"sup",
",",
"boolean",
"invignore",
")",
"{",
"TypePair",
"pair",
"=",
"new",
"TypePair",
"(",
"sub",
",",
"sup",
")",
";",
"int",
"i",
"=",
"done",
".",
"indexOf",
"(",
"pair",
... | Search the {@link #done} vector for an existing subtype comparison of two types before either returning the
previous result, or making a new comparison and adding that result to the vector.
@param sub
@param sup
@param invignore
@return Yes or No, if sub is a subtype of sup. | [
"Search",
"the",
"{",
"@link",
"#done",
"}",
"vector",
"for",
"an",
"existing",
"subtype",
"comparison",
"of",
"two",
"types",
"before",
"either",
"returning",
"the",
"previous",
"result",
"or",
"making",
"a",
"new",
"comparison",
"and",
"adding",
"that",
"r... | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java#L586-L603 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java | FastDateFormat.getInstance | public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
return cache.getInstance(pattern, timeZone, locale);
} | java | public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
return cache.getInstance(pattern, timeZone, locale);
} | [
"public",
"static",
"FastDateFormat",
"getInstance",
"(",
"final",
"String",
"pattern",
",",
"final",
"TimeZone",
"timeZone",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"cache",
".",
"getInstance",
"(",
"pattern",
",",
"timeZone",
",",
"locale",
")"... | 获得 {@link FastDateFormat} 实例<br>
支持缓存
@param pattern 使用{@link java.text.SimpleDateFormat} 相同的日期格式
@param timeZone 时区{@link TimeZone}
@param locale {@link Locale} 日期地理位置
@return {@link FastDateFormat}
@throws IllegalArgumentException 日期格式问题 | [
"获得",
"{",
"@link",
"FastDateFormat",
"}",
"实例<br",
">",
"支持缓存"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L109-L111 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/base64/Base64.java | Base64.safeDecode | @Nullable
@ReturnsMutableCopy
public static byte [] safeDecode (@Nullable final String sEncoded, final int nOptions)
{
if (sEncoded != null)
try
{
return decode (sEncoded, nOptions);
}
catch (final Exception ex)
{
// fall through
}
return null;
} | java | @Nullable
@ReturnsMutableCopy
public static byte [] safeDecode (@Nullable final String sEncoded, final int nOptions)
{
if (sEncoded != null)
try
{
return decode (sEncoded, nOptions);
}
catch (final Exception ex)
{
// fall through
}
return null;
} | [
"@",
"Nullable",
"@",
"ReturnsMutableCopy",
"public",
"static",
"byte",
"[",
"]",
"safeDecode",
"(",
"@",
"Nullable",
"final",
"String",
"sEncoded",
",",
"final",
"int",
"nOptions",
")",
"{",
"if",
"(",
"sEncoded",
"!=",
"null",
")",
"try",
"{",
"return",
... | Decode the string with the default encoding (US-ASCII is the preferred
one).
@param sEncoded
The encoded string.
@param nOptions
Decoding options.
@return <code>null</code> if decoding failed. | [
"Decode",
"the",
"string",
"with",
"the",
"default",
"encoding",
"(",
"US",
"-",
"ASCII",
"is",
"the",
"preferred",
"one",
")",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L2555-L2569 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java | AlignedBox3f.setY | @Override
public void setY(double min, double max) {
if (min <= max) {
this.miny = min;
this.maxy = max;
} else {
this.miny = max;
this.maxy = min;
}
} | java | @Override
public void setY(double min, double max) {
if (min <= max) {
this.miny = min;
this.maxy = max;
} else {
this.miny = max;
this.maxy = min;
}
} | [
"@",
"Override",
"public",
"void",
"setY",
"(",
"double",
"min",
",",
"double",
"max",
")",
"{",
"if",
"(",
"min",
"<=",
"max",
")",
"{",
"this",
".",
"miny",
"=",
"min",
";",
"this",
".",
"maxy",
"=",
"max",
";",
"}",
"else",
"{",
"this",
".",... | Set the y bounds of the box.
@param min the min value for the y axis.
@param max the max value for the y axis. | [
"Set",
"the",
"y",
"bounds",
"of",
"the",
"box",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java#L620-L629 |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java | ServerSessionContext.registerResult | ServerSessionContext registerResult(long sequence, ServerStateMachine.Result result) {
results.put(sequence, result);
return this;
} | java | ServerSessionContext registerResult(long sequence, ServerStateMachine.Result result) {
results.put(sequence, result);
return this;
} | [
"ServerSessionContext",
"registerResult",
"(",
"long",
"sequence",
",",
"ServerStateMachine",
".",
"Result",
"result",
")",
"{",
"results",
".",
"put",
"(",
"sequence",
",",
"result",
")",
";",
"return",
"this",
";",
"}"
] | Registers a session result.
<p>
Results are stored in memory on all servers in order to provide linearizable semantics. When a command
is applied to the state machine, the command's return value is stored with the sequence number. Once the
client acknowledges receipt of the command output the result will be cleared from memory.
@param sequence The result sequence number.
@param result The result.
@return The server session. | [
"Registers",
"a",
"session",
"result",
".",
"<p",
">",
"Results",
"are",
"stored",
"in",
"memory",
"on",
"all",
"servers",
"in",
"order",
"to",
"provide",
"linearizable",
"semantics",
".",
"When",
"a",
"command",
"is",
"applied",
"to",
"the",
"state",
"mac... | train | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java#L354-L357 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java | NLS.getFormattedMessage | public String getFormattedMessage(String key, Object[] args, String defaultString) {
try {
String result = getString(key);
return MessageFormat.format(result, args);
} catch (MissingResourceException e) {
return MessageFormat.format(defaultString, args);
}
} | java | public String getFormattedMessage(String key, Object[] args, String defaultString) {
try {
String result = getString(key);
return MessageFormat.format(result, args);
} catch (MissingResourceException e) {
return MessageFormat.format(defaultString, args);
}
} | [
"public",
"String",
"getFormattedMessage",
"(",
"String",
"key",
",",
"Object",
"[",
"]",
"args",
",",
"String",
"defaultString",
")",
"{",
"try",
"{",
"String",
"result",
"=",
"getString",
"(",
"key",
")",
";",
"return",
"MessageFormat",
".",
"format",
"(... | An easy way to pass variables into the messages. Provides a
consistent way of formatting the {0} type parameters. Returns
the formatted resource, or if it is not found, the formatted
default string that was passed in.
@param key Resource lookup key
@param args Variables to insert into the string.
@param defaultString Default string to use if the resource
is not found. | [
"An",
"easy",
"way",
"to",
"pass",
"variables",
"into",
"the",
"messages",
".",
"Provides",
"a",
"consistent",
"way",
"of",
"formatting",
"the",
"{",
"0",
"}",
"type",
"parameters",
".",
"Returns",
"the",
"formatted",
"resource",
"or",
"if",
"it",
"is",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java#L380-L387 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/UUID.java | UUID.fromString | public static UUID fromString(String name) {
String[] components = name.split("-");
if (components.length != 5) {
throw new IllegalArgumentException("Invalid UUID string: " + name);
}
for (int i = 0; i < 5; i++) {
components[i] = "0x" + components[i];
}
long mostSigBits = Long.decode(components[0]).longValue();
mostSigBits <<= 16;
mostSigBits |= Long.decode(components[1]).longValue();
mostSigBits <<= 16;
mostSigBits |= Long.decode(components[2]).longValue();
long leastSigBits = Long.decode(components[3]).longValue();
leastSigBits <<= 48;
leastSigBits |= Long.decode(components[4]).longValue();
return new UUID(mostSigBits, leastSigBits);
} | java | public static UUID fromString(String name) {
String[] components = name.split("-");
if (components.length != 5) {
throw new IllegalArgumentException("Invalid UUID string: " + name);
}
for (int i = 0; i < 5; i++) {
components[i] = "0x" + components[i];
}
long mostSigBits = Long.decode(components[0]).longValue();
mostSigBits <<= 16;
mostSigBits |= Long.decode(components[1]).longValue();
mostSigBits <<= 16;
mostSigBits |= Long.decode(components[2]).longValue();
long leastSigBits = Long.decode(components[3]).longValue();
leastSigBits <<= 48;
leastSigBits |= Long.decode(components[4]).longValue();
return new UUID(mostSigBits, leastSigBits);
} | [
"public",
"static",
"UUID",
"fromString",
"(",
"String",
"name",
")",
"{",
"String",
"[",
"]",
"components",
"=",
"name",
".",
"split",
"(",
"\"-\"",
")",
";",
"if",
"(",
"components",
".",
"length",
"!=",
"5",
")",
"{",
"throw",
"new",
"IllegalArgumen... | 根据 {@link #toString()} 方法中描述的字符串标准表示形式创建{@code UUID}。
@param name 指定 {@code UUID} 字符串
@return 具有指定值的 {@code UUID}
@throws IllegalArgumentException 如果 name 与 {@link #toString} 中描述的字符串表示形式不符抛出此异常 | [
"根据",
"{",
"@link",
"#toString",
"()",
"}",
"方法中描述的字符串标准表示形式创建",
"{",
"@code",
"UUID",
"}",
"。"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/UUID.java#L159-L179 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.retainBottom | public static <E> void retainBottom(Counter<E> c, int num) {
int numToPurge = c.size() - num;
if (numToPurge <= 0) {
return;
}
List<E> l = Counters.toSortedList(c);
for (int i = 0; i < numToPurge; i++) {
c.remove(l.get(i));
}
} | java | public static <E> void retainBottom(Counter<E> c, int num) {
int numToPurge = c.size() - num;
if (numToPurge <= 0) {
return;
}
List<E> l = Counters.toSortedList(c);
for (int i = 0; i < numToPurge; i++) {
c.remove(l.get(i));
}
} | [
"public",
"static",
"<",
"E",
">",
"void",
"retainBottom",
"(",
"Counter",
"<",
"E",
">",
"c",
",",
"int",
"num",
")",
"{",
"int",
"numToPurge",
"=",
"c",
".",
"size",
"(",
")",
"-",
"num",
";",
"if",
"(",
"numToPurge",
"<=",
"0",
")",
"{",
"re... | Removes all entries from c except for the bottom <code>num</code> | [
"Removes",
"all",
"entries",
"from",
"c",
"except",
"for",
"the",
"bottom",
"<code",
">",
"num<",
"/",
"code",
">"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L544-L554 |
knowm/Datasets | datasets-hja-birdsong/src/main/java/com/musicg/wave/WaveformRender.java | WaveformRender.saveWaveform | public void saveWaveform(Wave wave, int width, String filename) throws IOException {
BufferedImage bufferedImage = renderWaveform(wave, width);
saveWaveform(bufferedImage, filename);
} | java | public void saveWaveform(Wave wave, int width, String filename) throws IOException {
BufferedImage bufferedImage = renderWaveform(wave, width);
saveWaveform(bufferedImage, filename);
} | [
"public",
"void",
"saveWaveform",
"(",
"Wave",
"wave",
",",
"int",
"width",
",",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"BufferedImage",
"bufferedImage",
"=",
"renderWaveform",
"(",
"wave",
",",
"width",
")",
";",
"saveWaveform",
"(",
"buffer... | Render a waveform of a wave file
@param filename output file
@throws IOException
@see RGB graphic rendered | [
"Render",
"a",
"waveform",
"of",
"a",
"wave",
"file"
] | train | https://github.com/knowm/Datasets/blob/4ea16ccda1d4190a551accff78bbbe05c9c38c79/datasets-hja-birdsong/src/main/java/com/musicg/wave/WaveformRender.java#L111-L115 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_fax_serviceName_PUT | public void billingAccount_fax_serviceName_PUT(String billingAccount, String serviceName, OvhFax body) throws IOException {
String qPath = "/telephony/{billingAccount}/fax/{serviceName}";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_fax_serviceName_PUT(String billingAccount, String serviceName, OvhFax body) throws IOException {
String qPath = "/telephony/{billingAccount}/fax/{serviceName}";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_fax_serviceName_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"OvhFax",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/fax/{serviceName}\"",
";",
"StringBuilder"... | Alter this object properties
REST: PUT /telephony/{billingAccount}/fax/{serviceName}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4532-L4536 |
alkacon/opencms-core | src/org/opencms/util/CmsDateUtil.java | CmsDateUtil.parseDate | public static long parseDate(int year, int month, int date) {
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, date);
return calendar.getTime().getTime();
} | java | public static long parseDate(int year, int month, int date) {
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, date);
return calendar.getTime().getTime();
} | [
"public",
"static",
"long",
"parseDate",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"date",
")",
"{",
"Calendar",
"calendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"calendar",
".",
"set",
"(",
"year",
",",
"month",
",",
"date",
... | Returns the long value of a date created by the given integer values.<p>
@param year the integer value of year
@param month the integer value of month
@param date the integer value of date
@return the long value of a date created by the given integer values | [
"Returns",
"the",
"long",
"value",
"of",
"a",
"date",
"created",
"by",
"the",
"given",
"integer",
"values",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsDateUtil.java#L190-L195 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/image/VisualizeImageData.java | VisualizeImageData.grayMagnitudeTemp | public static BufferedImage grayMagnitudeTemp(ImageGray src, BufferedImage dst, double normalize) {
if (normalize < 0)
normalize = GImageStatistics.maxAbs(src);
dst = checkInputs(src, dst);
if (src.getDataType().isInteger()) {
return grayMagnitudeTemp((GrayI) src, dst, (int) normalize);
} else {
throw new RuntimeException("Add support");
}
} | java | public static BufferedImage grayMagnitudeTemp(ImageGray src, BufferedImage dst, double normalize) {
if (normalize < 0)
normalize = GImageStatistics.maxAbs(src);
dst = checkInputs(src, dst);
if (src.getDataType().isInteger()) {
return grayMagnitudeTemp((GrayI) src, dst, (int) normalize);
} else {
throw new RuntimeException("Add support");
}
} | [
"public",
"static",
"BufferedImage",
"grayMagnitudeTemp",
"(",
"ImageGray",
"src",
",",
"BufferedImage",
"dst",
",",
"double",
"normalize",
")",
"{",
"if",
"(",
"normalize",
"<",
"0",
")",
"normalize",
"=",
"GImageStatistics",
".",
"maxAbs",
"(",
"src",
")",
... | <p>
Renders a gray scale image using color values from cold to hot.
</p>
@param src Input single band image.
@param dst Where the image is rendered into. If null a new BufferedImage will be created and return.
@param normalize Used to normalize the input image.
@return Rendered image. | [
"<p",
">",
"Renders",
"a",
"gray",
"scale",
"image",
"using",
"color",
"values",
"from",
"cold",
"to",
"hot",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/image/VisualizeImageData.java#L186-L197 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfSigGenericPKCS.java | PdfSigGenericPKCS.setExternalDigest | public void setExternalDigest(byte digest[], byte RSAdata[], String digestEncryptionAlgorithm) {
externalDigest = digest;
externalRSAdata = RSAdata;
this.digestEncryptionAlgorithm = digestEncryptionAlgorithm;
} | java | public void setExternalDigest(byte digest[], byte RSAdata[], String digestEncryptionAlgorithm) {
externalDigest = digest;
externalRSAdata = RSAdata;
this.digestEncryptionAlgorithm = digestEncryptionAlgorithm;
} | [
"public",
"void",
"setExternalDigest",
"(",
"byte",
"digest",
"[",
"]",
",",
"byte",
"RSAdata",
"[",
"]",
",",
"String",
"digestEncryptionAlgorithm",
")",
"{",
"externalDigest",
"=",
"digest",
";",
"externalRSAdata",
"=",
"RSAdata",
";",
"this",
".",
"digestEn... | Sets the digest/signature to an external calculated value.
@param digest the digest. This is the actual signature
@param RSAdata the extra data that goes into the data tag in PKCS#7
@param digestEncryptionAlgorithm the encryption algorithm. It may must be <CODE>null</CODE> if the <CODE>digest</CODE>
is also <CODE>null</CODE>. If the <CODE>digest</CODE> is not <CODE>null</CODE>
then it may be "RSA" or "DSA" | [
"Sets",
"the",
"digest",
"/",
"signature",
"to",
"an",
"external",
"calculated",
"value",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfSigGenericPKCS.java#L130-L134 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/Mapper.java | Mapper.keyAndValueNotNull | @SuppressWarnings("unchecked")
public Mapper<K, V> keyAndValueNotNull() {
return addConstraint((MapConstraint<K, V>) MapConstraints.notNull());
} | java | @SuppressWarnings("unchecked")
public Mapper<K, V> keyAndValueNotNull() {
return addConstraint((MapConstraint<K, V>) MapConstraints.notNull());
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Mapper",
"<",
"K",
",",
"V",
">",
"keyAndValueNotNull",
"(",
")",
"{",
"return",
"addConstraint",
"(",
"(",
"MapConstraint",
"<",
"K",
",",
"V",
">",
")",
"MapConstraints",
".",
"notNull",
"(",... | Add a constraint that verifies that neither the key nor the value is
null. If either is null, a {@link NullPointerException} is thrown.
@return | [
"Add",
"a",
"constraint",
"that",
"verifies",
"that",
"neither",
"the",
"key",
"nor",
"the",
"value",
"is",
"null",
".",
"If",
"either",
"is",
"null",
"a",
"{",
"@link",
"NullPointerException",
"}",
"is",
"thrown",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Mapper.java#L113-L116 |
Inbot/inbot-utils | src/main/java/io/inbot/utils/SimpleStringTrie.java | SimpleStringTrie.from | public static SimpleStringTrie from(Map<String,?> map) {
SimpleStringTrie st = new SimpleStringTrie();
map.keySet().forEach(key -> st.add(key));
return st;
} | java | public static SimpleStringTrie from(Map<String,?> map) {
SimpleStringTrie st = new SimpleStringTrie();
map.keySet().forEach(key -> st.add(key));
return st;
} | [
"public",
"static",
"SimpleStringTrie",
"from",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"map",
")",
"{",
"SimpleStringTrie",
"st",
"=",
"new",
"SimpleStringTrie",
"(",
")",
";",
"map",
".",
"keySet",
"(",
")",
".",
"forEach",
"(",
"key",
"->",
"st",
... | Useful if you want to build a trie for an existing map so you can figure out a matching prefix that has an entry
@param map a map
@return a SimpleStringTrie for the map. | [
"Useful",
"if",
"you",
"want",
"to",
"build",
"a",
"trie",
"for",
"an",
"existing",
"map",
"so",
"you",
"can",
"figure",
"out",
"a",
"matching",
"prefix",
"that",
"has",
"an",
"entry"
] | train | https://github.com/Inbot/inbot-utils/blob/3112bc08d4237e95fe0f8a219a5bbceb390d0505/src/main/java/io/inbot/utils/SimpleStringTrie.java#L55-L59 |
jmurty/java-xmlbuilder | src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java | BaseXMLBuilder.toWriter | public void toWriter(Writer writer, Properties outputProperties)
throws TransformerException {
this.toWriter(true, writer, outputProperties);
} | java | public void toWriter(Writer writer, Properties outputProperties)
throws TransformerException {
this.toWriter(true, writer, outputProperties);
} | [
"public",
"void",
"toWriter",
"(",
"Writer",
"writer",
",",
"Properties",
"outputProperties",
")",
"throws",
"TransformerException",
"{",
"this",
".",
"toWriter",
"(",
"true",
",",
"writer",
",",
"outputProperties",
")",
";",
"}"
] | Serialize the XML document to the given writer using the default
{@link TransformerFactory} and {@link Transformer} classes. If output
options are provided, these options are provided to the
{@link Transformer} serializer.
@param writer
a writer to which the serialized document is written.
@param outputProperties
settings for the {@link Transformer} serializer. This parameter may be
null or an empty Properties object, in which case the default output
properties will be applied.
@throws TransformerException | [
"Serialize",
"the",
"XML",
"document",
"to",
"the",
"given",
"writer",
"using",
"the",
"default",
"{",
"@link",
"TransformerFactory",
"}",
"and",
"{",
"@link",
"Transformer",
"}",
"classes",
".",
"If",
"output",
"options",
"are",
"provided",
"these",
"options"... | train | https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L1342-L1345 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java | TypeSerializerSerializationUtil.tryReadSerializer | public static <T> TypeSerializer<T> tryReadSerializer(DataInputView in, ClassLoader userCodeClassLoader) throws IOException {
return tryReadSerializer(in, userCodeClassLoader, false);
} | java | public static <T> TypeSerializer<T> tryReadSerializer(DataInputView in, ClassLoader userCodeClassLoader) throws IOException {
return tryReadSerializer(in, userCodeClassLoader, false);
} | [
"public",
"static",
"<",
"T",
">",
"TypeSerializer",
"<",
"T",
">",
"tryReadSerializer",
"(",
"DataInputView",
"in",
",",
"ClassLoader",
"userCodeClassLoader",
")",
"throws",
"IOException",
"{",
"return",
"tryReadSerializer",
"(",
"in",
",",
"userCodeClassLoader",
... | Reads from a data input view a {@link TypeSerializer} that was previously
written using {@link #writeSerializer(DataOutputView, TypeSerializer)}.
<p>If deserialization fails for any reason (corrupted serializer bytes, serializer class
no longer in classpath, serializer class no longer valid, etc.), an {@link IOException} is thrown.
@param in the data input view.
@param userCodeClassLoader the user code class loader to use.
@param <T> Data type of the serializer.
@return the deserialized serializer. | [
"Reads",
"from",
"a",
"data",
"input",
"view",
"a",
"{",
"@link",
"TypeSerializer",
"}",
"that",
"was",
"previously",
"written",
"using",
"{",
"@link",
"#writeSerializer",
"(",
"DataOutputView",
"TypeSerializer",
")",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java#L86-L88 |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getFullString | public final String getFullString(final int len, String charsetName) {
if (position + len > origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position + len - origin));
try {
String string = new String(buffer, position, len, charsetName);
position += len;
return string;
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException("Unsupported encoding: " + charsetName, e);
}
} | java | public final String getFullString(final int len, String charsetName) {
if (position + len > origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position + len - origin));
try {
String string = new String(buffer, position, len, charsetName);
position += len;
return string;
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException("Unsupported encoding: " + charsetName, e);
}
} | [
"public",
"final",
"String",
"getFullString",
"(",
"final",
"int",
"len",
",",
"String",
"charsetName",
")",
"{",
"if",
"(",
"position",
"+",
"len",
">",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
... | Return next fix-length string from buffer without null-terminate
checking. Fix bug #17 {@link https
://github.com/AlibabaTech/canal/issues/17 } | [
"Return",
"next",
"fix",
"-",
"length",
"string",
"from",
"buffer",
"without",
"null",
"-",
"terminate",
"checking",
".",
"Fix",
"bug",
"#17",
"{"
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L1122-L1133 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java | SheetResourcesImpl.getSheetAsPDF | public void getSheetAsPDF(long id, OutputStream outputStream, PaperSize paperSize) throws SmartsheetException {
getSheetAsFile(id, paperSize, outputStream, "application/pdf");
} | java | public void getSheetAsPDF(long id, OutputStream outputStream, PaperSize paperSize) throws SmartsheetException {
getSheetAsFile(id, paperSize, outputStream, "application/pdf");
} | [
"public",
"void",
"getSheetAsPDF",
"(",
"long",
"id",
",",
"OutputStream",
"outputStream",
",",
"PaperSize",
"paperSize",
")",
"throws",
"SmartsheetException",
"{",
"getSheetAsFile",
"(",
"id",
",",
"paperSize",
",",
"outputStream",
",",
"\"application/pdf\"",
")",
... | Get a sheet as a PDF file.
It mirrors to the following Smartsheet REST API method: GET /sheet/{id} with "application/pdf" Accept HTTP
header
Exceptions:
IllegalArgumentException : if outputStream is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFoundException : if the resource can not be found
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param id the id
@param outputStream the output stream to which the PDF file will be written.
@param paperSize the optional paper size
@return the sheet as pdf
@throws SmartsheetException the smartsheet exception | [
"Get",
"a",
"sheet",
"as",
"a",
"PDF",
"file",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L363-L365 |
looly/hutool | hutool-aop/src/main/java/cn/hutool/aop/ProxyUtil.java | ProxyUtil.newProxyInstance | @SuppressWarnings("unchecked")
public static <T> T newProxyInstance(ClassLoader classloader, InvocationHandler invocationHandler, Class<?>... interfaces) {
return (T) Proxy.newProxyInstance(classloader, interfaces, invocationHandler);
} | java | @SuppressWarnings("unchecked")
public static <T> T newProxyInstance(ClassLoader classloader, InvocationHandler invocationHandler, Class<?>... interfaces) {
return (T) Proxy.newProxyInstance(classloader, interfaces, invocationHandler);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"newProxyInstance",
"(",
"ClassLoader",
"classloader",
",",
"InvocationHandler",
"invocationHandler",
",",
"Class",
"<",
"?",
">",
"...",
"interfaces",
")",
"{",
"return"... | 创建动态代理对象<br>
动态代理对象的创建原理是:<br>
假设创建的代理对象名为 $Proxy0<br>
1、根据传入的interfaces动态生成一个类,实现interfaces中的接口<br>
2、通过传入的classloder将刚生成的类加载到jvm中。即将$Proxy0类load<br>
3、调用$Proxy0的$Proxy0(InvocationHandler)构造函数 创建$Proxy0的对象,并且用interfaces参数遍历其所有接口的方法,这些实现方法的实现本质上是通过反射调用被代理对象的方法<br>
4、将$Proxy0的实例返回给客户端。 <br>
5、当调用代理类的相应方法时,相当于调用 {@link InvocationHandler#invoke(Object, java.lang.reflect.Method, Object[])} 方法
@param <T> 被代理对象类型
@param classloader 被代理类对应的ClassLoader
@param invocationHandler {@link InvocationHandler} ,被代理类通过实现此接口提供动态代理功能
@param interfaces 代理类中需要实现的被代理类的接口方法
@return 代理类 | [
"创建动态代理对象<br",
">",
"动态代理对象的创建原理是:<br",
">",
"假设创建的代理对象名为",
"$Proxy0<br",
">",
"1、根据传入的interfaces动态生成一个类,实现interfaces中的接口<br",
">",
"2、通过传入的classloder将刚生成的类加载到jvm中。即将$Proxy0类load<br",
">",
"3、调用$Proxy0的$Proxy0",
"(",
"InvocationHandler",
")",
"构造函数",
"创建$Proxy0的对象,并且用interfaces参数遍历其所... | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-aop/src/main/java/cn/hutool/aop/ProxyUtil.java#L57-L60 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/db/ModelMapper.java | ModelMapper.getDependency | public Dependency getDependency(final DbDependency dbDependency, final String sourceName, final String sourceVersion) {
final DbArtifact dbArtifact = repositoryHandler.getArtifact(dbDependency.getTarget());
final Artifact artifact;
if (dbArtifact == null) {
artifact = DataUtils.createArtifact(dbDependency.getTarget());
} else {
artifact = getArtifact(dbArtifact);
}
final Dependency dependency = DataModelFactory.createDependency(artifact, dbDependency.getScope());
dependency.setSourceName(sourceName);
dependency.setSourceVersion(sourceVersion);
return dependency;
} | java | public Dependency getDependency(final DbDependency dbDependency, final String sourceName, final String sourceVersion) {
final DbArtifact dbArtifact = repositoryHandler.getArtifact(dbDependency.getTarget());
final Artifact artifact;
if (dbArtifact == null) {
artifact = DataUtils.createArtifact(dbDependency.getTarget());
} else {
artifact = getArtifact(dbArtifact);
}
final Dependency dependency = DataModelFactory.createDependency(artifact, dbDependency.getScope());
dependency.setSourceName(sourceName);
dependency.setSourceVersion(sourceVersion);
return dependency;
} | [
"public",
"Dependency",
"getDependency",
"(",
"final",
"DbDependency",
"dbDependency",
",",
"final",
"String",
"sourceName",
",",
"final",
"String",
"sourceVersion",
")",
"{",
"final",
"DbArtifact",
"dbArtifact",
"=",
"repositoryHandler",
".",
"getArtifact",
"(",
"d... | Transform a dependency from database model to client/server model
@param dbDependency DbDependency
@return Dependency | [
"Transform",
"a",
"dependency",
"from",
"database",
"model",
"to",
"client",
"/",
"server",
"model"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/db/ModelMapper.java#L233-L248 |
netplex/json-smart-v2 | accessors-smart/src/main/java/net/minidev/asm/ASMUtil.java | ASMUtil.autoBoxing | protected static void autoBoxing(MethodVisitor mv, Type fieldType) {
switch (fieldType.getSort()) {
case Type.BOOLEAN:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;");
break;
case Type.BYTE:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;");
break;
case Type.CHAR:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;");
break;
case Type.SHORT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;");
break;
case Type.INT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;");
break;
case Type.FLOAT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;");
break;
case Type.LONG:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;");
break;
case Type.DOUBLE:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;");
break;
}
} | java | protected static void autoBoxing(MethodVisitor mv, Type fieldType) {
switch (fieldType.getSort()) {
case Type.BOOLEAN:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;");
break;
case Type.BYTE:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;");
break;
case Type.CHAR:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;");
break;
case Type.SHORT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;");
break;
case Type.INT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;");
break;
case Type.FLOAT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;");
break;
case Type.LONG:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;");
break;
case Type.DOUBLE:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;");
break;
}
} | [
"protected",
"static",
"void",
"autoBoxing",
"(",
"MethodVisitor",
"mv",
",",
"Type",
"fieldType",
")",
"{",
"switch",
"(",
"fieldType",
".",
"getSort",
"(",
")",
")",
"{",
"case",
"Type",
".",
"BOOLEAN",
":",
"mv",
".",
"visitMethodInsn",
"(",
"INVOKESTAT... | Append the call of proper autoboxing method for the given primitif type. | [
"Append",
"the",
"call",
"of",
"proper",
"autoboxing",
"method",
"for",
"the",
"given",
"primitif",
"type",
"."
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/accessors-smart/src/main/java/net/minidev/asm/ASMUtil.java#L73-L100 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java | TypeSignature.ofMap | public static TypeSignature ofMap(Class<?> namedKeyType, Class<?> namedValueType) {
return ofMap(ofNamed(namedKeyType, "namedKeyType"), ofNamed(namedValueType, "namedValueType"));
} | java | public static TypeSignature ofMap(Class<?> namedKeyType, Class<?> namedValueType) {
return ofMap(ofNamed(namedKeyType, "namedKeyType"), ofNamed(namedValueType, "namedValueType"));
} | [
"public",
"static",
"TypeSignature",
"ofMap",
"(",
"Class",
"<",
"?",
">",
"namedKeyType",
",",
"Class",
"<",
"?",
">",
"namedValueType",
")",
"{",
"return",
"ofMap",
"(",
"ofNamed",
"(",
"namedKeyType",
",",
"\"namedKeyType\"",
")",
",",
"ofNamed",
"(",
"... | Creates a new type signature for the map with the specified named key and value types.
This method is a shortcut of:
<pre>{@code
ofMap(ofNamed(namedKeyType), ofNamed(namedValueType));
}</pre> | [
"Creates",
"a",
"new",
"type",
"signature",
"for",
"the",
"map",
"with",
"the",
"specified",
"named",
"key",
"and",
"value",
"types",
".",
"This",
"method",
"is",
"a",
"shortcut",
"of",
":",
"<pre",
">",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java#L171-L173 |
amplexus/java-flac-encoder | src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java | EncodedElement.packIntByBits | protected static void packIntByBits(int[] inputA, int[] inputBits, int inputIndex, int inputCount, int destPos, byte[] dest) {
int origInputIndex = inputIndex;
inputIndex = packIntByBitsToByteBoundary(inputA, inputBits, inputIndex, inputCount,
destPos, dest);
if(destPos%8 > 0) destPos = (destPos/8+1)*8;//put dest where we know it should be
if(inputIndex < 0)//done, no more to write.
return;
inputCount = inputCount - (inputIndex - origInputIndex);
inputCount = EncodedElement.compressIntArrayByBits(inputA, inputBits, inputCount, inputIndex);
assert(destPos%8 == 0);//sanity check.
if(inputCount >1) {
int stopIndex = inputCount-1;
EncodedElement.mergeFullOnByte(inputA, stopIndex, dest, destPos/8);
destPos += (stopIndex)*32;
}
if(inputCount >0) {
int index = inputCount-1;
EncodedElement.addInt_new(inputA[index], inputBits[index], destPos, dest);
destPos+=inputBits[index];
}
} | java | protected static void packIntByBits(int[] inputA, int[] inputBits, int inputIndex, int inputCount, int destPos, byte[] dest) {
int origInputIndex = inputIndex;
inputIndex = packIntByBitsToByteBoundary(inputA, inputBits, inputIndex, inputCount,
destPos, dest);
if(destPos%8 > 0) destPos = (destPos/8+1)*8;//put dest where we know it should be
if(inputIndex < 0)//done, no more to write.
return;
inputCount = inputCount - (inputIndex - origInputIndex);
inputCount = EncodedElement.compressIntArrayByBits(inputA, inputBits, inputCount, inputIndex);
assert(destPos%8 == 0);//sanity check.
if(inputCount >1) {
int stopIndex = inputCount-1;
EncodedElement.mergeFullOnByte(inputA, stopIndex, dest, destPos/8);
destPos += (stopIndex)*32;
}
if(inputCount >0) {
int index = inputCount-1;
EncodedElement.addInt_new(inputA[index], inputBits[index], destPos, dest);
destPos+=inputBits[index];
}
} | [
"protected",
"static",
"void",
"packIntByBits",
"(",
"int",
"[",
"]",
"inputA",
",",
"int",
"[",
"]",
"inputBits",
",",
"int",
"inputIndex",
",",
"int",
"inputCount",
",",
"int",
"destPos",
",",
"byte",
"[",
"]",
"dest",
")",
"{",
"int",
"origInputIndex"... | Pack a number of bits from each int of an array(within given limits)to
the end of this list.
@param inputA Array containing input values.
@param inputBits Array containing number of bits to use for each index
packed. This array should be equal in size to the inputA array.
@param inputIndex Index of first usable index.
@param inputCount Number of indices to pack.
@param destPos First usable bit-level index in destination array(byte index = startPosIn/8, bit within that byte = destPos)
@param dest Destination array to store input values in. This array *must*
be large enough to store all values or this method will fail in an
undefined manner. | [
"Pack",
"a",
"number",
"of",
"bits",
"from",
"each",
"int",
"of",
"an",
"array",
"(",
"within",
"given",
"limits",
")",
"to",
"the",
"end",
"of",
"this",
"list",
"."
] | train | https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java#L881-L902 |
Impetus/Kundera | src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/GraphEntityMapper.java | GraphEntityMapper.getMatchingNodeFromIndexHits | protected Node getMatchingNodeFromIndexHits(IndexHits<Node> nodesFound, boolean skipProxy)
{
Node node = null;
try
{
if (nodesFound == null || nodesFound.size() == 0 || !nodesFound.hasNext())
{
return null;
}
else
{
if (skipProxy)
node = getNonProxyNode(nodesFound);
else
node = nodesFound.next();
}
}
finally
{
nodesFound.close();
}
return node;
} | java | protected Node getMatchingNodeFromIndexHits(IndexHits<Node> nodesFound, boolean skipProxy)
{
Node node = null;
try
{
if (nodesFound == null || nodesFound.size() == 0 || !nodesFound.hasNext())
{
return null;
}
else
{
if (skipProxy)
node = getNonProxyNode(nodesFound);
else
node = nodesFound.next();
}
}
finally
{
nodesFound.close();
}
return node;
} | [
"protected",
"Node",
"getMatchingNodeFromIndexHits",
"(",
"IndexHits",
"<",
"Node",
">",
"nodesFound",
",",
"boolean",
"skipProxy",
")",
"{",
"Node",
"node",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"nodesFound",
"==",
"null",
"||",
"nodesFound",
".",
"size"... | Fetches first Non-proxy node from Index Hits
@param skipProxy
@param nodesFound
@return | [
"Fetches",
"first",
"Non",
"-",
"proxy",
"node",
"from",
"Index",
"Hits"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/GraphEntityMapper.java#L695-L717 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.addAnnotationOrGetExisting | public static AnnotationNode addAnnotationOrGetExisting(ClassNode classNode, Class<? extends Annotation> annotationClass) {
return addAnnotationOrGetExisting(classNode, annotationClass, Collections.<String, Object>emptyMap());
} | java | public static AnnotationNode addAnnotationOrGetExisting(ClassNode classNode, Class<? extends Annotation> annotationClass) {
return addAnnotationOrGetExisting(classNode, annotationClass, Collections.<String, Object>emptyMap());
} | [
"public",
"static",
"AnnotationNode",
"addAnnotationOrGetExisting",
"(",
"ClassNode",
"classNode",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"return",
"addAnnotationOrGetExisting",
"(",
"classNode",
",",
"annotationClass",
",",
... | Adds an annotation to the given class node or returns the existing annotation
@param classNode The class node
@param annotationClass The annotation class | [
"Adds",
"an",
"annotation",
"to",
"the",
"given",
"class",
"node",
"or",
"returns",
"the",
"existing",
"annotation"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L826-L828 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/sparse/Arrays.java | Arrays.binarySearch | public static int binarySearch(int[] index, int key, int begin, int end) {
return java.util.Arrays.binarySearch(index, begin, end, key);
} | java | public static int binarySearch(int[] index, int key, int begin, int end) {
return java.util.Arrays.binarySearch(index, begin, end, key);
} | [
"public",
"static",
"int",
"binarySearch",
"(",
"int",
"[",
"]",
"index",
",",
"int",
"key",
",",
"int",
"begin",
",",
"int",
"end",
")",
"{",
"return",
"java",
".",
"util",
".",
"Arrays",
".",
"binarySearch",
"(",
"index",
",",
"begin",
",",
"end",
... | Searches for a key in a subset of a sorted array.
@param index
Sorted array of integers
@param key
Key to search for
@param begin
Start posisiton in the index
@param end
One past the end position in the index
@return Integer index to key. A negative integer if not found | [
"Searches",
"for",
"a",
"key",
"in",
"a",
"subset",
"of",
"a",
"sorted",
"array",
"."
] | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/sparse/Arrays.java#L119-L121 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/user/UserCoreDao.java | UserCoreDao.queryForChunk | public TResult queryForChunk(int limit, long offset) {
return queryForChunk(table.getPkColumn().getName(), limit, offset);
} | java | public TResult queryForChunk(int limit, long offset) {
return queryForChunk(table.getPkColumn().getName(), limit, offset);
} | [
"public",
"TResult",
"queryForChunk",
"(",
"int",
"limit",
",",
"long",
"offset",
")",
"{",
"return",
"queryForChunk",
"(",
"table",
".",
"getPkColumn",
"(",
")",
".",
"getName",
"(",
")",
",",
"limit",
",",
"offset",
")",
";",
"}"
] | Query for id ordered rows starting at the offset and returning no more
than the limit.
@param limit
chunk limit
@param offset
chunk query offset
@return result
@since 3.1.0 | [
"Query",
"for",
"id",
"ordered",
"rows",
"starting",
"at",
"the",
"offset",
"and",
"returning",
"no",
"more",
"than",
"the",
"limit",
"."
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserCoreDao.java#L487-L489 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsMessages.java | CmsMessages.getRegEx | private static String getRegEx(int position, String... options) {
String value = "" + position;
for (int i = 0; i < options.length; i++) {
value += "," + options[i];
}
return "{" + value + "}";
} | java | private static String getRegEx(int position, String... options) {
String value = "" + position;
for (int i = 0; i < options.length; i++) {
value += "," + options[i];
}
return "{" + value + "}";
} | [
"private",
"static",
"String",
"getRegEx",
"(",
"int",
"position",
",",
"String",
"...",
"options",
")",
"{",
"String",
"value",
"=",
"\"\"",
"+",
"position",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"options",
".",
"length",
";",
"i",
... | Returns a regular expression for replacement.<p>
@param position the parameter number
@param options the optional options
@return the regular expression for replacement | [
"Returns",
"a",
"regular",
"expression",
"for",
"replacement",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsMessages.java#L179-L186 |
alkacon/opencms-core | src-modules/org/opencms/workplace/CmsFrameset.java | CmsFrameset.getViewSelect | public String getViewSelect(String htmlAttributes) {
List<String> options = new ArrayList<String>();
List<String> values = new ArrayList<String>();
int selectedIndex = 0;
// loop through the vectors and fill the result vectors
Iterator<CmsWorkplaceView> i = OpenCms.getWorkplaceManager().getViews().iterator();
int count = -1;
String currentView = getSettings().getViewUri();
if (CmsStringUtil.isNotEmpty(currentView)) {
// remove possible parameters from current view
int pos = currentView.indexOf('?');
if (pos >= 0) {
currentView = currentView.substring(0, pos);
}
}
while (i.hasNext()) {
CmsWorkplaceView view = i.next();
if (getCms().existsResource(view.getUri(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
count++;
// ensure the current user has +v+r permissions on the view
String loopLink = getJsp().link(view.getUri());
String localizedKey = resolveMacros(view.getKey());
options.add(localizedKey);
values.add(loopLink);
if (loopLink.equals(currentView)) {
selectedIndex = count;
}
}
}
return buildSelect(htmlAttributes, options, values, selectedIndex);
} | java | public String getViewSelect(String htmlAttributes) {
List<String> options = new ArrayList<String>();
List<String> values = new ArrayList<String>();
int selectedIndex = 0;
// loop through the vectors and fill the result vectors
Iterator<CmsWorkplaceView> i = OpenCms.getWorkplaceManager().getViews().iterator();
int count = -1;
String currentView = getSettings().getViewUri();
if (CmsStringUtil.isNotEmpty(currentView)) {
// remove possible parameters from current view
int pos = currentView.indexOf('?');
if (pos >= 0) {
currentView = currentView.substring(0, pos);
}
}
while (i.hasNext()) {
CmsWorkplaceView view = i.next();
if (getCms().existsResource(view.getUri(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
count++;
// ensure the current user has +v+r permissions on the view
String loopLink = getJsp().link(view.getUri());
String localizedKey = resolveMacros(view.getKey());
options.add(localizedKey);
values.add(loopLink);
if (loopLink.equals(currentView)) {
selectedIndex = count;
}
}
}
return buildSelect(htmlAttributes, options, values, selectedIndex);
} | [
"public",
"String",
"getViewSelect",
"(",
"String",
"htmlAttributes",
")",
"{",
"List",
"<",
"String",
">",
"options",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"String... | Returns a html select box filled with the views accessible by the current user.<p>
@param htmlAttributes attributes that will be inserted into the generated html
@return a html select box filled with the views accessible by the current user | [
"Returns",
"a",
"html",
"select",
"box",
"filled",
"with",
"the",
"views",
"accessible",
"by",
"the",
"current",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsFrameset.java#L435-L469 |
tvesalainen/util | vfs/src/main/java/org/vesalainen/vfs/VirtualFileSystems.java | VirtualFileSystems.newFileSystem | public static final FileSystem newFileSystem(Path path, Map<String,?> env) throws IOException
{
return getDefault().provider().newFileSystem(path, env);
} | java | public static final FileSystem newFileSystem(Path path, Map<String,?> env) throws IOException
{
return getDefault().provider().newFileSystem(path, env);
} | [
"public",
"static",
"final",
"FileSystem",
"newFileSystem",
"(",
"Path",
"path",
",",
"Map",
"<",
"String",
",",
"?",
">",
"env",
")",
"throws",
"IOException",
"{",
"return",
"getDefault",
"(",
")",
".",
"provider",
"(",
")",
".",
"newFileSystem",
"(",
"... | Constructs a new FileSystem to access the contents of a file as a file system.
@param path
@param env
@return
@throws IOException | [
"Constructs",
"a",
"new",
"FileSystem",
"to",
"access",
"the",
"contents",
"of",
"a",
"file",
"as",
"a",
"file",
"system",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/VirtualFileSystems.java#L47-L50 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Scroller.java | Scroller.scrollToSide | @SuppressWarnings("deprecation")
public void scrollToSide(Side side, float scrollPosition, int stepCount) {
WindowManager windowManager = (WindowManager)
inst.getTargetContext().getSystemService(Context.WINDOW_SERVICE);
int screenHeight = windowManager.getDefaultDisplay()
.getHeight();
int screenWidth = windowManager.getDefaultDisplay()
.getWidth();
float x = screenWidth * scrollPosition;
float y = screenHeight / 2.0f;
if (side == Side.LEFT)
drag(70, x, y, y, stepCount);
else if (side == Side.RIGHT)
drag(x, 0, y, y, stepCount);
} | java | @SuppressWarnings("deprecation")
public void scrollToSide(Side side, float scrollPosition, int stepCount) {
WindowManager windowManager = (WindowManager)
inst.getTargetContext().getSystemService(Context.WINDOW_SERVICE);
int screenHeight = windowManager.getDefaultDisplay()
.getHeight();
int screenWidth = windowManager.getDefaultDisplay()
.getWidth();
float x = screenWidth * scrollPosition;
float y = screenHeight / 2.0f;
if (side == Side.LEFT)
drag(70, x, y, y, stepCount);
else if (side == Side.RIGHT)
drag(x, 0, y, y, stepCount);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"void",
"scrollToSide",
"(",
"Side",
"side",
",",
"float",
"scrollPosition",
",",
"int",
"stepCount",
")",
"{",
"WindowManager",
"windowManager",
"=",
"(",
"WindowManager",
")",
"inst",
".",
"getTar... | Scrolls horizontally.
@param side the side to which to scroll; {@link Side#RIGHT} or {@link Side#LEFT}
@param scrollPosition the position to scroll to, from 0 to 1 where 1 is all the way. Example is: 0.55.
@param stepCount how many move steps to include in the scroll. Less steps results in a faster scroll | [
"Scrolls",
"horizontally",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Scroller.java#L346-L361 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java | RespokeClient.postJoinGroupMembersError | private void postJoinGroupMembersError(final JoinGroupCompletionListener completionListener, final String errorMessage) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage);
}
}
});
} | java | private void postJoinGroupMembersError(final JoinGroupCompletionListener completionListener, final String errorMessage) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage);
}
}
});
} | [
"private",
"void",
"postJoinGroupMembersError",
"(",
"final",
"JoinGroupCompletionListener",
"completionListener",
",",
"final",
"String",
"errorMessage",
")",
"{",
"new",
"Handler",
"(",
"Looper",
".",
"getMainLooper",
"(",
")",
")",
".",
"post",
"(",
"new",
"Run... | A convenience method for posting errors to a JoinGroupCompletionListener
@param completionListener The listener to notify
@param errorMessage The human-readable error message that occurred | [
"A",
"convenience",
"method",
"for",
"posting",
"errors",
"to",
"a",
"JoinGroupCompletionListener"
] | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java#L1089-L1098 |
indeedeng/util | urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java | ParseUtils.parseSignedInt | public static int parseSignedInt(CharSequence s, final int start, final int end) throws NumberFormatException {
if (s.charAt(start) == '-') {
// negative!
return -parseUnsignedInt(s, start + 1, end);
} else {
return parseUnsignedInt(s, start, end);
}
} | java | public static int parseSignedInt(CharSequence s, final int start, final int end) throws NumberFormatException {
if (s.charAt(start) == '-') {
// negative!
return -parseUnsignedInt(s, start + 1, end);
} else {
return parseUnsignedInt(s, start, end);
}
} | [
"public",
"static",
"int",
"parseSignedInt",
"(",
"CharSequence",
"s",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
")",
"throws",
"NumberFormatException",
"{",
"if",
"(",
"s",
".",
"charAt",
"(",
"start",
")",
"==",
"'",
"'",
")",
"{",
"/... | Parses out an int value from the provided string, equivalent to Integer.parseInt(s.substring(start, end)),
but has significantly less overhead, no object creation and later garbage collection required.
@throws {@link NumberFormatException} if it encounters any character that is not [-0-9]. | [
"Parses",
"out",
"an",
"int",
"value",
"from",
"the",
"provided",
"string",
"equivalent",
"to",
"Integer",
".",
"parseInt",
"(",
"s",
".",
"substring",
"(",
"start",
"end",
"))",
"but",
"has",
"significantly",
"less",
"overhead",
"no",
"object",
"creation",
... | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java#L31-L38 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.deleteTag | public void deleteTag(GitlabProject project, String tagName) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project + GitlabTag.URL + "/" + tagName;
retrieve().method(DELETE).to(tailUrl, Void.class);
} | java | public void deleteTag(GitlabProject project, String tagName) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project + GitlabTag.URL + "/" + tagName;
retrieve().method(DELETE).to(tailUrl, Void.class);
} | [
"public",
"void",
"deleteTag",
"(",
"GitlabProject",
"project",
",",
"String",
"tagName",
")",
"throws",
"IOException",
"{",
"String",
"tailUrl",
"=",
"GitlabProject",
".",
"URL",
"+",
"\"/\"",
"+",
"project",
"+",
"GitlabTag",
".",
"URL",
"+",
"\"/\"",
"+",... | Delete tag in specific project
@param project
@param tagName
@throws IOException on gitlab api call error | [
"Delete",
"tag",
"in",
"specific",
"project"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3439-L3442 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java | InMemoryLockMapImpl.addReader | public boolean addReader(TransactionImpl tx, Object obj)
{
checkTimedOutLocks();
Identity oid = new Identity(obj,getBroker());
LockEntry reader = new LockEntry(oid.toString(),
tx.getGUID(),
System.currentTimeMillis(),
LockStrategyFactory.getIsolationLevel(obj),
LockEntry.LOCK_READ);
addReaderInternal(reader);
return true;
} | java | public boolean addReader(TransactionImpl tx, Object obj)
{
checkTimedOutLocks();
Identity oid = new Identity(obj,getBroker());
LockEntry reader = new LockEntry(oid.toString(),
tx.getGUID(),
System.currentTimeMillis(),
LockStrategyFactory.getIsolationLevel(obj),
LockEntry.LOCK_READ);
addReaderInternal(reader);
return true;
} | [
"public",
"boolean",
"addReader",
"(",
"TransactionImpl",
"tx",
",",
"Object",
"obj",
")",
"{",
"checkTimedOutLocks",
"(",
")",
";",
"Identity",
"oid",
"=",
"new",
"Identity",
"(",
"obj",
",",
"getBroker",
"(",
")",
")",
";",
"LockEntry",
"reader",
"=",
... | Add a reader lock entry for transaction tx on object obj
to the persistent storage. | [
"Add",
"a",
"reader",
"lock",
"entry",
"for",
"transaction",
"tx",
"on",
"object",
"obj",
"to",
"the",
"persistent",
"storage",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java#L132-L145 |
rnorth/visible-assertions | src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java | VisibleAssertions.assertNull | public static void assertNull(String message, Object o) {
if (o == null) {
pass(message);
} else {
fail(message, "'" + o + "' is not null");
}
} | java | public static void assertNull(String message, Object o) {
if (o == null) {
pass(message);
} else {
fail(message, "'" + o + "' is not null");
}
} | [
"public",
"static",
"void",
"assertNull",
"(",
"String",
"message",
",",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"pass",
"(",
"message",
")",
";",
"}",
"else",
"{",
"fail",
"(",
"message",
",",
"\"'\"",
"+",
"o",
"+",
"\"... | Assert that a value is null.
<p>
If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown.
@param message message to display alongside the assertion outcome
@param o value to test | [
"Assert",
"that",
"a",
"value",
"is",
"null",
".",
"<p",
">",
"If",
"the",
"assertion",
"passes",
"a",
"green",
"tick",
"will",
"be",
"shown",
".",
"If",
"the",
"assertion",
"fails",
"a",
"red",
"cross",
"will",
"be",
"shown",
"."
] | train | https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L279-L285 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.moveResource | public void moveResource(String source, String destination) throws CmsException {
CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION);
getResourceType(resource).moveResource(this, m_securityManager, resource, destination);
} | java | public void moveResource(String source, String destination) throws CmsException {
CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION);
getResourceType(resource).moveResource(this, m_securityManager, resource, destination);
} | [
"public",
"void",
"moveResource",
"(",
"String",
"source",
",",
"String",
"destination",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"readResource",
"(",
"source",
",",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
")",
";",
"getResourceType... | Moves a resource to the given destination.<p>
A move operation in OpenCms is always a copy (as sibling) followed by a delete,
this is a result of the online/offline structure of the
OpenCms VFS. This way you can see the deleted files/folders in the offline
project, and you will be unable to undelete them.<p>
@param source the name of the resource to move (full current site relative path)
@param destination the destination resource name (full current site relative path)
@throws CmsException if something goes wrong
@see #renameResource(String, String) | [
"Moves",
"a",
"resource",
"to",
"the",
"given",
"destination",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2241-L2245 |
HubSpot/Singularity | SingularityExecutor/src/main/java/com/hubspot/singularity/executor/SingularityExecutor.java | SingularityExecutor.reregistered | @Override
public void reregistered(ExecutorDriver executorDriver, Protos.SlaveInfo slaveInfo) {
LOG.debug("Re-registered with Mesos slave {}", slaveInfo.getId().getValue());
LOG.info("Re-registered with Mesos slave {}", MesosUtils.formatForLogging(slaveInfo));
} | java | @Override
public void reregistered(ExecutorDriver executorDriver, Protos.SlaveInfo slaveInfo) {
LOG.debug("Re-registered with Mesos slave {}", slaveInfo.getId().getValue());
LOG.info("Re-registered with Mesos slave {}", MesosUtils.formatForLogging(slaveInfo));
} | [
"@",
"Override",
"public",
"void",
"reregistered",
"(",
"ExecutorDriver",
"executorDriver",
",",
"Protos",
".",
"SlaveInfo",
"slaveInfo",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Re-registered with Mesos slave {}\"",
",",
"slaveInfo",
".",
"getId",
"(",
")",
".",
... | Invoked when the executor re-registers with a restarted slave. | [
"Invoked",
"when",
"the",
"executor",
"re",
"-",
"registers",
"with",
"a",
"restarted",
"slave",
"."
] | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityExecutor/src/main/java/com/hubspot/singularity/executor/SingularityExecutor.java#L51-L55 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Signature.java | Signature.prependArg | public Signature prependArg(String name, Class<?> type) {
String[] newArgNames = new String[argNames.length + 1];
System.arraycopy(argNames, 0, newArgNames, 1, argNames.length);
newArgNames[0] = name;
MethodType newMethodType = methodType.insertParameterTypes(0, type);
return new Signature(newMethodType, newArgNames);
} | java | public Signature prependArg(String name, Class<?> type) {
String[] newArgNames = new String[argNames.length + 1];
System.arraycopy(argNames, 0, newArgNames, 1, argNames.length);
newArgNames[0] = name;
MethodType newMethodType = methodType.insertParameterTypes(0, type);
return new Signature(newMethodType, newArgNames);
} | [
"public",
"Signature",
"prependArg",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"String",
"[",
"]",
"newArgNames",
"=",
"new",
"String",
"[",
"argNames",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"... | Prepend an argument (name + type) to the signature.
@param name the name of the argument
@param type the type of the argument
@return a new signature with the added arguments | [
"Prepend",
"an",
"argument",
"(",
"name",
"+",
"type",
")",
"to",
"the",
"signature",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L219-L225 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java | Collections.anyWithin | public static SatisfiesBuilder anyWithin(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY"), variable, expression, false);
} | java | public static SatisfiesBuilder anyWithin(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY"), variable, expression, false);
} | [
"public",
"static",
"SatisfiesBuilder",
"anyWithin",
"(",
"String",
"variable",
",",
"Expression",
"expression",
")",
"{",
"return",
"new",
"SatisfiesBuilder",
"(",
"x",
"(",
"\"ANY\"",
")",
",",
"variable",
",",
"expression",
",",
"false",
")",
";",
"}"
] | Create an ANY comprehension with a first WITHIN range.
ANY is a range predicate that allows you to test a Boolean condition over the
elements or attributes of a collection, object, or objects. It uses the IN and WITHIN operators to range through
the collection.
IN ranges in the direct elements of its array expression, WITHIN also ranges in its descendants.
If at least one item in the array satisfies the ANY expression, then ANY returns TRUE, otherwise returns FALSE. | [
"Create",
"an",
"ANY",
"comprehension",
"with",
"a",
"first",
"WITHIN",
"range",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L184-L186 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.getAccountAdjustments | public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type) {
return getAccountAdjustments(accountCode, type, null, new QueryParams());
} | java | public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type) {
return getAccountAdjustments(accountCode, type, null, new QueryParams());
} | [
"public",
"Adjustments",
"getAccountAdjustments",
"(",
"final",
"String",
"accountCode",
",",
"final",
"Adjustments",
".",
"AdjustmentType",
"type",
")",
"{",
"return",
"getAccountAdjustments",
"(",
"accountCode",
",",
"type",
",",
"null",
",",
"new",
"QueryParams",... | Get Account Adjustments
<p>
@param accountCode recurly account id
@param type {@link com.ning.billing.recurly.model.Adjustments.AdjustmentType}
@return the adjustments on the account | [
"Get",
"Account",
"Adjustments",
"<p",
">"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L387-L389 |
OpenTSDB/opentsdb | src/core/Internal.java | Internal.extractDataPoints | public static ArrayList<Cell> extractDataPoints(final KeyValue column) {
final ArrayList<KeyValue> row = new ArrayList<KeyValue>(1);
row.add(column);
return extractDataPoints(row, column.qualifier().length / 2);
} | java | public static ArrayList<Cell> extractDataPoints(final KeyValue column) {
final ArrayList<KeyValue> row = new ArrayList<KeyValue>(1);
row.add(column);
return extractDataPoints(row, column.qualifier().length / 2);
} | [
"public",
"static",
"ArrayList",
"<",
"Cell",
">",
"extractDataPoints",
"(",
"final",
"KeyValue",
"column",
")",
"{",
"final",
"ArrayList",
"<",
"KeyValue",
">",
"row",
"=",
"new",
"ArrayList",
"<",
"KeyValue",
">",
"(",
"1",
")",
";",
"row",
".",
"add",... | Extracts the data points from a single column.
While it's meant for use on a compacted column, you can pass any other type
of column and it will be returned. If the column represents a data point,
a single cell will be returned. If the column contains an annotation or
other object, the result will be an empty array list. Compacted columns
will be split into individual data points.
<b>Note:</b> This method does not account for duplicate timestamps in
qualifiers.
@param column The column to parse
@return An array list of data point {@link Cell} objects. The list may be
empty if the column did not contain a data point.
@throws IllegalDataException if one of the cells cannot be read because
it's corrupted or in a format we don't understand.
@since 2.0 | [
"Extracts",
"the",
"data",
"points",
"from",
"a",
"single",
"column",
".",
"While",
"it",
"s",
"meant",
"for",
"use",
"on",
"a",
"compacted",
"column",
"you",
"can",
"pass",
"any",
"other",
"type",
"of",
"column",
"and",
"it",
"will",
"be",
"returned",
... | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L216-L220 |
uber/NullAway | nullaway/src/main/java/com/uber/nullaway/ErrorBuilder.java | ErrorBuilder.createErrorDescription | Description createErrorDescription(
ErrorMessage errorMessage, TreePath path, Description.Builder descriptionBuilder) {
Tree enclosingSuppressTree = suppressibleNode(path);
return createErrorDescription(errorMessage, enclosingSuppressTree, descriptionBuilder);
} | java | Description createErrorDescription(
ErrorMessage errorMessage, TreePath path, Description.Builder descriptionBuilder) {
Tree enclosingSuppressTree = suppressibleNode(path);
return createErrorDescription(errorMessage, enclosingSuppressTree, descriptionBuilder);
} | [
"Description",
"createErrorDescription",
"(",
"ErrorMessage",
"errorMessage",
",",
"TreePath",
"path",
",",
"Description",
".",
"Builder",
"descriptionBuilder",
")",
"{",
"Tree",
"enclosingSuppressTree",
"=",
"suppressibleNode",
"(",
"path",
")",
";",
"return",
"creat... | create an error description for a nullability warning
@param errorMessage the error message object.
@param path the TreePath to the error location. Used to compute a suggested fix at the
enclosing method for the error location
@param descriptionBuilder the description builder for the error.
@return the error description | [
"create",
"an",
"error",
"description",
"for",
"a",
"nullability",
"warning"
] | train | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/ErrorBuilder.java#L78-L82 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java | DefaultSwidProcessor.setProductVersion | public DefaultSwidProcessor setProductVersion(final String productVersion,
final long productVersionMajor,
final long productVersionMinor,
final long productVersionBuild,
final long productVersionReview) {
final NumericVersionComplexType numericVersion = new NumericVersionComplexType(
new UInt(productVersionMajor, idGenerator.nextId()),
new UInt(productVersionMinor, idGenerator.nextId()),
new UInt(productVersionBuild, idGenerator.nextId()),
new UInt(productVersionReview, idGenerator.nextId()),
idGenerator.nextId());
swidTag.setProductVersion(
new ProductVersionComplexType(
new Token(productVersion, idGenerator.nextId()), numericVersion, idGenerator.nextId()));
return this;
} | java | public DefaultSwidProcessor setProductVersion(final String productVersion,
final long productVersionMajor,
final long productVersionMinor,
final long productVersionBuild,
final long productVersionReview) {
final NumericVersionComplexType numericVersion = new NumericVersionComplexType(
new UInt(productVersionMajor, idGenerator.nextId()),
new UInt(productVersionMinor, idGenerator.nextId()),
new UInt(productVersionBuild, idGenerator.nextId()),
new UInt(productVersionReview, idGenerator.nextId()),
idGenerator.nextId());
swidTag.setProductVersion(
new ProductVersionComplexType(
new Token(productVersion, idGenerator.nextId()), numericVersion, idGenerator.nextId()));
return this;
} | [
"public",
"DefaultSwidProcessor",
"setProductVersion",
"(",
"final",
"String",
"productVersion",
",",
"final",
"long",
"productVersionMajor",
",",
"final",
"long",
"productVersionMinor",
",",
"final",
"long",
"productVersionBuild",
",",
"final",
"long",
"productVersionRev... | Identifies the product version (tag: product_version) using two values – numeric version and version string.
@param productVersion
product version
@param productVersionMajor
product major version
@param productVersionMinor
product minor version
@param productVersionBuild
product build version
@param productVersionReview
product review version
@return a reference to this object. | [
"Identifies",
"the",
"product",
"version",
"(",
"tag",
":",
"product_version",
")",
"using",
"two",
"values",
"–",
"numeric",
"version",
"and",
"version",
"string",
"."
] | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java#L111-L126 |
NessComputing/components-ness-config | src/main/java/com/nesscomputing/config/Config.java | Config.getFixedConfig | public static Config getFixedConfig(@Nonnull Map<String, String> config)
{
return getFixedConfig(new MapConfiguration(config));
} | java | public static Config getFixedConfig(@Nonnull Map<String, String> config)
{
return getFixedConfig(new MapConfiguration(config));
} | [
"public",
"static",
"Config",
"getFixedConfig",
"(",
"@",
"Nonnull",
"Map",
"<",
"String",
",",
"String",
">",
"config",
")",
"{",
"return",
"getFixedConfig",
"(",
"new",
"MapConfiguration",
"(",
"config",
")",
")",
";",
"}"
] | Creates a fixed configuration for the supplied Map. Only key/value
pairs from this map will be present in the final configuration.
There is no implicit override from system properties. | [
"Creates",
"a",
"fixed",
"configuration",
"for",
"the",
"supplied",
"Map",
".",
"Only",
"key",
"/",
"value",
"pairs",
"from",
"this",
"map",
"will",
"be",
"present",
"in",
"the",
"final",
"configuration",
"."
] | train | https://github.com/NessComputing/components-ness-config/blob/eb9b37327a9e612a097f1258eb09d288f475e2cb/src/main/java/com/nesscomputing/config/Config.java#L92-L95 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java | DatabasesInner.createImportOperation | public ImportExportResponseInner createImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) {
return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body();
} | java | public ImportExportResponseInner createImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) {
return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body();
} | [
"public",
"ImportExportResponseInner",
"createImportOperation",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"ImportExtensionRequest",
"parameters",
")",
"{",
"return",
"createImportOperationWithServiceResponseAsync",
"(",... | Creates an import operation that imports a bacpac into an existing database. The existing database must be empty.
@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 import into
@param parameters The required parameters for importing a Bacpac into a database.
@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 ImportExportResponseInner object if successful. | [
"Creates",
"an",
"import",
"operation",
"that",
"imports",
"a",
"bacpac",
"into",
"an",
"existing",
"database",
".",
"The",
"existing",
"database",
"must",
"be",
"empty",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L1910-L1912 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/attribute/Attribute.java | Attribute.joinEqWithSourceAndAsOfCheck | protected Operation joinEqWithSourceAndAsOfCheck(Attribute other)
{
Mapper mapper = null;
if (this.getSourceAttributeType() != null && !(other instanceof MappedAttribute) && this.getSourceAttributeType().equals(other.getSourceAttributeType()))
{
MultiEqualityMapper mem = new MultiEqualityMapper(this, other);
mem.addAutoGeneratedAttributeMap(this.getSourceAttribute(), other.getSourceAttribute());
mapper = mem;
}
mapper = constructEqualityMapperWithAsOfCheck(other, mapper);
if (mapper == null)
{
mapper = this.constructEqualityMapper(other);
}
mapper.setAnonymous(true);
Attribute target = other;
if (other instanceof MappedAttribute)
{
target = ((MappedAttribute)other).getWrappedAttribute();
}
return new MappedOperation(mapper, new All(target));
} | java | protected Operation joinEqWithSourceAndAsOfCheck(Attribute other)
{
Mapper mapper = null;
if (this.getSourceAttributeType() != null && !(other instanceof MappedAttribute) && this.getSourceAttributeType().equals(other.getSourceAttributeType()))
{
MultiEqualityMapper mem = new MultiEqualityMapper(this, other);
mem.addAutoGeneratedAttributeMap(this.getSourceAttribute(), other.getSourceAttribute());
mapper = mem;
}
mapper = constructEqualityMapperWithAsOfCheck(other, mapper);
if (mapper == null)
{
mapper = this.constructEqualityMapper(other);
}
mapper.setAnonymous(true);
Attribute target = other;
if (other instanceof MappedAttribute)
{
target = ((MappedAttribute)other).getWrappedAttribute();
}
return new MappedOperation(mapper, new All(target));
} | [
"protected",
"Operation",
"joinEqWithSourceAndAsOfCheck",
"(",
"Attribute",
"other",
")",
"{",
"Mapper",
"mapper",
"=",
"null",
";",
"if",
"(",
"this",
".",
"getSourceAttributeType",
"(",
")",
"!=",
"null",
"&&",
"!",
"(",
"other",
"instanceof",
"MappedAttribute... | /*
public Operation in(List dataHolders, Extractor extractor)
{
return new InOperationWithExtractor(this, dataHolders, extractor);
} | [
"/",
"*",
"public",
"Operation",
"in",
"(",
"List",
"dataHolders",
"Extractor",
"extractor",
")",
"{",
"return",
"new",
"InOperationWithExtractor",
"(",
"this",
"dataHolders",
"extractor",
")",
";",
"}"
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/attribute/Attribute.java#L275-L296 |
facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java | SimulatorTaskTracker.progressTaskStatus | private void progressTaskStatus(SimulatorTaskInProgress tip, long now) {
TaskStatus status = tip.getTaskStatus();
if (status.getRunState() != State.RUNNING) {
return; // nothing to be done
}
boolean isMap = tip.isMapTask();
// Time when the user space code started
long startTime = -1;
// Time spent in map or just in the REDUCE phase of a reduce task
long runTime = tip.getUserSpaceRunTime();
float progress = 0.0f;
if (isMap) {
// We linearly estimate the progress of maps since their start
startTime = status.getStartTime();
progress = ((float)(now - startTime)) / runTime;
} else {
// We don't model reduce progress in the SHUFFLE or SORT phases
// We use linear estimate for the 3rd, REDUCE phase
Phase reducePhase = status.getPhase();
switch (reducePhase) {
case SHUFFLE:
progress = 0.0f; // 0 phase is done out of 3
break;
case SORT:
progress = 1.0f/3; // 1 phase is done out of 3
break;
case REDUCE: {
// REDUCE phase with the user code started when sort finished
startTime = status.getSortFinishTime();
// 0.66f : 2 phases are done out of of 3
progress = 2.0f/3 + (((float) (now - startTime)) / runTime) / 3.0f;
}
break;
default:
// should never get here
throw new IllegalArgumentException("Invalid reducePhase=" + reducePhase);
}
}
final float EPSILON = 0.0001f;
if (progress < -EPSILON || progress > 1 + EPSILON) {
throw new IllegalStateException("Task progress out of range: " + progress);
}
progress = Math.max(Math.min(1.0f, progress), 0.0f);
status.setProgress(progress);
if (LOG.isDebugEnabled()) {
LOG.debug("Updated task progress, taskId=" + status.getTaskID()
+ ", progress=" + status.getProgress());
}
} | java | private void progressTaskStatus(SimulatorTaskInProgress tip, long now) {
TaskStatus status = tip.getTaskStatus();
if (status.getRunState() != State.RUNNING) {
return; // nothing to be done
}
boolean isMap = tip.isMapTask();
// Time when the user space code started
long startTime = -1;
// Time spent in map or just in the REDUCE phase of a reduce task
long runTime = tip.getUserSpaceRunTime();
float progress = 0.0f;
if (isMap) {
// We linearly estimate the progress of maps since their start
startTime = status.getStartTime();
progress = ((float)(now - startTime)) / runTime;
} else {
// We don't model reduce progress in the SHUFFLE or SORT phases
// We use linear estimate for the 3rd, REDUCE phase
Phase reducePhase = status.getPhase();
switch (reducePhase) {
case SHUFFLE:
progress = 0.0f; // 0 phase is done out of 3
break;
case SORT:
progress = 1.0f/3; // 1 phase is done out of 3
break;
case REDUCE: {
// REDUCE phase with the user code started when sort finished
startTime = status.getSortFinishTime();
// 0.66f : 2 phases are done out of of 3
progress = 2.0f/3 + (((float) (now - startTime)) / runTime) / 3.0f;
}
break;
default:
// should never get here
throw new IllegalArgumentException("Invalid reducePhase=" + reducePhase);
}
}
final float EPSILON = 0.0001f;
if (progress < -EPSILON || progress > 1 + EPSILON) {
throw new IllegalStateException("Task progress out of range: " + progress);
}
progress = Math.max(Math.min(1.0f, progress), 0.0f);
status.setProgress(progress);
if (LOG.isDebugEnabled()) {
LOG.debug("Updated task progress, taskId=" + status.getTaskID()
+ ", progress=" + status.getProgress());
}
} | [
"private",
"void",
"progressTaskStatus",
"(",
"SimulatorTaskInProgress",
"tip",
",",
"long",
"now",
")",
"{",
"TaskStatus",
"status",
"=",
"tip",
".",
"getTaskStatus",
"(",
")",
";",
"if",
"(",
"status",
".",
"getRunState",
"(",
")",
"!=",
"State",
".",
"R... | Updates the progress indicator of a task if it is running.
@param tip simulator task in progress whose progress is to be updated
@param now current simulation time | [
"Updates",
"the",
"progress",
"indicator",
"of",
"a",
"task",
"if",
"it",
"is",
"running",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java#L440-L491 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java | GenericIHEAuditEventMessage.addValueSetParticipantObject | public void addValueSetParticipantObject(String valueSetUniqueId, String valueSetName, String valueSetVersion)
{
if (valueSetName == null){
valueSetName = "";
}
if (valueSetVersion == null){
valueSetVersion = "";
}
List<TypeValuePairType> tvp = new LinkedList<>();
tvp.add(getTypeValuePair("Value Set Version", valueSetVersion.getBytes()));
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
valueSetName,
null,
tvp,
valueSetUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | java | public void addValueSetParticipantObject(String valueSetUniqueId, String valueSetName, String valueSetVersion)
{
if (valueSetName == null){
valueSetName = "";
}
if (valueSetVersion == null){
valueSetVersion = "";
}
List<TypeValuePairType> tvp = new LinkedList<>();
tvp.add(getTypeValuePair("Value Set Version", valueSetVersion.getBytes()));
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
valueSetName,
null,
tvp,
valueSetUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | [
"public",
"void",
"addValueSetParticipantObject",
"(",
"String",
"valueSetUniqueId",
",",
"String",
"valueSetName",
",",
"String",
"valueSetVersion",
")",
"{",
"if",
"(",
"valueSetName",
"==",
"null",
")",
"{",
"valueSetName",
"=",
"\"\"",
";",
"}",
"if",
"(",
... | Adds a Participant Object representing a value set for SVS Exports
@param valueSetUniqueId unique id (OID) of the returned value set
@param valueSetName name associated with the unique id (OID) of the returned value set
@param valueSetVersion version of the returned value set | [
"Adds",
"a",
"Participant",
"Object",
"representing",
"a",
"value",
"set",
"for",
"SVS",
"Exports"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L262-L282 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsFailedToReindex | public FessMessages addErrorsFailedToReindex(String property, String arg0, String arg1) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_failed_to_reindex, arg0, arg1));
return this;
} | java | public FessMessages addErrorsFailedToReindex(String property, String arg0, String arg1) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_failed_to_reindex, arg0, arg1));
return this;
} | [
"public",
"FessMessages",
"addErrorsFailedToReindex",
"(",
"String",
"property",
",",
"String",
"arg0",
",",
"String",
"arg1",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_failed_to_r... | Add the created action message for the key 'errors.failed_to_reindex' with parameters.
<pre>
message: Failed to start reindexing from {0} to {1}
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@param arg1 The parameter arg1 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"failed_to_reindex",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Failed",
"to",
"start",
"reindexing",
"from",
"{",
"0",
"}",
"to",
"{",
"1",
"}",
"<",
"/",
... | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1935-L1939 |
weld/core | impl/src/main/java/org/jboss/weld/annotated/runtime/InvokableAnnotatedMethod.java | InvokableAnnotatedMethod.invokeOnInstance | public <X> X invokeOnInstance(Object instance, Object... parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
final Map<Class<?>, Method> methods = this.methods;
Method method = methods.get(instance.getClass());
if (method == null) {
// the same method may be written to the map twice, but that is ok
// lookupMethod is very slow
Method delegate = annotatedMethod.getJavaMember();
method = SecurityActions.lookupMethod(instance.getClass(), delegate.getName(), delegate.getParameterTypes());
SecurityActions.ensureAccessible(method);
synchronized (this) {
final Map<Class<?>, Method> newMethods = new HashMap<Class<?>, Method>(methods);
newMethods.put(instance.getClass(), method);
this.methods = WeldCollections.immutableMapView(newMethods);
}
}
return cast(method.invoke(instance, parameters));
} | java | public <X> X invokeOnInstance(Object instance, Object... parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
final Map<Class<?>, Method> methods = this.methods;
Method method = methods.get(instance.getClass());
if (method == null) {
// the same method may be written to the map twice, but that is ok
// lookupMethod is very slow
Method delegate = annotatedMethod.getJavaMember();
method = SecurityActions.lookupMethod(instance.getClass(), delegate.getName(), delegate.getParameterTypes());
SecurityActions.ensureAccessible(method);
synchronized (this) {
final Map<Class<?>, Method> newMethods = new HashMap<Class<?>, Method>(methods);
newMethods.put(instance.getClass(), method);
this.methods = WeldCollections.immutableMapView(newMethods);
}
}
return cast(method.invoke(instance, parameters));
} | [
"public",
"<",
"X",
">",
"X",
"invokeOnInstance",
"(",
"Object",
"instance",
",",
"Object",
"...",
"parameters",
")",
"throws",
"IllegalArgumentException",
",",
"SecurityException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"NoSuchMethodExcep... | Invokes the method on the class of the passed instance, not the declaring
class. Useful with proxies
@param instance The instance to invoke
@param manager The Bean manager
@return A reference to the instance | [
"Invokes",
"the",
"method",
"on",
"the",
"class",
"of",
"the",
"passed",
"instance",
"not",
"the",
"declaring",
"class",
".",
"Useful",
"with",
"proxies"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/annotated/runtime/InvokableAnnotatedMethod.java#L71-L87 |
EasyinnovaSL/Tiff-Library-4J | src/main/java/com/easyinnova/tiff/writer/TiffWriter.java | TiffWriter.classifyTags | private int classifyTags(IFD ifd, ArrayList<TagValue> oversized, ArrayList<TagValue> undersized) {
int tagValueSize = 4;
int n = 0;
for (TagValue tag : ifd.getMetadata().getTags()) {
int tagsize = getTagSize(tag);
if (tagsize > tagValueSize) {
oversized.add(tag);
} else {
undersized.add(tag);
}
n++;
}
return n;
} | java | private int classifyTags(IFD ifd, ArrayList<TagValue> oversized, ArrayList<TagValue> undersized) {
int tagValueSize = 4;
int n = 0;
for (TagValue tag : ifd.getMetadata().getTags()) {
int tagsize = getTagSize(tag);
if (tagsize > tagValueSize) {
oversized.add(tag);
} else {
undersized.add(tag);
}
n++;
}
return n;
} | [
"private",
"int",
"classifyTags",
"(",
"IFD",
"ifd",
",",
"ArrayList",
"<",
"TagValue",
">",
"oversized",
",",
"ArrayList",
"<",
"TagValue",
">",
"undersized",
")",
"{",
"int",
"tagValueSize",
"=",
"4",
";",
"int",
"n",
"=",
"0",
";",
"for",
"(",
"TagV... | Gets the oversized tags.
@param ifd the ifd
@param oversized the oversized
@param undersized the undersized
@return the number of tags | [
"Gets",
"the",
"oversized",
"tags",
"."
] | train | https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/writer/TiffWriter.java#L175-L188 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java | DataXceiver.getBlockCrc | void getBlockCrc(DataInputStream in, VersionAndOpcode versionAndOpcode)
throws IOException {
// header
BlockChecksumHeader blockChecksumHeader =
new BlockChecksumHeader(versionAndOpcode);
blockChecksumHeader.readFields(in);
final int namespaceId = blockChecksumHeader.getNamespaceId();
final Block block = new Block(blockChecksumHeader.getBlockId(), 0,
blockChecksumHeader.getGenStamp());
DataOutputStream out = null;
ReplicaToRead ri = datanode.data.getReplicaToRead(namespaceId, block);
if (ri == null) {
throw new IOException("Unknown block");
}
updateCurrentThreadName("getting CRC checksum for block " + block);
try {
//write reply
out = new DataOutputStream(
NetUtils.getOutputStream(s, datanode.socketWriteTimeout));
int blockCrc;
if (ri.hasBlockCrcInfo()) {
// There is actually a short window that the block is reopened
// and we got exception when call getBlockCrc but it's OK. It's
// only happens for append(). So far we don't optimize for this
// use case. We can do it later when necessary.
//
blockCrc = ri.getBlockCrc();
} else {
try {
if (ri.isInlineChecksum()) {
blockCrc = BlockInlineChecksumReader.getBlockCrc(datanode, ri,
namespaceId, block);
} else {
blockCrc = BlockWithChecksumFileReader.getBlockCrc(datanode, ri,
namespaceId, block);
}
} catch (IOException ioe) {
LOG.warn("Exception when getting Block CRC", ioe);
out.writeShort(DataTransferProtocol.OP_STATUS_ERROR);
out.flush();
throw ioe;
}
}
out.writeShort(DataTransferProtocol.OP_STATUS_SUCCESS);
out.writeLong(blockCrc);
out.flush();
} finally {
IOUtils.closeStream(out);
}
} | java | void getBlockCrc(DataInputStream in, VersionAndOpcode versionAndOpcode)
throws IOException {
// header
BlockChecksumHeader blockChecksumHeader =
new BlockChecksumHeader(versionAndOpcode);
blockChecksumHeader.readFields(in);
final int namespaceId = blockChecksumHeader.getNamespaceId();
final Block block = new Block(blockChecksumHeader.getBlockId(), 0,
blockChecksumHeader.getGenStamp());
DataOutputStream out = null;
ReplicaToRead ri = datanode.data.getReplicaToRead(namespaceId, block);
if (ri == null) {
throw new IOException("Unknown block");
}
updateCurrentThreadName("getting CRC checksum for block " + block);
try {
//write reply
out = new DataOutputStream(
NetUtils.getOutputStream(s, datanode.socketWriteTimeout));
int blockCrc;
if (ri.hasBlockCrcInfo()) {
// There is actually a short window that the block is reopened
// and we got exception when call getBlockCrc but it's OK. It's
// only happens for append(). So far we don't optimize for this
// use case. We can do it later when necessary.
//
blockCrc = ri.getBlockCrc();
} else {
try {
if (ri.isInlineChecksum()) {
blockCrc = BlockInlineChecksumReader.getBlockCrc(datanode, ri,
namespaceId, block);
} else {
blockCrc = BlockWithChecksumFileReader.getBlockCrc(datanode, ri,
namespaceId, block);
}
} catch (IOException ioe) {
LOG.warn("Exception when getting Block CRC", ioe);
out.writeShort(DataTransferProtocol.OP_STATUS_ERROR);
out.flush();
throw ioe;
}
}
out.writeShort(DataTransferProtocol.OP_STATUS_SUCCESS);
out.writeLong(blockCrc);
out.flush();
} finally {
IOUtils.closeStream(out);
}
} | [
"void",
"getBlockCrc",
"(",
"DataInputStream",
"in",
",",
"VersionAndOpcode",
"versionAndOpcode",
")",
"throws",
"IOException",
"{",
"// header",
"BlockChecksumHeader",
"blockChecksumHeader",
"=",
"new",
"BlockChecksumHeader",
"(",
"versionAndOpcode",
")",
";",
"blockChec... | Get block data's CRC32 checksum.
@param in
@param versionAndOpcode | [
"Get",
"block",
"data",
"s",
"CRC32",
"checksum",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java#L931-L985 |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlEnumLiteralBuilderImpl.java | SarlEnumLiteralBuilderImpl.eInit | public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
setTypeResolutionContext(context);
if (this.sarlEnumLiteral == null) {
this.container = container;
this.sarlEnumLiteral = SarlFactory.eINSTANCE.createSarlEnumLiteral();
this.sarlEnumLiteral.setName(name);
container.getMembers().add(this.sarlEnumLiteral);
}
} | java | public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
setTypeResolutionContext(context);
if (this.sarlEnumLiteral == null) {
this.container = container;
this.sarlEnumLiteral = SarlFactory.eINSTANCE.createSarlEnumLiteral();
this.sarlEnumLiteral.setName(name);
container.getMembers().add(this.sarlEnumLiteral);
}
} | [
"public",
"void",
"eInit",
"(",
"XtendTypeDeclaration",
"container",
",",
"String",
"name",
",",
"IJvmTypeProvider",
"context",
")",
"{",
"setTypeResolutionContext",
"(",
"context",
")",
";",
"if",
"(",
"this",
".",
"sarlEnumLiteral",
"==",
"null",
")",
"{",
"... | Initialize the Ecore element.
@param container the container of the SarlEnumLiteral.
@param name the name of the SarlEnumLiteral. | [
"Initialize",
"the",
"Ecore",
"element",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlEnumLiteralBuilderImpl.java#L61-L69 |
casmi/casmi | src/main/java/casmi/graphics/element/Arc.java | Arc.setEdgeColor | public void setEdgeColor(ColorSet colorSet) {
if (edgeColor == null) edgeColor = new RGBColor(0.0, 0.0, 0.0);
setGradation(true);
this.edgeColor = RGBColor.color(colorSet);
} | java | public void setEdgeColor(ColorSet colorSet) {
if (edgeColor == null) edgeColor = new RGBColor(0.0, 0.0, 0.0);
setGradation(true);
this.edgeColor = RGBColor.color(colorSet);
} | [
"public",
"void",
"setEdgeColor",
"(",
"ColorSet",
"colorSet",
")",
"{",
"if",
"(",
"edgeColor",
"==",
"null",
")",
"edgeColor",
"=",
"new",
"RGBColor",
"(",
"0.0",
",",
"0.0",
",",
"0.0",
")",
";",
"setGradation",
"(",
"true",
")",
";",
"this",
".",
... | Sets the colorSet of the edge of this Arc.
@param colorSet The colorSet of the edge of the Arc. | [
"Sets",
"the",
"colorSet",
"of",
"the",
"edge",
"of",
"this",
"Arc",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Arc.java#L447-L451 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/internal/crypto/ContentCryptoMaterial.java | ContentCryptoMaterial.doCreate | private static ContentCryptoMaterial doCreate(SecretKey cek, byte[] iv,
EncryptionMaterials kekMaterials,
ContentCryptoScheme contentCryptoScheme,
S3CryptoScheme targetS3CryptoScheme,
Provider provider,
AWSKMS kms,
AmazonWebServiceRequest req) {
// Secure the envelope symmetric key either by encryption, key wrapping
// or KMS.
SecuredCEK cekSecured = secureCEK(cek, kekMaterials,
targetS3CryptoScheme.getKeyWrapScheme(),
targetS3CryptoScheme.getSecureRandom(),
provider, kms, req);
return wrap(cek, iv, contentCryptoScheme, provider, cekSecured);
} | java | private static ContentCryptoMaterial doCreate(SecretKey cek, byte[] iv,
EncryptionMaterials kekMaterials,
ContentCryptoScheme contentCryptoScheme,
S3CryptoScheme targetS3CryptoScheme,
Provider provider,
AWSKMS kms,
AmazonWebServiceRequest req) {
// Secure the envelope symmetric key either by encryption, key wrapping
// or KMS.
SecuredCEK cekSecured = secureCEK(cek, kekMaterials,
targetS3CryptoScheme.getKeyWrapScheme(),
targetS3CryptoScheme.getSecureRandom(),
provider, kms, req);
return wrap(cek, iv, contentCryptoScheme, provider, cekSecured);
} | [
"private",
"static",
"ContentCryptoMaterial",
"doCreate",
"(",
"SecretKey",
"cek",
",",
"byte",
"[",
"]",
"iv",
",",
"EncryptionMaterials",
"kekMaterials",
",",
"ContentCryptoScheme",
"contentCryptoScheme",
",",
"S3CryptoScheme",
"targetS3CryptoScheme",
",",
"Provider",
... | Returns a new instance of <code>ContentCryptoMaterial</code> for the
given input parameters by using the specified content crypto scheme, and
S3 crypto scheme.
Note network calls are involved if the CEK is to be protected by KMS.
@param cek
content encrypting key
@param iv
initialization vector
@param kekMaterials
kek encryption material used to secure the CEK; can be KMS
enabled.
@param contentCryptoScheme
content crypto scheme to be used, which can differ from the
one of <code>targetS3CryptoScheme</code>
@param targetS3CryptoScheme
the target s3 crypto scheme to be used for providing the key
wrapping scheme and mechanism for secure randomness
@param provider
security provider
@param kms
reference to the KMS client
@param req
the originating AWS service request | [
"Returns",
"a",
"new",
"instance",
"of",
"<code",
">",
"ContentCryptoMaterial<",
"/",
"code",
">",
"for",
"the",
"given",
"input",
"parameters",
"by",
"using",
"the",
"specified",
"content",
"crypto",
"scheme",
"and",
"S3",
"crypto",
"scheme",
"."
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/internal/crypto/ContentCryptoMaterial.java#L798-L812 |
iig-uni-freiburg/SEWOL | ext/org/deckfour/xes/info/XGlobalAttributeNameMap.java | XGlobalAttributeNameMap.mapSafely | public String mapSafely(XAttribute attribute, String mappingName) {
return mapSafely(attribute, mappings.get(mappingName));
} | java | public String mapSafely(XAttribute attribute, String mappingName) {
return mapSafely(attribute, mappings.get(mappingName));
} | [
"public",
"String",
"mapSafely",
"(",
"XAttribute",
"attribute",
",",
"String",
"mappingName",
")",
"{",
"return",
"mapSafely",
"(",
"attribute",
",",
"mappings",
".",
"get",
"(",
"mappingName",
")",
")",
";",
"}"
] | Maps an attribute safely, using the given attribute mapping.
Safe mapping attempts to map the attribute using the given
mapping first. If this does not succeed, the standard mapping
(EN) will be used for mapping. If no mapping is available in
the standard mapping, the original attribute key is returned
unchanged. This way, it is always ensured that this method
returns a valid string for naming attributes.
@param attribute Attribute to map.
@param mappingName Name of the mapping to be used preferably.
@return The safe mapping for the given attribute. | [
"Maps",
"an",
"attribute",
"safely",
"using",
"the",
"given",
"attribute",
"mapping",
".",
"Safe",
"mapping",
"attempts",
"to",
"map",
"the",
"attribute",
"using",
"the",
"given",
"mapping",
"first",
".",
"If",
"this",
"does",
"not",
"succeed",
"the",
"stand... | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/info/XGlobalAttributeNameMap.java#L242-L244 |
itfsw/QueryBuilder | src/main/java/com/itfsw/query/builder/support/utils/spring/NumberUtils.java | NumberUtils.checkedLongValue | private static long checkedLongValue(Number number, Class<? extends Number> targetClass) {
BigInteger bigInt = null;
if (number instanceof BigInteger) {
bigInt = (BigInteger) number;
} else if (number instanceof BigDecimal) {
bigInt = ((BigDecimal) number).toBigInteger();
}
// Effectively analogous to JDK 8's BigInteger.longValueExact()
if (bigInt != null && (bigInt.compareTo(LONG_MIN) < 0 || bigInt.compareTo(LONG_MAX) > 0)) {
raiseOverflowException(number, targetClass);
}
return number.longValue();
} | java | private static long checkedLongValue(Number number, Class<? extends Number> targetClass) {
BigInteger bigInt = null;
if (number instanceof BigInteger) {
bigInt = (BigInteger) number;
} else if (number instanceof BigDecimal) {
bigInt = ((BigDecimal) number).toBigInteger();
}
// Effectively analogous to JDK 8's BigInteger.longValueExact()
if (bigInt != null && (bigInt.compareTo(LONG_MIN) < 0 || bigInt.compareTo(LONG_MAX) > 0)) {
raiseOverflowException(number, targetClass);
}
return number.longValue();
} | [
"private",
"static",
"long",
"checkedLongValue",
"(",
"Number",
"number",
",",
"Class",
"<",
"?",
"extends",
"Number",
">",
"targetClass",
")",
"{",
"BigInteger",
"bigInt",
"=",
"null",
";",
"if",
"(",
"number",
"instanceof",
"BigInteger",
")",
"{",
"bigInt"... | Check for a {@code BigInteger}/{@code BigDecimal} long overflow
before returning the given number as a long value.
@param number the number to convert
@param targetClass the target class to convert to
@return the long value, if convertible without overflow
@throws IllegalArgumentException if there is an overflow
@see #raiseOverflowException | [
"Check",
"for",
"a",
"{"
] | train | https://github.com/itfsw/QueryBuilder/blob/231dc9a334d54cf98755cfcb236202201ddee162/src/main/java/com/itfsw/query/builder/support/utils/spring/NumberUtils.java#L139-L151 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/storage/snapshot/SnapshotFile.java | SnapshotFile.createSnapshotFile | @VisibleForTesting
static File createSnapshotFile(File directory, String serverName, long index) {
return new File(directory, createSnapshotFileName(serverName, index));
} | java | @VisibleForTesting
static File createSnapshotFile(File directory, String serverName, long index) {
return new File(directory, createSnapshotFileName(serverName, index));
} | [
"@",
"VisibleForTesting",
"static",
"File",
"createSnapshotFile",
"(",
"File",
"directory",
",",
"String",
"serverName",
",",
"long",
"index",
")",
"{",
"return",
"new",
"File",
"(",
"directory",
",",
"createSnapshotFileName",
"(",
"serverName",
",",
"index",
")... | Creates a snapshot file for the given directory, log name, and snapshot index. | [
"Creates",
"a",
"snapshot",
"file",
"for",
"the",
"given",
"directory",
"log",
"name",
"and",
"snapshot",
"index",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/storage/snapshot/SnapshotFile.java#L88-L91 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java | JCRAssert.assertStringPropertyEquals | public static void assertStringPropertyEquals(final Node node, final String propertyName, final String actualValue)
throws RepositoryException {
assertTrue("Node " + node.getPath() + " has no property " + propertyName, node.hasProperty(propertyName));
final Property prop = node.getProperty(propertyName);
assertEquals("Property type is not STRING ", PropertyType.STRING, prop.getType());
assertEquals(actualValue, prop.getString());
} | java | public static void assertStringPropertyEquals(final Node node, final String propertyName, final String actualValue)
throws RepositoryException {
assertTrue("Node " + node.getPath() + " has no property " + propertyName, node.hasProperty(propertyName));
final Property prop = node.getProperty(propertyName);
assertEquals("Property type is not STRING ", PropertyType.STRING, prop.getType());
assertEquals(actualValue, prop.getString());
} | [
"public",
"static",
"void",
"assertStringPropertyEquals",
"(",
"final",
"Node",
"node",
",",
"final",
"String",
"propertyName",
",",
"final",
"String",
"actualValue",
")",
"throws",
"RepositoryException",
"{",
"assertTrue",
"(",
"\"Node \"",
"+",
"node",
".",
"get... | Asserts the equality of a property value of a node with an expected value
@param node
the node containing the property to be verified
@param propertyName
the property name to be verified
@param actualValue
the actual value that should be compared to the propert node
@throws RepositoryException | [
"Asserts",
"the",
"equality",
"of",
"a",
"property",
"value",
"of",
"a",
"node",
"with",
"an",
"expected",
"value"
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java#L62-L68 |
h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/deeplearning/DeeplearningMojoModel.java | DeeplearningMojoModel.score0 | @Override
public final double[] score0(double[] dataRow, double offset, double[] preds) {
assert(dataRow != null) : "doubles are null"; // check to make sure data is not null
double[] neuronsInput = new double[_units[0]]; // store inputs into the neural network
double[] neuronsOutput; // save output from a neural network layer
// transform inputs: NAs in categoricals are always set to new extra level.
setInput(dataRow, neuronsInput, _numsA, _catsA, _nums, _cats, _catoffsets, _normmul, _normsub, _use_all_factor_levels, true);
// proprogate inputs through neural network
for (int layer=0; layer < _numLayers; layer++) {
NeuralNetwork oneLayer = new NeuralNetwork(_allActivations[layer], _all_drop_out_ratios[layer],
_weightsAndBias[layer], neuronsInput, _units[layer + 1]);
neuronsOutput = oneLayer.fprop1Layer();
neuronsInput = neuronsOutput;
}
if (!this.isAutoEncoder())
assert (_nclasses == neuronsInput.length) : "nclasses " + _nclasses + " neuronsOutput.length " + neuronsInput.length;
// Correction for classification or standardize outputs
return modifyOutputs(neuronsInput, preds, dataRow);
} | java | @Override
public final double[] score0(double[] dataRow, double offset, double[] preds) {
assert(dataRow != null) : "doubles are null"; // check to make sure data is not null
double[] neuronsInput = new double[_units[0]]; // store inputs into the neural network
double[] neuronsOutput; // save output from a neural network layer
// transform inputs: NAs in categoricals are always set to new extra level.
setInput(dataRow, neuronsInput, _numsA, _catsA, _nums, _cats, _catoffsets, _normmul, _normsub, _use_all_factor_levels, true);
// proprogate inputs through neural network
for (int layer=0; layer < _numLayers; layer++) {
NeuralNetwork oneLayer = new NeuralNetwork(_allActivations[layer], _all_drop_out_ratios[layer],
_weightsAndBias[layer], neuronsInput, _units[layer + 1]);
neuronsOutput = oneLayer.fprop1Layer();
neuronsInput = neuronsOutput;
}
if (!this.isAutoEncoder())
assert (_nclasses == neuronsInput.length) : "nclasses " + _nclasses + " neuronsOutput.length " + neuronsInput.length;
// Correction for classification or standardize outputs
return modifyOutputs(neuronsInput, preds, dataRow);
} | [
"@",
"Override",
"public",
"final",
"double",
"[",
"]",
"score0",
"(",
"double",
"[",
"]",
"dataRow",
",",
"double",
"offset",
",",
"double",
"[",
"]",
"preds",
")",
"{",
"assert",
"(",
"dataRow",
"!=",
"null",
")",
":",
"\"doubles are null\"",
";",
"/... | *
This method will be derived from the scoring/prediction function of deeplearning model itself. However,
we followed closely what is being done in deepwater mojo. The variable offset is not used.
@param dataRow
@param offset
@param preds
@return | [
"*",
"This",
"method",
"will",
"be",
"derived",
"from",
"the",
"scoring",
"/",
"prediction",
"function",
"of",
"deeplearning",
"model",
"itself",
".",
"However",
"we",
"followed",
"closely",
"what",
"is",
"being",
"done",
"in",
"deepwater",
"mojo",
".",
"The... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/deeplearning/DeeplearningMojoModel.java#L60-L80 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.readGroup | public CmsGroup readGroup(CmsRequestContext context, CmsUUID groupId) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsGroup result = null;
try {
result = m_driverManager.readGroup(dbc, groupId);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_READ_GROUP_FOR_ID_1, groupId.toString()), e);
} finally {
dbc.clear();
}
return result;
} | java | public CmsGroup readGroup(CmsRequestContext context, CmsUUID groupId) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsGroup result = null;
try {
result = m_driverManager.readGroup(dbc, groupId);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_READ_GROUP_FOR_ID_1, groupId.toString()), e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"CmsGroup",
"readGroup",
"(",
"CmsRequestContext",
"context",
",",
"CmsUUID",
"groupId",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"CmsGroup",
"result",
"=",
"null... | Reads a group based on its id.<p>
@param context the current request context
@param groupId the id of the group that is to be read
@return the requested group
@throws CmsException if operation was not successful | [
"Reads",
"a",
"group",
"based",
"on",
"its",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4350-L4362 |
JavaMoney/jsr354-api | src/main/java/javax/money/format/MonetaryFormats.java | MonetaryFormats.getAmountFormat | public static MonetaryAmountFormat getAmountFormat(Locale locale, String... providers) {
return getAmountFormat(AmountFormatQueryBuilder.of(locale).setProviderNames(providers).setLocale(locale).build());
} | java | public static MonetaryAmountFormat getAmountFormat(Locale locale, String... providers) {
return getAmountFormat(AmountFormatQueryBuilder.of(locale).setProviderNames(providers).setLocale(locale).build());
} | [
"public",
"static",
"MonetaryAmountFormat",
"getAmountFormat",
"(",
"Locale",
"locale",
",",
"String",
"...",
"providers",
")",
"{",
"return",
"getAmountFormat",
"(",
"AmountFormatQueryBuilder",
".",
"of",
"(",
"locale",
")",
".",
"setProviderNames",
"(",
"providers... | Access the default {@link MonetaryAmountFormat} given a {@link Locale}.
@param locale the target {@link Locale}, not {@code null}.
@param providers The providers to be queried, if not set the providers as defined by #getDefaultCurrencyProviderChain()
are queried.
@return the matching {@link MonetaryAmountFormat}
@throws MonetaryException if no registered {@link MonetaryAmountFormatProviderSpi} can provide a
corresponding {@link MonetaryAmountFormat} instance. | [
"Access",
"the",
"default",
"{",
"@link",
"MonetaryAmountFormat",
"}",
"given",
"a",
"{",
"@link",
"Locale",
"}",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/format/MonetaryFormats.java#L89-L91 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java | ID3v2Tag.setURLFrame | public void setURLFrame(String id, String data)
{
if ((id.charAt(0) == 'W') && !id.equals(ID3v2Frames.USER_DEFINED_URL))
{
updateFrameData(id, data.getBytes());
}
} | java | public void setURLFrame(String id, String data)
{
if ((id.charAt(0) == 'W') && !id.equals(ID3v2Frames.USER_DEFINED_URL))
{
updateFrameData(id, data.getBytes());
}
} | [
"public",
"void",
"setURLFrame",
"(",
"String",
"id",
",",
"String",
"data",
")",
"{",
"if",
"(",
"(",
"id",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"&&",
"!",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"USER_DEFINED_URL",
")",
")",
... | Set the data contained in a URL frame. This includes all frames with
an id that starts with 'W' but excludes "WXXX". If an improper id is
passed, then nothing will happen.
@param id the id of the frame to set the data for
@param data the data for the frame | [
"Set",
"the",
"data",
"contained",
"in",
"a",
"URL",
"frame",
".",
"This",
"includes",
"all",
"frames",
"with",
"an",
"id",
"that",
"starts",
"with",
"W",
"but",
"excludes",
"WXXX",
".",
"If",
"an",
"improper",
"id",
"is",
"passed",
"then",
"nothing",
... | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L327-L333 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ConsumerSessionProxy.java | ConsumerSessionProxy._deleteSet | private void _deleteSet(SIMessageHandle[] msgHandles, SITransaction tran)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "_deleteSet",
new Object[] { msgHandles.length + " msg handles", tran });
if (TraceComponent.isAnyTracingEnabled()) {
CommsLightTrace.traceMessageIds(tc, "DeleteSetMsgTrace", msgHandles);
}
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putShort(getProxyID());
request.putSITransaction(tran);
request.putSIMessageHandles(msgHandles);
CommsByteBuffer reply = jfapExchange(request,
JFapChannelConstants.SEG_DELETE_SET,
JFapChannelConstants.PRIORITY_MEDIUM,
true);
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_DELETE_SET_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SILimitExceededException(reply, err);
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIMessageNotLockedException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "_deleteSet");
} | java | private void _deleteSet(SIMessageHandle[] msgHandles, SITransaction tran)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "_deleteSet",
new Object[] { msgHandles.length + " msg handles", tran });
if (TraceComponent.isAnyTracingEnabled()) {
CommsLightTrace.traceMessageIds(tc, "DeleteSetMsgTrace", msgHandles);
}
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putShort(getProxyID());
request.putSITransaction(tran);
request.putSIMessageHandles(msgHandles);
CommsByteBuffer reply = jfapExchange(request,
JFapChannelConstants.SEG_DELETE_SET,
JFapChannelConstants.PRIORITY_MEDIUM,
true);
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_DELETE_SET_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SILimitExceededException(reply, err);
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIMessageNotLockedException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "_deleteSet");
} | [
"private",
"void",
"_deleteSet",
"(",
"SIMessageHandle",
"[",
"]",
"msgHandles",
",",
"SITransaction",
"tran",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
... | Used to delete a set of messages.
@param msgHandles
@param tran | [
"Used",
"to",
"delete",
"a",
"set",
"of",
"messages",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ConsumerSessionProxy.java#L1581-L1631 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java | PublicIPPrefixesInner.getByResourceGroupAsync | public Observable<PublicIPPrefixInner> getByResourceGroupAsync(String resourceGroupName, String publicIpPrefixName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
} | java | public Observable<PublicIPPrefixInner> getByResourceGroupAsync(String resourceGroupName, String publicIpPrefixName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PublicIPPrefixInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"publicIpPrefixName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"publicIpPrefixName",
... | Gets the specified public IP prefix in a specified resource group.
@param resourceGroupName The name of the resource group.
@param publicIpPrefixName The name of the PublicIPPrefx.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PublicIPPrefixInner object | [
"Gets",
"the",
"specified",
"public",
"IP",
"prefix",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java#L302-L309 |
dkpro/dkpro-statistics | dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java | UnitizingAnnotationStudy.findNextUnit | public static IUnitizingAnnotationUnit findNextUnit(
final Iterator<IUnitizingAnnotationUnit> units, int raterIdx) {
return findNextUnit(units, raterIdx, null);
} | java | public static IUnitizingAnnotationUnit findNextUnit(
final Iterator<IUnitizingAnnotationUnit> units, int raterIdx) {
return findNextUnit(units, raterIdx, null);
} | [
"public",
"static",
"IUnitizingAnnotationUnit",
"findNextUnit",
"(",
"final",
"Iterator",
"<",
"IUnitizingAnnotationUnit",
">",
"units",
",",
"int",
"raterIdx",
")",
"{",
"return",
"findNextUnit",
"(",
"units",
",",
"raterIdx",
",",
"null",
")",
";",
"}"
] | Utility method for moving on the cursor of the given iterator until
a unit of the specified rater is returned. | [
"Utility",
"method",
"for",
"moving",
"on",
"the",
"cursor",
"of",
"the",
"given",
"iterator",
"until",
"a",
"unit",
"of",
"the",
"specified",
"rater",
"is",
"returned",
"."
] | train | https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java#L120-L123 |
camunda/camunda-xml-model | src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java | ModelUtil.getModelElement | public static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, ModelElementTypeImpl modelType) {
ModelElementInstance modelElement = domElement.getModelElementInstance();
if(modelElement == null) {
modelElement = modelType.newInstance(modelInstance, domElement);
domElement.setModelElementInstance(modelElement);
}
return modelElement;
} | java | public static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, ModelElementTypeImpl modelType) {
ModelElementInstance modelElement = domElement.getModelElementInstance();
if(modelElement == null) {
modelElement = modelType.newInstance(modelInstance, domElement);
domElement.setModelElementInstance(modelElement);
}
return modelElement;
} | [
"public",
"static",
"ModelElementInstance",
"getModelElement",
"(",
"DomElement",
"domElement",
",",
"ModelInstanceImpl",
"modelInstance",
",",
"ModelElementTypeImpl",
"modelType",
")",
"{",
"ModelElementInstance",
"modelElement",
"=",
"domElement",
".",
"getModelElementInsta... | Returns the {@link ModelElementInstanceImpl ModelElement} for a DOM element.
If the model element does not yet exist, it is created and linked to the DOM.
@param domElement the child element to create a new {@link ModelElementInstanceImpl ModelElement} for
@param modelInstance the {@link ModelInstanceImpl ModelInstance} for which the new {@link ModelElementInstanceImpl ModelElement} is created
@param modelType the {@link ModelElementTypeImpl ModelElementType} to create a new {@link ModelElementInstanceImpl ModelElement} for
@return the child model element | [
"Returns",
"the",
"{",
"@link",
"ModelElementInstanceImpl",
"ModelElement",
"}",
"for",
"a",
"DOM",
"element",
".",
"If",
"the",
"model",
"element",
"does",
"not",
"yet",
"exist",
"it",
"is",
"created",
"and",
"linked",
"to",
"the",
"DOM",
"."
] | train | https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L68-L76 |
census-instrumentation/opencensus-java | impl_core/src/main/java/io/opencensus/implcore/tags/TagContextUtils.java | TagContextUtils.addTagToBuilder | static void addTagToBuilder(Tag tag, TagMapBuilderImpl builder) {
builder.put(tag.getKey(), tag.getValue(), tag.getTagMetadata());
} | java | static void addTagToBuilder(Tag tag, TagMapBuilderImpl builder) {
builder.put(tag.getKey(), tag.getValue(), tag.getTagMetadata());
} | [
"static",
"void",
"addTagToBuilder",
"(",
"Tag",
"tag",
",",
"TagMapBuilderImpl",
"builder",
")",
"{",
"builder",
".",
"put",
"(",
"tag",
".",
"getKey",
"(",
")",
",",
"tag",
".",
"getValue",
"(",
")",
",",
"tag",
".",
"getTagMetadata",
"(",
")",
")",
... | Add a {@code Tag} of any type to a builder.
@param tag tag containing the key and value to set.
@param builder the builder to update. | [
"Add",
"a",
"{",
"@code",
"Tag",
"}",
"of",
"any",
"type",
"to",
"a",
"builder",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/impl_core/src/main/java/io/opencensus/implcore/tags/TagContextUtils.java#L30-L32 |
iipc/webarchive-commons | src/main/java/org/archive/util/DevUtils.java | DevUtils.warnHandle | public static void warnHandle(Throwable ex, String note) {
logger.warning(TextUtils.exceptionToString(note, ex));
} | java | public static void warnHandle(Throwable ex, String note) {
logger.warning(TextUtils.exceptionToString(note, ex));
} | [
"public",
"static",
"void",
"warnHandle",
"(",
"Throwable",
"ex",
",",
"String",
"note",
")",
"{",
"logger",
".",
"warning",
"(",
"TextUtils",
".",
"exceptionToString",
"(",
"note",
",",
"ex",
")",
")",
";",
"}"
] | Log a warning message to the logger 'org.archive.util.DevUtils' made of
the passed 'note' and a stack trace based off passed exception.
@param ex Exception we print a stacktrace on.
@param note Message to print ahead of the stacktrace. | [
"Log",
"a",
"warning",
"message",
"to",
"the",
"logger",
"org",
".",
"archive",
".",
"util",
".",
"DevUtils",
"made",
"of",
"the",
"passed",
"note",
"and",
"a",
"stack",
"trace",
"based",
"off",
"passed",
"exception",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/DevUtils.java#L46-L48 |
sundrio/sundrio | components/swagger/src/main/java/io/sundr/swagger/language/JavaFluentCodegen.java | JavaFluentCodegen.addOperationToGroup | @SuppressWarnings("static-method")
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
String prefix = co.returnBaseType != null && co.returnBaseType.contains(".")
? co.returnBaseType.substring(0, co.returnBaseType.lastIndexOf("."))
: "";
String newTag = !prefix.isEmpty()
? prefix + "." + tag
: tag;
super.addOperationToGroup(newTag, resourcePath, operation, co, operations);
} | java | @SuppressWarnings("static-method")
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
String prefix = co.returnBaseType != null && co.returnBaseType.contains(".")
? co.returnBaseType.substring(0, co.returnBaseType.lastIndexOf("."))
: "";
String newTag = !prefix.isEmpty()
? prefix + "." + tag
: tag;
super.addOperationToGroup(newTag, resourcePath, operation, co, operations);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"void",
"addOperationToGroup",
"(",
"String",
"tag",
",",
"String",
"resourcePath",
",",
"Operation",
"operation",
",",
"CodegenOperation",
"co",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"Code... | Add operation to group
@param tag name of the tag
@param resourcePath path of the resource
@param operation Swagger Operation object
@param co Codegen Operation object
@param operations map of Codegen operations | [
"Add",
"operation",
"to",
"group"
] | train | https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/components/swagger/src/main/java/io/sundr/swagger/language/JavaFluentCodegen.java#L349-L360 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/KeyArea.java | KeyArea.reverseKeyBuffer | public void reverseKeyBuffer(BaseBuffer bufferSource, int iAreaDesc) // Move these keys back to the record
{
boolean bForceUniqueKey = true;
int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false);
for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++)
{
KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey);
BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA);
BaseField paramField = keyField.getField(iAreaDesc);
if (iAreaDesc != DBConstants.FILE_KEY_AREA)
field.moveFieldToThis(paramField, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Copy the value
if (bufferSource != null)
{
bufferSource.getNextField(field, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Read move ignores most behaviors
}
}
} | java | public void reverseKeyBuffer(BaseBuffer bufferSource, int iAreaDesc) // Move these keys back to the record
{
boolean bForceUniqueKey = true;
int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false);
for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++)
{
KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey);
BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA);
BaseField paramField = keyField.getField(iAreaDesc);
if (iAreaDesc != DBConstants.FILE_KEY_AREA)
field.moveFieldToThis(paramField, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Copy the value
if (bufferSource != null)
{
bufferSource.getNextField(field, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Read move ignores most behaviors
}
}
} | [
"public",
"void",
"reverseKeyBuffer",
"(",
"BaseBuffer",
"bufferSource",
",",
"int",
"iAreaDesc",
")",
"// Move these keys back to the record",
"{",
"boolean",
"bForceUniqueKey",
"=",
"true",
";",
"int",
"iKeyFieldCount",
"=",
"this",
".",
"getKeyFields",
"(",
"bForce... | Move the key area to the record.
<pre>
Remember to do the following: (before calling this method!)
if (bufferSource != null)
bufferSource.resetPosition();
</pre>
@param destBuffer A BaseBuffer to fill with data (ignore if null).
@param iAreaDesc The (optional) temporary area to copy the current fields to. | [
"Move",
"the",
"key",
"area",
"to",
"the",
"record",
".",
"<pre",
">",
"Remember",
"to",
"do",
"the",
"following",
":",
"(",
"before",
"calling",
"this",
"method!",
")",
"if",
"(",
"bufferSource",
"!",
"=",
"null",
")",
"bufferSource",
".",
"resetPositio... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L447-L463 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/api/ContentServiceV1.java | ContentServiceV1.getFiles | @Get("regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/contents(?<path>(|/.*))$")
public CompletableFuture<?> getFiles(
@Param("path") String path, @Param("revision") @Default("-1") String revision,
Repository repository,
@RequestConverter(WatchRequestConverter.class) Optional<WatchRequest> watchRequest,
@RequestConverter(QueryRequestConverter.class) Optional<Query<?>> query) {
final String normalizedPath = normalizePath(path);
// watch repository or a file
if (watchRequest.isPresent()) {
final Revision lastKnownRevision = watchRequest.get().lastKnownRevision();
final long timeOutMillis = watchRequest.get().timeoutMillis();
if (query.isPresent()) {
return watchFile(repository, lastKnownRevision, query.get(), timeOutMillis);
}
return watchRepository(repository, lastKnownRevision, normalizedPath, timeOutMillis);
}
final Revision normalizedRev = repository.normalizeNow(new Revision(revision));
if (query.isPresent()) {
// get a file
return repository.get(normalizedRev, query.get())
.handle(returnOrThrow((Entry<?> result) -> convert(repository, normalizedRev,
result, true)));
}
// get files
final CompletableFuture<List<EntryDto<?>>> future = new CompletableFuture<>();
listFiles(repository, normalizedPath, normalizedRev, true, future);
return future;
} | java | @Get("regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/contents(?<path>(|/.*))$")
public CompletableFuture<?> getFiles(
@Param("path") String path, @Param("revision") @Default("-1") String revision,
Repository repository,
@RequestConverter(WatchRequestConverter.class) Optional<WatchRequest> watchRequest,
@RequestConverter(QueryRequestConverter.class) Optional<Query<?>> query) {
final String normalizedPath = normalizePath(path);
// watch repository or a file
if (watchRequest.isPresent()) {
final Revision lastKnownRevision = watchRequest.get().lastKnownRevision();
final long timeOutMillis = watchRequest.get().timeoutMillis();
if (query.isPresent()) {
return watchFile(repository, lastKnownRevision, query.get(), timeOutMillis);
}
return watchRepository(repository, lastKnownRevision, normalizedPath, timeOutMillis);
}
final Revision normalizedRev = repository.normalizeNow(new Revision(revision));
if (query.isPresent()) {
// get a file
return repository.get(normalizedRev, query.get())
.handle(returnOrThrow((Entry<?> result) -> convert(repository, normalizedRev,
result, true)));
}
// get files
final CompletableFuture<List<EntryDto<?>>> future = new CompletableFuture<>();
listFiles(repository, normalizedPath, normalizedRev, true, future);
return future;
} | [
"@",
"Get",
"(",
"\"regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/contents(?<path>(|/.*))$\"",
")",
"public",
"CompletableFuture",
"<",
"?",
">",
"getFiles",
"(",
"@",
"Param",
"(",
"\"path\"",
")",
"String",
"path",
",",
"@",
"Param",
"(",
"\"revision\... | GET /projects/{projectName}/repos/{repoName}/contents{path}?revision={revision}&
jsonpath={jsonpath}
<p>Returns the entry of files in the path. This is same with
{@link #listFiles(String, String, Repository)} except that containing the content of the files.
Note that if the {@link HttpHeaderNames#IF_NONE_MATCH} in which has a revision is sent with,
this will await for the time specified in {@link HttpHeaderNames#PREFER}.
During the time if the specified revision becomes different with the latest revision, this will
response back right away to the client.
{@link HttpStatus#NOT_MODIFIED} otherwise. | [
"GET",
"/",
"projects",
"/",
"{",
"projectName",
"}",
"/",
"repos",
"/",
"{",
"repoName",
"}",
"/",
"contents",
"{",
"path",
"}",
"?revision",
"=",
"{",
"revision",
"}",
"&",
";",
"jsonpath",
"=",
"{",
"jsonpath",
"}"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/ContentServiceV1.java#L223-L254 |
alkacon/opencms-core | src-modules/org/opencms/workplace/CmsWidgetDialog.java | CmsWidgetDialog.buildRemoveElement | public String buildRemoveElement(String elementName, int index, boolean enabled) {
if (enabled) {
StringBuffer href = new StringBuffer(4);
href.append("javascript:removeElement('");
href.append(elementName);
href.append("', ");
href.append(index);
href.append(");");
return button(href.toString(), null, "deletecontent.png", Messages.GUI_DIALOG_BUTTON_DELETE_0, 0);
} else {
return "";
}
} | java | public String buildRemoveElement(String elementName, int index, boolean enabled) {
if (enabled) {
StringBuffer href = new StringBuffer(4);
href.append("javascript:removeElement('");
href.append(elementName);
href.append("', ");
href.append(index);
href.append(");");
return button(href.toString(), null, "deletecontent.png", Messages.GUI_DIALOG_BUTTON_DELETE_0, 0);
} else {
return "";
}
} | [
"public",
"String",
"buildRemoveElement",
"(",
"String",
"elementName",
",",
"int",
"index",
",",
"boolean",
"enabled",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"StringBuffer",
"href",
"=",
"new",
"StringBuffer",
"(",
"4",
")",
";",
"href",
".",
"append",... | Returns the html for a button to remove an optional element.<p>
@param elementName name of the element
@param index the element index of the element to remove
@param enabled if true, the button to remove an element is shown, otherwise a spacer is returned
@return the html for a button to remove an optional element | [
"Returns",
"the",
"html",
"for",
"a",
"button",
"to",
"remove",
"an",
"optional",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsWidgetDialog.java#L259-L272 |
hexagonframework/spring-data-ebean | src/main/java/org/springframework/data/ebean/repository/support/EbeanRepositoryFactory.java | EbeanRepositoryFactory.getTargetRepository | protected <T extends Persistable, ID extends Serializable> SimpleEbeanRepository<T, ID> getTargetRepository(
RepositoryInformation information, EbeanServer ebeanServer) {
return getTargetRepositoryViaReflection(information, information.getDomainType(), ebeanServer);
} | java | protected <T extends Persistable, ID extends Serializable> SimpleEbeanRepository<T, ID> getTargetRepository(
RepositoryInformation information, EbeanServer ebeanServer) {
return getTargetRepositoryViaReflection(information, information.getDomainType(), ebeanServer);
} | [
"protected",
"<",
"T",
"extends",
"Persistable",
",",
"ID",
"extends",
"Serializable",
">",
"SimpleEbeanRepository",
"<",
"T",
",",
"ID",
">",
"getTargetRepository",
"(",
"RepositoryInformation",
"information",
",",
"EbeanServer",
"ebeanServer",
")",
"{",
"return",
... | Callback to create a {@link EbeanRepository} instance with the given {@link EbeanServer}
@param <T>
@param <ID>
@param ebeanServer
@return | [
"Callback",
"to",
"create",
"a",
"{",
"@link",
"EbeanRepository",
"}",
"instance",
"with",
"the",
"given",
"{",
"@link",
"EbeanServer",
"}"
] | train | https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/repository/support/EbeanRepositoryFactory.java#L85-L89 |
HotelsDotCom/corc | corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java | CorcInputFormat.setTypeInfo | public static void setTypeInfo(Configuration conf, StructTypeInfo typeInfo) {
conf.set(INPUT_TYPE_INFO, typeInfo.getTypeName());
LOG.debug("Set input typeInfo on conf: {}", typeInfo);
} | java | public static void setTypeInfo(Configuration conf, StructTypeInfo typeInfo) {
conf.set(INPUT_TYPE_INFO, typeInfo.getTypeName());
LOG.debug("Set input typeInfo on conf: {}", typeInfo);
} | [
"public",
"static",
"void",
"setTypeInfo",
"(",
"Configuration",
"conf",
",",
"StructTypeInfo",
"typeInfo",
")",
"{",
"conf",
".",
"set",
"(",
"INPUT_TYPE_INFO",
",",
"typeInfo",
".",
"getTypeName",
"(",
")",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Set input ... | Sets the StructTypeInfo that declares the columns to be read in the configuration | [
"Sets",
"the",
"StructTypeInfo",
"that",
"declares",
"the",
"columns",
"to",
"be",
"read",
"in",
"the",
"configuration"
] | train | https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L113-L116 |
NLPchina/elasticsearch-sql | src/main/java/org/nlpcn/es4sql/query/maker/AggMaker.java | AggMaker.makeFieldAgg | public AggregationBuilder makeFieldAgg(MethodField field, AggregationBuilder parent) throws SqlParseException {
//question 加到groupMap里是为了什么
groupMap.put(field.getAlias(), new KVValue("FIELD", parent));
ValuesSourceAggregationBuilder builder;
field.setAlias(fixAlias(field.getAlias()));
switch (field.getName().toUpperCase()) {
case "SUM":
builder = AggregationBuilders.sum(field.getAlias());
return addFieldToAgg(field, builder);
case "MAX":
builder = AggregationBuilders.max(field.getAlias());
return addFieldToAgg(field, builder);
case "MIN":
builder = AggregationBuilders.min(field.getAlias());
return addFieldToAgg(field, builder);
case "AVG":
builder = AggregationBuilders.avg(field.getAlias());
return addFieldToAgg(field, builder);
case "STATS":
builder = AggregationBuilders.stats(field.getAlias());
return addFieldToAgg(field, builder);
case "EXTENDED_STATS":
builder = AggregationBuilders.extendedStats(field.getAlias());
return addFieldToAgg(field, builder);
case "PERCENTILES":
builder = AggregationBuilders.percentiles(field.getAlias());
addSpecificPercentiles((PercentilesAggregationBuilder) builder, field.getParams());
return addFieldToAgg(field, builder);
case "TOPHITS":
return makeTopHitsAgg(field);
case "SCRIPTED_METRIC":
return scriptedMetric(field);
case "COUNT":
groupMap.put(field.getAlias(), new KVValue("COUNT", parent));
return addFieldToAgg(field, makeCountAgg(field));
default:
throw new SqlParseException("the agg function not to define !");
}
} | java | public AggregationBuilder makeFieldAgg(MethodField field, AggregationBuilder parent) throws SqlParseException {
//question 加到groupMap里是为了什么
groupMap.put(field.getAlias(), new KVValue("FIELD", parent));
ValuesSourceAggregationBuilder builder;
field.setAlias(fixAlias(field.getAlias()));
switch (field.getName().toUpperCase()) {
case "SUM":
builder = AggregationBuilders.sum(field.getAlias());
return addFieldToAgg(field, builder);
case "MAX":
builder = AggregationBuilders.max(field.getAlias());
return addFieldToAgg(field, builder);
case "MIN":
builder = AggregationBuilders.min(field.getAlias());
return addFieldToAgg(field, builder);
case "AVG":
builder = AggregationBuilders.avg(field.getAlias());
return addFieldToAgg(field, builder);
case "STATS":
builder = AggregationBuilders.stats(field.getAlias());
return addFieldToAgg(field, builder);
case "EXTENDED_STATS":
builder = AggregationBuilders.extendedStats(field.getAlias());
return addFieldToAgg(field, builder);
case "PERCENTILES":
builder = AggregationBuilders.percentiles(field.getAlias());
addSpecificPercentiles((PercentilesAggregationBuilder) builder, field.getParams());
return addFieldToAgg(field, builder);
case "TOPHITS":
return makeTopHitsAgg(field);
case "SCRIPTED_METRIC":
return scriptedMetric(field);
case "COUNT":
groupMap.put(field.getAlias(), new KVValue("COUNT", parent));
return addFieldToAgg(field, makeCountAgg(field));
default:
throw new SqlParseException("the agg function not to define !");
}
} | [
"public",
"AggregationBuilder",
"makeFieldAgg",
"(",
"MethodField",
"field",
",",
"AggregationBuilder",
"parent",
")",
"throws",
"SqlParseException",
"{",
"//question 加到groupMap里是为了什么",
"groupMap",
".",
"put",
"(",
"field",
".",
"getAlias",
"(",
")",
",",
"new",
"KV... | Create aggregation according to the SQL function.
zhongshu-comment 根据sql中的函数来生成一些agg,例如sql中的count()、sum()函数,这是agg链中最里边的那个agg了,eg:
select a,b,count(c),sum(d) from tbl group by a,b
@param field SQL function
@param parent parentAggregation
@return AggregationBuilder represents the SQL function
@throws SqlParseException in case of unrecognized function | [
"Create",
"aggregation",
"according",
"to",
"the",
"SQL",
"function",
".",
"zhongshu",
"-",
"comment",
"根据sql中的函数来生成一些agg,例如sql中的count",
"()",
"、sum",
"()",
"函数,这是agg链中最里边的那个agg了,eg:",
"select",
"a",
"b",
"count",
"(",
"c",
")",
"sum",
"(",
"d",
")",
"from",
"... | train | https://github.com/NLPchina/elasticsearch-sql/blob/eaab70b4bf1729978911b83eb96e816ebcfe6e7f/src/main/java/org/nlpcn/es4sql/query/maker/AggMaker.java#L128-L167 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java | WatchMonitor.createAll | public static WatchMonitor createAll(Path path, Watcher watcher){
final WatchMonitor watchMonitor = create(path, EVENTS_ALL);
watchMonitor.setWatcher(watcher);
return watchMonitor;
} | java | public static WatchMonitor createAll(Path path, Watcher watcher){
final WatchMonitor watchMonitor = create(path, EVENTS_ALL);
watchMonitor.setWatcher(watcher);
return watchMonitor;
} | [
"public",
"static",
"WatchMonitor",
"createAll",
"(",
"Path",
"path",
",",
"Watcher",
"watcher",
")",
"{",
"final",
"WatchMonitor",
"watchMonitor",
"=",
"create",
"(",
"path",
",",
"EVENTS_ALL",
")",
";",
"watchMonitor",
".",
"setWatcher",
"(",
"watcher",
")",... | 创建并初始化监听,监听所有事件
@param path 路径
@param watcher {@link Watcher}
@return {@link WatchMonitor} | [
"创建并初始化监听,监听所有事件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L238-L242 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java | DefaultApplicationObjectConfigurer.configureCommandLabel | protected void configureCommandLabel(CommandLabelConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
String labelStr = loadMessage(objectName + "." + LABEL_KEY);
if (StringUtils.hasText(labelStr)) {
CommandButtonLabelInfo labelInfo = CommandButtonLabelInfo.valueOf(labelStr);
configurable.setLabelInfo(labelInfo);
}
} | java | protected void configureCommandLabel(CommandLabelConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
String labelStr = loadMessage(objectName + "." + LABEL_KEY);
if (StringUtils.hasText(labelStr)) {
CommandButtonLabelInfo labelInfo = CommandButtonLabelInfo.valueOf(labelStr);
configurable.setLabelInfo(labelInfo);
}
} | [
"protected",
"void",
"configureCommandLabel",
"(",
"CommandLabelConfigurable",
"configurable",
",",
"String",
"objectName",
")",
"{",
"Assert",
".",
"notNull",
"(",
"configurable",
",",
"\"configurable\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"objectName",
",",
... | Sets the {@link CommandButtonLabelInfo} of the given object. The label
info is created after loading the encoded label string from this
instance's {@link MessageSource} using a message code in the format
<pre>
<objectName>.label
</pre>
@param configurable The object to be configured. Must not be null.
@param objectName The name of the configurable object, unique within the
application. Must not be null.
@throws IllegalArgumentException if either argument is null. | [
"Sets",
"the",
"{",
"@link",
"CommandButtonLabelInfo",
"}",
"of",
"the",
"given",
"object",
".",
"The",
"label",
"info",
"is",
"created",
"after",
"loading",
"the",
"encoded",
"label",
"string",
"from",
"this",
"instance",
"s",
"{",
"@link",
"MessageSource",
... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java#L427-L437 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/jetty/servlet/WebApplicationHandler.java | WebApplicationHandler.addFilterPathMapping | public FilterHolder addFilterPathMapping(String pathSpec, String filterName, int dispatches)
{
FilterHolder holder = (FilterHolder)_filterMap.get(filterName);
if (holder==null)
throw new IllegalArgumentException("unknown filter: "+filterName);
FilterMapping mapping = new FilterMapping(pathSpec,holder,dispatches);
_pathFilters.add(mapping);
return holder;
} | java | public FilterHolder addFilterPathMapping(String pathSpec, String filterName, int dispatches)
{
FilterHolder holder = (FilterHolder)_filterMap.get(filterName);
if (holder==null)
throw new IllegalArgumentException("unknown filter: "+filterName);
FilterMapping mapping = new FilterMapping(pathSpec,holder,dispatches);
_pathFilters.add(mapping);
return holder;
} | [
"public",
"FilterHolder",
"addFilterPathMapping",
"(",
"String",
"pathSpec",
",",
"String",
"filterName",
",",
"int",
"dispatches",
")",
"{",
"FilterHolder",
"holder",
"=",
"(",
"FilterHolder",
")",
"_filterMap",
".",
"get",
"(",
"filterName",
")",
";",
"if",
... | Add a mapping from a pathSpec to a Filter.
@param pathSpec The path specification
@param filterName The name of the filter (must already be added or defined)
@param dispatches An integer formed by the logical OR of FilterHolder.__REQUEST,
FilterHolder.__FORWARD,FilterHolder.__INCLUDE and/or FilterHolder.__ERROR.
@return The holder of the filter instance. | [
"Add",
"a",
"mapping",
"from",
"a",
"pathSpec",
"to",
"a",
"Filter",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/jetty/servlet/WebApplicationHandler.java#L123-L132 |
Blazebit/blaze-utils | blaze-ee-utils/src/main/java/com/blazebit/cdi/CdiUtils.java | CdiUtils.getBean | public static <T> T getBean(BeanManager bm, Class<T> clazz) {
return getBean(bm, clazz, (Annotation[]) null);
} | java | public static <T> T getBean(BeanManager bm, Class<T> clazz) {
return getBean(bm, clazz, (Annotation[]) null);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getBean",
"(",
"BeanManager",
"bm",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"getBean",
"(",
"bm",
",",
"clazz",
",",
"(",
"Annotation",
"[",
"]",
")",
"null",
")",
";",
"}"
] | Retrieves the bean for the given class from the given bean manager
qualified with #{@link Default}.
@param <T> The type of the bean to look for
@param bm The bean manager which should be used for the lookup
@param clazz The class of the bean to look for
@return The bean instance if found, otherwise null | [
"Retrieves",
"the",
"bean",
"for",
"the",
"given",
"class",
"from",
"the",
"given",
"bean",
"manager",
"qualified",
"with",
"#",
"{",
"@link",
"Default",
"}",
"."
] | train | https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-ee-utils/src/main/java/com/blazebit/cdi/CdiUtils.java#L80-L82 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_GET | public OvhOvhPabxMenuEntry billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_GET(String billingAccount, String serviceName, Long menuId, Long entryId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, menuId, entryId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxMenuEntry.class);
} | java | public OvhOvhPabxMenuEntry billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_GET(String billingAccount, String serviceName, Long menuId, Long entryId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, menuId, entryId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxMenuEntry.class);
} | [
"public",
"OvhOvhPabxMenuEntry",
"billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"menuId",
",",
"Long",
"entryId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\... | Get this object properties
REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param menuId [required]
@param entryId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7492-L7497 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/ngmf/util/cosu/luca/ParameterData.java | ParameterData.setStat | public void setStat(double[] dataValue, int calibrationType, boolean[] calibrate) {
this.data = dataValue;
this.calibrationType = calibrationType;
this.calibrationFlag = calibrate;
calibrationDataSize = 0;
for (int i = 0; i < this.calibrationFlag.length; i++) {
if (calibrate[i]) {
calibrationDataSize++;
}
}
calculateMean();
findMin();
findMax();
// setDeviation();
} | java | public void setStat(double[] dataValue, int calibrationType, boolean[] calibrate) {
this.data = dataValue;
this.calibrationType = calibrationType;
this.calibrationFlag = calibrate;
calibrationDataSize = 0;
for (int i = 0; i < this.calibrationFlag.length; i++) {
if (calibrate[i]) {
calibrationDataSize++;
}
}
calculateMean();
findMin();
findMax();
// setDeviation();
} | [
"public",
"void",
"setStat",
"(",
"double",
"[",
"]",
"dataValue",
",",
"int",
"calibrationType",
",",
"boolean",
"[",
"]",
"calibrate",
")",
"{",
"this",
".",
"data",
"=",
"dataValue",
";",
"this",
".",
"calibrationType",
"=",
"calibrationType",
";",
"thi... | /* Sets the parameter values, the type of calibration, and the calibration flag.
Also, the mean of the parameter values is calculated, and the max and min value
of the parameter values are determined. | [
"/",
"*",
"Sets",
"the",
"parameter",
"values",
"the",
"type",
"of",
"calibration",
"and",
"the",
"calibration",
"flag",
".",
"Also",
"the",
"mean",
"of",
"the",
"parameter",
"values",
"is",
"calculated",
"and",
"the",
"max",
"and",
"min",
"value",
"of",
... | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/cosu/luca/ParameterData.java#L202-L218 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java | SimpleDocTreeVisitor.visitSince | @Override
public R visitSince(SinceTree node, P p) {
return defaultAction(node, p);
} | java | @Override
public R visitSince(SinceTree node, P p) {
return defaultAction(node, p);
} | [
"@",
"Override",
"public",
"R",
"visitSince",
"(",
"SinceTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"node",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"calls",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L381-L384 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPCalculator.java | AFPCalculator.getEnd2EndDistance | private static final double getEnd2EndDistance(Atom[] ca1, Atom[] ca2, int p1b, int p1e, int p2b, int p2e)
{
double min = 99;
double dist1 = Calc.getDistance(ca1[p1b], ca1[p1e]);
double dist2 = Calc.getDistance(ca2[p2b], ca2[p2e]);
min = dist1 - dist2;
return Math.abs(min);
} | java | private static final double getEnd2EndDistance(Atom[] ca1, Atom[] ca2, int p1b, int p1e, int p2b, int p2e)
{
double min = 99;
double dist1 = Calc.getDistance(ca1[p1b], ca1[p1e]);
double dist2 = Calc.getDistance(ca2[p2b], ca2[p2e]);
min = dist1 - dist2;
return Math.abs(min);
} | [
"private",
"static",
"final",
"double",
"getEnd2EndDistance",
"(",
"Atom",
"[",
"]",
"ca1",
",",
"Atom",
"[",
"]",
"ca2",
",",
"int",
"p1b",
",",
"int",
"p1e",
",",
"int",
"p2b",
",",
"int",
"p2e",
")",
"{",
"double",
"min",
"=",
"99",
";",
"double... | filter 1 for AFP extration: the distance of end-to-end
@param p1b
@param p1e
@param p2b
@param p2e
@return | [
"filter",
"1",
"for",
"AFP",
"extration",
":",
"the",
"distance",
"of",
"end",
"-",
"to",
"-",
"end"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPCalculator.java#L150-L159 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getKeyVersionsWithServiceResponseAsync | public Observable<ServiceResponse<Page<KeyItem>>> getKeyVersionsWithServiceResponseAsync(final String vaultBaseUrl, final String keyName) {
return getKeyVersionsSinglePageAsync(vaultBaseUrl, keyName)
.concatMap(new Func1<ServiceResponse<Page<KeyItem>>, Observable<ServiceResponse<Page<KeyItem>>>>() {
@Override
public Observable<ServiceResponse<Page<KeyItem>>> call(ServiceResponse<Page<KeyItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getKeyVersionsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<KeyItem>>> getKeyVersionsWithServiceResponseAsync(final String vaultBaseUrl, final String keyName) {
return getKeyVersionsSinglePageAsync(vaultBaseUrl, keyName)
.concatMap(new Func1<ServiceResponse<Page<KeyItem>>, Observable<ServiceResponse<Page<KeyItem>>>>() {
@Override
public Observable<ServiceResponse<Page<KeyItem>>> call(ServiceResponse<Page<KeyItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getKeyVersionsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"KeyItem",
">",
">",
">",
"getKeyVersionsWithServiceResponseAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"String",
"keyName",
")",
"{",
"return",
"getKeyVersionsSinglePageAsync",
"(",
... | Retrieves a list of individual key versions with the same key name.
The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<KeyItem> object | [
"Retrieves",
"a",
"list",
"of",
"individual",
"key",
"versions",
"with",
"the",
"same",
"key",
"name",
".",
"The",
"full",
"key",
"identifier",
"attributes",
"and",
"tags",
"are",
"provided",
"in",
"the",
"response",
".",
"This",
"operation",
"requires",
"th... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1539-L1551 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java | CmsSitemapToolbar.setNewGalleryEnabled | public void setNewGalleryEnabled(boolean enabled, String disabledReason) {
if (enabled) {
m_newGalleryMenuButton.enable();
} else {
m_newGalleryMenuButton.disable(disabledReason);
}
} | java | public void setNewGalleryEnabled(boolean enabled, String disabledReason) {
if (enabled) {
m_newGalleryMenuButton.enable();
} else {
m_newGalleryMenuButton.disable(disabledReason);
}
} | [
"public",
"void",
"setNewGalleryEnabled",
"(",
"boolean",
"enabled",
",",
"String",
"disabledReason",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"m_newGalleryMenuButton",
".",
"enable",
"(",
")",
";",
"}",
"else",
"{",
"m_newGalleryMenuButton",
".",
"disable",
... | Enables/disables the new menu button.<p>
@param enabled <code>true</code> to enable the button
@param disabledReason the reason, why the button is disabled | [
"Enables",
"/",
"disables",
"the",
"new",
"menu",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java#L258-L265 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/zinternaltools/CalculateMinimumDateFieldSize.java | CalculateMinimumDateFieldSize.getLongestTextMonthInLocale | static private Month getLongestTextMonthInLocale(Locale locale, FontMetrics fontMetrics) {
// Get the "formatting names" of all the months for this locale.
// Request the capitalized long version of the translated month names.
String[] formattingMonthNames = ExtraDateStrings.getFormattingMonthNamesArray(
locale, true, false);
// Find out which month is longest, using the supplied font metrics.
int longestMonthWidth = 0;
Month longestMonth = Month.JANUARY;
for (int i = 0; i < formattingMonthNames.length; ++i) {
int currentMonthWidth = fontMetrics.stringWidth(formattingMonthNames[i]);
if (currentMonthWidth >= longestMonthWidth) {
int oneBasedMonthIndex = (i + 1);
longestMonth = Month.of(oneBasedMonthIndex);
longestMonthWidth = currentMonthWidth;
}
}
return longestMonth;
} | java | static private Month getLongestTextMonthInLocale(Locale locale, FontMetrics fontMetrics) {
// Get the "formatting names" of all the months for this locale.
// Request the capitalized long version of the translated month names.
String[] formattingMonthNames = ExtraDateStrings.getFormattingMonthNamesArray(
locale, true, false);
// Find out which month is longest, using the supplied font metrics.
int longestMonthWidth = 0;
Month longestMonth = Month.JANUARY;
for (int i = 0; i < formattingMonthNames.length; ++i) {
int currentMonthWidth = fontMetrics.stringWidth(formattingMonthNames[i]);
if (currentMonthWidth >= longestMonthWidth) {
int oneBasedMonthIndex = (i + 1);
longestMonth = Month.of(oneBasedMonthIndex);
longestMonthWidth = currentMonthWidth;
}
}
return longestMonth;
} | [
"static",
"private",
"Month",
"getLongestTextMonthInLocale",
"(",
"Locale",
"locale",
",",
"FontMetrics",
"fontMetrics",
")",
"{",
"// Get the \"formatting names\" of all the months for this locale.",
"// Request the capitalized long version of the translated month names.",
"String",
"... | getLongestTextMonthInLocale,
For the supplied locale, this returns the month that has the longest translated, "formatting
version", "long text version" month name. The version of the month name string that is used
for comparison is further defined below.
Note that this does not return the longest month for numeric month date formats. The longest
month in entirely numeric formats is always December. (Month number 12).
The compared month names are the "formatting version" of the translated month names (not the
standalone version). In some locales such as Russian and Czech, the formatting version can be
different from the standalone version. The "formatting version" is the name of the month that
would be used in a formatted date. The standalone version is only used when the month is
displayed by itself.
The month names that are used for comparison are also the "long version" of the month names,
not the short (abbreviated) version.
The translated month names are compared using the supplied font metrics.
This returns the longest month, as defined by the above criteria. If two or more months are
"tied" as the "longest month", then the longest month that is closest to the end of the year
will be the one that is returned. | [
"getLongestTextMonthInLocale"
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/CalculateMinimumDateFieldSize.java#L106-L123 |
hal/core | gui/src/main/java/org/jboss/as/console/client/tools/ChildView.java | ChildView.showAddDialog | public void showAddDialog(final ModelNode address, boolean isSingleton, SecurityContext securityContext, ModelNode description) {
String resourceAddress = AddressUtils.asKey(address, isSingleton);
if(securityContext.getOperationPriviledge(resourceAddress, "add").isGranted()) {
_showAddDialog(address, isSingleton, securityContext, description);
}
else
{
Feedback.alert(Console.CONSTANTS.unauthorized(),
Console.CONSTANTS.unauthorizedAdd());
}
} | java | public void showAddDialog(final ModelNode address, boolean isSingleton, SecurityContext securityContext, ModelNode description) {
String resourceAddress = AddressUtils.asKey(address, isSingleton);
if(securityContext.getOperationPriviledge(resourceAddress, "add").isGranted()) {
_showAddDialog(address, isSingleton, securityContext, description);
}
else
{
Feedback.alert(Console.CONSTANTS.unauthorized(),
Console.CONSTANTS.unauthorizedAdd());
}
} | [
"public",
"void",
"showAddDialog",
"(",
"final",
"ModelNode",
"address",
",",
"boolean",
"isSingleton",
",",
"SecurityContext",
"securityContext",
",",
"ModelNode",
"description",
")",
"{",
"String",
"resourceAddress",
"=",
"AddressUtils",
".",
"asKey",
"(",
"addres... | Callback for creation of add dialogs.
Will be invoked once the presenter has loaded the resource description.
@param address
@param isSingleton
@param securityContext
@param description | [
"Callback",
"for",
"creation",
"of",
"add",
"dialogs",
".",
"Will",
"be",
"invoked",
"once",
"the",
"presenter",
"has",
"loaded",
"the",
"resource",
"description",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/tools/ChildView.java#L231-L244 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.