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 |
|---|---|---|---|---|---|---|---|---|---|---|
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPOptionUtil.java | CPOptionUtil.findByUUID_G | public static CPOption findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.product.exception.NoSuchCPOptionException {
return getPersistence().findByUUID_G(uuid, groupId);
} | java | public static CPOption findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.product.exception.NoSuchCPOptionException {
return getPersistence().findByUUID_G(uuid, groupId);
} | [
"public",
"static",
"CPOption",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"com",
".",
"liferay",
".",
"commerce",
".",
"product",
".",
"exception",
".",
"NoSuchCPOptionException",
"{",
"return",
"getPersistence",
"(",
")",
"... | Returns the cp option where uuid = ? and groupId = ? or throws a {@link NoSuchCPOptionException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching cp option
@throws NoSuchCPOptionException if a matching cp option could not be found | [
"Returns",
"the",
"cp",
"option",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPOptionException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPOptionUtil.java#L274-L277 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/rest/param/AbstractParam.java | AbstractParam.onError | protected Response onError(String param, Throwable e) {
return Response.status(Status.BAD_REQUEST)
.entity(getErrorMessage(param, e)).build();
} | java | protected Response onError(String param, Throwable e) {
return Response.status(Status.BAD_REQUEST)
.entity(getErrorMessage(param, e)).build();
} | [
"protected",
"Response",
"onError",
"(",
"String",
"param",
",",
"Throwable",
"e",
")",
"{",
"return",
"Response",
".",
"status",
"(",
"Status",
".",
"BAD_REQUEST",
")",
".",
"entity",
"(",
"getErrorMessage",
"(",
"param",
",",
"e",
")",
")",
".",
"build... | Generates an HTTP 400 (Bad Request)
@param param the original parameter
@param e the original error
@return HTTP 400 Bad Request | [
"Generates",
"an",
"HTTP",
"400",
"(",
"Bad",
"Request",
")"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/param/AbstractParam.java#L73-L76 |
alkacon/opencms-core | src/org/opencms/jsp/jsonpart/CmsJsonPart.java | CmsJsonPart.parseJsonParts | public static List<CmsJsonPart> parseJsonParts(String text) {
List<CmsJsonPart> result = Lists.newArrayList();
Matcher matcher = FORMAT_PATTERN.matcher(text);
while (matcher.find()) {
String key = matcher.group(1);
String value = matcher.group(2);
CmsJsonPart part = new CmsJsonPart(key, value);
result.add(part);
}
return result;
} | java | public static List<CmsJsonPart> parseJsonParts(String text) {
List<CmsJsonPart> result = Lists.newArrayList();
Matcher matcher = FORMAT_PATTERN.matcher(text);
while (matcher.find()) {
String key = matcher.group(1);
String value = matcher.group(2);
CmsJsonPart part = new CmsJsonPart(key, value);
result.add(part);
}
return result;
} | [
"public",
"static",
"List",
"<",
"CmsJsonPart",
">",
"parseJsonParts",
"(",
"String",
"text",
")",
"{",
"List",
"<",
"CmsJsonPart",
">",
"result",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"Matcher",
"matcher",
"=",
"FORMAT_PATTERN",
".",
"matcher",
... | Parses the encoded JSON parts from the given string and puts them in a list.<p>
@param text the text containing the encoded JSON parts
@return the decoded JSON parts | [
"Parses",
"the",
"encoded",
"JSON",
"parts",
"from",
"the",
"given",
"string",
"and",
"puts",
"them",
"in",
"a",
"list",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/jsonpart/CmsJsonPart.java#L85-L96 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java | PixelMath.boundImage | public static void boundImage( GrayU16 img , int min , int max ) {
ImplPixelMath.boundImage(img,min,max);
} | java | public static void boundImage( GrayU16 img , int min , int max ) {
ImplPixelMath.boundImage(img,min,max);
} | [
"public",
"static",
"void",
"boundImage",
"(",
"GrayU16",
"img",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"ImplPixelMath",
".",
"boundImage",
"(",
"img",
",",
"min",
",",
"max",
")",
";",
"}"
] | Bounds image pixels to be between these two values
@param img Image
@param min minimum value.
@param max maximum value. | [
"Bounds",
"image",
"pixels",
"to",
"be",
"between",
"these",
"two",
"values"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L4360-L4362 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java | AppsImpl.updateSettingsWithServiceResponseAsync | public Observable<ServiceResponse<OperationStatus>> updateSettingsWithServiceResponseAsync(UUID appId, UpdateSettingsOptionalParameter updateSettingsOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
final boolean publicParameter = updateSettingsOptionalParameter != null ? updateSettingsOptionalParameter.publicParameter() : false;
return updateSettingsWithServiceResponseAsync(appId, publicParameter);
} | java | public Observable<ServiceResponse<OperationStatus>> updateSettingsWithServiceResponseAsync(UUID appId, UpdateSettingsOptionalParameter updateSettingsOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
final boolean publicParameter = updateSettingsOptionalParameter != null ? updateSettingsOptionalParameter.publicParameter() : false;
return updateSettingsWithServiceResponseAsync(appId, publicParameter);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OperationStatus",
">",
">",
"updateSettingsWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"UpdateSettingsOptionalParameter",
"updateSettingsOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
... | Updates the application settings.
@param appId The application ID.
@param updateSettingsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Updates",
"the",
"application",
"settings",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java#L1352-L1362 |
citrusframework/citrus | modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java | JmxClient.addNotificationListener | private void addNotificationListener(ObjectName objectName, final String correlationKey, MBeanServerConnection serverConnection) {
try {
notificationListener = new NotificationListener() {
@Override
public void handleNotification(Notification notification, Object handback) {
correlationManager.store(correlationKey, new DefaultMessage(notification.getMessage()));
}
};
serverConnection.addNotificationListener(objectName, notificationListener, getEndpointConfiguration().getNotificationFilter(), getEndpointConfiguration().getNotificationHandback());
} catch (InstanceNotFoundException e) {
throw new CitrusRuntimeException("Failed to find object name instance", e);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to add notification listener", e);
}
} | java | private void addNotificationListener(ObjectName objectName, final String correlationKey, MBeanServerConnection serverConnection) {
try {
notificationListener = new NotificationListener() {
@Override
public void handleNotification(Notification notification, Object handback) {
correlationManager.store(correlationKey, new DefaultMessage(notification.getMessage()));
}
};
serverConnection.addNotificationListener(objectName, notificationListener, getEndpointConfiguration().getNotificationFilter(), getEndpointConfiguration().getNotificationHandback());
} catch (InstanceNotFoundException e) {
throw new CitrusRuntimeException("Failed to find object name instance", e);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to add notification listener", e);
}
} | [
"private",
"void",
"addNotificationListener",
"(",
"ObjectName",
"objectName",
",",
"final",
"String",
"correlationKey",
",",
"MBeanServerConnection",
"serverConnection",
")",
"{",
"try",
"{",
"notificationListener",
"=",
"new",
"NotificationListener",
"(",
")",
"{",
... | Add notification listener for response messages.
@param objectName
@param correlationKey
@param serverConnection | [
"Add",
"notification",
"listener",
"for",
"response",
"messages",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java#L261-L276 |
igniterealtime/Smack | smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java | Roster.getEntriesAndAddListener | public void getEntriesAndAddListener(RosterListener rosterListener, RosterEntries rosterEntries) {
Objects.requireNonNull(rosterListener, "listener must not be null");
Objects.requireNonNull(rosterEntries, "rosterEntries must not be null");
synchronized (rosterListenersAndEntriesLock) {
rosterEntries.rosterEntries(entries.values());
addRosterListener(rosterListener);
}
} | java | public void getEntriesAndAddListener(RosterListener rosterListener, RosterEntries rosterEntries) {
Objects.requireNonNull(rosterListener, "listener must not be null");
Objects.requireNonNull(rosterEntries, "rosterEntries must not be null");
synchronized (rosterListenersAndEntriesLock) {
rosterEntries.rosterEntries(entries.values());
addRosterListener(rosterListener);
}
} | [
"public",
"void",
"getEntriesAndAddListener",
"(",
"RosterListener",
"rosterListener",
",",
"RosterEntries",
"rosterEntries",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"rosterListener",
",",
"\"listener must not be null\"",
")",
";",
"Objects",
".",
"requireNonNull... | Add a roster listener and invoke the roster entries with all entries of the roster.
<p>
The method guarantees that the listener is only invoked after
{@link RosterEntries#rosterEntries(Collection)} has been invoked, and that all roster events
that happen while <code>rosterEntries(Collection) </code> is called are queued until the
method returns.
</p>
<p>
This guarantee makes this the ideal method to e.g. populate a UI element with the roster while
installing a {@link RosterListener} to listen for subsequent roster events.
</p>
@param rosterListener the listener to install
@param rosterEntries the roster entries callback interface
@since 4.1 | [
"Add",
"a",
"roster",
"listener",
"and",
"invoke",
"the",
"roster",
"entries",
"with",
"all",
"entries",
"of",
"the",
"roster",
".",
"<p",
">",
"The",
"method",
"guarantees",
"that",
"the",
"listener",
"is",
"only",
"invoked",
"after",
"{",
"@link",
"Roste... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java#L867-L875 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/HanLP.java | HanLP.convertToPinyinFirstCharString | public static String convertToPinyinFirstCharString(String text, String separator, boolean remainNone)
{
List<Pinyin> pinyinList = PinyinDictionary.convertToPinyin(text, remainNone);
int length = pinyinList.size();
StringBuilder sb = new StringBuilder(length * (1 + separator.length()));
int i = 1;
for (Pinyin pinyin : pinyinList)
{
sb.append(pinyin.getFirstChar());
if (i < length)
{
sb.append(separator);
}
++i;
}
return sb.toString();
} | java | public static String convertToPinyinFirstCharString(String text, String separator, boolean remainNone)
{
List<Pinyin> pinyinList = PinyinDictionary.convertToPinyin(text, remainNone);
int length = pinyinList.size();
StringBuilder sb = new StringBuilder(length * (1 + separator.length()));
int i = 1;
for (Pinyin pinyin : pinyinList)
{
sb.append(pinyin.getFirstChar());
if (i < length)
{
sb.append(separator);
}
++i;
}
return sb.toString();
} | [
"public",
"static",
"String",
"convertToPinyinFirstCharString",
"(",
"String",
"text",
",",
"String",
"separator",
",",
"boolean",
"remainNone",
")",
"{",
"List",
"<",
"Pinyin",
">",
"pinyinList",
"=",
"PinyinDictionary",
".",
"convertToPinyin",
"(",
"text",
",",
... | 转化为拼音(首字母)
@param text 文本
@param separator 分隔符
@param remainNone 有些字没有拼音(如标点),是否保留它们(用none表示)
@return 一个字符串,由[首字母][分隔符][首字母]构成 | [
"转化为拼音(首字母)"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L608-L624 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java | UTF16.countCodePoint | public static int countCodePoint(char source[], int start, int limit) {
if (source == null || source.length == 0) {
return 0;
}
return findCodePointOffset(source, start, limit, limit - start);
} | java | public static int countCodePoint(char source[], int start, int limit) {
if (source == null || source.length == 0) {
return 0;
}
return findCodePointOffset(source, start, limit, limit - start);
} | [
"public",
"static",
"int",
"countCodePoint",
"(",
"char",
"source",
"[",
"]",
",",
"int",
"start",
",",
"int",
"limit",
")",
"{",
"if",
"(",
"source",
"==",
"null",
"||",
"source",
".",
"length",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"retur... | Number of codepoints in a UTF16 char array substring
@param source UTF16 char array
@param start Offset of the substring
@param limit Offset of the substring
@return number of codepoint in the substring
@exception IndexOutOfBoundsException If start and limit are not valid. | [
"Number",
"of",
"codepoints",
"in",
"a",
"UTF16",
"char",
"array",
"substring"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L1067-L1072 |
alkacon/opencms-core | src/org/opencms/security/CmsRoleManager.java | CmsRoleManager.checkRole | public void checkRole(CmsObject cms, CmsRole role) throws CmsRoleViolationException {
m_securityManager.checkRole(cms.getRequestContext(), role);
} | java | public void checkRole(CmsObject cms, CmsRole role) throws CmsRoleViolationException {
m_securityManager.checkRole(cms.getRequestContext(), role);
} | [
"public",
"void",
"checkRole",
"(",
"CmsObject",
"cms",
",",
"CmsRole",
"role",
")",
"throws",
"CmsRoleViolationException",
"{",
"m_securityManager",
".",
"checkRole",
"(",
"cms",
".",
"getRequestContext",
"(",
")",
",",
"role",
")",
";",
"}"
] | Checks if the user of this OpenCms context is a member of the given role
for the given organizational unit.<p>
The user must have the given role in at least one parent organizational unit.<p>
@param cms the opencms context
@param role the role to check
@throws CmsRoleViolationException if the user does not have the required role permissions | [
"Checks",
"if",
"the",
"user",
"of",
"this",
"OpenCms",
"context",
"is",
"a",
"member",
"of",
"the",
"given",
"role",
"for",
"the",
"given",
"organizational",
"unit",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsRoleManager.java#L91-L94 |
alkacon/opencms-core | src/org/opencms/db/CmsSubscriptionManager.java | CmsSubscriptionManager.markResourceAsVisitedBy | public void markResourceAsVisitedBy(CmsObject cms, CmsResource resource, CmsUser user) throws CmsException {
if (!isEnabled()) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_SUBSCRIPTION_MANAGER_DISABLED_0));
}
m_securityManager.markResourceAsVisitedBy(cms.getRequestContext(), getPoolName(), resource, user);
} | java | public void markResourceAsVisitedBy(CmsObject cms, CmsResource resource, CmsUser user) throws CmsException {
if (!isEnabled()) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_SUBSCRIPTION_MANAGER_DISABLED_0));
}
m_securityManager.markResourceAsVisitedBy(cms.getRequestContext(), getPoolName(), resource, user);
} | [
"public",
"void",
"markResourceAsVisitedBy",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"CmsUser",
"user",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"!",
"isEnabled",
"(",
")",
")",
"{",
"throw",
"new",
"CmsRuntimeException",
"(",
"Mess... | Mark the given resource as visited by the user.<p>
@param cms the current users context
@param resource the resource to mark as visited
@param user the user that visited the resource
@throws CmsException if something goes wrong | [
"Mark",
"the",
"given",
"resource",
"as",
"visited",
"by",
"the",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSubscriptionManager.java#L171-L177 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java | PathNormalizer.normalizePath | public static final String normalizePath(String path) {
String normalizedPath = path.replaceAll("//", JawrConstant.URL_SEPARATOR);
StringTokenizer tk = new StringTokenizer(normalizedPath, JawrConstant.URL_SEPARATOR);
StringBuilder sb = new StringBuilder();
while (tk.hasMoreTokens()) {
sb.append(tk.nextToken());
if (tk.hasMoreTokens())
sb.append(JawrConstant.URL_SEPARATOR);
}
return sb.toString();
} | java | public static final String normalizePath(String path) {
String normalizedPath = path.replaceAll("//", JawrConstant.URL_SEPARATOR);
StringTokenizer tk = new StringTokenizer(normalizedPath, JawrConstant.URL_SEPARATOR);
StringBuilder sb = new StringBuilder();
while (tk.hasMoreTokens()) {
sb.append(tk.nextToken());
if (tk.hasMoreTokens())
sb.append(JawrConstant.URL_SEPARATOR);
}
return sb.toString();
} | [
"public",
"static",
"final",
"String",
"normalizePath",
"(",
"String",
"path",
")",
"{",
"String",
"normalizedPath",
"=",
"path",
".",
"replaceAll",
"(",
"\"//\"",
",",
"JawrConstant",
".",
"URL_SEPARATOR",
")",
";",
"StringTokenizer",
"tk",
"=",
"new",
"Strin... | Removes leading and trailing separators from a path, and removes double
separators (// is replaced by /).
@param path
the path to normalize
@return the normalized path | [
"Removes",
"leading",
"and",
"trailing",
"separators",
"from",
"a",
"path",
"and",
"removes",
"double",
"separators",
"(",
"//",
"is",
"replaced",
"by",
"/",
")",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L363-L374 |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SessionManagerUtil.java | SessionManagerUtil.getSipApplicationSessionKey | public static SipApplicationSessionKey getSipApplicationSessionKey(final String applicationName, final String id, final String appGeneratedKey) {
if (logger.isDebugEnabled()){
logger.debug("getSipApplicationSessionKey - applicationName=" + applicationName + ", id=" + id + ", appGeneratedKey=" + appGeneratedKey);
}
if(applicationName == null) {
throw new NullPointerException("the application name cannot be null for sip application session key creation");
}
return new SipApplicationSessionKey(
id,
applicationName,
appGeneratedKey);
} | java | public static SipApplicationSessionKey getSipApplicationSessionKey(final String applicationName, final String id, final String appGeneratedKey) {
if (logger.isDebugEnabled()){
logger.debug("getSipApplicationSessionKey - applicationName=" + applicationName + ", id=" + id + ", appGeneratedKey=" + appGeneratedKey);
}
if(applicationName == null) {
throw new NullPointerException("the application name cannot be null for sip application session key creation");
}
return new SipApplicationSessionKey(
id,
applicationName,
appGeneratedKey);
} | [
"public",
"static",
"SipApplicationSessionKey",
"getSipApplicationSessionKey",
"(",
"final",
"String",
"applicationName",
",",
"final",
"String",
"id",
",",
"final",
"String",
"appGeneratedKey",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
... | Computes the sip application session key from the input parameters.
The sip application session key will be of the form (UUID,APPNAME)
@param applicationName the name of the application that will be the second component of the key
@param id the Id composing the first component of the key
@return the computed key
@throws NullPointerException if one of the two parameters is null | [
"Computes",
"the",
"sip",
"application",
"session",
"key",
"from",
"the",
"input",
"parameters",
".",
"The",
"sip",
"application",
"session",
"key",
"will",
"be",
"of",
"the",
"form",
"(",
"UUID",
"APPNAME",
")"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SessionManagerUtil.java#L114-L125 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/consumer/article/reader/WikipediaXMLReader.java | WikipediaXMLReader.readContributor | protected void readContributor(Revision rev, String str) throws IOException, ArticleReaderException
{
char[] contrChars = str.toCharArray();
int size;
StringBuilder buffer = null;
this.keywords.reset();
for(char curChar:contrChars){
if (buffer != null) {
buffer.append(curChar);
}
if (this.keywords.check(curChar)) {
switch (this.keywords.getValue()) {
case KEY_START_ID:
case KEY_START_IP:
case KEY_START_USERNAME:
buffer = new StringBuilder();
break;
case KEY_END_IP:
size = buffer.length();
buffer.delete(size
- WikipediaXMLKeys.KEY_END_IP.getKeyword()
.length(), size);
// escape id string
rev.setContributorName(SQLEscape.escape(buffer.toString()));
rev.setContributorIsRegistered(false);
buffer = null;
break;
case KEY_END_USERNAME:
size = buffer.length();
buffer.delete(size
- WikipediaXMLKeys.KEY_END_USERNAME.getKeyword()
.length(), size);
// escape id string
rev.setContributorName(SQLEscape.escape(buffer.toString()));
rev.setContributorIsRegistered(true);
buffer = null;
break;
case KEY_END_ID:
size = buffer.length();
buffer.delete(size
- WikipediaXMLKeys.KEY_END_ID.getKeyword()
.length(), size);
String id = buffer.toString();
if(!id.isEmpty()){
rev.setContributorId(Integer.parseInt(buffer.toString()));
}
buffer = null;
break;
}
}
}
} | java | protected void readContributor(Revision rev, String str) throws IOException, ArticleReaderException
{
char[] contrChars = str.toCharArray();
int size;
StringBuilder buffer = null;
this.keywords.reset();
for(char curChar:contrChars){
if (buffer != null) {
buffer.append(curChar);
}
if (this.keywords.check(curChar)) {
switch (this.keywords.getValue()) {
case KEY_START_ID:
case KEY_START_IP:
case KEY_START_USERNAME:
buffer = new StringBuilder();
break;
case KEY_END_IP:
size = buffer.length();
buffer.delete(size
- WikipediaXMLKeys.KEY_END_IP.getKeyword()
.length(), size);
// escape id string
rev.setContributorName(SQLEscape.escape(buffer.toString()));
rev.setContributorIsRegistered(false);
buffer = null;
break;
case KEY_END_USERNAME:
size = buffer.length();
buffer.delete(size
- WikipediaXMLKeys.KEY_END_USERNAME.getKeyword()
.length(), size);
// escape id string
rev.setContributorName(SQLEscape.escape(buffer.toString()));
rev.setContributorIsRegistered(true);
buffer = null;
break;
case KEY_END_ID:
size = buffer.length();
buffer.delete(size
- WikipediaXMLKeys.KEY_END_ID.getKeyword()
.length(), size);
String id = buffer.toString();
if(!id.isEmpty()){
rev.setContributorId(Integer.parseInt(buffer.toString()));
}
buffer = null;
break;
}
}
}
} | [
"protected",
"void",
"readContributor",
"(",
"Revision",
"rev",
",",
"String",
"str",
")",
"throws",
"IOException",
",",
"ArticleReaderException",
"{",
"char",
"[",
"]",
"contrChars",
"=",
"str",
".",
"toCharArray",
"(",
")",
";",
"int",
"size",
";",
"String... | Parses the content within the contributor tags and adds the
parsed info to the provided revision object.
@param rev the revision object to store the parsed info in
@param str the contributor data to be parsed
@throws IOException
@throws ArticleReaderException | [
"Parses",
"the",
"content",
"within",
"the",
"contributor",
"tags",
"and",
"adds",
"the",
"parsed",
"info",
"to",
"the",
"provided",
"revision",
"object",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/consumer/article/reader/WikipediaXMLReader.java#L571-L631 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.appendColName | protected boolean appendColName(String attr, boolean useOuterJoins, UserAlias aUserAlias, StringBuffer buf)
{
AttributeInfo attrInfo = getAttributeInfo(attr, useOuterJoins, aUserAlias, getQuery().getPathClasses());
TableAlias tableAlias = attrInfo.tableAlias;
return appendColName(tableAlias, attrInfo.pathInfo, (tableAlias != null), buf);
} | java | protected boolean appendColName(String attr, boolean useOuterJoins, UserAlias aUserAlias, StringBuffer buf)
{
AttributeInfo attrInfo = getAttributeInfo(attr, useOuterJoins, aUserAlias, getQuery().getPathClasses());
TableAlias tableAlias = attrInfo.tableAlias;
return appendColName(tableAlias, attrInfo.pathInfo, (tableAlias != null), buf);
} | [
"protected",
"boolean",
"appendColName",
"(",
"String",
"attr",
",",
"boolean",
"useOuterJoins",
",",
"UserAlias",
"aUserAlias",
",",
"StringBuffer",
"buf",
")",
"{",
"AttributeInfo",
"attrInfo",
"=",
"getAttributeInfo",
"(",
"attr",
",",
"useOuterJoins",
",",
"aU... | Append the appropriate ColumnName to the buffer<br>
if a FIELDDESCRIPTOR is found for the Criteria the colName is taken from
there otherwise its taken from Criteria. <br>
field names in functions (ie: sum(name) ) are tried to resolve
ie: name from FIELDDESCRIPTOR , UPPER(name_test) from Criteria<br>
also resolve pathExpression adress.city or owner.konti.saldo | [
"Append",
"the",
"appropriate",
"ColumnName",
"to",
"the",
"buffer<br",
">",
"if",
"a",
"FIELDDESCRIPTOR",
"is",
"found",
"for",
"the",
"Criteria",
"the",
"colName",
"is",
"taken",
"from",
"there",
"otherwise",
"its",
"taken",
"from",
"Criteria",
".",
"<br",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L440-L446 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsStaticExportManager.java | CmsStaticExportManager.addExportRule | public void addExportRule(String name, String description) {
m_exportRules.add(
new CmsStaticExportExportRule(
name,
description,
m_exportTmpRule.getModifiedResources(),
m_exportTmpRule.getExportResourcePatterns()));
m_exportTmpRule = new CmsStaticExportExportRule("", "");
} | java | public void addExportRule(String name, String description) {
m_exportRules.add(
new CmsStaticExportExportRule(
name,
description,
m_exportTmpRule.getModifiedResources(),
m_exportTmpRule.getExportResourcePatterns()));
m_exportTmpRule = new CmsStaticExportExportRule("", "");
} | [
"public",
"void",
"addExportRule",
"(",
"String",
"name",
",",
"String",
"description",
")",
"{",
"m_exportRules",
".",
"add",
"(",
"new",
"CmsStaticExportExportRule",
"(",
"name",
",",
"description",
",",
"m_exportTmpRule",
".",
"getModifiedResources",
"(",
")",
... | Adds a new export rule to the configuration.<p>
@param name the name of the rule
@param description the description for the rule | [
"Adds",
"a",
"new",
"export",
"rule",
"to",
"the",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L362-L371 |
js-lib-com/commons | src/main/java/js/converter/ConverterRegistry.java | ConverterRegistry.registerConverterInstance | private void registerConverterInstance(Class<?> valueType, Converter converter)
{
if(converters.put(valueType, converter) == null) {
log.debug("Register converter |%s| for value type |%s|.", converter.getClass(), valueType);
}
else {
log.warn("Override converter |%s| for value type |%s|.", converter.getClass(), valueType);
}
} | java | private void registerConverterInstance(Class<?> valueType, Converter converter)
{
if(converters.put(valueType, converter) == null) {
log.debug("Register converter |%s| for value type |%s|.", converter.getClass(), valueType);
}
else {
log.warn("Override converter |%s| for value type |%s|.", converter.getClass(), valueType);
}
} | [
"private",
"void",
"registerConverterInstance",
"(",
"Class",
"<",
"?",
">",
"valueType",
",",
"Converter",
"converter",
")",
"{",
"if",
"(",
"converters",
".",
"put",
"(",
"valueType",
",",
"converter",
")",
"==",
"null",
")",
"{",
"log",
".",
"debug",
... | Utility method to bind converter instance to concrete value type.
@param valueType concrete value type,
@param converter converter instance able to handle value type. | [
"Utility",
"method",
"to",
"bind",
"converter",
"instance",
"to",
"concrete",
"value",
"type",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/ConverterRegistry.java#L382-L390 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java | INodeDirectory.addChild | <T extends INode> T addChild(final T node, boolean inheritPermission) {
return addChild(node, inheritPermission, true, UNKNOWN_INDEX);
} | java | <T extends INode> T addChild(final T node, boolean inheritPermission) {
return addChild(node, inheritPermission, true, UNKNOWN_INDEX);
} | [
"<",
"T",
"extends",
"INode",
">",
"T",
"addChild",
"(",
"final",
"T",
"node",
",",
"boolean",
"inheritPermission",
")",
"{",
"return",
"addChild",
"(",
"node",
",",
"inheritPermission",
",",
"true",
",",
"UNKNOWN_INDEX",
")",
";",
"}"
] | Add a child inode to the directory.
@param node INode to insert
@param inheritPermission inherit permission from parent?
@return null if the child with this name already exists;
node, otherwise | [
"Add",
"a",
"child",
"inode",
"to",
"the",
"directory",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java#L247-L249 |
js-lib-com/template.xhtml | src/main/java/js/template/xhtml/Serializer.java | Serializer.writeAttributes | private void writeAttributes(Element element, Iterable<Attr> attributes) throws IOException {
for (Attr attr : attributes) {
final String attrName = attr.getName();
if (!enableOperatorsSerialization && Opcode.fromAttrName(attrName) != Opcode.NONE) {
// skip operator attributes if operators serialization is disabled
continue;
}
final String attrValue = attr.getValue();
if (attrValue.isEmpty()) {
// do not write the attribute if its value is empty
continue;
}
if (attrValue.equals(HTML.DEFAULT_ATTRS.get(attrName))) {
// do not write the attribute if it is a default one with a default value
continue;
}
writeAttribute(attrName, attrValue);
}
} | java | private void writeAttributes(Element element, Iterable<Attr> attributes) throws IOException {
for (Attr attr : attributes) {
final String attrName = attr.getName();
if (!enableOperatorsSerialization && Opcode.fromAttrName(attrName) != Opcode.NONE) {
// skip operator attributes if operators serialization is disabled
continue;
}
final String attrValue = attr.getValue();
if (attrValue.isEmpty()) {
// do not write the attribute if its value is empty
continue;
}
if (attrValue.equals(HTML.DEFAULT_ATTRS.get(attrName))) {
// do not write the attribute if it is a default one with a default value
continue;
}
writeAttribute(attrName, attrValue);
}
} | [
"private",
"void",
"writeAttributes",
"(",
"Element",
"element",
",",
"Iterable",
"<",
"Attr",
">",
"attributes",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Attr",
"attr",
":",
"attributes",
")",
"{",
"final",
"String",
"attrName",
"=",
"attr",
".",
"... | Traverse all element's attributes and delegates {@link #writeAttribute(String, String)}. Skip operators if
{@link #enableOperatorsSerialization} is false. This method is called after element start tag was opened.
@param element element whose attributes to write.
@throws IOException if underlying writer fails to write. | [
"Traverse",
"all",
"element",
"s",
"attributes",
"and",
"delegates",
"{",
"@link",
"#writeAttribute",
"(",
"String",
"String",
")",
"}",
".",
"Skip",
"operators",
"if",
"{",
"@link",
"#enableOperatorsSerialization",
"}",
"is",
"false",
".",
"This",
"method",
"... | train | https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/Serializer.java#L354-L372 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/basic/impl/StageServiceImpl.java | StageServiceImpl.getScene | private Scene getScene(final StageWaveBean swb, final Region region) {
Scene scene = swb.scene();
if (scene == null) {
scene = new Scene(region);
} else {
scene.setRoot(region);
}
return scene;
} | java | private Scene getScene(final StageWaveBean swb, final Region region) {
Scene scene = swb.scene();
if (scene == null) {
scene = new Scene(region);
} else {
scene.setRoot(region);
}
return scene;
} | [
"private",
"Scene",
"getScene",
"(",
"final",
"StageWaveBean",
"swb",
",",
"final",
"Region",
"region",
")",
"{",
"Scene",
"scene",
"=",
"swb",
".",
"scene",
"(",
")",
";",
"if",
"(",
"scene",
"==",
"null",
")",
"{",
"scene",
"=",
"new",
"Scene",
"("... | Gets the scene.
@param swb the waveBean holding defaut values
@param region the region
@return the scene | [
"Gets",
"the",
"scene",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/basic/impl/StageServiceImpl.java#L112-L122 |
Erudika/para | para-core/src/main/java/com/erudika/para/utils/Utils.java | Utils.getMaxImgSize | public static int[] getMaxImgSize(int h, int w) {
int[] size = {h, w};
int max = Config.MAX_IMG_SIZE_PX;
if (w == h) {
size[0] = Math.min(h, max);
size[1] = Math.min(w, max);
} else if (Math.max(h, w) > max) {
int ratio = (100 * max) / Math.max(h, w);
if (h > w) {
size[0] = max;
size[1] = (w * ratio) / 100;
} else {
size[0] = (h * ratio) / 100;
size[1] = max;
}
}
return size;
} | java | public static int[] getMaxImgSize(int h, int w) {
int[] size = {h, w};
int max = Config.MAX_IMG_SIZE_PX;
if (w == h) {
size[0] = Math.min(h, max);
size[1] = Math.min(w, max);
} else if (Math.max(h, w) > max) {
int ratio = (100 * max) / Math.max(h, w);
if (h > w) {
size[0] = max;
size[1] = (w * ratio) / 100;
} else {
size[0] = (h * ratio) / 100;
size[1] = max;
}
}
return size;
} | [
"public",
"static",
"int",
"[",
"]",
"getMaxImgSize",
"(",
"int",
"h",
",",
"int",
"w",
")",
"{",
"int",
"[",
"]",
"size",
"=",
"{",
"h",
",",
"w",
"}",
";",
"int",
"max",
"=",
"Config",
".",
"MAX_IMG_SIZE_PX",
";",
"if",
"(",
"w",
"==",
"h",
... | Returns the adjusted size of an image (doesn't do any resizing).
@param h an image height
@param w an image width
@return the adjusted width and height if they are larger than {@link Config#MAX_IMG_SIZE_PX}.
@see Config#MAX_IMG_SIZE_PX | [
"Returns",
"the",
"adjusted",
"size",
"of",
"an",
"image",
"(",
"doesn",
"t",
"do",
"any",
"resizing",
")",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L729-L746 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java | LayoutParser.getTag | private Tag getTag(Element node, Tag... tags) {
String name = node.getTagName();
String error = null;
try {
Tag tag = Tag.valueOf(name.toUpperCase());
int i = ArrayUtils.indexOf(tags, tag);
if (i < 0) {
error = "Tag '%s' is not valid at this location";
} else {
if (!tag.allowMultiple) {
tags[i] = null;
}
return tag;
}
} catch (IllegalArgumentException e) {
error = "Unrecognized tag '%s' in layout";
}
throw new IllegalArgumentException(getInvalidTagError(error, name, tags));
} | java | private Tag getTag(Element node, Tag... tags) {
String name = node.getTagName();
String error = null;
try {
Tag tag = Tag.valueOf(name.toUpperCase());
int i = ArrayUtils.indexOf(tags, tag);
if (i < 0) {
error = "Tag '%s' is not valid at this location";
} else {
if (!tag.allowMultiple) {
tags[i] = null;
}
return tag;
}
} catch (IllegalArgumentException e) {
error = "Unrecognized tag '%s' in layout";
}
throw new IllegalArgumentException(getInvalidTagError(error, name, tags));
} | [
"private",
"Tag",
"getTag",
"(",
"Element",
"node",
",",
"Tag",
"...",
"tags",
")",
"{",
"String",
"name",
"=",
"node",
".",
"getTagName",
"(",
")",
";",
"String",
"error",
"=",
"null",
";",
"try",
"{",
"Tag",
"tag",
"=",
"Tag",
".",
"valueOf",
"("... | Return and validate the tag type, throwing an exception if the tag is unknown or among the
allowable types.
@param node The DOM node.
@param tags The allowable tag types.
@return The tag type. | [
"Return",
"and",
"validate",
"the",
"tag",
"type",
"throwing",
"an",
"exception",
"if",
"the",
"tag",
"is",
"unknown",
"or",
"among",
"the",
"allowable",
"types",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L336-L358 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java | SdkUtils.setInitialsThumb | public static void setInitialsThumb(Context context, TextView initialsView, String fullName) {
char initial1 = '\u0000';
char initial2 = '\u0000';
if (fullName != null) {
String[] nameParts = fullName.split(" ");
if (nameParts[0].length() > 0) {
initial1 = nameParts[0].charAt(0);
}
if (nameParts.length > 1) {
initial2 = nameParts[nameParts.length - 1].charAt(0);
}
}
setColorForInitialsThumb(initialsView, initial1 + initial2);
initialsView.setText(initial1 + "" + initial2);
initialsView.setTextColor(Color.WHITE);
} | java | public static void setInitialsThumb(Context context, TextView initialsView, String fullName) {
char initial1 = '\u0000';
char initial2 = '\u0000';
if (fullName != null) {
String[] nameParts = fullName.split(" ");
if (nameParts[0].length() > 0) {
initial1 = nameParts[0].charAt(0);
}
if (nameParts.length > 1) {
initial2 = nameParts[nameParts.length - 1].charAt(0);
}
}
setColorForInitialsThumb(initialsView, initial1 + initial2);
initialsView.setText(initial1 + "" + initial2);
initialsView.setTextColor(Color.WHITE);
} | [
"public",
"static",
"void",
"setInitialsThumb",
"(",
"Context",
"context",
",",
"TextView",
"initialsView",
",",
"String",
"fullName",
")",
"{",
"char",
"initial1",
"=",
"'",
"'",
";",
"char",
"initial2",
"=",
"'",
"'",
";",
"if",
"(",
"fullName",
"!=",
... | Helper method used to display initials into a given textview.
@param context current context
@param initialsView TextView used to set initials into.
@param fullName The user's full name to create initials for. | [
"Helper",
"method",
"used",
"to",
"display",
"initials",
"into",
"a",
"given",
"textview",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java#L551-L566 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java | RespokeEndpoint.didSendMessage | public void didSendMessage(final String message, final Date timestamp) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != listenerReference) {
Listener listener = listenerReference.get();
if (null != listener) {
listener.onMessage(message, timestamp, RespokeEndpoint.this, true);
}
}
}
});
} | java | public void didSendMessage(final String message, final Date timestamp) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != listenerReference) {
Listener listener = listenerReference.get();
if (null != listener) {
listener.onMessage(message, timestamp, RespokeEndpoint.this, true);
}
}
}
});
} | [
"public",
"void",
"didSendMessage",
"(",
"final",
"String",
"message",
",",
"final",
"Date",
"timestamp",
")",
"{",
"new",
"Handler",
"(",
"Looper",
".",
"getMainLooper",
"(",
")",
")",
".",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",... | Process a sent message. This is used internally to the SDK and should not be called directly by your client application.
@param message The body of the message
@param timestamp The message timestamp | [
"Process",
"a",
"sent",
"message",
".",
"This",
"is",
"used",
"internally",
"to",
"the",
"SDK",
"and",
"should",
"not",
"be",
"called",
"directly",
"by",
"your",
"client",
"application",
"."
] | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java#L233-L245 |
groupon/odo | client/src/main/java/com/groupon/odo/client/Client.java | Client.deleteServerMapping | public List<ServerRedirect> deleteServerMapping(int serverMappingId) {
ArrayList<ServerRedirect> servers = new ArrayList<ServerRedirect>();
try {
JSONArray serverArray = new JSONArray(doDelete(BASE_SERVER + "/" + serverMappingId, null));
for (int i = 0; i < serverArray.length(); i++) {
JSONObject jsonServer = serverArray.getJSONObject(i);
ServerRedirect server = getServerRedirectFromJSON(jsonServer);
if (server != null) {
servers.add(server);
}
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return servers;
} | java | public List<ServerRedirect> deleteServerMapping(int serverMappingId) {
ArrayList<ServerRedirect> servers = new ArrayList<ServerRedirect>();
try {
JSONArray serverArray = new JSONArray(doDelete(BASE_SERVER + "/" + serverMappingId, null));
for (int i = 0; i < serverArray.length(); i++) {
JSONObject jsonServer = serverArray.getJSONObject(i);
ServerRedirect server = getServerRedirectFromJSON(jsonServer);
if (server != null) {
servers.add(server);
}
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return servers;
} | [
"public",
"List",
"<",
"ServerRedirect",
">",
"deleteServerMapping",
"(",
"int",
"serverMappingId",
")",
"{",
"ArrayList",
"<",
"ServerRedirect",
">",
"servers",
"=",
"new",
"ArrayList",
"<",
"ServerRedirect",
">",
"(",
")",
";",
"try",
"{",
"JSONArray",
"serv... | Remove a server mapping from current profile by ID
@param serverMappingId server mapping ID
@return Collection of updated ServerRedirects | [
"Remove",
"a",
"server",
"mapping",
"from",
"current",
"profile",
"by",
"ID"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L1039-L1056 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.getMovieAccountState | public MediaState getMovieAccountState(int movieId, String sessionId) throws MovieDbException {
return tmdbMovies.getMovieAccountState(movieId, sessionId);
} | java | public MediaState getMovieAccountState(int movieId, String sessionId) throws MovieDbException {
return tmdbMovies.getMovieAccountState(movieId, sessionId);
} | [
"public",
"MediaState",
"getMovieAccountState",
"(",
"int",
"movieId",
",",
"String",
"sessionId",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbMovies",
".",
"getMovieAccountState",
"(",
"movieId",
",",
"sessionId",
")",
";",
"}"
] | This method lets a user get the status of whether or not the movie has
been rated or added to their favourite or movie watch list.
A valid session id is required.
@param movieId movieId
@param sessionId sessionId
@return
@throws MovieDbException exception | [
"This",
"method",
"lets",
"a",
"user",
"get",
"the",
"status",
"of",
"whether",
"or",
"not",
"the",
"movie",
"has",
"been",
"rated",
"or",
"added",
"to",
"their",
"favourite",
"or",
"movie",
"watch",
"list",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L883-L885 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Reflector.java | Reflector.getSetter | public static MethodInstance getSetter(Object obj, String prop, Object value, MethodInstance defaultValue) {
prop = "set" + StringUtil.ucFirst(prop);
MethodInstance mi = getMethodInstanceEL(obj, obj.getClass(), KeyImpl.getInstance(prop), new Object[] { value });
if (mi == null) return defaultValue;
Method m = mi.getMethod();
if (m.getReturnType() != void.class) return defaultValue;
return mi;
} | java | public static MethodInstance getSetter(Object obj, String prop, Object value, MethodInstance defaultValue) {
prop = "set" + StringUtil.ucFirst(prop);
MethodInstance mi = getMethodInstanceEL(obj, obj.getClass(), KeyImpl.getInstance(prop), new Object[] { value });
if (mi == null) return defaultValue;
Method m = mi.getMethod();
if (m.getReturnType() != void.class) return defaultValue;
return mi;
} | [
"public",
"static",
"MethodInstance",
"getSetter",
"(",
"Object",
"obj",
",",
"String",
"prop",
",",
"Object",
"value",
",",
"MethodInstance",
"defaultValue",
")",
"{",
"prop",
"=",
"\"set\"",
"+",
"StringUtil",
".",
"ucFirst",
"(",
"prop",
")",
";",
"Method... | to invoke a setter Method of a Object
@param obj Object to invoke method from
@param prop Name of the Method without get
@param value Value to set to the Method
@return MethodInstance | [
"to",
"invoke",
"a",
"setter",
"Method",
"of",
"a",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1056-L1064 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Betner.java | Betner.asMap | public Map<Integer, String> asMap() {
initializePosition();
final Map<Integer, String> results = Maps.newHashMap();
Mapper.from(positions.get()).entryLoop(new Decisional<Map.Entry<Integer, Pair<Integer,Integer>>>() {
@Override protected void decision(Entry<Integer, Pair<Integer, Integer>> input) {
results.put(input.getKey(), doSubstring(input.getValue()));
}
});
return results;
} | java | public Map<Integer, String> asMap() {
initializePosition();
final Map<Integer, String> results = Maps.newHashMap();
Mapper.from(positions.get()).entryLoop(new Decisional<Map.Entry<Integer, Pair<Integer,Integer>>>() {
@Override protected void decision(Entry<Integer, Pair<Integer, Integer>> input) {
results.put(input.getKey(), doSubstring(input.getValue()));
}
});
return results;
} | [
"public",
"Map",
"<",
"Integer",
",",
"String",
">",
"asMap",
"(",
")",
"{",
"initializePosition",
"(",
")",
";",
"final",
"Map",
"<",
"Integer",
",",
"String",
">",
"results",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"Mapper",
".",
"from",
"("... | Returns the substring results in given range as a map, left position number as key, substring as value
@return | [
"Returns",
"the",
"substring",
"results",
"in",
"given",
"range",
"as",
"a",
"map",
"left",
"position",
"number",
"as",
"key",
"substring",
"as",
"value"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Betner.java#L259-L271 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.beginGetNextHopAsync | public Observable<NextHopResultInner> beginGetNextHopAsync(String resourceGroupName, String networkWatcherName, NextHopParameters parameters) {
return beginGetNextHopWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NextHopResultInner>, NextHopResultInner>() {
@Override
public NextHopResultInner call(ServiceResponse<NextHopResultInner> response) {
return response.body();
}
});
} | java | public Observable<NextHopResultInner> beginGetNextHopAsync(String resourceGroupName, String networkWatcherName, NextHopParameters parameters) {
return beginGetNextHopWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NextHopResultInner>, NextHopResultInner>() {
@Override
public NextHopResultInner call(ServiceResponse<NextHopResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NextHopResultInner",
">",
"beginGetNextHopAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"NextHopParameters",
"parameters",
")",
"{",
"return",
"beginGetNextHopWithServiceResponseAsync",
"(",
"resourceGroupN... | Gets the next hop from the specified VM.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@param parameters Parameters that define the source and destination endpoint.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NextHopResultInner object | [
"Gets",
"the",
"next",
"hop",
"from",
"the",
"specified",
"VM",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1228-L1235 |
apereo/cas | support/cas-server-support-couchdb-core/src/main/java/org/apereo/cas/couchdb/core/CouchDbProfileDocument.java | CouchDbProfileDocument.setAttribute | @JsonIgnore
public void setAttribute(final String key, final Object value) {
attributes.put(key, CollectionUtils.toCollection(value, ArrayList.class));
} | java | @JsonIgnore
public void setAttribute(final String key, final Object value) {
attributes.put(key, CollectionUtils.toCollection(value, ArrayList.class));
} | [
"@",
"JsonIgnore",
"public",
"void",
"setAttribute",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"attributes",
".",
"put",
"(",
"key",
",",
"CollectionUtils",
".",
"toCollection",
"(",
"value",
",",
"ArrayList",
".",
"class",
... | Sets a single attribute.
@param key the attribute key to set
@param value the value to be set | [
"Sets",
"a",
"single",
"attribute",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-couchdb-core/src/main/java/org/apereo/cas/couchdb/core/CouchDbProfileDocument.java#L73-L76 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/atompair/PiContactDetectionDescriptor.java | PiContactDetectionDescriptor.isANeighboorsInAnAtomContainer | private boolean isANeighboorsInAnAtomContainer(List<IAtom> neighs, IAtomContainer ac) {
boolean isIn = false;
int count = 0;
for (IAtom neigh : neighs) {
if (ac.contains(neigh)) {
count += 1;
}
}
if (count > 0) {
isIn = true;
}
return isIn;
} | java | private boolean isANeighboorsInAnAtomContainer(List<IAtom> neighs, IAtomContainer ac) {
boolean isIn = false;
int count = 0;
for (IAtom neigh : neighs) {
if (ac.contains(neigh)) {
count += 1;
}
}
if (count > 0) {
isIn = true;
}
return isIn;
} | [
"private",
"boolean",
"isANeighboorsInAnAtomContainer",
"(",
"List",
"<",
"IAtom",
">",
"neighs",
",",
"IAtomContainer",
"ac",
")",
"{",
"boolean",
"isIn",
"=",
"false",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"IAtom",
"neigh",
":",
"neighs",
")",
... | Gets if neighbours of an atom are in an atom container.
@param neighs array of atoms
@param ac AtomContainer
@return The boolean result | [
"Gets",
"if",
"neighbours",
"of",
"an",
"atom",
"are",
"in",
"an",
"atom",
"container",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/atompair/PiContactDetectionDescriptor.java#L202-L214 |
JodaOrg/joda-time | src/main/java/org/joda/time/DateTime.java | DateTime.withDurationAdded | public DateTime withDurationAdded(ReadableDuration durationToAdd, int scalar) {
if (durationToAdd == null || scalar == 0) {
return this;
}
return withDurationAdded(durationToAdd.getMillis(), scalar);
} | java | public DateTime withDurationAdded(ReadableDuration durationToAdd, int scalar) {
if (durationToAdd == null || scalar == 0) {
return this;
}
return withDurationAdded(durationToAdd.getMillis(), scalar);
} | [
"public",
"DateTime",
"withDurationAdded",
"(",
"ReadableDuration",
"durationToAdd",
",",
"int",
"scalar",
")",
"{",
"if",
"(",
"durationToAdd",
"==",
"null",
"||",
"scalar",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"return",
"withDurationAdded",
"(",
... | Returns a copy of this datetime with the specified duration added.
<p>
If the addition is zero, then <code>this</code> is returned.
@param durationToAdd the duration to add to this one, null means zero
@param scalar the amount of times to add, such as -1 to subtract once
@return a copy of this datetime with the duration added
@throws ArithmeticException if the new datetime exceeds the capacity of a long | [
"Returns",
"a",
"copy",
"of",
"this",
"datetime",
"with",
"the",
"specified",
"duration",
"added",
".",
"<p",
">",
"If",
"the",
"addition",
"is",
"zero",
"then",
"<code",
">",
"this<",
"/",
"code",
">",
"is",
"returned",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTime.java#L915-L920 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java | JDBC4CallableStatement.setSQLXML | @Override
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"void",
"setSQLXML",
"(",
"String",
"parameterName",
",",
"SQLXML",
"xmlObject",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
")",
";",
"}"
] | Sets the designated parameter to the given java.sql.SQLXML object. | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"java",
".",
"sql",
".",
"SQLXML",
"object",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L871-L876 |
twitter/chill | chill-hadoop/src/main/java/com/twitter/chill/hadoop/Varint.java | Varint.writeUnsignedVarLong | public static void writeUnsignedVarLong(long value, DataOutputStream out) throws IOException {
while ((value & 0xFFFFFFFFFFFFFF80L) != 0L) {
out.writeByte(((int) value & 0x7F) | 0x80);
value >>>= 7;
}
out.writeByte((int) value & 0x7F);
} | java | public static void writeUnsignedVarLong(long value, DataOutputStream out) throws IOException {
while ((value & 0xFFFFFFFFFFFFFF80L) != 0L) {
out.writeByte(((int) value & 0x7F) | 0x80);
value >>>= 7;
}
out.writeByte((int) value & 0x7F);
} | [
"public",
"static",
"void",
"writeUnsignedVarLong",
"(",
"long",
"value",
",",
"DataOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"while",
"(",
"(",
"value",
"&",
"0xFFFFFFFFFFFFFF80",
"L",
")",
"!=",
"0L",
")",
"{",
"out",
".",
"writeByte",
"(",
... | Encodes a value using the variable-length encoding from
<a href="http://code.google.com/apis/protocolbuffers/docs/encoding.html">
Google Protocol Buffers</a>. Zig-zag is not used, so input must not be negative.
If values can be negative, use {@link #writeSignedVarLong(long, java.io.DataOutputStream)}
instead. This method treats negative input as like a large unsigned value.
@param value value to encode
@param out to write bytes to
@throws java.io.IOException if {@link java.io.DataOutputStream} throws {@link java.io.IOException} | [
"Encodes",
"a",
"value",
"using",
"the",
"variable",
"-",
"length",
"encoding",
"from",
"<a",
"href",
"=",
"http",
":",
"//",
"code",
".",
"google",
".",
"com",
"/",
"apis",
"/",
"protocolbuffers",
"/",
"docs",
"/",
"encoding",
".",
"html",
">",
"Googl... | train | https://github.com/twitter/chill/blob/0919984ec3aeb320ff522911c726425e9f18ea41/chill-hadoop/src/main/java/com/twitter/chill/hadoop/Varint.java#L71-L77 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java | SerializedFormBuilder.buildSerializedForm | public void buildSerializedForm(XMLNode node, Content serializedTree) throws DocletException {
serializedTree = writer.getHeader(configuration.getText(
"doclet.Serialized_Form"));
buildChildren(node, serializedTree);
writer.addFooter(serializedTree);
writer.printDocument(serializedTree);
} | java | public void buildSerializedForm(XMLNode node, Content serializedTree) throws DocletException {
serializedTree = writer.getHeader(configuration.getText(
"doclet.Serialized_Form"));
buildChildren(node, serializedTree);
writer.addFooter(serializedTree);
writer.printDocument(serializedTree);
} | [
"public",
"void",
"buildSerializedForm",
"(",
"XMLNode",
"node",
",",
"Content",
"serializedTree",
")",
"throws",
"DocletException",
"{",
"serializedTree",
"=",
"writer",
".",
"getHeader",
"(",
"configuration",
".",
"getText",
"(",
"\"doclet.Serialized_Form\"",
")",
... | Build the serialized form.
@param node the XML element that specifies which components to document
@param serializedTree content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation | [
"Build",
"the",
"serialized",
"form",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L160-L166 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java | ClassBuilder.buildMemberDetails | public void buildMemberDetails(XMLNode node, Content classContentTree) {
Content memberDetailsTree = writer.getMemberTreeHeader();
buildChildren(node, memberDetailsTree);
classContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
} | java | public void buildMemberDetails(XMLNode node, Content classContentTree) {
Content memberDetailsTree = writer.getMemberTreeHeader();
buildChildren(node, memberDetailsTree);
classContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
} | [
"public",
"void",
"buildMemberDetails",
"(",
"XMLNode",
"node",
",",
"Content",
"classContentTree",
")",
"{",
"Content",
"memberDetailsTree",
"=",
"writer",
".",
"getMemberTreeHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"memberDetailsTree",
")",
";"... | Build the member details contents of the page.
@param node the XML element that specifies which components to document
@param classContentTree the content tree to which the documentation will be added | [
"Build",
"the",
"member",
"details",
"contents",
"of",
"the",
"page",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java#L352-L356 |
paypal/SeLion | dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java | XmlDataProviderImpl.getDataAsHashtable | @Override
public Hashtable<String, Object> getDataAsHashtable() {
logger.entering();
if (null == resource.getCls()) {
resource.setCls(KeyValueMap.class);
}
Hashtable<String, Object> dataHashTable = new Hashtable<>();
try {
JAXBContext context = JAXBContext.newInstance(resource.getCls());
Unmarshaller unmarshaller = context.createUnmarshaller();
StreamSource xmlStreamSource = new StreamSource(resource.getInputStream());
Map<String, KeyValuePair> keyValueItems = unmarshaller
.unmarshal(xmlStreamSource, KeyValueMap.class).getValue().getMap();
for (Entry<?, ?> entry : keyValueItems.entrySet()) {
dataHashTable.put((String) entry.getKey(), entry.getValue());
}
} catch (JAXBException excp) {
logger.exiting(excp.getMessage());
throw new DataProviderException("Error unmarshalling XML file.", excp);
}
logger.exiting();
return dataHashTable;
} | java | @Override
public Hashtable<String, Object> getDataAsHashtable() {
logger.entering();
if (null == resource.getCls()) {
resource.setCls(KeyValueMap.class);
}
Hashtable<String, Object> dataHashTable = new Hashtable<>();
try {
JAXBContext context = JAXBContext.newInstance(resource.getCls());
Unmarshaller unmarshaller = context.createUnmarshaller();
StreamSource xmlStreamSource = new StreamSource(resource.getInputStream());
Map<String, KeyValuePair> keyValueItems = unmarshaller
.unmarshal(xmlStreamSource, KeyValueMap.class).getValue().getMap();
for (Entry<?, ?> entry : keyValueItems.entrySet()) {
dataHashTable.put((String) entry.getKey(), entry.getValue());
}
} catch (JAXBException excp) {
logger.exiting(excp.getMessage());
throw new DataProviderException("Error unmarshalling XML file.", excp);
}
logger.exiting();
return dataHashTable;
} | [
"@",
"Override",
"public",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"getDataAsHashtable",
"(",
")",
"{",
"logger",
".",
"entering",
"(",
")",
";",
"if",
"(",
"null",
"==",
"resource",
".",
"getCls",
"(",
")",
")",
"{",
"resource",
".",
"setCls",... | Gets xml data and returns in a hashtable instead of an Object 2D array. Only compatible with a xml file
formatted to return a map. <br>
<br>
XML file example:
<pre>
<items>
<item>
<key>k1</key>
<value>val1</value>
</item>
<item>
<key>k2</key>
<value>val2</value>
</item>
<item>
<key>k3</key>
<value>val3</value>
</item>
</items>
</pre>
@return xml data in form of a Hashtable. | [
"Gets",
"xml",
"data",
"and",
"returns",
"in",
"a",
"hashtable",
"instead",
"of",
"an",
"Object",
"2D",
"array",
".",
"Only",
"compatible",
"with",
"a",
"xml",
"file",
"formatted",
"to",
"return",
"a",
"map",
".",
"<br",
">",
"<br",
">",
"XML",
"file",... | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java#L312-L336 |
ujmp/universal-java-matrix-package | ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java | Ginv.divideRowBy | public static void divideRowBy(DenseDoubleMatrix2D matrix, long aRow, long fromCol, double value) {
long cols = matrix.getColumnCount();
for (long col = fromCol; col < cols; col++) {
matrix.setDouble(matrix.getDouble(aRow, col) / value, aRow, col);
}
} | java | public static void divideRowBy(DenseDoubleMatrix2D matrix, long aRow, long fromCol, double value) {
long cols = matrix.getColumnCount();
for (long col = fromCol; col < cols; col++) {
matrix.setDouble(matrix.getDouble(aRow, col) / value, aRow, col);
}
} | [
"public",
"static",
"void",
"divideRowBy",
"(",
"DenseDoubleMatrix2D",
"matrix",
",",
"long",
"aRow",
",",
"long",
"fromCol",
",",
"double",
"value",
")",
"{",
"long",
"cols",
"=",
"matrix",
".",
"getColumnCount",
"(",
")",
";",
"for",
"(",
"long",
"col",
... | Divide the row from this column position by this value
@param matrix
the matrix to modify
@param aRow
the row to process
@param fromCol
starting from column
@param value
the value to divide | [
"Divide",
"the",
"row",
"from",
"this",
"column",
"position",
"by",
"this",
"value"
] | train | https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java#L693-L698 |
Cornutum/tcases | tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java | GeneratorSetJson.asGeneratorSet | public static IGeneratorSet asGeneratorSet( JsonObject json)
{
GeneratorSet generatorSet = new GeneratorSet();
// Get generator definitions
json.keySet().stream()
.forEach( function -> {
try
{
generatorSet.addGenerator( validFunction( function), asGenerator( json.getJsonObject( function)));
}
catch( GeneratorSetException e)
{
throw new GeneratorSetException( String.format( "Error defining generator for function=%s", function), e);
}
});
return generatorSet;
} | java | public static IGeneratorSet asGeneratorSet( JsonObject json)
{
GeneratorSet generatorSet = new GeneratorSet();
// Get generator definitions
json.keySet().stream()
.forEach( function -> {
try
{
generatorSet.addGenerator( validFunction( function), asGenerator( json.getJsonObject( function)));
}
catch( GeneratorSetException e)
{
throw new GeneratorSetException( String.format( "Error defining generator for function=%s", function), e);
}
});
return generatorSet;
} | [
"public",
"static",
"IGeneratorSet",
"asGeneratorSet",
"(",
"JsonObject",
"json",
")",
"{",
"GeneratorSet",
"generatorSet",
"=",
"new",
"GeneratorSet",
"(",
")",
";",
"// Get generator definitions",
"json",
".",
"keySet",
"(",
")",
".",
"stream",
"(",
")",
".",
... | Returns the IGeneratorSet represented by the given JSON object. | [
"Returns",
"the",
"IGeneratorSet",
"represented",
"by",
"the",
"given",
"JSON",
"object",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L41-L59 |
k3po/k3po | lang/src/main/java/org/kaazing/k3po/lang/el/FunctionMapper.java | FunctionMapper.newFunctionMapper | public static FunctionMapper newFunctionMapper() {
ServiceLoader<FunctionMapperSpi> loader = loadFunctionMapperSpi();
// load FunctionMapperSpi instances
ConcurrentMap<String, FunctionMapperSpi> functionMappers = new ConcurrentHashMap<>();
for (FunctionMapperSpi functionMapperSpi : loader) {
String prefixName = functionMapperSpi.getPrefixName();
FunctionMapperSpi oldFunctionMapperSpi = functionMappers.putIfAbsent(prefixName, functionMapperSpi);
if (oldFunctionMapperSpi != null) {
throw new ELException(String.format("Duplicate prefix function mapper: %s", prefixName));
}
}
return new FunctionMapper(functionMappers);
} | java | public static FunctionMapper newFunctionMapper() {
ServiceLoader<FunctionMapperSpi> loader = loadFunctionMapperSpi();
// load FunctionMapperSpi instances
ConcurrentMap<String, FunctionMapperSpi> functionMappers = new ConcurrentHashMap<>();
for (FunctionMapperSpi functionMapperSpi : loader) {
String prefixName = functionMapperSpi.getPrefixName();
FunctionMapperSpi oldFunctionMapperSpi = functionMappers.putIfAbsent(prefixName, functionMapperSpi);
if (oldFunctionMapperSpi != null) {
throw new ELException(String.format("Duplicate prefix function mapper: %s", prefixName));
}
}
return new FunctionMapper(functionMappers);
} | [
"public",
"static",
"FunctionMapper",
"newFunctionMapper",
"(",
")",
"{",
"ServiceLoader",
"<",
"FunctionMapperSpi",
">",
"loader",
"=",
"loadFunctionMapperSpi",
"(",
")",
";",
"// load FunctionMapperSpi instances",
"ConcurrentMap",
"<",
"String",
",",
"FunctionMapperSpi"... | Creates a new Function Mapper.
@return returns an instance of the FunctionMapper | [
"Creates",
"a",
"new",
"Function",
"Mapper",
"."
] | train | https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/lang/src/main/java/org/kaazing/k3po/lang/el/FunctionMapper.java#L44-L58 |
SeleniumHQ/selenium | java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java | PerSessionLogHandler.fetchAndStoreLogsFromDriver | public synchronized void fetchAndStoreLogsFromDriver(SessionId sessionId, WebDriver driver)
throws IOException {
if (!perSessionDriverEntries.containsKey(sessionId)) {
perSessionDriverEntries.put(sessionId, new HashMap<>());
}
Map<String, LogEntries> typeToEntriesMap = perSessionDriverEntries.get(sessionId);
if (storeLogsOnSessionQuit) {
typeToEntriesMap.put(LogType.SERVER, getSessionLog(sessionId));
Set<String> logTypeSet = driver.manage().logs().getAvailableLogTypes();
for (String logType : logTypeSet) {
typeToEntriesMap.put(logType, driver.manage().logs().get(logType));
}
}
} | java | public synchronized void fetchAndStoreLogsFromDriver(SessionId sessionId, WebDriver driver)
throws IOException {
if (!perSessionDriverEntries.containsKey(sessionId)) {
perSessionDriverEntries.put(sessionId, new HashMap<>());
}
Map<String, LogEntries> typeToEntriesMap = perSessionDriverEntries.get(sessionId);
if (storeLogsOnSessionQuit) {
typeToEntriesMap.put(LogType.SERVER, getSessionLog(sessionId));
Set<String> logTypeSet = driver.manage().logs().getAvailableLogTypes();
for (String logType : logTypeSet) {
typeToEntriesMap.put(logType, driver.manage().logs().get(logType));
}
}
} | [
"public",
"synchronized",
"void",
"fetchAndStoreLogsFromDriver",
"(",
"SessionId",
"sessionId",
",",
"WebDriver",
"driver",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"perSessionDriverEntries",
".",
"containsKey",
"(",
"sessionId",
")",
")",
"{",
"perSession... | Fetches and stores available logs from the given session and driver.
@param sessionId The id of the session.
@param driver The driver to get the logs from.
@throws IOException If there was a problem reading from file. | [
"Fetches",
"and",
"stores",
"available",
"logs",
"from",
"the",
"given",
"session",
"and",
"driver",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java#L236-L249 |
tvesalainen/lpg | src/main/java/org/vesalainen/parser/util/Input.java | Input.getInstance | public static <T> InputReader getInstance(T input) throws IOException
{
return getInstance(input, -1, UTF_8, NO_FEATURES);
} | java | public static <T> InputReader getInstance(T input) throws IOException
{
return getInstance(input, -1, UTF_8, NO_FEATURES);
} | [
"public",
"static",
"<",
"T",
">",
"InputReader",
"getInstance",
"(",
"T",
"input",
")",
"throws",
"IOException",
"{",
"return",
"getInstance",
"(",
"input",
",",
"-",
"1",
",",
"UTF_8",
",",
"NO_FEATURES",
")",
";",
"}"
] | Returns InputReader for input
@param <T>
@param input Any supported input type
@return
@throws IOException | [
"Returns",
"InputReader",
"for",
"input"
] | train | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/Input.java#L166-L169 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ssl_certkey_policy.java | ns_ssl_certkey_policy.update | public static ns_ssl_certkey_policy update(nitro_service client, ns_ssl_certkey_policy resource) throws Exception
{
resource.validate("modify");
return ((ns_ssl_certkey_policy[]) resource.update_resource(client))[0];
} | java | public static ns_ssl_certkey_policy update(nitro_service client, ns_ssl_certkey_policy resource) throws Exception
{
resource.validate("modify");
return ((ns_ssl_certkey_policy[]) resource.update_resource(client))[0];
} | [
"public",
"static",
"ns_ssl_certkey_policy",
"update",
"(",
"nitro_service",
"client",
",",
"ns_ssl_certkey_policy",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"modify\"",
")",
";",
"return",
"(",
"(",
"ns_ssl_certkey_policy",
"... | <pre>
Use this operation to set the polling frequency of the NetScaler SSL certificates.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"set",
"the",
"polling",
"frequency",
"of",
"the",
"NetScaler",
"SSL",
"certificates",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ssl_certkey_policy.java#L126-L130 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/FuzzyBugComparator.java | FuzzyBugComparator.compareSourceLines | public int compareSourceLines(BugCollection lhsCollection, BugCollection rhsCollection, SourceLineAnnotation lhs,
SourceLineAnnotation rhs) {
if (lhs == null || rhs == null) {
return compareNullElements(lhs, rhs);
}
// Classes must match fuzzily.
int cmp = compareClassesByName(lhsCollection, rhsCollection, lhs.getClassName(), rhs.getClassName());
if (cmp != 0) {
return cmp;
}
return 0;
} | java | public int compareSourceLines(BugCollection lhsCollection, BugCollection rhsCollection, SourceLineAnnotation lhs,
SourceLineAnnotation rhs) {
if (lhs == null || rhs == null) {
return compareNullElements(lhs, rhs);
}
// Classes must match fuzzily.
int cmp = compareClassesByName(lhsCollection, rhsCollection, lhs.getClassName(), rhs.getClassName());
if (cmp != 0) {
return cmp;
}
return 0;
} | [
"public",
"int",
"compareSourceLines",
"(",
"BugCollection",
"lhsCollection",
",",
"BugCollection",
"rhsCollection",
",",
"SourceLineAnnotation",
"lhs",
",",
"SourceLineAnnotation",
"rhs",
")",
"{",
"if",
"(",
"lhs",
"==",
"null",
"||",
"rhs",
"==",
"null",
")",
... | Compare source line annotations.
@param rhsCollection
lhs BugCollection
@param lhsCollection
rhs BugCollection
@param lhs
a SourceLineAnnotation
@param rhs
another SourceLineAnnotation
@return comparison of lhs and rhs | [
"Compare",
"source",
"line",
"annotations",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FuzzyBugComparator.java#L298-L311 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java | CheckpointListener.loadLastCheckpointCG | public static ComputationGraph loadLastCheckpointCG(File rootDir){
Checkpoint last = lastCheckpoint(rootDir);
return loadCheckpointCG(rootDir, last);
} | java | public static ComputationGraph loadLastCheckpointCG(File rootDir){
Checkpoint last = lastCheckpoint(rootDir);
return loadCheckpointCG(rootDir, last);
} | [
"public",
"static",
"ComputationGraph",
"loadLastCheckpointCG",
"(",
"File",
"rootDir",
")",
"{",
"Checkpoint",
"last",
"=",
"lastCheckpoint",
"(",
"rootDir",
")",
";",
"return",
"loadCheckpointCG",
"(",
"rootDir",
",",
"last",
")",
";",
"}"
] | Load the last (most recent) checkpoint from the specified root directory
@param rootDir Root directory to load checpoint from
@return ComputationGraph for last checkpoint | [
"Load",
"the",
"last",
"(",
"most",
"recent",
")",
"checkpoint",
"from",
"the",
"specified",
"root",
"directory"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java#L535-L538 |
ltearno/hexa.tools | hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java | hqlParser.selectStatement | public final hqlParser.selectStatement_return selectStatement() throws RecognitionException {
hqlParser.selectStatement_return retval = new hqlParser.selectStatement_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope q =null;
RewriteRuleSubtreeStream stream_queryRule=new RewriteRuleSubtreeStream(adaptor,"rule queryRule");
try {
// hql.g:209:2: (q= queryRule -> ^( QUERY[\"query\"] $q) )
// hql.g:209:4: q= queryRule
{
pushFollow(FOLLOW_queryRule_in_selectStatement802);
q=queryRule();
state._fsp--;
stream_queryRule.add(q.getTree());
// AST REWRITE
// elements: q
// token labels:
// rule labels: retval, q
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
RewriteRuleSubtreeStream stream_q=new RewriteRuleSubtreeStream(adaptor,"rule q",q!=null?q.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 210:2: -> ^( QUERY[\"query\"] $q)
{
// hql.g:210:5: ^( QUERY[\"query\"] $q)
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(QUERY, "query"), root_1);
adaptor.addChild(root_1, stream_q.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} | java | public final hqlParser.selectStatement_return selectStatement() throws RecognitionException {
hqlParser.selectStatement_return retval = new hqlParser.selectStatement_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope q =null;
RewriteRuleSubtreeStream stream_queryRule=new RewriteRuleSubtreeStream(adaptor,"rule queryRule");
try {
// hql.g:209:2: (q= queryRule -> ^( QUERY[\"query\"] $q) )
// hql.g:209:4: q= queryRule
{
pushFollow(FOLLOW_queryRule_in_selectStatement802);
q=queryRule();
state._fsp--;
stream_queryRule.add(q.getTree());
// AST REWRITE
// elements: q
// token labels:
// rule labels: retval, q
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
RewriteRuleSubtreeStream stream_q=new RewriteRuleSubtreeStream(adaptor,"rule q",q!=null?q.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 210:2: -> ^( QUERY[\"query\"] $q)
{
// hql.g:210:5: ^( QUERY[\"query\"] $q)
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(QUERY, "query"), root_1);
adaptor.addChild(root_1, stream_q.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} | [
"public",
"final",
"hqlParser",
".",
"selectStatement_return",
"selectStatement",
"(",
")",
"throws",
"RecognitionException",
"{",
"hqlParser",
".",
"selectStatement_return",
"retval",
"=",
"new",
"hqlParser",
".",
"selectStatement_return",
"(",
")",
";",
"retval",
".... | hql.g:208:1: selectStatement : q= queryRule -> ^( QUERY[\"query\"] $q) ; | [
"hql",
".",
"g",
":",
"208",
":",
"1",
":",
"selectStatement",
":",
"q",
"=",
"queryRule",
"-",
">",
"^",
"(",
"QUERY",
"[",
"\\",
"query",
"\\",
"]",
"$q",
")",
";"
] | train | https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java#L1025-L1088 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnszone_domain_binding.java | dnszone_domain_binding.count_filtered | public static long count_filtered(nitro_service service, String zonename, String filter) throws Exception{
dnszone_domain_binding obj = new dnszone_domain_binding();
obj.set_zonename(zonename);
options option = new options();
option.set_count(true);
option.set_filter(filter);
dnszone_domain_binding[] response = (dnszone_domain_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, String zonename, String filter) throws Exception{
dnszone_domain_binding obj = new dnszone_domain_binding();
obj.set_zonename(zonename);
options option = new options();
option.set_count(true);
option.set_filter(filter);
dnszone_domain_binding[] response = (dnszone_domain_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"String",
"zonename",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"dnszone_domain_binding",
"obj",
"=",
"new",
"dnszone_domain_binding",
"(",
")",
";",
"obj",
".",
... | Use this API to count the filtered set of dnszone_domain_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"dnszone_domain_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnszone_domain_binding.java#L174-L185 |
facebookarchive/nifty | nifty-ssl/src/main/java/com/facebook/nifty/ssl/CryptoUtil.java | CryptoUtil.initHmacSha256 | private static Mac initHmacSha256(byte[] key) {
try {
SecretKeySpec keySpec = new SecretKeySpec(key, MAC_ALGORITHM);
Mac mac = Mac.getInstance(MAC_ALGORITHM);
mac.init(keySpec);
return mac;
}
catch (GeneralSecurityException e) {
throw new IllegalArgumentException(e);
}
} | java | private static Mac initHmacSha256(byte[] key) {
try {
SecretKeySpec keySpec = new SecretKeySpec(key, MAC_ALGORITHM);
Mac mac = Mac.getInstance(MAC_ALGORITHM);
mac.init(keySpec);
return mac;
}
catch (GeneralSecurityException e) {
throw new IllegalArgumentException(e);
}
} | [
"private",
"static",
"Mac",
"initHmacSha256",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"try",
"{",
"SecretKeySpec",
"keySpec",
"=",
"new",
"SecretKeySpec",
"(",
"key",
",",
"MAC_ALGORITHM",
")",
";",
"Mac",
"mac",
"=",
"Mac",
".",
"getInstance",
"(",
"MAC... | Initializes a {@link Mac} object using the given key.
@param key the HMAC key.
@return the initialized Mac object.
@throws IllegalArgumentException if the provided key is invalid. | [
"Initializes",
"a",
"{",
"@link",
"Mac",
"}",
"object",
"using",
"the",
"given",
"key",
"."
] | train | https://github.com/facebookarchive/nifty/blob/ccacff7f0a723abe0b9ed399bcc3bc85784e7396/nifty-ssl/src/main/java/com/facebook/nifty/ssl/CryptoUtil.java#L53-L63 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContactSet.java | GroupContactSet.hasContact | public boolean hasContact(ResidueNumber resNumber1, ResidueNumber resNumber2) {
return contacts.containsKey(new Pair<ResidueNumber>(resNumber1, resNumber2));
} | java | public boolean hasContact(ResidueNumber resNumber1, ResidueNumber resNumber2) {
return contacts.containsKey(new Pair<ResidueNumber>(resNumber1, resNumber2));
} | [
"public",
"boolean",
"hasContact",
"(",
"ResidueNumber",
"resNumber1",
",",
"ResidueNumber",
"resNumber2",
")",
"{",
"return",
"contacts",
".",
"containsKey",
"(",
"new",
"Pair",
"<",
"ResidueNumber",
">",
"(",
"resNumber1",
",",
"resNumber2",
")",
")",
";",
"... | Tell whether the given pair is a contact in this GroupContactSet,
the comparison is done by matching residue numbers and chain identifiers
@param resNumber1
@param resNumber2
@return | [
"Tell",
"whether",
"the",
"given",
"pair",
"is",
"a",
"contact",
"in",
"this",
"GroupContactSet",
"the",
"comparison",
"is",
"done",
"by",
"matching",
"residue",
"numbers",
"and",
"chain",
"identifiers"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContactSet.java#L116-L118 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryBySecret | public Iterable<DConnection> queryBySecret(java.lang.String secret) {
return queryByField(null, DConnectionMapper.Field.SECRET.getFieldName(), secret);
} | java | public Iterable<DConnection> queryBySecret(java.lang.String secret) {
return queryByField(null, DConnectionMapper.Field.SECRET.getFieldName(), secret);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryBySecret",
"(",
"java",
".",
"lang",
".",
"String",
"secret",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"SECRET",
".",
"getFieldName",
"(",
")",
",",
"... | query-by method for field secret
@param secret the specified attribute
@return an Iterable of DConnections for the specified secret | [
"query",
"-",
"by",
"method",
"for",
"field",
"secret"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L142-L144 |
facebookarchive/hadoop-20 | src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java | HadoopLocationWizard.createConfCheckButton | private Button createConfCheckButton(SelectionListener listener,
Composite parent, ConfProp prop, String text) {
Button button = new Button(parent, SWT.CHECK);
button.setText(text);
button.setData("hProp", prop);
button.setSelection(location.getConfProp(prop).equalsIgnoreCase("yes"));
button.addSelectionListener(listener);
return button;
} | java | private Button createConfCheckButton(SelectionListener listener,
Composite parent, ConfProp prop, String text) {
Button button = new Button(parent, SWT.CHECK);
button.setText(text);
button.setData("hProp", prop);
button.setSelection(location.getConfProp(prop).equalsIgnoreCase("yes"));
button.addSelectionListener(listener);
return button;
} | [
"private",
"Button",
"createConfCheckButton",
"(",
"SelectionListener",
"listener",
",",
"Composite",
"parent",
",",
"ConfProp",
"prop",
",",
"String",
"text",
")",
"{",
"Button",
"button",
"=",
"new",
"Button",
"(",
"parent",
",",
"SWT",
".",
"CHECK",
")",
... | Create a SWT Checked Button component for the given {@link ConfProp}
boolean configuration property.
@param listener
@param parent
@param prop
@return | [
"Create",
"a",
"SWT",
"Checked",
"Button",
"component",
"for",
"the",
"given",
"{",
"@link",
"ConfProp",
"}",
"boolean",
"configuration",
"property",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java#L518-L528 |
h2oai/h2o-3 | h2o-core/src/main/java/water/api/RequestServer.java | RequestServer.maybeLogRequest | private static boolean maybeLogRequest(RequestUri uri, Properties header, Properties parms) {
LogFilterLevel level = LogFilterLevel.LOG;
for (HttpLogFilter f : _filters)
level = level.reduce(f.filter(uri, header, parms));
switch (level) {
case DO_NOT_LOG:
return false; // do not log the request by default but allow parameters to be logged on exceptional completion
case URL_ONLY:
Log.info(uri, ", parms: <hidden>");
return true; // parameters are sensitive - never log them
default:
Log.info(uri + ", parms: " + parms);
return false;
}
} | java | private static boolean maybeLogRequest(RequestUri uri, Properties header, Properties parms) {
LogFilterLevel level = LogFilterLevel.LOG;
for (HttpLogFilter f : _filters)
level = level.reduce(f.filter(uri, header, parms));
switch (level) {
case DO_NOT_LOG:
return false; // do not log the request by default but allow parameters to be logged on exceptional completion
case URL_ONLY:
Log.info(uri, ", parms: <hidden>");
return true; // parameters are sensitive - never log them
default:
Log.info(uri + ", parms: " + parms);
return false;
}
} | [
"private",
"static",
"boolean",
"maybeLogRequest",
"(",
"RequestUri",
"uri",
",",
"Properties",
"header",
",",
"Properties",
"parms",
")",
"{",
"LogFilterLevel",
"level",
"=",
"LogFilterLevel",
".",
"LOG",
";",
"for",
"(",
"HttpLogFilter",
"f",
":",
"_filters",
... | Log the request (unless it's an overly common one).
@return flag whether the request parameters might be sensitive or not | [
"Log",
"the",
"request",
"(",
"unless",
"it",
"s",
"an",
"overly",
"common",
"one",
")",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/RequestServer.java#L532-L546 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/Enforcer.java | Enforcer.deletePermissionForUser | public boolean deletePermissionForUser(String user, String... permission) {
List<String> params = new ArrayList<>();
params.add(user);
Collections.addAll(params, permission);
return removePolicy(params);
} | java | public boolean deletePermissionForUser(String user, String... permission) {
List<String> params = new ArrayList<>();
params.add(user);
Collections.addAll(params, permission);
return removePolicy(params);
} | [
"public",
"boolean",
"deletePermissionForUser",
"(",
"String",
"user",
",",
"String",
"...",
"permission",
")",
"{",
"List",
"<",
"String",
">",
"params",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"params",
".",
"add",
"(",
"user",
")",
";",
"Collect... | deletePermissionForUser deletes a permission for a user or role.
Returns false if the user or role does not have the permission (aka not affected).
@param user the user.
@param permission the permission, usually be (obj, act). It is actually the rule without the subject.
@return succeeds or not. | [
"deletePermissionForUser",
"deletes",
"a",
"permission",
"for",
"a",
"user",
"or",
"role",
".",
"Returns",
"false",
"if",
"the",
"user",
"or",
"role",
"does",
"not",
"have",
"the",
"permission",
"(",
"aka",
"not",
"affected",
")",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L280-L287 |
zxing/zxing | core/src/main/java/com/google/zxing/pdf417/PDF417Writer.java | PDF417Writer.bitMatrixFromEncoder | private static BitMatrix bitMatrixFromEncoder(PDF417 encoder,
String contents,
int errorCorrectionLevel,
int width,
int height,
int margin) throws WriterException {
encoder.generateBarcodeLogic(contents, errorCorrectionLevel);
int aspectRatio = 4;
byte[][] originalScale = encoder.getBarcodeMatrix().getScaledMatrix(1, aspectRatio);
boolean rotated = false;
if ((height > width) != (originalScale[0].length < originalScale.length)) {
originalScale = rotateArray(originalScale);
rotated = true;
}
int scaleX = width / originalScale[0].length;
int scaleY = height / originalScale.length;
int scale;
if (scaleX < scaleY) {
scale = scaleX;
} else {
scale = scaleY;
}
if (scale > 1) {
byte[][] scaledMatrix =
encoder.getBarcodeMatrix().getScaledMatrix(scale, scale * aspectRatio);
if (rotated) {
scaledMatrix = rotateArray(scaledMatrix);
}
return bitMatrixFromBitArray(scaledMatrix, margin);
}
return bitMatrixFromBitArray(originalScale, margin);
} | java | private static BitMatrix bitMatrixFromEncoder(PDF417 encoder,
String contents,
int errorCorrectionLevel,
int width,
int height,
int margin) throws WriterException {
encoder.generateBarcodeLogic(contents, errorCorrectionLevel);
int aspectRatio = 4;
byte[][] originalScale = encoder.getBarcodeMatrix().getScaledMatrix(1, aspectRatio);
boolean rotated = false;
if ((height > width) != (originalScale[0].length < originalScale.length)) {
originalScale = rotateArray(originalScale);
rotated = true;
}
int scaleX = width / originalScale[0].length;
int scaleY = height / originalScale.length;
int scale;
if (scaleX < scaleY) {
scale = scaleX;
} else {
scale = scaleY;
}
if (scale > 1) {
byte[][] scaledMatrix =
encoder.getBarcodeMatrix().getScaledMatrix(scale, scale * aspectRatio);
if (rotated) {
scaledMatrix = rotateArray(scaledMatrix);
}
return bitMatrixFromBitArray(scaledMatrix, margin);
}
return bitMatrixFromBitArray(originalScale, margin);
} | [
"private",
"static",
"BitMatrix",
"bitMatrixFromEncoder",
"(",
"PDF417",
"encoder",
",",
"String",
"contents",
",",
"int",
"errorCorrectionLevel",
",",
"int",
"width",
",",
"int",
"height",
",",
"int",
"margin",
")",
"throws",
"WriterException",
"{",
"encoder",
... | Takes encoder, accounts for width/height, and retrieves bit matrix | [
"Takes",
"encoder",
"accounts",
"for",
"width",
"/",
"height",
"and",
"retrieves",
"bit",
"matrix"
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/PDF417Writer.java#L101-L136 |
sarxos/webcam-capture | webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java | Webcam.getWebcams | public static List<Webcam> getWebcams(long timeout) throws TimeoutException, WebcamException {
if (timeout < 0) {
throw new IllegalArgumentException(String.format("Timeout cannot be negative (%d)", timeout));
}
return getWebcams(timeout, TimeUnit.MILLISECONDS);
} | java | public static List<Webcam> getWebcams(long timeout) throws TimeoutException, WebcamException {
if (timeout < 0) {
throw new IllegalArgumentException(String.format("Timeout cannot be negative (%d)", timeout));
}
return getWebcams(timeout, TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"List",
"<",
"Webcam",
">",
"getWebcams",
"(",
"long",
"timeout",
")",
"throws",
"TimeoutException",
",",
"WebcamException",
"{",
"if",
"(",
"timeout",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"f... | Get list of webcams to use. This method will wait given time interval for webcam devices to
be discovered. Time argument is given in milliseconds.
@param timeout the time to wait for webcam devices to be discovered
@return List of webcams existing in the ssytem
@throws TimeoutException when timeout occurs
@throws WebcamException when something is wrong
@throws IllegalArgumentException when timeout is negative
@see Webcam#getWebcams(long, TimeUnit) | [
"Get",
"list",
"of",
"webcams",
"to",
"use",
".",
"This",
"method",
"will",
"wait",
"given",
"time",
"interval",
"for",
"webcam",
"devices",
"to",
"be",
"discovered",
".",
"Time",
"argument",
"is",
"given",
"in",
"milliseconds",
"."
] | train | https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java#L862-L867 |
operasoftware/operaprestodriver | src/com/opera/core/systems/arguments/OperaArgument.java | OperaArgument.hasSwitch | private static Boolean hasSwitch(String key, String sign) {
return (key.length() > sign.length()) && key.substring(0, sign.length()).equals(sign);
} | java | private static Boolean hasSwitch(String key, String sign) {
return (key.length() > sign.length()) && key.substring(0, sign.length()).equals(sign);
} | [
"private",
"static",
"Boolean",
"hasSwitch",
"(",
"String",
"key",
",",
"String",
"sign",
")",
"{",
"return",
"(",
"key",
".",
"length",
"(",
")",
">",
"sign",
".",
"length",
"(",
")",
")",
"&&",
"key",
".",
"substring",
"(",
"0",
",",
"sign",
".",... | Determines whether given argument key contains given argument sign.
@param key the argument key to check
@param sign the sign to check for
@return true if key contains sign as first characters, false otherwise
@see OperaArgumentSign | [
"Determines",
"whether",
"given",
"argument",
"key",
"contains",
"given",
"argument",
"sign",
"."
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/arguments/OperaArgument.java#L137-L139 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/SupportSimpleAlertDialogFragment.java | SupportSimpleAlertDialogFragment.newInstance | public static SupportSimpleAlertDialogFragment newInstance(int titleResId, int messageResId) {
SupportSimpleAlertDialogFragment fragment = new SupportSimpleAlertDialogFragment();
Bundle args = new Bundle();
args.putInt(ARGS_MESSAGE_RES, messageResId);
args.putInt(ARGS_TITLE_RES, titleResId);
fragment.setArguments(args);
return fragment;
} | java | public static SupportSimpleAlertDialogFragment newInstance(int titleResId, int messageResId) {
SupportSimpleAlertDialogFragment fragment = new SupportSimpleAlertDialogFragment();
Bundle args = new Bundle();
args.putInt(ARGS_MESSAGE_RES, messageResId);
args.putInt(ARGS_TITLE_RES, titleResId);
fragment.setArguments(args);
return fragment;
} | [
"public",
"static",
"SupportSimpleAlertDialogFragment",
"newInstance",
"(",
"int",
"titleResId",
",",
"int",
"messageResId",
")",
"{",
"SupportSimpleAlertDialogFragment",
"fragment",
"=",
"new",
"SupportSimpleAlertDialogFragment",
"(",
")",
";",
"Bundle",
"args",
"=",
"... | Construct {@link com.amalgam.app.SupportSimpleAlertDialogFragment} with the specified message and title resource.
@param titleResId to show as an alert dialog title.
@param messageResId to show on alert dialog
@return simplified alert dialog fragment. | [
"Construct",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/SupportSimpleAlertDialogFragment.java#L58-L65 |
milaboratory/milib | src/main/java/com/milaboratory/util/HashFunctions.java | HashFunctions.MurmurHash2 | public static int MurmurHash2(int c, int seed) {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
int m = 0x5bd1e995;
// Initialize the hash to a 'random' value
int h = seed ^ 4;
c *= m;
c ^= c >>> 24;
c *= m;
h *= m;
h ^= c;
h ^= h >>> 13;
h *= m;
h ^= h >>> 15;
return h;
} | java | public static int MurmurHash2(int c, int seed) {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
int m = 0x5bd1e995;
// Initialize the hash to a 'random' value
int h = seed ^ 4;
c *= m;
c ^= c >>> 24;
c *= m;
h *= m;
h ^= c;
h ^= h >>> 13;
h *= m;
h ^= h >>> 15;
return h;
} | [
"public",
"static",
"int",
"MurmurHash2",
"(",
"int",
"c",
",",
"int",
"seed",
")",
"{",
"// 'm' and 'r' are mixing constants generated offline.",
"// They're not really 'magic', they just happen to work well.",
"int",
"m",
"=",
"0x5bd1e995",
";",
"// Initialize the hash to a '... | MurmurHash hash function integer. <p/> <h3>Links</h3> <a href="http://sites.google.com/site/murmurhash/">http://sites.google.com/site/murmurhash/</a><br/>
<a href="http://dmy999.com/article/50/murmurhash-2-java-port">http://dmy999.com/article/50/murmurhash-2-java-port</a><br/>
<a href="http://en.wikipedia.org/wiki/MurmurHash">http://en.wikipedia.org/wiki/MurmurHash</a><br/>
@param c int to be hashed
@param seed seed parameter
@return 32 bit hash | [
"MurmurHash",
"hash",
"function",
"integer",
".",
"<p",
"/",
">",
"<h3",
">",
"Links<",
"/",
"h3",
">",
"<a",
"href",
"=",
"http",
":",
"//",
"sites",
".",
"google",
".",
"com",
"/",
"site",
"/",
"murmurhash",
"/",
">",
"http",
":",
"//",
"sites",
... | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/util/HashFunctions.java#L397-L412 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/sc/scparameter.java | scparameter.get | public static scparameter get(nitro_service service, options option) throws Exception{
scparameter obj = new scparameter();
scparameter[] response = (scparameter[])obj.get_resources(service,option);
return response[0];
} | java | public static scparameter get(nitro_service service, options option) throws Exception{
scparameter obj = new scparameter();
scparameter[] response = (scparameter[])obj.get_resources(service,option);
return response[0];
} | [
"public",
"static",
"scparameter",
"get",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"scparameter",
"obj",
"=",
"new",
"scparameter",
"(",
")",
";",
"scparameter",
"[",
"]",
"response",
"=",
"(",
"scparameter",
... | Use this API to fetch all the scparameter resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"scparameter",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/sc/scparameter.java#L150-L154 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/IronjacamarXmlGen.java | IronjacamarXmlGen.getPropsString | private void getPropsString(StringBuilder strProps, List<ConfigPropType> propsList, int indent)
{
for (ConfigPropType props : propsList)
{
for (int i = 0; i < indent; i++)
strProps.append(" ");
strProps.append("<config-property name=\"");
strProps.append(props.getName());
strProps.append("\">");
strProps.append(props.getValue());
strProps.append("</config-property>");
strProps.append("\n");
}
} | java | private void getPropsString(StringBuilder strProps, List<ConfigPropType> propsList, int indent)
{
for (ConfigPropType props : propsList)
{
for (int i = 0; i < indent; i++)
strProps.append(" ");
strProps.append("<config-property name=\"");
strProps.append(props.getName());
strProps.append("\">");
strProps.append(props.getValue());
strProps.append("</config-property>");
strProps.append("\n");
}
} | [
"private",
"void",
"getPropsString",
"(",
"StringBuilder",
"strProps",
",",
"List",
"<",
"ConfigPropType",
">",
"propsList",
",",
"int",
"indent",
")",
"{",
"for",
"(",
"ConfigPropType",
"props",
":",
"propsList",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0"... | generate properties String
@param strProps the string property
@param propsList the properties list
@param indent how much indent | [
"generate",
"properties",
"String"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/IronjacamarXmlGen.java#L140-L153 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java | FactoryKernel.random1D_I32 | public static Kernel1D_S32 random1D_I32(int width , int offset, int min, int max, Random rand) {
Kernel1D_S32 ret = new Kernel1D_S32(width,offset);
int range = max - min;
for (int i = 0; i < ret.data.length; i++) {
ret.data[i] = rand.nextInt(range) + min;
}
return ret;
} | java | public static Kernel1D_S32 random1D_I32(int width , int offset, int min, int max, Random rand) {
Kernel1D_S32 ret = new Kernel1D_S32(width,offset);
int range = max - min;
for (int i = 0; i < ret.data.length; i++) {
ret.data[i] = rand.nextInt(range) + min;
}
return ret;
} | [
"public",
"static",
"Kernel1D_S32",
"random1D_I32",
"(",
"int",
"width",
",",
"int",
"offset",
",",
"int",
"min",
",",
"int",
"max",
",",
"Random",
"rand",
")",
"{",
"Kernel1D_S32",
"ret",
"=",
"new",
"Kernel1D_S32",
"(",
"width",
",",
"offset",
")",
";"... | Creates a random 1D kernel drawn from a uniform distribution.
@param width Kernel's width.
@param offset Offset for element zero in the kernel
@param min minimum value.
@param max maximum value.
@param rand Random number generator.
@return Randomized kernel. | [
"Creates",
"a",
"random",
"1D",
"kernel",
"drawn",
"from",
"a",
"uniform",
"distribution",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java#L223-L232 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.releaseLock | public void releaseLock (final NodeObject.Lock lock, final ResultListener<String> listener)
{
// wait until any pending resolution is complete
queryLock(lock, new ChainedResultListener<String, String>(listener) {
public void requestCompleted (String result) {
if (Objects.equal(_nodeName, result)) {
if (_suboids.isEmpty()) {
lockReleased(lock, listener);
} else {
_locks.put(lock, new LockHandler(lock, false, listener));
}
} else {
if (result != null) {
log.warning("Tried to release lock held by another peer", "lock", lock,
"owner", result);
}
listener.requestCompleted(result);
}
}
});
} | java | public void releaseLock (final NodeObject.Lock lock, final ResultListener<String> listener)
{
// wait until any pending resolution is complete
queryLock(lock, new ChainedResultListener<String, String>(listener) {
public void requestCompleted (String result) {
if (Objects.equal(_nodeName, result)) {
if (_suboids.isEmpty()) {
lockReleased(lock, listener);
} else {
_locks.put(lock, new LockHandler(lock, false, listener));
}
} else {
if (result != null) {
log.warning("Tried to release lock held by another peer", "lock", lock,
"owner", result);
}
listener.requestCompleted(result);
}
}
});
} | [
"public",
"void",
"releaseLock",
"(",
"final",
"NodeObject",
".",
"Lock",
"lock",
",",
"final",
"ResultListener",
"<",
"String",
">",
"listener",
")",
"{",
"// wait until any pending resolution is complete",
"queryLock",
"(",
"lock",
",",
"new",
"ChainedResultListener... | Releases a lock. This can be cancelled using {@link #reacquireLock}, in which case the
passed listener will receive this node's name as opposed to <code>null</code>, which
signifies that the lock has been successfully released. | [
"Releases",
"a",
"lock",
".",
"This",
"can",
"be",
"cancelled",
"using",
"{"
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L822-L842 |
litsec/swedish-eid-shibboleth-base | shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/controller/AbstractExternalAuthenticationController.java | AbstractExternalAuthenticationController.getPrincipalSelection | protected PrincipalSelection getPrincipalSelection(ProfileRequestContext<?, ?> context) {
final AuthnRequest authnRequest = this.getAuthnRequest(context);
if (authnRequest != null && authnRequest.getExtensions() != null) {
return authnRequest.getExtensions()
.getUnknownXMLObjects()
.stream()
.filter(PrincipalSelection.class::isInstance)
.map(PrincipalSelection.class::cast)
.findFirst()
.orElse(null);
}
return null;
} | java | protected PrincipalSelection getPrincipalSelection(ProfileRequestContext<?, ?> context) {
final AuthnRequest authnRequest = this.getAuthnRequest(context);
if (authnRequest != null && authnRequest.getExtensions() != null) {
return authnRequest.getExtensions()
.getUnknownXMLObjects()
.stream()
.filter(PrincipalSelection.class::isInstance)
.map(PrincipalSelection.class::cast)
.findFirst()
.orElse(null);
}
return null;
} | [
"protected",
"PrincipalSelection",
"getPrincipalSelection",
"(",
"ProfileRequestContext",
"<",
"?",
",",
"?",
">",
"context",
")",
"{",
"final",
"AuthnRequest",
"authnRequest",
"=",
"this",
".",
"getAuthnRequest",
"(",
"context",
")",
";",
"if",
"(",
"authnRequest... | Utility method that may be used to obtain the {@link PrincipalSelection} extension that may be received in an
{@code AuthnRequest}.
@param context
the profile context
@return the {@code PrincipalSelection} extension, or {@code null} if none is found in the current
{@code AuthnRequest} | [
"Utility",
"method",
"that",
"may",
"be",
"used",
"to",
"obtain",
"the",
"{",
"@link",
"PrincipalSelection",
"}",
"extension",
"that",
"may",
"be",
"received",
"in",
"an",
"{",
"@code",
"AuthnRequest",
"}",
"."
] | train | https://github.com/litsec/swedish-eid-shibboleth-base/blob/aaaa467ff61f07d7dfa31627fb36851a37da6804/shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/controller/AbstractExternalAuthenticationController.java#L555-L567 |
rometools/rome | rome/src/main/java/com/rometools/rome/io/impl/NumberParser.java | NumberParser.parseLong | public static long parseLong(final String str, final long def) {
final Long ret = parseLong(str);
if (ret == null) {
return def;
} else {
return ret.longValue();
}
} | java | public static long parseLong(final String str, final long def) {
final Long ret = parseLong(str);
if (ret == null) {
return def;
} else {
return ret.longValue();
}
} | [
"public",
"static",
"long",
"parseLong",
"(",
"final",
"String",
"str",
",",
"final",
"long",
"def",
")",
"{",
"final",
"Long",
"ret",
"=",
"parseLong",
"(",
"str",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"return",
"def",
";",
"}",
"els... | Parses a long out of a string.
@param str string to parse for a long.
@param def default value to return if it is not possible to parse the the string.
@return the long represented by the given string, or the default. | [
"Parses",
"a",
"long",
"out",
"of",
"a",
"string",
"."
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/NumberParser.java#L111-L118 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgObject.java | DwgObject.readObjectHeaderV15 | public int readObjectHeaderV15(int[] data, int offset) throws Exception {
int bitPos = offset;
Integer mode = (Integer)DwgUtil.getBits(data, 2, bitPos);
bitPos = bitPos + 2;
setMode(mode.intValue());
Vector v = DwgUtil.getBitLong(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int rnum = ((Integer)v.get(1)).intValue();
setNumReactors(rnum);
v = DwgUtil.testBit(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
boolean nolinks = ((Boolean)v.get(1)).booleanValue();
setNoLinks(nolinks);
v = DwgUtil.getBitShort(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int color = ((Integer)v.get(1)).intValue();
setColor(color);
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
float ltscale = ((Double)v.get(1)).floatValue();
Integer ltflag = (Integer)DwgUtil.getBits(data, 2, bitPos);
bitPos = bitPos + 2;
Integer psflag = (Integer)DwgUtil.getBits(data, 2, bitPos);
bitPos = bitPos + 2;
v = DwgUtil.getBitShort(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int invis = ((Integer)v.get(1)).intValue();
v = DwgUtil.getRawChar(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int weight = ((Integer)v.get(1)).intValue();
return bitPos;
} | java | public int readObjectHeaderV15(int[] data, int offset) throws Exception {
int bitPos = offset;
Integer mode = (Integer)DwgUtil.getBits(data, 2, bitPos);
bitPos = bitPos + 2;
setMode(mode.intValue());
Vector v = DwgUtil.getBitLong(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int rnum = ((Integer)v.get(1)).intValue();
setNumReactors(rnum);
v = DwgUtil.testBit(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
boolean nolinks = ((Boolean)v.get(1)).booleanValue();
setNoLinks(nolinks);
v = DwgUtil.getBitShort(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int color = ((Integer)v.get(1)).intValue();
setColor(color);
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
float ltscale = ((Double)v.get(1)).floatValue();
Integer ltflag = (Integer)DwgUtil.getBits(data, 2, bitPos);
bitPos = bitPos + 2;
Integer psflag = (Integer)DwgUtil.getBits(data, 2, bitPos);
bitPos = bitPos + 2;
v = DwgUtil.getBitShort(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int invis = ((Integer)v.get(1)).intValue();
v = DwgUtil.getRawChar(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int weight = ((Integer)v.get(1)).intValue();
return bitPos;
} | [
"public",
"int",
"readObjectHeaderV15",
"(",
"int",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"throws",
"Exception",
"{",
"int",
"bitPos",
"=",
"offset",
";",
"Integer",
"mode",
"=",
"(",
"Integer",
")",
"DwgUtil",
".",
"getBits",
"(",
"data",
",",
... | Reads the header of an object in a DWG file Version 15
@param data Array of unsigned bytes obtained from the DWG binary file
@param offset The current bit offset where the value begins
@return int New offset
@throws Exception If an unexpected bit value is found in the DWG file. Occurs
when we are looking for LwPolylines. | [
"Reads",
"the",
"header",
"of",
"an",
"object",
"in",
"a",
"DWG",
"file",
"Version",
"15"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgObject.java#L56-L87 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/FTPClient.java | FTPClient.asynchPut | public TransferState asynchPut(String remoteFileName,
DataSource source,
MarkerListener mListener)
throws IOException, ServerException, ClientException {
return asynchPut(remoteFileName, source, mListener, false);
} | java | public TransferState asynchPut(String remoteFileName,
DataSource source,
MarkerListener mListener)
throws IOException, ServerException, ClientException {
return asynchPut(remoteFileName, source, mListener, false);
} | [
"public",
"TransferState",
"asynchPut",
"(",
"String",
"remoteFileName",
",",
"DataSource",
"source",
",",
"MarkerListener",
"mListener",
")",
"throws",
"IOException",
",",
"ServerException",
",",
"ClientException",
"{",
"return",
"asynchPut",
"(",
"remoteFileName",
"... | Stores file at the remote server.
@param remoteFileName remote file name
@param source data will be read from here
@param mListener restart marker listener (currently not used) | [
"Stores",
"file",
"at",
"the",
"remote",
"server",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L1319-L1324 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java | TaskOperations.updateTask | public void updateTask(String jobId, String taskId, TaskConstraints constraints)
throws BatchErrorException, IOException {
updateTask(jobId, taskId, constraints, null);
} | java | public void updateTask(String jobId, String taskId, TaskConstraints constraints)
throws BatchErrorException, IOException {
updateTask(jobId, taskId, constraints, null);
} | [
"public",
"void",
"updateTask",
"(",
"String",
"jobId",
",",
"String",
"taskId",
",",
"TaskConstraints",
"constraints",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"updateTask",
"(",
"jobId",
",",
"taskId",
",",
"constraints",
",",
"null",
")"... | Updates the specified task.
@param jobId
The ID of the job containing the task.
@param taskId
The ID of the task.
@param constraints
Constraints that apply to this task. If null, the task is given
the default constraints.
@throws BatchErrorException
Exception thrown when an error response is received from the
Batch service.
@throws IOException
Exception thrown when there is an error in
serialization/deserialization of data sent to/received from the
Batch service. | [
"Updates",
"the",
"specified",
"task",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java#L679-L682 |
actorapp/actor-platform | actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java | MarkdownParser.isGoodAnchor | private boolean isGoodAnchor(String text, int index) {
// Check if there is space and punctuation mark after block
String punct = " .,:!?\t\n";
if (index >= 0 && index < text.length()) {
if (punct.indexOf(text.charAt(index)) == -1) {
return false;
}
}
return true;
} | java | private boolean isGoodAnchor(String text, int index) {
// Check if there is space and punctuation mark after block
String punct = " .,:!?\t\n";
if (index >= 0 && index < text.length()) {
if (punct.indexOf(text.charAt(index)) == -1) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"isGoodAnchor",
"(",
"String",
"text",
",",
"int",
"index",
")",
"{",
"// Check if there is space and punctuation mark after block",
"String",
"punct",
"=",
"\" .,:!?\\t\\n\"",
";",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"text",
"... | Test if symbol at index is space or out of string bounds
@param text text
@param index char to test
@return is good anchor | [
"Test",
"if",
"symbol",
"at",
"index",
"is",
"space",
"or",
"out",
"of",
"string",
"bounds"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java#L376-L386 |
jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java | IdDt.withServerBase | @Override
public IdDt withServerBase(String theServerBase, String theResourceType) {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(theServerBase, theResourceType, getIdPart(), getVersionIdPart());
} | java | @Override
public IdDt withServerBase(String theServerBase, String theResourceType) {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(theServerBase, theResourceType, getIdPart(), getVersionIdPart());
} | [
"@",
"Override",
"public",
"IdDt",
"withServerBase",
"(",
"String",
"theServerBase",
",",
"String",
"theResourceType",
")",
"{",
"if",
"(",
"isLocal",
"(",
")",
"||",
"isUrn",
"(",
")",
")",
"{",
"return",
"new",
"IdDt",
"(",
"getValueAsString",
"(",
")",
... | Returns a view of this ID as a fully qualified URL, given a server base and resource name (which will only be used if the ID does not already contain those respective parts). Essentially,
because IdDt can contain either a complete URL or a partial one (or even jut a simple ID), this method may be used to translate into a complete URL.
@param theServerBase The server base (e.g. "http://example.com/fhir")
@param theResourceType The resource name (e.g. "Patient")
@return A fully qualified URL for this ID (e.g. "http://example.com/fhir/Patient/1") | [
"Returns",
"a",
"view",
"of",
"this",
"ID",
"as",
"a",
"fully",
"qualified",
"URL",
"given",
"a",
"server",
"base",
"and",
"resource",
"name",
"(",
"which",
"will",
"only",
"be",
"used",
"if",
"the",
"ID",
"does",
"not",
"already",
"contain",
"those",
... | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java#L611-L617 |
bekkopen/NoCommons | src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerValidator.java | OrganisasjonsnummerValidator.isValid | public boolean isValid(String organisasjonsnummer, ConstraintValidatorContext context) {
if(organisasjonsnummer == null){
return true;
}
return isValid(organisasjonsnummer);
} | java | public boolean isValid(String organisasjonsnummer, ConstraintValidatorContext context) {
if(organisasjonsnummer == null){
return true;
}
return isValid(organisasjonsnummer);
} | [
"public",
"boolean",
"isValid",
"(",
"String",
"organisasjonsnummer",
",",
"ConstraintValidatorContext",
"context",
")",
"{",
"if",
"(",
"organisasjonsnummer",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"return",
"isValid",
"(",
"organisasjonsnummer",
")"... | Validation method used by a JSR303 validator. Normally it is better to call the static methods directly.
@param organisasjonsnummer
The organisasjonsnummer to be validated
@param context
context sent in by a validator
@return boolean
whether or not the given organisasjonsnummer is valid | [
"Validation",
"method",
"used",
"by",
"a",
"JSR303",
"validator",
".",
"Normally",
"it",
"is",
"better",
"to",
"call",
"the",
"static",
"methods",
"directly",
"."
] | train | https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerValidator.java#L107-L113 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.deleteTagAsync | public Observable<Void> deleteTagAsync(UUID projectId, UUID tagId) {
return deleteTagWithServiceResponseAsync(projectId, tagId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteTagAsync(UUID projectId, UUID tagId) {
return deleteTagWithServiceResponseAsync(projectId, tagId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteTagAsync",
"(",
"UUID",
"projectId",
",",
"UUID",
"tagId",
")",
"{",
"return",
"deleteTagWithServiceResponseAsync",
"(",
"projectId",
",",
"tagId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"... | Delete a tag from the project.
@param projectId The project id
@param tagId Id of the tag to be deleted
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Delete",
"a",
"tag",
"from",
"the",
"project",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L717-L724 |
pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java | StreamMetrics.createStreamFailed | public void createStreamFailed(String scope, String streamName) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_STREAM_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_STREAM_FAILED, 1, streamTags(scope, streamName));
} | java | public void createStreamFailed(String scope, String streamName) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_STREAM_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_STREAM_FAILED, 1, streamTags(scope, streamName));
} | [
"public",
"void",
"createStreamFailed",
"(",
"String",
"scope",
",",
"String",
"streamName",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"CREATE_STREAM_FAILED",
")",
",",
"1",
")",
";",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
... | This method increments the global counter of failed Stream creations in the system as well as the failed creation
attempts for this specific Stream.
@param scope Scope.
@param streamName Name of the Stream. | [
"This",
"method",
"increments",
"the",
"global",
"counter",
"of",
"failed",
"Stream",
"creations",
"in",
"the",
"system",
"as",
"well",
"as",
"the",
"failed",
"creation",
"attempts",
"for",
"this",
"specific",
"Stream",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java#L75-L78 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_mailingList_POST | public OvhTask organizationName_service_exchangeService_mailingList_POST(String organizationName, String exchangeService, OvhMailingListDepartRestrictionEnum departRestriction, String displayName, Boolean hiddenFromGAL, OvhMailingListJoinRestrictionEnum joinRestriction, String mailingListAddress, Long maxReceiveSize, Long maxSendSize, Boolean senderAuthentification) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "departRestriction", departRestriction);
addBody(o, "displayName", displayName);
addBody(o, "hiddenFromGAL", hiddenFromGAL);
addBody(o, "joinRestriction", joinRestriction);
addBody(o, "mailingListAddress", mailingListAddress);
addBody(o, "maxReceiveSize", maxReceiveSize);
addBody(o, "maxSendSize", maxSendSize);
addBody(o, "senderAuthentification", senderAuthentification);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask organizationName_service_exchangeService_mailingList_POST(String organizationName, String exchangeService, OvhMailingListDepartRestrictionEnum departRestriction, String displayName, Boolean hiddenFromGAL, OvhMailingListJoinRestrictionEnum joinRestriction, String mailingListAddress, Long maxReceiveSize, Long maxSendSize, Boolean senderAuthentification) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "departRestriction", departRestriction);
addBody(o, "displayName", displayName);
addBody(o, "hiddenFromGAL", hiddenFromGAL);
addBody(o, "joinRestriction", joinRestriction);
addBody(o, "mailingListAddress", mailingListAddress);
addBody(o, "maxReceiveSize", maxReceiveSize);
addBody(o, "maxSendSize", maxSendSize);
addBody(o, "senderAuthentification", senderAuthentification);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"organizationName_service_exchangeService_mailingList_POST",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"OvhMailingListDepartRestrictionEnum",
"departRestriction",
",",
"String",
"displayName",
",",
"Boolean",
"hiddenFromGAL",
"... | Add mailing list
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/mailingList
@param senderAuthentification [required] If true sender has to authenticate
@param hiddenFromGAL [required] If true mailing list is hiddend in Global Address List
@param departRestriction [required] Depart restriction policy
@param maxSendSize [required] Maximum send email size in MB
@param joinRestriction [required] Join restriction policy
@param mailingListAddress [required] The mailing list address
@param maxReceiveSize [required] Maximum receive email size in MB
@param displayName [required] Name displayed in Global Access List
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Add",
"mailing",
"list"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1522-L1536 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/lang/ExcelDateUtils.java | ExcelDateUtils.parseDate | public static Date parseDate(final String str) {
ArgUtils.notEmpty(str, str);
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
format.setTimeZone(TimeZone.getTimeZone("GMT-00:00"));
return format.parse(str);
} catch (ParseException e) {
throw new IllegalStateException(String.format("fail parse to Data from '%s',", str), e);
}
} | java | public static Date parseDate(final String str) {
ArgUtils.notEmpty(str, str);
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
format.setTimeZone(TimeZone.getTimeZone("GMT-00:00"));
return format.parse(str);
} catch (ParseException e) {
throw new IllegalStateException(String.format("fail parse to Data from '%s',", str), e);
}
} | [
"public",
"static",
"Date",
"parseDate",
"(",
"final",
"String",
"str",
")",
"{",
"ArgUtils",
".",
"notEmpty",
"(",
"str",
",",
"str",
")",
";",
"try",
"{",
"SimpleDateFormat",
"format",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd HH:mm:ss.SSS\"",
")",
... | 文字列を日時形式を{@literal yyyy-MM-dd HH:mm:ss.SSS}のパースする。
<p>ただし、タイムゾーンは、標準時間の{@literal GMT-00:00}で処理する。
@param str パース対象の文字列
@return パースした日付。
@throws IllegalArgumentException str is empty.
@throws IllegalStateException fail parsing. | [
"文字列を日時形式を",
"{"
] | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/lang/ExcelDateUtils.java#L196-L207 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/channels/MediaChannel.java | MediaChannel.enableDTLS | public void enableDTLS(String hashFunction, String remoteFingerprint) {
if (!this.dtls) {
this.rtpChannel.enableSRTP(hashFunction, remoteFingerprint);
if (!this.rtcpMux) {
rtcpChannel.enableSRTCP(hashFunction, remoteFingerprint);
}
this.dtls = true;
if (logger.isDebugEnabled()) {
logger.debug(this.mediaType + " channel " + this.ssrc + " enabled DTLS");
}
}
} | java | public void enableDTLS(String hashFunction, String remoteFingerprint) {
if (!this.dtls) {
this.rtpChannel.enableSRTP(hashFunction, remoteFingerprint);
if (!this.rtcpMux) {
rtcpChannel.enableSRTCP(hashFunction, remoteFingerprint);
}
this.dtls = true;
if (logger.isDebugEnabled()) {
logger.debug(this.mediaType + " channel " + this.ssrc + " enabled DTLS");
}
}
} | [
"public",
"void",
"enableDTLS",
"(",
"String",
"hashFunction",
",",
"String",
"remoteFingerprint",
")",
"{",
"if",
"(",
"!",
"this",
".",
"dtls",
")",
"{",
"this",
".",
"rtpChannel",
".",
"enableSRTP",
"(",
"hashFunction",
",",
"remoteFingerprint",
")",
";",... | Enables DTLS on the channel. RTP and RTCP packets flowing through this
channel will be secured.
<p>
This method is used in <b>inbound</b> calls where the remote fingerprint is known.
</p>
@param remoteFingerprint
The DTLS finger print of the remote peer. | [
"Enables",
"DTLS",
"on",
"the",
"channel",
".",
"RTP",
"and",
"RTCP",
"packets",
"flowing",
"through",
"this",
"channel",
"will",
"be",
"secured",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/channels/MediaChannel.java#L801-L813 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/ValidationUtils.java | ValidationUtils.assertAllAreNull | public static void assertAllAreNull(String messageIfNull, Object... objects) throws IllegalArgumentException {
for (Object object : objects) {
if (object != null) {
throw new IllegalArgumentException(messageIfNull);
}
}
} | java | public static void assertAllAreNull(String messageIfNull, Object... objects) throws IllegalArgumentException {
for (Object object : objects) {
if (object != null) {
throw new IllegalArgumentException(messageIfNull);
}
}
} | [
"public",
"static",
"void",
"assertAllAreNull",
"(",
"String",
"messageIfNull",
",",
"Object",
"...",
"objects",
")",
"throws",
"IllegalArgumentException",
"{",
"for",
"(",
"Object",
"object",
":",
"objects",
")",
"{",
"if",
"(",
"object",
"!=",
"null",
")",
... | Asserts that all of the objects are null.
@throws IllegalArgumentException
if any object provided was NOT null. | [
"Asserts",
"that",
"all",
"of",
"the",
"objects",
"are",
"null",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/ValidationUtils.java#L48-L54 |
coopernurse/barrister-java | src/main/java/com/bitmechanic/barrister/Server.java | Server.addHandler | public synchronized void addHandler(Class iface, Object handler) {
try {
iface.cast(handler);
}
catch (Exception e) {
throw new IllegalArgumentException("Handler: " + handler.getClass().getName() +
" does not implement: " + iface.getName());
}
if (contract.getInterfaces().get(iface.getSimpleName()) == null) {
throw new IllegalArgumentException("Interface: " + iface.getName() +
" is not a part of this Contract");
}
if (contract.getPackage() == null) {
setContractPackage(iface);
}
handlers.put(iface.getSimpleName(), handler);
} | java | public synchronized void addHandler(Class iface, Object handler) {
try {
iface.cast(handler);
}
catch (Exception e) {
throw new IllegalArgumentException("Handler: " + handler.getClass().getName() +
" does not implement: " + iface.getName());
}
if (contract.getInterfaces().get(iface.getSimpleName()) == null) {
throw new IllegalArgumentException("Interface: " + iface.getName() +
" is not a part of this Contract");
}
if (contract.getPackage() == null) {
setContractPackage(iface);
}
handlers.put(iface.getSimpleName(), handler);
} | [
"public",
"synchronized",
"void",
"addHandler",
"(",
"Class",
"iface",
",",
"Object",
"handler",
")",
"{",
"try",
"{",
"iface",
".",
"cast",
"(",
"handler",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | Associates the handler instance with the given IDL interface. Replaces
an existing handler for this iface if one was previously registered.
@param iface Interface class that this handler implements. This is usually
an Idl2Java generated interface Class
@param handler Object that implements iface. Generally one of your application classes
@throws IllegalArgumentException if iface is not an interface on this Server's Contract
or if handler cannot be cast to iface | [
"Associates",
"the",
"handler",
"instance",
"with",
"the",
"given",
"IDL",
"interface",
".",
"Replaces",
"an",
"existing",
"handler",
"for",
"this",
"iface",
"if",
"one",
"was",
"previously",
"registered",
"."
] | train | https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Server.java#L76-L95 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java | MutableURI.setOpaque | public void setOpaque( String scheme, String schemeSpecificPart )
{
if ( scheme == null || scheme.length() == 0
|| schemeSpecificPart == null
|| schemeSpecificPart.length() == 0
|| schemeSpecificPart.indexOf( '/' ) > 0 )
{
throw new IllegalArgumentException( "Not a proper opaque URI." );
}
_opaque = true;
setScheme( scheme );
setSchemeSpecificPart( schemeSpecificPart );
setUserInfo( null );
setHost( null );
setPort( UNDEFINED_PORT );
setPath( null );
setQuery( null );
} | java | public void setOpaque( String scheme, String schemeSpecificPart )
{
if ( scheme == null || scheme.length() == 0
|| schemeSpecificPart == null
|| schemeSpecificPart.length() == 0
|| schemeSpecificPart.indexOf( '/' ) > 0 )
{
throw new IllegalArgumentException( "Not a proper opaque URI." );
}
_opaque = true;
setScheme( scheme );
setSchemeSpecificPart( schemeSpecificPart );
setUserInfo( null );
setHost( null );
setPort( UNDEFINED_PORT );
setPath( null );
setQuery( null );
} | [
"public",
"void",
"setOpaque",
"(",
"String",
"scheme",
",",
"String",
"schemeSpecificPart",
")",
"{",
"if",
"(",
"scheme",
"==",
"null",
"||",
"scheme",
".",
"length",
"(",
")",
"==",
"0",
"||",
"schemeSpecificPart",
"==",
"null",
"||",
"schemeSpecificPart"... | Sets the URI to be opaque using the given scheme and
schemeSpecificPart.
<p> From {@link URI}: "A URI is opaque if, and only
if, it is absolute and its scheme-specific part does not begin with
a slash character ('/'). An opaque URI has a scheme, a
scheme-specific part, and possibly a fragment; all other components
are undefined." </p>
@param scheme the scheme component of this URI
@param schemeSpecificPart the scheme-specific part of this URI | [
"Sets",
"the",
"URI",
"to",
"be",
"opaque",
"using",
"the",
"given",
"scheme",
"and",
"schemeSpecificPart",
".",
"<p",
">",
"From",
"{",
"@link",
"URI",
"}",
":",
""",
";",
"A",
"URI",
"is",
"opaque",
"if",
"and",
"only",
"if",
"it",
"is",
"absol... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L799-L817 |
js-lib-com/net-client | src/main/java/js/net/client/ConnectionFactory.java | ConnectionFactory.isSecure | private static boolean isSecure(String protocol) throws BugError {
if (HTTP.equalsIgnoreCase(protocol)) {
return false;
} else if (HTTPS.equalsIgnoreCase(protocol)) {
return true;
} else {
throw new BugError("Unsupported protocol |%s| for HTTP transaction.", protocol);
}
} | java | private static boolean isSecure(String protocol) throws BugError {
if (HTTP.equalsIgnoreCase(protocol)) {
return false;
} else if (HTTPS.equalsIgnoreCase(protocol)) {
return true;
} else {
throw new BugError("Unsupported protocol |%s| for HTTP transaction.", protocol);
}
} | [
"private",
"static",
"boolean",
"isSecure",
"(",
"String",
"protocol",
")",
"throws",
"BugError",
"{",
"if",
"(",
"HTTP",
".",
"equalsIgnoreCase",
"(",
"protocol",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"HTTPS",
".",
"equalsIgnoreCa... | Predicate to test if given protocol is secure.
@param protocol protocol to test if secure.
@return true it given <code>protocol</code> is secure.
@throws BugError if given protocol is not supported. | [
"Predicate",
"to",
"test",
"if",
"given",
"protocol",
"is",
"secure",
"."
] | train | https://github.com/js-lib-com/net-client/blob/0489f85d8baa1be1ff115aa79929e0cf05d4c72d/src/main/java/js/net/client/ConnectionFactory.java#L167-L175 |
UrielCh/ovh-java-sdk | ovh-java-sdk-kube/src/main/java/net/minidev/ovh/api/ApiOvhKube.java | ApiOvhKube.serviceName_publiccloud_node_nodeId_DELETE | public void serviceName_publiccloud_node_nodeId_DELETE(String serviceName, String nodeId) throws IOException {
String qPath = "/kube/{serviceName}/publiccloud/node/{nodeId}";
StringBuilder sb = path(qPath, serviceName, nodeId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void serviceName_publiccloud_node_nodeId_DELETE(String serviceName, String nodeId) throws IOException {
String qPath = "/kube/{serviceName}/publiccloud/node/{nodeId}";
StringBuilder sb = path(qPath, serviceName, nodeId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"serviceName_publiccloud_node_nodeId_DELETE",
"(",
"String",
"serviceName",
",",
"String",
"nodeId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/kube/{serviceName}/publiccloud/node/{nodeId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
... | Delete a node on your cluster
REST: DELETE /kube/{serviceName}/publiccloud/node/{nodeId}
@param nodeId [required] Node ID
@param serviceName [required] Cluster ID
API beta | [
"Delete",
"a",
"node",
"on",
"your",
"cluster"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-kube/src/main/java/net/minidev/ovh/api/ApiOvhKube.java#L218-L222 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java | InfinispanConfigurationLoader.completeFilesystem | private void completeFilesystem(ConfigurationBuilder builder, Configuration configuration)
{
PersistenceConfigurationBuilder persistence = builder.persistence();
if (containsIncompleteFileLoader(configuration)) {
for (StoreConfigurationBuilder<?, ?> store : persistence.stores()) {
if (store instanceof SingleFileStoreConfigurationBuilder) {
SingleFileStoreConfigurationBuilder singleFileStore = (SingleFileStoreConfigurationBuilder) store;
singleFileStore.location(createTempDir());
}
}
}
} | java | private void completeFilesystem(ConfigurationBuilder builder, Configuration configuration)
{
PersistenceConfigurationBuilder persistence = builder.persistence();
if (containsIncompleteFileLoader(configuration)) {
for (StoreConfigurationBuilder<?, ?> store : persistence.stores()) {
if (store instanceof SingleFileStoreConfigurationBuilder) {
SingleFileStoreConfigurationBuilder singleFileStore = (SingleFileStoreConfigurationBuilder) store;
singleFileStore.location(createTempDir());
}
}
}
} | [
"private",
"void",
"completeFilesystem",
"(",
"ConfigurationBuilder",
"builder",
",",
"Configuration",
"configuration",
")",
"{",
"PersistenceConfigurationBuilder",
"persistence",
"=",
"builder",
".",
"persistence",
"(",
")",
";",
"if",
"(",
"containsIncompleteFileLoader"... | Add missing location for filesystem based cache.
@param currentBuilder the configuration builder
@param configuration the configuration
@return the configuration builder | [
"Add",
"missing",
"location",
"for",
"filesystem",
"based",
"cache",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java#L162-L175 |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.createRoutines | private void createRoutines(Collection<Routine> routines, SchemaDescriptor schemaDescriptor, Map<String, ColumnTypeDescriptor> columnTypes, Store store)
throws IOException {
for (Routine routine : routines) {
RoutineDescriptor routineDescriptor;
String returnType;
switch (routine.getRoutineType()) {
case procedure:
routineDescriptor = store.create(ProcedureDescriptor.class);
returnType = ((ProcedureReturnType) routine.getReturnType()).name();
schemaDescriptor.getProcedures().add((ProcedureDescriptor) routineDescriptor);
break;
case function:
routineDescriptor = store.create(FunctionDescriptor.class);
returnType = ((FunctionReturnType) routine.getReturnType()).name();
schemaDescriptor.getFunctions().add((FunctionDescriptor) routineDescriptor);
break;
case unknown:
routineDescriptor = store.create(RoutineDescriptor.class);
returnType = null;
schemaDescriptor.getUnknownRoutines().add(routineDescriptor);
break;
default:
throw new IOException("Unsupported routine type " + routine.getRoutineType());
}
routineDescriptor.setName(routine.getName());
routineDescriptor.setReturnType(returnType);
routineDescriptor.setBodyType(routine.getRoutineBodyType().name());
routineDescriptor.setDefinition(routine.getDefinition());
for (RoutineColumn<? extends Routine> routineColumn : routine.getColumns()) {
RoutineColumnDescriptor columnDescriptor = createColumnDescriptor(routineColumn, RoutineColumnDescriptor.class, columnTypes, store);
routineDescriptor.getColumns().add(columnDescriptor);
RoutineColumnType columnType = routineColumn.getColumnType();
if (columnType instanceof ProcedureColumnType) {
ProcedureColumnType procedureColumnType = (ProcedureColumnType) columnType;
columnDescriptor.setType(procedureColumnType.name());
} else if (columnType instanceof FunctionColumnType) {
FunctionColumnType functionColumnType = (FunctionColumnType) columnType;
columnDescriptor.setType(functionColumnType.name());
} else {
throw new IOException("Unsupported routine column type " + columnType.getClass().getName());
}
}
}
} | java | private void createRoutines(Collection<Routine> routines, SchemaDescriptor schemaDescriptor, Map<String, ColumnTypeDescriptor> columnTypes, Store store)
throws IOException {
for (Routine routine : routines) {
RoutineDescriptor routineDescriptor;
String returnType;
switch (routine.getRoutineType()) {
case procedure:
routineDescriptor = store.create(ProcedureDescriptor.class);
returnType = ((ProcedureReturnType) routine.getReturnType()).name();
schemaDescriptor.getProcedures().add((ProcedureDescriptor) routineDescriptor);
break;
case function:
routineDescriptor = store.create(FunctionDescriptor.class);
returnType = ((FunctionReturnType) routine.getReturnType()).name();
schemaDescriptor.getFunctions().add((FunctionDescriptor) routineDescriptor);
break;
case unknown:
routineDescriptor = store.create(RoutineDescriptor.class);
returnType = null;
schemaDescriptor.getUnknownRoutines().add(routineDescriptor);
break;
default:
throw new IOException("Unsupported routine type " + routine.getRoutineType());
}
routineDescriptor.setName(routine.getName());
routineDescriptor.setReturnType(returnType);
routineDescriptor.setBodyType(routine.getRoutineBodyType().name());
routineDescriptor.setDefinition(routine.getDefinition());
for (RoutineColumn<? extends Routine> routineColumn : routine.getColumns()) {
RoutineColumnDescriptor columnDescriptor = createColumnDescriptor(routineColumn, RoutineColumnDescriptor.class, columnTypes, store);
routineDescriptor.getColumns().add(columnDescriptor);
RoutineColumnType columnType = routineColumn.getColumnType();
if (columnType instanceof ProcedureColumnType) {
ProcedureColumnType procedureColumnType = (ProcedureColumnType) columnType;
columnDescriptor.setType(procedureColumnType.name());
} else if (columnType instanceof FunctionColumnType) {
FunctionColumnType functionColumnType = (FunctionColumnType) columnType;
columnDescriptor.setType(functionColumnType.name());
} else {
throw new IOException("Unsupported routine column type " + columnType.getClass().getName());
}
}
}
} | [
"private",
"void",
"createRoutines",
"(",
"Collection",
"<",
"Routine",
">",
"routines",
",",
"SchemaDescriptor",
"schemaDescriptor",
",",
"Map",
"<",
"String",
",",
"ColumnTypeDescriptor",
">",
"columnTypes",
",",
"Store",
"store",
")",
"throws",
"IOException",
"... | Create routines, i.e. functions and procedures.
@param routines The routines.
@param schemaDescriptor The schema descriptor.
@param columnTypes The column types.
@param store The store.
@throws java.io.IOException If an unsupported routine type has been found. | [
"Create",
"routines",
"i",
".",
"e",
".",
"functions",
"and",
"procedures",
"."
] | train | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L265-L308 |
alkacon/opencms-core | src/org/opencms/main/CmsShellCommands.java | CmsShellCommands.replaceModule | public void replaceModule(String moduleName, String importFile) throws Exception {
CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(importFile);
if (moduleName.equals(module.getName())) {
replaceModule(importFile);
} else {
if (OpenCms.getModuleManager().getModule(moduleName) != null) {
OpenCms.getModuleManager().deleteModule(
m_cms,
moduleName,
true,
new CmsShellReport(m_cms.getRequestContext().getLocale()));
}
importModule(importFile);
}
} | java | public void replaceModule(String moduleName, String importFile) throws Exception {
CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(importFile);
if (moduleName.equals(module.getName())) {
replaceModule(importFile);
} else {
if (OpenCms.getModuleManager().getModule(moduleName) != null) {
OpenCms.getModuleManager().deleteModule(
m_cms,
moduleName,
true,
new CmsShellReport(m_cms.getRequestContext().getLocale()));
}
importModule(importFile);
}
} | [
"public",
"void",
"replaceModule",
"(",
"String",
"moduleName",
",",
"String",
"importFile",
")",
"throws",
"Exception",
"{",
"CmsModule",
"module",
"=",
"CmsModuleImportExportHandler",
".",
"readModuleFromImport",
"(",
"importFile",
")",
";",
"if",
"(",
"moduleName... | Replaces a module with another revision.<p>
@param moduleName the name of the module to delete
@param importFile the name of the import file
@throws Exception if something goes wrong | [
"Replaces",
"a",
"module",
"with",
"another",
"revision",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1412-L1427 |
mangstadt/biweekly | src/main/java/biweekly/property/ICalProperty.java | ICalProperty.setParameter | public void setParameter(String name, Collection<String> values) {
parameters.replace(name, values);
} | java | public void setParameter(String name, Collection<String> values) {
parameters.replace(name, values);
} | [
"public",
"void",
"setParameter",
"(",
"String",
"name",
",",
"Collection",
"<",
"String",
">",
"values",
")",
"{",
"parameters",
".",
"replace",
"(",
"name",
",",
"values",
")",
";",
"}"
] | Replaces all existing values of a parameter with the given values.
@param name the parameter name (case insensitive, e.g. "LANGUAGE")
@param values the parameter values | [
"Replaces",
"all",
"existing",
"values",
"of",
"a",
"parameter",
"with",
"the",
"given",
"values",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/property/ICalProperty.java#L124-L126 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/user/UserClient.java | UserClient.updateFriendsNote | public ResponseWrapper updateFriendsNote(String username, FriendNote[] array)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
FriendNotePayload payload = new FriendNotePayload.Builder()
.setFriendNotes(array)
.build();
Preconditions.checkArgument(null != payload, "FriendNotePayload should not be null");
return _httpClient.sendPut(_baseUrl + userPath + "/" + username + "/friends", payload.toString());
} | java | public ResponseWrapper updateFriendsNote(String username, FriendNote[] array)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
FriendNotePayload payload = new FriendNotePayload.Builder()
.setFriendNotes(array)
.build();
Preconditions.checkArgument(null != payload, "FriendNotePayload should not be null");
return _httpClient.sendPut(_baseUrl + userPath + "/" + username + "/friends", payload.toString());
} | [
"public",
"ResponseWrapper",
"updateFriendsNote",
"(",
"String",
"username",
",",
"FriendNote",
"[",
"]",
"array",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"FriendNotePayl... | Update friends' note information. The size is limit to 500.
@param username Necessary
@param array FriendNote array
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Update",
"friends",
"note",
"information",
".",
"The",
"size",
"is",
"limit",
"to",
"500",
"."
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L326-L334 |
synchronoss/cpo-api | cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java | CassandraCpoAdapter.insertObjects | @Override
public <T> long insertObjects(String name, Collection<T> coll, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException {
return processUpdateGroup(coll, CpoAdapter.CREATE_GROUP, name, wheres, orderBy, nativeExpressions);
} | java | @Override
public <T> long insertObjects(String name, Collection<T> coll, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException {
return processUpdateGroup(coll, CpoAdapter.CREATE_GROUP, name, wheres, orderBy, nativeExpressions);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"long",
"insertObjects",
"(",
"String",
"name",
",",
"Collection",
"<",
"T",
">",
"coll",
",",
"Collection",
"<",
"CpoWhere",
">",
"wheres",
",",
"Collection",
"<",
"CpoOrderBy",
">",
"orderBy",
",",
"Collection",
... | Iterates through a collection of Objects, creates and stores them in the datasource. The assumption is that the
objects contained in the collection do not exist in the datasource.
<p/>
This method creates and stores the objects in the datasource. The objects in the collection will be treated as one
transaction, assuming the datasource supports transactions.
<p/>
This means that if one of the objects fail being created in the datasource then the CpoAdapter should stop
processing the remainder of the collection, and if supported, rollback all the objects created thus far.
<p/>
<pre>Example:
<code>
<p/>
class SomeObject so = null;
class CpoAdapter cpo = null;
<p/>
try {
cpo = new CpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
if (cpo!=null) {
ArrayList al = new ArrayList();
for (int i=0; i<3; i++){
so = new SomeObject();
so.setId(1);
so.setName("SomeName");
al.add(so);
}
try{
cpo.insertObjects("IdNameInsert",al);
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The String name of the CREATE Function Group that will be used to create the object in the datasource.
null signifies that the default rules will be used.
@param coll This is a collection of objects that have been defined within the metadata of the datasource. If the
class is not defined an exception will be thrown.
@param wheres A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
@param orderBy The CpoOrderBy bean that defines the order in which beans should be returned
@param nativeExpressions Native expression that will be used to augment the expression stored in the meta data. This
text will be embedded at run-time
@return The number of objects created in the datasource
@throws CpoException Thrown if there are errors accessing the datasource | [
"Iterates",
"through",
"a",
"collection",
"of",
"Objects",
"creates",
"and",
"stores",
"them",
"in",
"the",
"datasource",
".",
"The",
"assumption",
"is",
"that",
"the",
"objects",
"contained",
"in",
"the",
"collection",
"do",
"not",
"exist",
"in",
"the",
"da... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L400-L403 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.unixTimestamp | public static long unixTimestamp(String dateStr, String format, TimeZone tz) {
long ts = parseToTimeMillis(dateStr, format, tz);
if (ts == Long.MIN_VALUE) {
return Long.MIN_VALUE;
} else {
// return the seconds
return ts / 1000;
}
} | java | public static long unixTimestamp(String dateStr, String format, TimeZone tz) {
long ts = parseToTimeMillis(dateStr, format, tz);
if (ts == Long.MIN_VALUE) {
return Long.MIN_VALUE;
} else {
// return the seconds
return ts / 1000;
}
} | [
"public",
"static",
"long",
"unixTimestamp",
"(",
"String",
"dateStr",
",",
"String",
"format",
",",
"TimeZone",
"tz",
")",
"{",
"long",
"ts",
"=",
"parseToTimeMillis",
"(",
"dateStr",
",",
"format",
",",
"tz",
")",
";",
"if",
"(",
"ts",
"==",
"Long",
... | Returns the value of the argument as an unsigned integer in seconds since
'1970-01-01 00:00:00' UTC. | [
"Returns",
"the",
"value",
"of",
"the",
"argument",
"as",
"an",
"unsigned",
"integer",
"in",
"seconds",
"since",
"1970",
"-",
"01",
"-",
"01",
"00",
":",
"00",
":",
"00",
"UTC",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L889-L897 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsProjectDriver.java | CmsProjectDriver.internalResetResourceState | protected void internalResetResourceState(CmsDbContext dbc, CmsResource resource) throws CmsDataAccessException {
try {
// reset the resource state
resource.setState(CmsResource.STATE_UNCHANGED);
m_driverManager.getVfsDriver(dbc).writeResourceState(
dbc,
dbc.currentProject(),
resource,
CmsDriverManager.UPDATE_ALL,
true);
} catch (CmsDataAccessException e) {
if (LOG.isErrorEnabled()) {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_ERROR_RESETTING_RESOURCE_STATE_1,
resource.getRootPath()),
e);
}
throw e;
}
} | java | protected void internalResetResourceState(CmsDbContext dbc, CmsResource resource) throws CmsDataAccessException {
try {
// reset the resource state
resource.setState(CmsResource.STATE_UNCHANGED);
m_driverManager.getVfsDriver(dbc).writeResourceState(
dbc,
dbc.currentProject(),
resource,
CmsDriverManager.UPDATE_ALL,
true);
} catch (CmsDataAccessException e) {
if (LOG.isErrorEnabled()) {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_ERROR_RESETTING_RESOURCE_STATE_1,
resource.getRootPath()),
e);
}
throw e;
}
} | [
"protected",
"void",
"internalResetResourceState",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsDataAccessException",
"{",
"try",
"{",
"// reset the resource state",
"resource",
".",
"setState",
"(",
"CmsResource",
".",
"STATE_UNCHANGED",... | Resets the state to UNCHANGED for a specified resource.<p>
@param dbc the current database context
@param resource the Cms resource
@throws CmsDataAccessException if something goes wrong | [
"Resets",
"the",
"state",
"to",
"UNCHANGED",
"for",
"a",
"specified",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsProjectDriver.java#L3182-L3203 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java | ServiceEndpointPoliciesInner.beginUpdate | public ServiceEndpointPolicyInner beginUpdate(String resourceGroupName, String serviceEndpointPolicyName, Map<String, String> tags) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, tags).toBlocking().single().body();
} | java | public ServiceEndpointPolicyInner beginUpdate(String resourceGroupName, String serviceEndpointPolicyName, Map<String, String> tags) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, tags).toBlocking().single().body();
} | [
"public",
"ServiceEndpointPolicyInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serviceEndpointPolicyName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName... | Updates service Endpoint Policies.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy.
@param tags Resource tags.
@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 ServiceEndpointPolicyInner object if successful. | [
"Updates",
"service",
"Endpoint",
"Policies",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java#L835-L837 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.fromJson | public static Feature fromJson(@NonNull String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create());
gson.registerTypeAdapterFactory(GeometryAdapterFactory.create());
Feature feature = gson.create().fromJson(json, Feature.class);
// Even thought properties are Nullable,
// Feature object will be created with properties set to an empty object,
// so that addProperties() would work
if (feature.properties() != null) {
return feature;
}
return new Feature(TYPE, feature.bbox(),
feature.id(), feature.geometry(), new JsonObject());
} | java | public static Feature fromJson(@NonNull String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create());
gson.registerTypeAdapterFactory(GeometryAdapterFactory.create());
Feature feature = gson.create().fromJson(json, Feature.class);
// Even thought properties are Nullable,
// Feature object will be created with properties set to an empty object,
// so that addProperties() would work
if (feature.properties() != null) {
return feature;
}
return new Feature(TYPE, feature.bbox(),
feature.id(), feature.geometry(), new JsonObject());
} | [
"public",
"static",
"Feature",
"fromJson",
"(",
"@",
"NonNull",
"String",
"json",
")",
"{",
"GsonBuilder",
"gson",
"=",
"new",
"GsonBuilder",
"(",
")",
";",
"gson",
".",
"registerTypeAdapterFactory",
"(",
"GeoJsonAdapterFactory",
".",
"create",
"(",
")",
")",
... | Create a new instance of this class by passing in a formatted valid JSON String. If you are
creating a Feature object from scratch it is better to use one of the other provided static
factory methods such as {@link #fromGeometry(Geometry)}.
@param json a formatted valid JSON string defining a GeoJson Feature
@return a new instance of this class defined by the values passed inside this static factory
method
@since 1.0.0 | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"passing",
"in",
"a",
"formatted",
"valid",
"JSON",
"String",
".",
"If",
"you",
"are",
"creating",
"a",
"Feature",
"object",
"from",
"scratch",
"it",
"is",
"better",
"to",
"use",
"one",
"of",... | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L76-L92 |
geomajas/geomajas-project-client-gwt | plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java | SearchCommService.buildGeometryCriterion | public static GeometryCriterion buildGeometryCriterion(final Geometry geometry, final MapWidget mapWidget,
VectorLayer layer) {
List<String> layers;
if (null == layer) {
layers = getVisibleServerLayerIds(mapWidget.getMapModel());
} else {
layers = new ArrayList<String>();
layers.add(layer.getServerLayerId());
}
return new GeometryCriterion(layers, GeometryConverter.toDto(geometry));
} | java | public static GeometryCriterion buildGeometryCriterion(final Geometry geometry, final MapWidget mapWidget,
VectorLayer layer) {
List<String> layers;
if (null == layer) {
layers = getVisibleServerLayerIds(mapWidget.getMapModel());
} else {
layers = new ArrayList<String>();
layers.add(layer.getServerLayerId());
}
return new GeometryCriterion(layers, GeometryConverter.toDto(geometry));
} | [
"public",
"static",
"GeometryCriterion",
"buildGeometryCriterion",
"(",
"final",
"Geometry",
"geometry",
",",
"final",
"MapWidget",
"mapWidget",
",",
"VectorLayer",
"layer",
")",
"{",
"List",
"<",
"String",
">",
"layers",
";",
"if",
"(",
"null",
"==",
"layer",
... | Build {@link GeometryCriterion} for the map widget, geometry and optional layer.
@param geometry geometry
@param mapWidget map widget
@param layer layer
@return geometry criterion | [
"Build",
"{",
"@link",
"GeometryCriterion",
"}",
"for",
"the",
"map",
"widget",
"geometry",
"and",
"optional",
"layer",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java#L175-L185 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java | WorkItemConfigurationsInner.createAsync | public Observable<WorkItemConfigurationInner> createAsync(String resourceGroupName, String resourceName, WorkItemCreateConfiguration workItemConfigurationProperties) {
return createWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigurationProperties).map(new Func1<ServiceResponse<WorkItemConfigurationInner>, WorkItemConfigurationInner>() {
@Override
public WorkItemConfigurationInner call(ServiceResponse<WorkItemConfigurationInner> response) {
return response.body();
}
});
} | java | public Observable<WorkItemConfigurationInner> createAsync(String resourceGroupName, String resourceName, WorkItemCreateConfiguration workItemConfigurationProperties) {
return createWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigurationProperties).map(new Func1<ServiceResponse<WorkItemConfigurationInner>, WorkItemConfigurationInner>() {
@Override
public WorkItemConfigurationInner call(ServiceResponse<WorkItemConfigurationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkItemConfigurationInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"WorkItemCreateConfiguration",
"workItemConfigurationProperties",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
... | Create a work item configuration for an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param workItemConfigurationProperties Properties that need to be specified to create a work item configuration of a Application Insights component.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkItemConfigurationInner object | [
"Create",
"a",
"work",
"item",
"configuration",
"for",
"an",
"Application",
"Insights",
"component",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java#L208-L215 |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/exception/http/RedirectionActionHelper.java | RedirectionActionHelper.buildFormPostContentAction | public static RedirectionAction buildFormPostContentAction(final WebContext context, final String content) {
if (ContextHelper.isPost(context) && useModernHttpCodes) {
return new TemporaryRedirectAction(content);
} else {
return new OkAction(content);
}
} | java | public static RedirectionAction buildFormPostContentAction(final WebContext context, final String content) {
if (ContextHelper.isPost(context) && useModernHttpCodes) {
return new TemporaryRedirectAction(content);
} else {
return new OkAction(content);
}
} | [
"public",
"static",
"RedirectionAction",
"buildFormPostContentAction",
"(",
"final",
"WebContext",
"context",
",",
"final",
"String",
"content",
")",
"{",
"if",
"(",
"ContextHelper",
".",
"isPost",
"(",
"context",
")",
"&&",
"useModernHttpCodes",
")",
"{",
"return... | Build the appropriate redirection action for a content which is a form post.
@param context the web context
@param content the content
@return the appropriate redirection action | [
"Build",
"the",
"appropriate",
"redirection",
"action",
"for",
"a",
"content",
"which",
"is",
"a",
"form",
"post",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/exception/http/RedirectionActionHelper.java#L40-L46 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java | ExecutionEnvironment.createRemoteEnvironment | public static ExecutionEnvironment createRemoteEnvironment(String host, int port, String... jarFiles) {
return new RemoteEnvironment(host, port, jarFiles);
} | java | public static ExecutionEnvironment createRemoteEnvironment(String host, int port, String... jarFiles) {
return new RemoteEnvironment(host, port, jarFiles);
} | [
"public",
"static",
"ExecutionEnvironment",
"createRemoteEnvironment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"...",
"jarFiles",
")",
"{",
"return",
"new",
"RemoteEnvironment",
"(",
"host",
",",
"port",
",",
"jarFiles",
")",
";",
"}"
] | Creates a {@link RemoteEnvironment}. The remote environment sends (parts of) the program
to a cluster for execution. Note that all file paths used in the program must be accessible from the
cluster. The execution will use the cluster's default parallelism, unless the parallelism is
set explicitly via {@link ExecutionEnvironment#setParallelism(int)}.
@param host The host name or address of the master (JobManager), where the program should be executed.
@param port The port of the master (JobManager), where the program should be executed.
@param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses
user-defined functions, user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"Creates",
"a",
"{",
"@link",
"RemoteEnvironment",
"}",
".",
"The",
"remote",
"environment",
"sends",
"(",
"parts",
"of",
")",
"the",
"program",
"to",
"a",
"cluster",
"for",
"execution",
".",
"Note",
"that",
"all",
"file",
"paths",
"used",
"in",
"the",
"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L1172-L1174 |
amsa-code/risky | behaviour-detector/src/main/java/au/gov/amsa/navigation/VesselPosition.java | VesselPosition.intersectionTimes | public Optional<Times> intersectionTimes(VesselPosition vp) {
// TODO handle vp doesn't have speed or cog but is within collision
// distance given any cog and max speed
Optional<VesselPosition> p = vp.predict(time);
if (!p.isPresent()) {
return Optional.absent();
}
Vector deltaV = velocity().get().minus(p.get().velocity().get());
Vector deltaP = position(this).minus(p.get().position(this));
// imagine a ring around the vessel centroid with maxDimensionMetres/2
// radius. This is the ring we are going to test for collision.
double r = p.get().maxDimensionMetres().or(maxDimensionMetresWhenUnknown) / 2
+ maxDimensionMetres().or(maxDimensionMetresWhenUnknown) / 2;
if (deltaP.dot(deltaP) <= r)
return of(new Times(p.get().time()));
double a = deltaV.dot(deltaV);
double b = 2 * deltaV.dot(deltaP);
double c = deltaP.dot(deltaP) - r * r;
// Now solve the quadratic equation with coefficients a,b,c
double discriminant = b * b - 4 * a * c;
if (a == 0)
return Optional.absent();
else if (discriminant < 0)
return Optional.absent();
else {
if (discriminant == 0) {
return of(new Times(Math.round(-b / 2 / a)));
} else {
long alpha1 = Math.round((-b + Math.sqrt(discriminant)) / 2 / a);
long alpha2 = Math.round((-b - Math.sqrt(discriminant)) / 2 / a);
return of(new Times(alpha1, alpha2));
}
}
} | java | public Optional<Times> intersectionTimes(VesselPosition vp) {
// TODO handle vp doesn't have speed or cog but is within collision
// distance given any cog and max speed
Optional<VesselPosition> p = vp.predict(time);
if (!p.isPresent()) {
return Optional.absent();
}
Vector deltaV = velocity().get().minus(p.get().velocity().get());
Vector deltaP = position(this).minus(p.get().position(this));
// imagine a ring around the vessel centroid with maxDimensionMetres/2
// radius. This is the ring we are going to test for collision.
double r = p.get().maxDimensionMetres().or(maxDimensionMetresWhenUnknown) / 2
+ maxDimensionMetres().or(maxDimensionMetresWhenUnknown) / 2;
if (deltaP.dot(deltaP) <= r)
return of(new Times(p.get().time()));
double a = deltaV.dot(deltaV);
double b = 2 * deltaV.dot(deltaP);
double c = deltaP.dot(deltaP) - r * r;
// Now solve the quadratic equation with coefficients a,b,c
double discriminant = b * b - 4 * a * c;
if (a == 0)
return Optional.absent();
else if (discriminant < 0)
return Optional.absent();
else {
if (discriminant == 0) {
return of(new Times(Math.round(-b / 2 / a)));
} else {
long alpha1 = Math.round((-b + Math.sqrt(discriminant)) / 2 / a);
long alpha2 = Math.round((-b - Math.sqrt(discriminant)) / 2 / a);
return of(new Times(alpha1, alpha2));
}
}
} | [
"public",
"Optional",
"<",
"Times",
">",
"intersectionTimes",
"(",
"VesselPosition",
"vp",
")",
"{",
"// TODO handle vp doesn't have speed or cog but is within collision",
"// distance given any cog and max speed",
"Optional",
"<",
"VesselPosition",
">",
"p",
"=",
"vp",
".",
... | Returns absent if no intersection occurs else return the one or two times
of intersection of circles around the vessel relative to this.time().
@param vp
@return | [
"Returns",
"absent",
"if",
"no",
"intersection",
"occurs",
"else",
"return",
"the",
"one",
"or",
"two",
"times",
"of",
"intersection",
"of",
"circles",
"around",
"the",
"vessel",
"relative",
"to",
"this",
".",
"time",
"()",
"."
] | train | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/behaviour-detector/src/main/java/au/gov/amsa/navigation/VesselPosition.java#L337-L377 |
carewebframework/carewebframework-vista | org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java | AbstractNotification.appendText | private void appendText(StringBuilder sb, String text, String format) {
if (text != null && !text.isEmpty()) {
format = "@vistanotification.detail." + format + ".label";
sb.append(StrUtil.formatMessage(format, text)).append("\n");
}
} | java | private void appendText(StringBuilder sb, String text, String format) {
if (text != null && !text.isEmpty()) {
format = "@vistanotification.detail." + format + ".label";
sb.append(StrUtil.formatMessage(format, text)).append("\n");
}
} | [
"private",
"void",
"appendText",
"(",
"StringBuilder",
"sb",
",",
"String",
"text",
",",
"String",
"format",
")",
"{",
"if",
"(",
"text",
"!=",
"null",
"&&",
"!",
"text",
".",
"isEmpty",
"(",
")",
")",
"{",
"format",
"=",
"\"@vistanotification.detail.\"",
... | Appends a text element if it is not null or empty.
@param sb String builder.
@param text Text value to append.
@param format Format specifier. | [
"Appends",
"a",
"text",
"element",
"if",
"it",
"is",
"not",
"null",
"or",
"empty",
"."
] | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java#L327-L332 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java | DefaultBeanClassBuilder.buildDynamicPropertyMap | protected void buildDynamicPropertyMap( ClassWriter cw, ClassDefinition def ) {
FieldVisitor fv = cw.visitField( Opcodes.ACC_PRIVATE,
TraitableBean.MAP_FIELD_NAME,
Type.getDescriptor( Map.class ) ,
"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;",
null);
fv.visitEnd();
MethodVisitor mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
"_getDynamicProperties",
Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ),
"()Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;",
null);
mv.visitCode();
mv.visitVarInsn( ALOAD, 0 );
mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType(def.getName()), TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) );
mv.visitInsn( ARETURN );
mv.visitMaxs( 0, 0 );
mv.visitEnd();
mv = cw.visitMethod( ACC_PUBLIC,
"_setDynamicProperties",
Type.getMethodDescriptor( Type.getType( void.class ), new Type[] { Type.getType( Map.class ) } ),
"(Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;)V",
null);
mv.visitCode();
mv.visitVarInsn( ALOAD, 0 );
mv.visitVarInsn( ALOAD, 1 );
mv.visitFieldInsn ( PUTFIELD, BuildUtils.getInternalType( def.getName() ), TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) );
mv.visitInsn( RETURN) ;
mv.visitMaxs( 0, 0 );
mv.visitEnd();
} | java | protected void buildDynamicPropertyMap( ClassWriter cw, ClassDefinition def ) {
FieldVisitor fv = cw.visitField( Opcodes.ACC_PRIVATE,
TraitableBean.MAP_FIELD_NAME,
Type.getDescriptor( Map.class ) ,
"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;",
null);
fv.visitEnd();
MethodVisitor mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
"_getDynamicProperties",
Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ),
"()Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;",
null);
mv.visitCode();
mv.visitVarInsn( ALOAD, 0 );
mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType(def.getName()), TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) );
mv.visitInsn( ARETURN );
mv.visitMaxs( 0, 0 );
mv.visitEnd();
mv = cw.visitMethod( ACC_PUBLIC,
"_setDynamicProperties",
Type.getMethodDescriptor( Type.getType( void.class ), new Type[] { Type.getType( Map.class ) } ),
"(Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;)V",
null);
mv.visitCode();
mv.visitVarInsn( ALOAD, 0 );
mv.visitVarInsn( ALOAD, 1 );
mv.visitFieldInsn ( PUTFIELD, BuildUtils.getInternalType( def.getName() ), TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) );
mv.visitInsn( RETURN) ;
mv.visitMaxs( 0, 0 );
mv.visitEnd();
} | [
"protected",
"void",
"buildDynamicPropertyMap",
"(",
"ClassWriter",
"cw",
",",
"ClassDefinition",
"def",
")",
"{",
"FieldVisitor",
"fv",
"=",
"cw",
".",
"visitField",
"(",
"Opcodes",
".",
"ACC_PRIVATE",
",",
"TraitableBean",
".",
"MAP_FIELD_NAME",
",",
"Type",
"... | A traitable class is a special class with support for dynamic properties and types.
This method builds the property map, containing the key/values pairs to implement
any property defined in a trait interface but not supported by the traited class
fields.
@param cw
@param def | [
"A",
"traitable",
"class",
"is",
"a",
"special",
"class",
"with",
"support",
"for",
"dynamic",
"properties",
"and",
"types",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java#L765-L801 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.lastIndexOf | public int lastIndexOf(final char ch, int startIndex) {
startIndex = (startIndex >= size ? size - 1 : startIndex);
if (startIndex < 0) {
return -1;
}
for (int i = startIndex; i >= 0; i--) {
if (buffer[i] == ch) {
return i;
}
}
return -1;
} | java | public int lastIndexOf(final char ch, int startIndex) {
startIndex = (startIndex >= size ? size - 1 : startIndex);
if (startIndex < 0) {
return -1;
}
for (int i = startIndex; i >= 0; i--) {
if (buffer[i] == ch) {
return i;
}
}
return -1;
} | [
"public",
"int",
"lastIndexOf",
"(",
"final",
"char",
"ch",
",",
"int",
"startIndex",
")",
"{",
"startIndex",
"=",
"(",
"startIndex",
">=",
"size",
"?",
"size",
"-",
"1",
":",
"startIndex",
")",
";",
"if",
"(",
"startIndex",
"<",
"0",
")",
"{",
"retu... | Searches the string builder to find the last reference to the specified char.
@param ch the character to find
@param startIndex the index to start at, invalid index rounded to edge
@return the last index of the character, or -1 if not found | [
"Searches",
"the",
"string",
"builder",
"to",
"find",
"the",
"last",
"reference",
"to",
"the",
"specified",
"char",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2541-L2552 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/image/InterleavedU8.java | InterleavedU8.get32 | public int get32( int x , int y ) {
int i = startIndex + y*stride+x*4;
return ((data[i]&0xFF) << 24) | ((data[i+1]&0xFF) << 16) | ((data[i+2]&0xFF) << 8) | (data[i+3]&0xFF);
} | java | public int get32( int x , int y ) {
int i = startIndex + y*stride+x*4;
return ((data[i]&0xFF) << 24) | ((data[i+1]&0xFF) << 16) | ((data[i+2]&0xFF) << 8) | (data[i+3]&0xFF);
} | [
"public",
"int",
"get32",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"i",
"=",
"startIndex",
"+",
"y",
"*",
"stride",
"+",
"x",
"*",
"4",
";",
"return",
"(",
"(",
"data",
"[",
"i",
"]",
"&",
"0xFF",
")",
"<<",
"24",
")",
"|",
"(",
... | Returns an integer formed from 4 bands. a[i]<<24 | a[i+1] << 16 | a[i+2]<<8 | a[3]
@param x column
@param y row
@return 32 bit integer | [
"Returns",
"an",
"integer",
"formed",
"from",
"4",
"bands",
".",
"a",
"[",
"i",
"]",
"<<24",
"|",
"a",
"[",
"i",
"+",
"1",
"]",
"<<",
"16",
"|",
"a",
"[",
"i",
"+",
"2",
"]",
"<<8",
"|",
"a",
"[",
"3",
"]"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/image/InterleavedU8.java#L56-L59 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java | WebDriverTool.findAll | @Deprecated
public List<WebElement> findAll(final By by, final Predicate<WebElement> condition) {
return findElements(by, condition);
} | java | @Deprecated
public List<WebElement> findAll(final By by, final Predicate<WebElement> condition) {
return findElements(by, condition);
} | [
"@",
"Deprecated",
"public",
"List",
"<",
"WebElement",
">",
"findAll",
"(",
"final",
"By",
"by",
",",
"final",
"Predicate",
"<",
"WebElement",
">",
"condition",
")",
"{",
"return",
"findElements",
"(",
"by",
",",
"condition",
")",
";",
"}"
] | Finds all elements. Uses the internal {@link WebElementFinder}, which tries to apply the
specified {@code condition} until it times out.
@param by
the {@link By} used to locate the element
@param condition
a condition the found elements must meet
@return the list of elements
@deprecated Use {@link #findElements(By, Predicate)} instead | [
"Finds",
"all",
"elements",
".",
"Uses",
"the",
"internal",
"{",
"@link",
"WebElementFinder",
"}",
"which",
"tries",
"to",
"apply",
"the",
"specified",
"{",
"@code",
"condition",
"}",
"until",
"it",
"times",
"out",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L226-L229 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.