repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.initWorkplaceMembers | protected void initWorkplaceMembers(CmsObject cms, HttpSession session) {
m_cms = cms;
m_session = session;
// check role
try {
checkRole();
} catch (CmsRoleViolationException e) {
throw new CmsIllegalStateException(e.getMessageContainer(), e);
}
// get / create the workplace settings
m_settings = (CmsWorkplaceSettings)m_session.getAttribute(CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
if (m_settings == null) {
// create the settings object
m_settings = new CmsWorkplaceSettings();
m_settings = initWorkplaceSettings(m_cms, m_settings, false);
storeSettings(m_session, m_settings);
}
// initialize messages
CmsMessages messages = OpenCms.getWorkplaceManager().getMessages(getLocale());
// generate a new multi messages object and add the messages from the workplace
m_messages = new CmsMultiMessages(getLocale());
m_messages.addMessages(messages);
initMessages();
if (m_jsp != null) {
// check request for changes in the workplace settings
initWorkplaceRequestValues(m_settings, m_jsp.getRequest());
}
// set cms context accordingly
initWorkplaceCmsContext(m_settings, m_cms);
// timewarp reset logic
initTimeWarp(m_settings.getUserSettings(), m_session);
} | java | protected void initWorkplaceMembers(CmsObject cms, HttpSession session) {
m_cms = cms;
m_session = session;
// check role
try {
checkRole();
} catch (CmsRoleViolationException e) {
throw new CmsIllegalStateException(e.getMessageContainer(), e);
}
// get / create the workplace settings
m_settings = (CmsWorkplaceSettings)m_session.getAttribute(CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
if (m_settings == null) {
// create the settings object
m_settings = new CmsWorkplaceSettings();
m_settings = initWorkplaceSettings(m_cms, m_settings, false);
storeSettings(m_session, m_settings);
}
// initialize messages
CmsMessages messages = OpenCms.getWorkplaceManager().getMessages(getLocale());
// generate a new multi messages object and add the messages from the workplace
m_messages = new CmsMultiMessages(getLocale());
m_messages.addMessages(messages);
initMessages();
if (m_jsp != null) {
// check request for changes in the workplace settings
initWorkplaceRequestValues(m_settings, m_jsp.getRequest());
}
// set cms context accordingly
initWorkplaceCmsContext(m_settings, m_cms);
// timewarp reset logic
initTimeWarp(m_settings.getUserSettings(), m_session);
} | [
"protected",
"void",
"initWorkplaceMembers",
"(",
"CmsObject",
"cms",
",",
"HttpSession",
"session",
")",
"{",
"m_cms",
"=",
"cms",
";",
"m_session",
"=",
"session",
";",
"// check role",
"try",
"{",
"checkRole",
"(",
")",
";",
"}",
"catch",
"(",
"CmsRoleVio... | Initializes this workplace class instance.<p>
@param cms the user context
@param session the session | [
"Initializes",
"this",
"workplace",
"class",
"instance",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L2340-L2378 |
bazaarvoice/emodb | common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java | EmoUriComponent.contextualEncode | public static String contextualEncode(String s, Type t) {
return _encode(s, t, false, true);
} | java | public static String contextualEncode(String s, Type t) {
return _encode(s, t, false, true);
} | [
"public",
"static",
"String",
"contextualEncode",
"(",
"String",
"s",
",",
"Type",
"t",
")",
"{",
"return",
"_encode",
"(",
"s",
",",
"t",
",",
"false",
",",
"true",
")",
";",
"}"
] | Contextually encodes the characters of string that are either non-ASCII
characters or are ASCII characters that must be percent-encoded using the
UTF-8 encoding. Percent-encoded characters will be recognized and not
double encoded.
@param s the string to be encoded.
@param t the URI component type identifying the ASCII characters that
must be percent-encoded.
@return the encoded string. | [
"Contextually",
"encodes",
"the",
"characters",
"of",
"string",
"that",
"are",
"either",
"non",
"-",
"ASCII",
"characters",
"or",
"are",
"ASCII",
"characters",
"that",
"must",
"be",
"percent",
"-",
"encoded",
"using",
"the",
"UTF",
"-",
"8",
"encoding",
".",... | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java#L167-L169 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/client/ApiClient.java | ApiClient.configureAuthorizationFlow | public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
for(Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
OAuth oauth = (OAuth) auth;
oauth.getTokenRequestBuilder()
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
oauth.getAuthenticationRequestBuilder()
.setClientId(clientId)
.setRedirectURI(redirectURI);
return;
}
}
} | java | public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
for(Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
OAuth oauth = (OAuth) auth;
oauth.getTokenRequestBuilder()
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
oauth.getAuthenticationRequestBuilder()
.setClientId(clientId)
.setRedirectURI(redirectURI);
return;
}
}
} | [
"public",
"void",
"configureAuthorizationFlow",
"(",
"String",
"clientId",
",",
"String",
"clientSecret",
",",
"String",
"redirectURI",
")",
"{",
"for",
"(",
"Authentication",
"auth",
":",
"authentications",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"auth"... | Helper method to configure the OAuth accessCode/implicit flow parameters
@param clientId OAuth2 client ID
@param clientSecret OAuth2 client secret
@param redirectURI OAuth2 redirect uri | [
"Helper",
"method",
"to",
"configure",
"the",
"OAuth",
"accessCode",
"/",
"implicit",
"flow",
"parameters"
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/client/ApiClient.java#L448-L462 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java | MessageEventManager.sendDeliveredNotification | public void sendDeliveredNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
messageEvent.setDelivered(true);
messageEvent.setStanzaId(packetID);
msg.addExtension(messageEvent);
// Send the packet
connection().sendStanza(msg);
} | java | public void sendDeliveredNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
messageEvent.setDelivered(true);
messageEvent.setStanzaId(packetID);
msg.addExtension(messageEvent);
// Send the packet
connection().sendStanza(msg);
} | [
"public",
"void",
"sendDeliveredNotification",
"(",
"Jid",
"to",
",",
"String",
"packetID",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// Create the message to send",
"Message",
"msg",
"=",
"new",
"Message",
"(",
"to",
")",
";",
"// C... | Sends the notification that the message was delivered to the sender of the original message.
@param to the recipient of the notification.
@param packetID the id of the message to send.
@throws NotConnectedException
@throws InterruptedException | [
"Sends",
"the",
"notification",
"that",
"the",
"message",
"was",
"delivered",
"to",
"the",
"sender",
"of",
"the",
"original",
"message",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java#L215-L225 |
3redronin/mu-server | src/main/java/io/muserver/handlers/ResourceHandlerBuilder.java | ResourceHandlerBuilder.fileOrClasspath | public static ResourceHandlerBuilder fileOrClasspath(String fileRootIfExists, String classpathRoot) {
Path path = Paths.get(fileRootIfExists);
if (Files.isDirectory(path)) {
return fileHandler(path);
} else {
return classpathHandler(classpathRoot);
}
} | java | public static ResourceHandlerBuilder fileOrClasspath(String fileRootIfExists, String classpathRoot) {
Path path = Paths.get(fileRootIfExists);
if (Files.isDirectory(path)) {
return fileHandler(path);
} else {
return classpathHandler(classpathRoot);
}
} | [
"public",
"static",
"ResourceHandlerBuilder",
"fileOrClasspath",
"(",
"String",
"fileRootIfExists",
",",
"String",
"classpathRoot",
")",
"{",
"Path",
"path",
"=",
"Paths",
".",
"get",
"(",
"fileRootIfExists",
")",
";",
"if",
"(",
"Files",
".",
"isDirectory",
"("... | Creates a resource handler that serves from the file system if the directory exists; otherwise from the class path.
<p>
A common use case is for when you want to serve from the file path at development time (so you can update
files without restarting) but at deploy time resources are packaged in an uber jar.
@param fileRootIfExists A path to a directory holding static content, which may not exist, e.g. <code>src/main/resources/web</code>
@param classpathRoot A classpath path to a directory holding static content, e.g. <code>/web</code>
@return Returns a file-based resource handler builder or a classpath-based one. | [
"Creates",
"a",
"resource",
"handler",
"that",
"serves",
"from",
"the",
"file",
"system",
"if",
"the",
"directory",
"exists",
";",
"otherwise",
"from",
"the",
"class",
"path",
".",
"<p",
">",
"A",
"common",
"use",
"case",
"is",
"for",
"when",
"you",
"wan... | train | https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/handlers/ResourceHandlerBuilder.java#L121-L128 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.writeFile | public CmsFile writeFile(CmsRequestContext context, CmsFile resource) throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsFile result = null;
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL);
result = m_driverManager.writeFile(dbc, resource);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_WRITE_FILE_1, context.getSitePath(resource)), e);
} finally {
dbc.clear();
}
return result;
} | java | public CmsFile writeFile(CmsRequestContext context, CmsFile resource) throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsFile result = null;
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL);
result = m_driverManager.writeFile(dbc, resource);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_WRITE_FILE_1, context.getSitePath(resource)), e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"CmsFile",
"writeFile",
"(",
"CmsRequestContext",
"context",
",",
"CmsFile",
"resource",
")",
"throws",
"CmsException",
",",
"CmsSecurityException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"CmsF... | Writes a resource to the OpenCms VFS, including it's content.<p>
Applies only to resources of type <code>{@link CmsFile}</code>
i.e. resources that have a binary content attached.<p>
Certain resource types might apply content validation or transformation rules
before the resource is actually written to the VFS. The returned result
might therefore be a modified version from the provided original.<p>
@param context the current request context
@param resource the resource to apply this operation to
@return the written resource (may have been modified)
@throws CmsSecurityException if the user has insufficient permission for the given resource ({@link CmsPermissionSet#ACCESS_WRITE} required)
@throws CmsException if something goes wrong
@see CmsObject#writeFile(CmsFile)
@see org.opencms.file.types.I_CmsResourceType#writeFile(CmsObject, CmsSecurityManager, CmsFile) | [
"Writes",
"a",
"resource",
"to",
"the",
"OpenCms",
"VFS",
"including",
"it",
"s",
"content",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6636-L6650 |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/client/SchedulerREEF.java | SchedulerREEF.runTaskScheduler | public static void runTaskScheduler(final Configuration runtimeConf, final String[] args)
throws InjectionException, IOException, ParseException {
final Tang tang = Tang.Factory.getTang();
final Configuration commandLineConf = CommandLine.parseToConfiguration(args, Retain.class);
// Merge the configurations to run Driver
final Configuration driverConf = Configurations.merge(getDriverConf(), getHttpConf(), commandLineConf);
final REEF reef = tang.newInjector(runtimeConf).getInstance(REEF.class);
reef.submit(driverConf);
} | java | public static void runTaskScheduler(final Configuration runtimeConf, final String[] args)
throws InjectionException, IOException, ParseException {
final Tang tang = Tang.Factory.getTang();
final Configuration commandLineConf = CommandLine.parseToConfiguration(args, Retain.class);
// Merge the configurations to run Driver
final Configuration driverConf = Configurations.merge(getDriverConf(), getHttpConf(), commandLineConf);
final REEF reef = tang.newInjector(runtimeConf).getInstance(REEF.class);
reef.submit(driverConf);
} | [
"public",
"static",
"void",
"runTaskScheduler",
"(",
"final",
"Configuration",
"runtimeConf",
",",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"InjectionException",
",",
"IOException",
",",
"ParseException",
"{",
"final",
"Tang",
"tang",
"=",
"Tang",
"."... | Run the Task scheduler. If '-retain true' option is passed via command line,
the scheduler reuses evaluators to submit new Tasks.
@param runtimeConf The runtime configuration (e.g. Local, YARN, etc)
@param args Command line arguments.
@throws InjectionException
@throws java.io.IOException | [
"Run",
"the",
"Task",
"scheduler",
".",
"If",
"-",
"retain",
"true",
"option",
"is",
"passed",
"via",
"command",
"line",
"the",
"scheduler",
"reuses",
"evaluators",
"to",
"submit",
"new",
"Tasks",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/client/SchedulerREEF.java#L91-L102 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/metadata/RepositoryTags.java | RepositoryTags.getCompleteTagById | public String getCompleteTagById(int elementId, String characters)
{
String result = getOpeningTagById(elementId);
result += characters;
result += getClosingTagById(elementId);
return result;
} | java | public String getCompleteTagById(int elementId, String characters)
{
String result = getOpeningTagById(elementId);
result += characters;
result += getClosingTagById(elementId);
return result;
} | [
"public",
"String",
"getCompleteTagById",
"(",
"int",
"elementId",
",",
"String",
"characters",
")",
"{",
"String",
"result",
"=",
"getOpeningTagById",
"(",
"elementId",
")",
";",
"result",
"+=",
"characters",
";",
"result",
"+=",
"getClosingTagById",
"(",
"elem... | returns the opening xml-tag associated with the repository element with
id <code>elementId</code>.
@return the resulting tag | [
"returns",
"the",
"opening",
"xml",
"-",
"tag",
"associated",
"with",
"the",
"repository",
"element",
"with",
"id",
"<code",
">",
"elementId<",
"/",
"code",
">",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java#L277-L283 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/headerfooter/RtfHeaderFooterGroup.java | RtfHeaderFooterGroup.setHeaderFooter | public void setHeaderFooter(HeaderFooter headerFooter, int displayAt) {
this.mode = MODE_MULTIPLE;
switch(displayAt) {
case RtfHeaderFooter.DISPLAY_ALL_PAGES:
headerAll = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
break;
case RtfHeaderFooter.DISPLAY_FIRST_PAGE:
headerFirst = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
break;
case RtfHeaderFooter.DISPLAY_LEFT_PAGES:
headerLeft = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
break;
case RtfHeaderFooter.DISPLAY_RIGHT_PAGES:
headerRight = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
break;
}
} | java | public void setHeaderFooter(HeaderFooter headerFooter, int displayAt) {
this.mode = MODE_MULTIPLE;
switch(displayAt) {
case RtfHeaderFooter.DISPLAY_ALL_PAGES:
headerAll = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
break;
case RtfHeaderFooter.DISPLAY_FIRST_PAGE:
headerFirst = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
break;
case RtfHeaderFooter.DISPLAY_LEFT_PAGES:
headerLeft = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
break;
case RtfHeaderFooter.DISPLAY_RIGHT_PAGES:
headerRight = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
break;
}
} | [
"public",
"void",
"setHeaderFooter",
"(",
"HeaderFooter",
"headerFooter",
",",
"int",
"displayAt",
")",
"{",
"this",
".",
"mode",
"=",
"MODE_MULTIPLE",
";",
"switch",
"(",
"displayAt",
")",
"{",
"case",
"RtfHeaderFooter",
".",
"DISPLAY_ALL_PAGES",
":",
"headerAl... | Set a HeaderFooter to be displayed at a certain position
@param headerFooter The HeaderFooter to set
@param displayAt The display location to use | [
"Set",
"a",
"HeaderFooter",
"to",
"be",
"displayed",
"at",
"a",
"certain",
"position"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/headerfooter/RtfHeaderFooterGroup.java#L274-L290 |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java | ZipExploder.process | public void process(File[] zipFiles, File[] jarFiles, File destDir) throws IOException {
processZips(zipFiles, destDir);
processJars(jarFiles, destDir);
} | java | public void process(File[] zipFiles, File[] jarFiles, File destDir) throws IOException {
processZips(zipFiles, destDir);
processJars(jarFiles, destDir);
} | [
"public",
"void",
"process",
"(",
"File",
"[",
"]",
"zipFiles",
",",
"File",
"[",
"]",
"jarFiles",
",",
"File",
"destDir",
")",
"throws",
"IOException",
"{",
"processZips",
"(",
"zipFiles",
",",
"destDir",
")",
";",
"processJars",
"(",
"jarFiles",
",",
"... | Explode source JAR and/or ZIP files into a target directory
@param zipFiles
source files
@param jarFiles
source files
@param destDir
target directory (should already exist)
@exception IOException
error creating a target file | [
"Explode",
"source",
"JAR",
"and",
"/",
"or",
"ZIP",
"files",
"into",
"a",
"target",
"directory"
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java#L135-L138 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadBitmap | public static Bitmap loadBitmap(Uri uri, Context context) throws ImageLoadException {
return loadBitmap(new UriSource(uri, context));
} | java | public static Bitmap loadBitmap(Uri uri, Context context) throws ImageLoadException {
return loadBitmap(new UriSource(uri, context));
} | [
"public",
"static",
"Bitmap",
"loadBitmap",
"(",
"Uri",
"uri",
",",
"Context",
"context",
")",
"throws",
"ImageLoadException",
"{",
"return",
"loadBitmap",
"(",
"new",
"UriSource",
"(",
"uri",
",",
"context",
")",
")",
";",
"}"
] | Loading bitmap without any modifications
@param uri content uri for bitmap
@param context Application Context
@return loaded bitmap (always not null)
@throws ImageLoadException if it is unable to load file | [
"Loading",
"bitmap",
"without",
"any",
"modifications"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L49-L51 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeCheck.java | TypeCheck.ensureTyped | private void ensureTyped(Node n, JSType type) {
// Make sure FUNCTION nodes always get function type.
checkState(!n.isFunction() || type.isFunctionType() || type.isUnknownType());
if (n.getJSType() == null) {
n.setJSType(type);
}
} | java | private void ensureTyped(Node n, JSType type) {
// Make sure FUNCTION nodes always get function type.
checkState(!n.isFunction() || type.isFunctionType() || type.isUnknownType());
if (n.getJSType() == null) {
n.setJSType(type);
}
} | [
"private",
"void",
"ensureTyped",
"(",
"Node",
"n",
",",
"JSType",
"type",
")",
"{",
"// Make sure FUNCTION nodes always get function type.",
"checkState",
"(",
"!",
"n",
".",
"isFunction",
"(",
")",
"||",
"type",
".",
"isFunctionType",
"(",
")",
"||",
"type",
... | Ensures the node is typed.
@param n The node getting a type assigned to it.
@param type The type to be assigned. | [
"Ensures",
"the",
"node",
"is",
"typed",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L3028-L3034 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/LoadedFieldSet.java | LoadedFieldSet.addStore | public void addStore(InstructionHandle handle, XField field) {
getLoadStoreCount(field).storeCount++;
handleToFieldMap.put(handle, field);
} | java | public void addStore(InstructionHandle handle, XField field) {
getLoadStoreCount(field).storeCount++;
handleToFieldMap.put(handle, field);
} | [
"public",
"void",
"addStore",
"(",
"InstructionHandle",
"handle",
",",
"XField",
"field",
")",
"{",
"getLoadStoreCount",
"(",
"field",
")",
".",
"storeCount",
"++",
";",
"handleToFieldMap",
".",
"put",
"(",
"handle",
",",
"field",
")",
";",
"}"
] | Add a store of given field at given instruction.
@param handle
the instruction
@param field
the field | [
"Add",
"a",
"store",
"of",
"given",
"field",
"at",
"given",
"instruction",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/LoadedFieldSet.java#L118-L121 |
finmath/finmath-lib | src/main/java6/net/finmath/montecarlo/interestrate/products/SwaptionSimple.java | SwaptionSimple.getValue | @Override
public RandomVariableInterface getValue(double evaluationTime, LIBORModelMonteCarloSimulationInterface model) throws CalculationException {
RandomVariableInterface value = swaption.getValue(evaluationTime, model);
if(valueUnit == ValueUnit.VALUE) {
return value;
}
ForwardCurveInterface forwardCurve = model.getModel().getForwardRateCurve();
DiscountCurveInterface discountCurve = model.getModel().getAnalyticModel() != null ? model.getModel().getAnalyticModel().getDiscountCurve(forwardCurve.getDiscountCurveName()) : null;
double parSwaprate = Swap.getForwardSwapRate(new RegularSchedule(tenor), new RegularSchedule(tenor), forwardCurve, model.getModel().getAnalyticModel());
double optionMaturity = tenor.getTime(0);
double strikeSwaprate = swaprate;
double swapAnnuity = discountCurve != null ? SwapAnnuity.getSwapAnnuity(tenor, discountCurve) : SwapAnnuity.getSwapAnnuity(tenor, forwardCurve);
if(valueUnit == ValueUnit.VOLATILITY || valueUnit == ValueUnit.VOLATILITYLOGNORMAL) {
double volatility = AnalyticFormulas.blackScholesOptionImpliedVolatility(parSwaprate, optionMaturity, strikeSwaprate, swapAnnuity, value.getAverage());
return model.getRandomVariableForConstant(volatility);
}
else if(valueUnit == ValueUnit.VOLATILITYNORMAL) {
double volatility = AnalyticFormulas.bachelierOptionImpliedVolatility(parSwaprate, optionMaturity, strikeSwaprate, swapAnnuity, value.getAverage());
return model.getRandomVariableForConstant(volatility);
}
else if(valueUnit == ValueUnit.INTEGRATEDVARIANCE || valueUnit == ValueUnit.INTEGRATEDLOGNORMALVARIANCE) {
double volatility = AnalyticFormulas.blackScholesOptionImpliedVolatility(parSwaprate, optionMaturity, strikeSwaprate, swapAnnuity, value.getAverage());
return model.getRandomVariableForConstant(volatility * volatility * optionMaturity);
}
else if(valueUnit == ValueUnit.INTEGRATEDNORMALVARIANCE) {
double volatility = AnalyticFormulas.bachelierOptionImpliedVolatility(parSwaprate, optionMaturity, strikeSwaprate, swapAnnuity, value.getAverage());
return model.getRandomVariableForConstant(volatility * volatility * optionMaturity);
}
else {
throw new UnsupportedOperationException("Provided valueUnit not implemented.");
}
} | java | @Override
public RandomVariableInterface getValue(double evaluationTime, LIBORModelMonteCarloSimulationInterface model) throws CalculationException {
RandomVariableInterface value = swaption.getValue(evaluationTime, model);
if(valueUnit == ValueUnit.VALUE) {
return value;
}
ForwardCurveInterface forwardCurve = model.getModel().getForwardRateCurve();
DiscountCurveInterface discountCurve = model.getModel().getAnalyticModel() != null ? model.getModel().getAnalyticModel().getDiscountCurve(forwardCurve.getDiscountCurveName()) : null;
double parSwaprate = Swap.getForwardSwapRate(new RegularSchedule(tenor), new RegularSchedule(tenor), forwardCurve, model.getModel().getAnalyticModel());
double optionMaturity = tenor.getTime(0);
double strikeSwaprate = swaprate;
double swapAnnuity = discountCurve != null ? SwapAnnuity.getSwapAnnuity(tenor, discountCurve) : SwapAnnuity.getSwapAnnuity(tenor, forwardCurve);
if(valueUnit == ValueUnit.VOLATILITY || valueUnit == ValueUnit.VOLATILITYLOGNORMAL) {
double volatility = AnalyticFormulas.blackScholesOptionImpliedVolatility(parSwaprate, optionMaturity, strikeSwaprate, swapAnnuity, value.getAverage());
return model.getRandomVariableForConstant(volatility);
}
else if(valueUnit == ValueUnit.VOLATILITYNORMAL) {
double volatility = AnalyticFormulas.bachelierOptionImpliedVolatility(parSwaprate, optionMaturity, strikeSwaprate, swapAnnuity, value.getAverage());
return model.getRandomVariableForConstant(volatility);
}
else if(valueUnit == ValueUnit.INTEGRATEDVARIANCE || valueUnit == ValueUnit.INTEGRATEDLOGNORMALVARIANCE) {
double volatility = AnalyticFormulas.blackScholesOptionImpliedVolatility(parSwaprate, optionMaturity, strikeSwaprate, swapAnnuity, value.getAverage());
return model.getRandomVariableForConstant(volatility * volatility * optionMaturity);
}
else if(valueUnit == ValueUnit.INTEGRATEDNORMALVARIANCE) {
double volatility = AnalyticFormulas.bachelierOptionImpliedVolatility(parSwaprate, optionMaturity, strikeSwaprate, swapAnnuity, value.getAverage());
return model.getRandomVariableForConstant(volatility * volatility * optionMaturity);
}
else {
throw new UnsupportedOperationException("Provided valueUnit not implemented.");
}
} | [
"@",
"Override",
"public",
"RandomVariableInterface",
"getValue",
"(",
"double",
"evaluationTime",
",",
"LIBORModelMonteCarloSimulationInterface",
"model",
")",
"throws",
"CalculationException",
"{",
"RandomVariableInterface",
"value",
"=",
"swaption",
".",
"getValue",
"(",... | This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"This",
"method",
"returns",
"the",
"value",
"random",
"variable",
"of",
"the",
"product",
"within",
"the",
"specified",
"model",
"evaluated",
"at",
"a",
"given",
"evalutationTime",
".",
"Note",
":",
"For",
"a",
"lattice",
"this",
"is",
"often",
"the",
"valu... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/products/SwaptionSimple.java#L77-L112 |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ParameterUtil.java | ParameterUtil.getParameterByName | public static QueryParameter getParameterByName(Report report, String parameterName) {
return getParameterByName(report.getParameters(), parameterName);
} | java | public static QueryParameter getParameterByName(Report report, String parameterName) {
return getParameterByName(report.getParameters(), parameterName);
} | [
"public",
"static",
"QueryParameter",
"getParameterByName",
"(",
"Report",
"report",
",",
"String",
"parameterName",
")",
"{",
"return",
"getParameterByName",
"(",
"report",
".",
"getParameters",
"(",
")",
",",
"parameterName",
")",
";",
"}"
] | Get parameter by name
@param report next report object
@param parameterName parameter name
@return return paramater with the specified name, null if parameter not found | [
"Get",
"parameter",
"by",
"name"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ParameterUtil.java#L615-L617 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java | MediaServicesInner.regenerateKeyAsync | public Observable<RegenerateKeyOutputInner> regenerateKeyAsync(String resourceGroupName, String mediaServiceName, KeyType keyType) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, mediaServiceName, keyType).map(new Func1<ServiceResponse<RegenerateKeyOutputInner>, RegenerateKeyOutputInner>() {
@Override
public RegenerateKeyOutputInner call(ServiceResponse<RegenerateKeyOutputInner> response) {
return response.body();
}
});
} | java | public Observable<RegenerateKeyOutputInner> regenerateKeyAsync(String resourceGroupName, String mediaServiceName, KeyType keyType) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, mediaServiceName, keyType).map(new Func1<ServiceResponse<RegenerateKeyOutputInner>, RegenerateKeyOutputInner>() {
@Override
public RegenerateKeyOutputInner call(ServiceResponse<RegenerateKeyOutputInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RegenerateKeyOutputInner",
">",
"regenerateKeyAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"mediaServiceName",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"regenerateKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Regenerates a primary or secondary key for a Media Service.
@param resourceGroupName Name of the resource group within the Azure subscription.
@param mediaServiceName Name of the Media Service.
@param keyType The keyType indicating which key you want to regenerate, Primary or Secondary. Possible values include: 'Primary', 'Secondary'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RegenerateKeyOutputInner object | [
"Regenerates",
"a",
"primary",
"or",
"secondary",
"key",
"for",
"a",
"Media",
"Service",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java#L674-L681 |
cdk/cdk | display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/HighlightGenerator.java | HighlightGenerator.createBondHighlight | private static Shape createBondHighlight(IBond bond, double radius) {
double x1 = bond.getBegin().getPoint2d().x;
double x2 = bond.getEnd().getPoint2d().x;
double y1 = bond.getBegin().getPoint2d().y;
double y2 = bond.getEnd().getPoint2d().y;
double dx = x2 - x1;
double dy = y2 - y1;
double mag = Math.sqrt((dx * dx) + (dy * dy));
dx /= mag;
dy /= mag;
double r2 = radius / 2;
Shape s = new RoundRectangle2D.Double(x1 - r2, y1 - r2, mag + radius, radius, radius, radius);
double theta = Math.atan2(dy, dx);
return AffineTransform.getRotateInstance(theta, x1, y1).createTransformedShape(s);
} | java | private static Shape createBondHighlight(IBond bond, double radius) {
double x1 = bond.getBegin().getPoint2d().x;
double x2 = bond.getEnd().getPoint2d().x;
double y1 = bond.getBegin().getPoint2d().y;
double y2 = bond.getEnd().getPoint2d().y;
double dx = x2 - x1;
double dy = y2 - y1;
double mag = Math.sqrt((dx * dx) + (dy * dy));
dx /= mag;
dy /= mag;
double r2 = radius / 2;
Shape s = new RoundRectangle2D.Double(x1 - r2, y1 - r2, mag + radius, radius, radius, radius);
double theta = Math.atan2(dy, dx);
return AffineTransform.getRotateInstance(theta, x1, y1).createTransformedShape(s);
} | [
"private",
"static",
"Shape",
"createBondHighlight",
"(",
"IBond",
"bond",
",",
"double",
"radius",
")",
"{",
"double",
"x1",
"=",
"bond",
".",
"getBegin",
"(",
")",
".",
"getPoint2d",
"(",
")",
".",
"x",
";",
"double",
"x2",
"=",
"bond",
".",
"getEnd"... | Create the shape which will highlight the provided bond.
@param bond the bond to highlight
@param radius the specified radius
@return the shape which will highlight the atom | [
"Create",
"the",
"shape",
"which",
"will",
"highlight",
"the",
"provided",
"bond",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/HighlightGenerator.java#L204-L226 |
jayantk/jklol | src/com/jayantkrish/jklol/util/KbestQueue.java | KbestQueue.offer | public final T offer(T toQueue, double score) {
HeapUtils.offer(keys, values, size, toQueue, score);
size++;
if (size > maxElements) {
return removeMin();
} else {
return null;
}
} | java | public final T offer(T toQueue, double score) {
HeapUtils.offer(keys, values, size, toQueue, score);
size++;
if (size > maxElements) {
return removeMin();
} else {
return null;
}
} | [
"public",
"final",
"T",
"offer",
"(",
"T",
"toQueue",
",",
"double",
"score",
")",
"{",
"HeapUtils",
".",
"offer",
"(",
"keys",
",",
"values",
",",
"size",
",",
"toQueue",
",",
"score",
")",
";",
"size",
"++",
";",
"if",
"(",
"size",
">",
"maxEleme... | Add {@code toQueue} to this with {@code score}.
Calling this method may remove the lowest-scoring
element if adding the new element causes the size of
{@code this} to exceed {@code this.maxElements}.
@param toQueue
@param score
@return the removed element if an element was removed,
{@code null} otherwise. | [
"Add",
"{",
"@code",
"toQueue",
"}",
"to",
"this",
"with",
"{",
"@code",
"score",
"}",
".",
"Calling",
"this",
"method",
"may",
"remove",
"the",
"lowest",
"-",
"scoring",
"element",
"if",
"adding",
"the",
"new",
"element",
"causes",
"the",
"size",
"of",
... | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/KbestQueue.java#L45-L54 |
bwkimmel/java-util | src/main/java/ca/eandb/util/io/FileUtil.java | FileUtil.getRelativePath | public static String getRelativePath(File file, File base) throws IOException {
StringWriter path = new StringWriter();
while (!isAncestor(file, base)) {
path.append("../");
}
String fileName = file.getAbsolutePath();
String baseName = base.getAbsolutePath();
int prefixLength = baseName.length();
if (!baseName.endsWith("/")) {
prefixLength++;
}
path.append(fileName.substring(prefixLength));
return path.toString();
} | java | public static String getRelativePath(File file, File base) throws IOException {
StringWriter path = new StringWriter();
while (!isAncestor(file, base)) {
path.append("../");
}
String fileName = file.getAbsolutePath();
String baseName = base.getAbsolutePath();
int prefixLength = baseName.length();
if (!baseName.endsWith("/")) {
prefixLength++;
}
path.append(fileName.substring(prefixLength));
return path.toString();
} | [
"public",
"static",
"String",
"getRelativePath",
"(",
"File",
"file",
",",
"File",
"base",
")",
"throws",
"IOException",
"{",
"StringWriter",
"path",
"=",
"new",
"StringWriter",
"(",
")",
";",
"while",
"(",
"!",
"isAncestor",
"(",
"file",
",",
"base",
")",... | Gets the <code>String</code> representing the path to a file relative to
a given directory.
@param file The <code>File</code> for which to obtain the relative path.
@param base The <code>File</code> representing the directory that the
resulting path should be relative to.
@return The <code>String</code> representing the relative path.
@throws IOException If a directory along the walk from <code>base</code>
to <code>file</code> could not be read. | [
"Gets",
"the",
"<code",
">",
"String<",
"/",
"code",
">",
"representing",
"the",
"path",
"to",
"a",
"file",
"relative",
"to",
"a",
"given",
"directory",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L317-L335 |
shevek/jcpp | src/main/java/org/anarres/cpp/CppReader.java | CppReader.addMacro | public void addMacro(@Nonnull String name, @Nonnull String value)
throws LexerException {
cpp.addMacro(name, value);
} | java | public void addMacro(@Nonnull String name, @Nonnull String value)
throws LexerException {
cpp.addMacro(name, value);
} | [
"public",
"void",
"addMacro",
"(",
"@",
"Nonnull",
"String",
"name",
",",
"@",
"Nonnull",
"String",
"value",
")",
"throws",
"LexerException",
"{",
"cpp",
".",
"addMacro",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Defines the given name as a macro.
This is a convnience method. | [
"Defines",
"the",
"given",
"name",
"as",
"a",
"macro",
"."
] | train | https://github.com/shevek/jcpp/blob/71462c702097cabf8304202c740f780285fc35a8/src/main/java/org/anarres/cpp/CppReader.java#L83-L86 |
bwkimmel/jdcp | jdcp-worker/src/main/java/ca/eandb/jdcp/worker/CachingJobServiceClassLoaderStrategy.java | CachingJobServiceClassLoaderStrategy.beginLookup | private synchronized boolean beginLookup(Map<String, String> pending, String name) {
String canonical = pending.get(name);
if (canonical != null) {
do {
try {
canonical.wait();
} catch (InterruptedException e) {}
} while (pending.containsKey(name));
}
return (canonical == null);
} | java | private synchronized boolean beginLookup(Map<String, String> pending, String name) {
String canonical = pending.get(name);
if (canonical != null) {
do {
try {
canonical.wait();
} catch (InterruptedException e) {}
} while (pending.containsKey(name));
}
return (canonical == null);
} | [
"private",
"synchronized",
"boolean",
"beginLookup",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"pending",
",",
"String",
"name",
")",
"{",
"String",
"canonical",
"=",
"pending",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"canonical",
"!=",
"null"... | Ensures that only one thread is calling the service to obtain the class
digest or definition for a particular class name.
@param pending The <code>Map</code> in which to store pending lookups.
@param name The name of the class to be looked up.
@return A value indicating whether the current thread is designated to
perform the lookup. | [
"Ensures",
"that",
"only",
"one",
"thread",
"is",
"calling",
"the",
"service",
"to",
"obtain",
"the",
"class",
"digest",
"or",
"definition",
"for",
"a",
"particular",
"class",
"name",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-worker/src/main/java/ca/eandb/jdcp/worker/CachingJobServiceClassLoaderStrategy.java#L127-L137 |
google/closure-compiler | src/com/google/javascript/jscomp/Compiler.java | Compiler.getAstDotGraph | public String getAstDotGraph() throws IOException {
if (jsRoot != null) {
ControlFlowAnalysis cfa = new ControlFlowAnalysis(this, true, false);
cfa.process(null, jsRoot);
return DotFormatter.toDot(jsRoot, cfa.getCfg());
} else {
return "";
}
} | java | public String getAstDotGraph() throws IOException {
if (jsRoot != null) {
ControlFlowAnalysis cfa = new ControlFlowAnalysis(this, true, false);
cfa.process(null, jsRoot);
return DotFormatter.toDot(jsRoot, cfa.getCfg());
} else {
return "";
}
} | [
"public",
"String",
"getAstDotGraph",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"jsRoot",
"!=",
"null",
")",
"{",
"ControlFlowAnalysis",
"cfa",
"=",
"new",
"ControlFlowAnalysis",
"(",
"this",
",",
"true",
",",
"false",
")",
";",
"cfa",
".",
"proce... | Gets the DOT graph of the AST generated at the end of compilation. | [
"Gets",
"the",
"DOT",
"graph",
"of",
"the",
"AST",
"generated",
"at",
"the",
"end",
"of",
"compilation",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Compiler.java#L3005-L3013 |
rapid7/conqueso-client-java | src/main/java/com/rapid7/conqueso/client/ConquesoClient.java | ConquesoClient.getRoleInstancesWithMetadata | public ImmutableList<InstanceInfo> getRoleInstancesWithMetadata(String roleName, String...metadataQueryPairs) {
checkArgument(metadataQueryPairs.length > 0, "No metadata query pairs specified");
checkArgument(metadataQueryPairs.length % 2 == 0, "Odd number of arguments passed as metadata query pairs");
return getRoleInstancesWithMetadata(roleName, toMap(metadataQueryPairs));
} | java | public ImmutableList<InstanceInfo> getRoleInstancesWithMetadata(String roleName, String...metadataQueryPairs) {
checkArgument(metadataQueryPairs.length > 0, "No metadata query pairs specified");
checkArgument(metadataQueryPairs.length % 2 == 0, "Odd number of arguments passed as metadata query pairs");
return getRoleInstancesWithMetadata(roleName, toMap(metadataQueryPairs));
} | [
"public",
"ImmutableList",
"<",
"InstanceInfo",
">",
"getRoleInstancesWithMetadata",
"(",
"String",
"roleName",
",",
"String",
"...",
"metadataQueryPairs",
")",
"{",
"checkArgument",
"(",
"metadataQueryPairs",
".",
"length",
">",
"0",
",",
"\"No metadata query pairs spe... | Retrieve information about all online instances of a particular role matching the given metadata query from
the Conqueso Server.
The metadata query is expressed as key/value pairs. For example, calling this method like this:
<p>
<code>
conquesoClient.getRoleInstancesWithMetadata("reporting-service", "availability-zone", "us-east-1c",
"instance-type", "m1.small");
</code>
</p>
will return all instances of role reporting-service with metadata that matches availability-zone=us-east-1c and
instance-type=m1.small.
@param roleName the role to retrieve
@param metadataQueryPairs the key/value pairs representing a query for instances matching the metadata
@return the information about the matching instances
@throws ConquesoCommunicationException if there's an error communicating with the Conqueso Server. | [
"Retrieve",
"information",
"about",
"all",
"online",
"instances",
"of",
"a",
"particular",
"role",
"matching",
"the",
"given",
"metadata",
"query",
"from",
"the",
"Conqueso",
"Server",
".",
"The",
"metadata",
"query",
"is",
"expressed",
"as",
"key",
"/",
"valu... | train | https://github.com/rapid7/conqueso-client-java/blob/fa4a7a6dbf67e5afe6b4f68cbc97b1929af864e2/src/main/java/com/rapid7/conqueso/client/ConquesoClient.java#L534-L539 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/sorting/SortFileParser.java | SortFileParser.getSortedResources | public List<String> getSortedResources() {
List<String> resources = new ArrayList<>();
try (BufferedReader bf = new BufferedReader(reader)) {
String res;
while ((res = bf.readLine()) != null) {
String name = PathNormalizer.normalizePath(res.trim());
for (String available : availableResources) {
if (PathNormalizer.normalizePath(available).equals(name)) {
if (name.endsWith(".js") || name.endsWith(".css"))
resources.add(PathNormalizer.joinPaths(dirName, name));
else
resources.add(PathNormalizer.joinPaths(dirName, name + "/"));
availableResources.remove(available);
break;
}
}
}
} catch (IOException e) {
throw new BundlingProcessException("Unexpected IOException reading sort file", e);
}
return resources;
} | java | public List<String> getSortedResources() {
List<String> resources = new ArrayList<>();
try (BufferedReader bf = new BufferedReader(reader)) {
String res;
while ((res = bf.readLine()) != null) {
String name = PathNormalizer.normalizePath(res.trim());
for (String available : availableResources) {
if (PathNormalizer.normalizePath(available).equals(name)) {
if (name.endsWith(".js") || name.endsWith(".css"))
resources.add(PathNormalizer.joinPaths(dirName, name));
else
resources.add(PathNormalizer.joinPaths(dirName, name + "/"));
availableResources.remove(available);
break;
}
}
}
} catch (IOException e) {
throw new BundlingProcessException("Unexpected IOException reading sort file", e);
}
return resources;
} | [
"public",
"List",
"<",
"String",
">",
"getSortedResources",
"(",
")",
"{",
"List",
"<",
"String",
">",
"resources",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"(",
"BufferedReader",
"bf",
"=",
"new",
"BufferedReader",
"(",
"reader",
")",
")",
... | Creates a list with the ordered resource names and returns it. If a
resource is not in the resources dir, it is ignored.
@return the list of ordered resource names | [
"Creates",
"a",
"list",
"with",
"the",
"ordered",
"resource",
"names",
"and",
"returns",
"it",
".",
"If",
"a",
"resource",
"is",
"not",
"in",
"the",
"resources",
"dir",
"it",
"is",
"ignored",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/sorting/SortFileParser.java#L67-L89 |
Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/util/PropertyValueRecovered.java | PropertyValueRecovered.recoveredValue | public static <T> T recoveredValue(Class<T> type, String properties) throws ExecutionException {
return recoveredValueASArray(type, properties)[0];
} | java | public static <T> T recoveredValue(Class<T> type, String properties) throws ExecutionException {
return recoveredValueASArray(type, properties)[0];
} | [
"public",
"static",
"<",
"T",
">",
"T",
"recoveredValue",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"properties",
")",
"throws",
"ExecutionException",
"{",
"return",
"recoveredValueASArray",
"(",
"type",
",",
"properties",
")",
"[",
"0",
"]",
";"... | This method recovered the property.
@param properties the string which represents the properties to recovered.
@param type the type to recovered.
@return the properties.
@Throws ExecutionException if an error happens. | [
"This",
"method",
"recovered",
"the",
"property",
"."
] | train | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/util/PropertyValueRecovered.java#L91-L93 |
grpc/grpc-java | netty/src/main/java/io/grpc/netty/NettyServerBuilder.java | NettyServerBuilder.withChildOption | public <T> NettyServerBuilder withChildOption(ChannelOption<T> option, T value) {
this.channelOptions.put(option, value);
return this;
} | java | public <T> NettyServerBuilder withChildOption(ChannelOption<T> option, T value) {
this.channelOptions.put(option, value);
return this;
} | [
"public",
"<",
"T",
">",
"NettyServerBuilder",
"withChildOption",
"(",
"ChannelOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"this",
".",
"channelOptions",
".",
"put",
"(",
"option",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Specifies a channel option. As the underlying channel as well as network implementation may
ignore this value applications should consider it a hint.
@since 1.9.0 | [
"Specifies",
"a",
"channel",
"option",
".",
"As",
"the",
"underlying",
"channel",
"as",
"well",
"as",
"network",
"implementation",
"may",
"ignore",
"this",
"value",
"applications",
"should",
"consider",
"it",
"a",
"hint",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L166-L169 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java | BigDecimalMath.atan | public static BigDecimal atan(BigDecimal x, MathContext mathContext) {
checkMathContext(mathContext);
MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode());
x = x.divide(sqrt(ONE.add(x.multiply(x, mc), mc), mc), mc);
BigDecimal result = asin(x, mc);
return round(result, mathContext);
} | java | public static BigDecimal atan(BigDecimal x, MathContext mathContext) {
checkMathContext(mathContext);
MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode());
x = x.divide(sqrt(ONE.add(x.multiply(x, mc), mc), mc), mc);
BigDecimal result = asin(x, mc);
return round(result, mathContext);
} | [
"public",
"static",
"BigDecimal",
"atan",
"(",
"BigDecimal",
"x",
",",
"MathContext",
"mathContext",
")",
"{",
"checkMathContext",
"(",
"mathContext",
")",
";",
"MathContext",
"mc",
"=",
"new",
"MathContext",
"(",
"mathContext",
".",
"getPrecision",
"(",
")",
... | Calculates the arc tangens (inverted tangens) of {@link BigDecimal} x.
<p>See: <a href="http://en.wikipedia.org/wiki/Arctangens">Wikipedia: Arctangens</a></p>
@param x the {@link BigDecimal} to calculate the arc tangens for
@param mathContext the {@link MathContext} used for the result
@return the calculated arc tangens {@link BigDecimal} with the precision specified in the <code>mathContext</code>
@throws UnsupportedOperationException if the {@link MathContext} has unlimited precision | [
"Calculates",
"the",
"arc",
"tangens",
"(",
"inverted",
"tangens",
")",
"of",
"{",
"@link",
"BigDecimal",
"}",
"x",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1434-L1442 |
kubernetes-client/java | kubernetes/src/main/java/io/kubernetes/client/ApiClient.java | ApiClient.executeAsync | @SuppressWarnings("unchecked")
public <T> void executeAsync(Call call, final Type returnType, final ApiCallback<T> callback) {
call.enqueue(new Callback() {
@Override
public void onFailure(Request request, IOException e) {
callback.onFailure(new ApiException(e), 0, null);
}
@Override
public void onResponse(Response response) throws IOException {
T result;
try {
result = (T) handleResponse(response, returnType);
} catch (ApiException e) {
callback.onFailure(e, response.code(), response.headers().toMultimap());
return;
}
callback.onSuccess(result, response.code(), response.headers().toMultimap());
}
});
} | java | @SuppressWarnings("unchecked")
public <T> void executeAsync(Call call, final Type returnType, final ApiCallback<T> callback) {
call.enqueue(new Callback() {
@Override
public void onFailure(Request request, IOException e) {
callback.onFailure(new ApiException(e), 0, null);
}
@Override
public void onResponse(Response response) throws IOException {
T result;
try {
result = (T) handleResponse(response, returnType);
} catch (ApiException e) {
callback.onFailure(e, response.code(), response.headers().toMultimap());
return;
}
callback.onSuccess(result, response.code(), response.headers().toMultimap());
}
});
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"void",
"executeAsync",
"(",
"Call",
"call",
",",
"final",
"Type",
"returnType",
",",
"final",
"ApiCallback",
"<",
"T",
">",
"callback",
")",
"{",
"call",
".",
"enqueue",
"(",
"... | Execute HTTP call asynchronously.
@see #execute(Call, Type)
@param <T> Type
@param call The callback to be executed when the API call finishes
@param returnType Return type
@param callback ApiCallback | [
"Execute",
"HTTP",
"call",
"asynchronously",
"."
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/ApiClient.java#L829-L849 |
carrotsearch/hppc | hppc/src/main/templates/com/carrotsearch/hppc/KTypeHashSet.java | KTypeHashSet.indexInsert | public void indexInsert(int index, KType key) {
assert index < 0 : "The index must not point at an existing key.";
index = ~index;
if (Intrinsics.isEmpty(key)) {
assert index == mask + 1;
assert Intrinsics.isEmpty(keys[index]);
hasEmptyKey = true;
} else {
assert Intrinsics.isEmpty(keys[index]);
if (assigned == resizeAt) {
allocateThenInsertThenRehash(index, key);
} else {
keys[index] = key;
}
assigned++;
}
} | java | public void indexInsert(int index, KType key) {
assert index < 0 : "The index must not point at an existing key.";
index = ~index;
if (Intrinsics.isEmpty(key)) {
assert index == mask + 1;
assert Intrinsics.isEmpty(keys[index]);
hasEmptyKey = true;
} else {
assert Intrinsics.isEmpty(keys[index]);
if (assigned == resizeAt) {
allocateThenInsertThenRehash(index, key);
} else {
keys[index] = key;
}
assigned++;
}
} | [
"public",
"void",
"indexInsert",
"(",
"int",
"index",
",",
"KType",
"key",
")",
"{",
"assert",
"index",
"<",
"0",
":",
"\"The index must not point at an existing key.\"",
";",
"index",
"=",
"~",
"index",
";",
"if",
"(",
"Intrinsics",
".",
"isEmpty",
"(",
"ke... | Inserts a key for an index that is not present in the set. This method
may help in avoiding double recalculation of the key's hash.
@see #indexOf
@param index The index of a previously non-existing key, as returned from
{@link #indexOf}.
@throws AssertionError If assertions are enabled and the index does
not correspond to an existing key. | [
"Inserts",
"a",
"key",
"for",
"an",
"index",
"that",
"is",
"not",
"present",
"in",
"the",
"set",
".",
"This",
"method",
"may",
"help",
"in",
"avoiding",
"double",
"recalculation",
"of",
"the",
"key",
"s",
"hash",
"."
] | train | https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeHashSet.java#L681-L700 |
VoltDB/voltdb | src/frontend/org/voltdb/jni/ExecutionEngineJNI.java | ExecutionEngineJNI.loadLargeTempTableBlock | public boolean loadLargeTempTableBlock(long siteId, long blockCounter, ByteBuffer block) {
LargeBlockTask task = LargeBlockTask.getLoadTask(new BlockId(siteId, blockCounter), block);
return executeLargeBlockTaskSynchronously(task);
} | java | public boolean loadLargeTempTableBlock(long siteId, long blockCounter, ByteBuffer block) {
LargeBlockTask task = LargeBlockTask.getLoadTask(new BlockId(siteId, blockCounter), block);
return executeLargeBlockTaskSynchronously(task);
} | [
"public",
"boolean",
"loadLargeTempTableBlock",
"(",
"long",
"siteId",
",",
"long",
"blockCounter",
",",
"ByteBuffer",
"block",
")",
"{",
"LargeBlockTask",
"task",
"=",
"LargeBlockTask",
".",
"getLoadTask",
"(",
"new",
"BlockId",
"(",
"siteId",
",",
"blockCounter"... | Read a large table block from disk and write it to a ByteBuffer.
Block will still be stored on disk when this operation completes.
@param siteId The originating site id of the block to load
@param blockCounter The id of the block to load
@param block The buffer to write the block to
@return The original address of the block (so that its internal pointers may get updated) | [
"Read",
"a",
"large",
"table",
"block",
"from",
"disk",
"and",
"write",
"it",
"to",
"a",
"ByteBuffer",
".",
"Block",
"will",
"still",
"be",
"stored",
"on",
"disk",
"when",
"this",
"operation",
"completes",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jni/ExecutionEngineJNI.java#L892-L895 |
elki-project/elki | addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/uncertain/UKMeans.java | UKMeans.getExpectedRepDistance | protected double getExpectedRepDistance(NumberVector rep, DiscreteUncertainObject uo) {
SquaredEuclideanDistanceFunction euclidean = SquaredEuclideanDistanceFunction.STATIC;
int counter = 0;
double sum = 0.0;
for(int i = 0; i < uo.getNumberSamples(); i++) {
sum += euclidean.distance(rep, uo.getSample(i));
counter++;
}
return sum / counter;
} | java | protected double getExpectedRepDistance(NumberVector rep, DiscreteUncertainObject uo) {
SquaredEuclideanDistanceFunction euclidean = SquaredEuclideanDistanceFunction.STATIC;
int counter = 0;
double sum = 0.0;
for(int i = 0; i < uo.getNumberSamples(); i++) {
sum += euclidean.distance(rep, uo.getSample(i));
counter++;
}
return sum / counter;
} | [
"protected",
"double",
"getExpectedRepDistance",
"(",
"NumberVector",
"rep",
",",
"DiscreteUncertainObject",
"uo",
")",
"{",
"SquaredEuclideanDistanceFunction",
"euclidean",
"=",
"SquaredEuclideanDistanceFunction",
".",
"STATIC",
";",
"int",
"counter",
"=",
"0",
";",
"d... | Get expected distance between a Vector and an uncertain object
@param rep A vector, e.g. a cluster representative
@param uo A discrete uncertain object
@return The distance | [
"Get",
"expected",
"distance",
"between",
"a",
"Vector",
"and",
"an",
"uncertain",
"object"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/uncertain/UKMeans.java#L243-L252 |
podio/podio-java | src/main/java/com/podio/task/TaskAPI.java | TaskAPI.updatePrivate | public void updatePrivate(int taskId, boolean priv) {
getResourceFactory().getApiResource("/task/" + taskId + "/private")
.entity(new TaskPrivate(priv), MediaType.APPLICATION_JSON_TYPE)
.put();
} | java | public void updatePrivate(int taskId, boolean priv) {
getResourceFactory().getApiResource("/task/" + taskId + "/private")
.entity(new TaskPrivate(priv), MediaType.APPLICATION_JSON_TYPE)
.put();
} | [
"public",
"void",
"updatePrivate",
"(",
"int",
"taskId",
",",
"boolean",
"priv",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/task/\"",
"+",
"taskId",
"+",
"\"/private\"",
")",
".",
"entity",
"(",
"new",
"TaskPrivate",
"(",
"priv... | Update the private flag on the given task.
@param taskId
The id of the task
@param priv
<code>true</code> if the task should be private,
<code>false</code> otherwise | [
"Update",
"the",
"private",
"flag",
"on",
"the",
"given",
"task",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/task/TaskAPI.java#L130-L134 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunckPyramid.java | HornSchunckPyramid.interpolateFlowScale | protected void interpolateFlowScale(int widthNew, int heightNew) {
initFlowX.reshape(widthNew,heightNew);
initFlowY.reshape(widthNew,heightNew);
interpolateFlowScale(flowX, initFlowX);
interpolateFlowScale(flowY, initFlowY);
flowX.reshape(widthNew,heightNew);
flowY.reshape(widthNew,heightNew);
// init flow contains the initial estimate of the flow vector (if available)
// flow contains the estimate for each iteration below
flowX.setTo(initFlowX);
flowY.setTo(initFlowY);
} | java | protected void interpolateFlowScale(int widthNew, int heightNew) {
initFlowX.reshape(widthNew,heightNew);
initFlowY.reshape(widthNew,heightNew);
interpolateFlowScale(flowX, initFlowX);
interpolateFlowScale(flowY, initFlowY);
flowX.reshape(widthNew,heightNew);
flowY.reshape(widthNew,heightNew);
// init flow contains the initial estimate of the flow vector (if available)
// flow contains the estimate for each iteration below
flowX.setTo(initFlowX);
flowY.setTo(initFlowY);
} | [
"protected",
"void",
"interpolateFlowScale",
"(",
"int",
"widthNew",
",",
"int",
"heightNew",
")",
"{",
"initFlowX",
".",
"reshape",
"(",
"widthNew",
",",
"heightNew",
")",
";",
"initFlowY",
".",
"reshape",
"(",
"widthNew",
",",
"heightNew",
")",
";",
"inter... | Provides an initial estimate for the flow by interpolating values from the previous layer. | [
"Provides",
"an",
"initial",
"estimate",
"for",
"the",
"flow",
"by",
"interpolating",
"values",
"from",
"the",
"previous",
"layer",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunckPyramid.java#L155-L169 |
aws/aws-sdk-java | aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/internal/netty/handler/ErrorUnmarshallingHandler.java | ErrorUnmarshallingHandler.cumulateContent | private void cumulateContent(ChannelHandlerContext ctx, HttpContent msg) {
cumulation = cumulator.cumulate(ctx.alloc(), cumulation, msg.content());
} | java | private void cumulateContent(ChannelHandlerContext ctx, HttpContent msg) {
cumulation = cumulator.cumulate(ctx.alloc(), cumulation, msg.content());
} | [
"private",
"void",
"cumulateContent",
"(",
"ChannelHandlerContext",
"ctx",
",",
"HttpContent",
"msg",
")",
"{",
"cumulation",
"=",
"cumulator",
".",
"cumulate",
"(",
"ctx",
".",
"alloc",
"(",
")",
",",
"cumulation",
",",
"msg",
".",
"content",
"(",
")",
")... | Adds the current {@link HttpContent} to the cumulation of data.
@param ctx Channel context.
@param msg Current {@link HttpContent} message. | [
"Adds",
"the",
"current",
"{",
"@link",
"HttpContent",
"}",
"to",
"the",
"cumulation",
"of",
"data",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/internal/netty/handler/ErrorUnmarshallingHandler.java#L126-L128 |
requery/requery | requery-android/src/main/java/io/requery/android/sqlite/BasePreparedStatement.java | BasePreparedStatement.bindBlobLiteral | protected void bindBlobLiteral(int index, byte[] value) {
if (blobLiterals == null) {
blobLiterals = new LinkedHashMap<>();
}
blobLiterals.put(index, value);
} | java | protected void bindBlobLiteral(int index, byte[] value) {
if (blobLiterals == null) {
blobLiterals = new LinkedHashMap<>();
}
blobLiterals.put(index, value);
} | [
"protected",
"void",
"bindBlobLiteral",
"(",
"int",
"index",
",",
"byte",
"[",
"]",
"value",
")",
"{",
"if",
"(",
"blobLiterals",
"==",
"null",
")",
"{",
"blobLiterals",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"}",
"blobLiterals",
".",
"put",
... | inlines a blob literal into the sql statement since it can't be used as bind parameter | [
"inlines",
"a",
"blob",
"literal",
"into",
"the",
"sql",
"statement",
"since",
"it",
"can",
"t",
"be",
"used",
"as",
"bind",
"parameter"
] | train | https://github.com/requery/requery/blob/3070590c2ef76bb7062570bf9df03cd482db024a/requery-android/src/main/java/io/requery/android/sqlite/BasePreparedStatement.java#L115-L120 |
alkacon/opencms-core | src/org/opencms/importexport/CmsImportExportManager.java | CmsImportExportManager.addImportPrincipalTranslation | public void addImportPrincipalTranslation(String type, String from, String to) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ADDED_PRINCIPAL_TRANSLATION_3,
type,
from,
to));
}
if (I_CmsPrincipal.PRINCIPAL_GROUP.equalsIgnoreCase(type)) {
m_importGroupTranslations.put(from, to);
if (LOG.isInfoEnabled()) {
LOG.info(
Messages.get().getBundle().key(Messages.INIT_IMPORTEXPORT_ADDED_GROUP_TRANSLATION_2, from, to));
}
} else if (I_CmsPrincipal.PRINCIPAL_USER.equalsIgnoreCase(type)) {
m_importUserTranslations.put(from, to);
if (LOG.isInfoEnabled()) {
LOG.info(Messages.get().getBundle().key(Messages.INIT_IMPORTEXPORT_ADDED_USER_TRANSLATION_2, from, to));
}
}
} | java | public void addImportPrincipalTranslation(String type, String from, String to) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ADDED_PRINCIPAL_TRANSLATION_3,
type,
from,
to));
}
if (I_CmsPrincipal.PRINCIPAL_GROUP.equalsIgnoreCase(type)) {
m_importGroupTranslations.put(from, to);
if (LOG.isInfoEnabled()) {
LOG.info(
Messages.get().getBundle().key(Messages.INIT_IMPORTEXPORT_ADDED_GROUP_TRANSLATION_2, from, to));
}
} else if (I_CmsPrincipal.PRINCIPAL_USER.equalsIgnoreCase(type)) {
m_importUserTranslations.put(from, to);
if (LOG.isInfoEnabled()) {
LOG.info(Messages.get().getBundle().key(Messages.INIT_IMPORTEXPORT_ADDED_USER_TRANSLATION_2, from, to));
}
}
} | [
"public",
"void",
"addImportPrincipalTranslation",
"(",
"String",
"type",
",",
"String",
"from",
",",
"String",
"to",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"Messages",
".",
"get",
"(",
")",
"."... | Adds an import princial translation to the configuration.<p>
@param type the princial type ("USER" or "GROUP")
@param from the "from" translation source
@param to the "to" translation target | [
"Adds",
"an",
"import",
"princial",
"translation",
"to",
"the",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportExportManager.java#L560-L582 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/CopySoundexHandler.java | CopySoundexHandler.fieldChanged | public int fieldChanged(boolean bDisplayOption, int moveMode)
{
String source = this.getOwner().getString();
String soundex = this.soundex(source.substring(0, Math.min(4, source.length())));
if (soundex == null)
return DBConstants.NORMAL_RETURN;
short hashValue = this.hashSound(soundex);
BaseField field = this.getOwner().getRecord().getField(m_iFieldSeq);
return field.setValue(hashValue, bDisplayOption, moveMode); // Move even if no change
} | java | public int fieldChanged(boolean bDisplayOption, int moveMode)
{
String source = this.getOwner().getString();
String soundex = this.soundex(source.substring(0, Math.min(4, source.length())));
if (soundex == null)
return DBConstants.NORMAL_RETURN;
short hashValue = this.hashSound(soundex);
BaseField field = this.getOwner().getRecord().getField(m_iFieldSeq);
return field.setValue(hashValue, bDisplayOption, moveMode); // Move even if no change
} | [
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"moveMode",
")",
"{",
"String",
"source",
"=",
"this",
".",
"getOwner",
"(",
")",
".",
"getString",
"(",
")",
";",
"String",
"soundex",
"=",
"this",
".",
"soundex",
"(",
"sour... | The Field has Changed.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay). | [
"The",
"Field",
"has",
"Changed",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CopySoundexHandler.java#L75-L84 |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java | TopologyBuilder.initTopology | public void initTopology(String topologyName, int delay) {
if (this.topology != null) {
// TODO: possible refactor this code later
System.out.println("Topology has been initialized before!");
return;
}
this.topology = componentFactory.createTopology(topologyName);
} | java | public void initTopology(String topologyName, int delay) {
if (this.topology != null) {
// TODO: possible refactor this code later
System.out.println("Topology has been initialized before!");
return;
}
this.topology = componentFactory.createTopology(topologyName);
} | [
"public",
"void",
"initTopology",
"(",
"String",
"topologyName",
",",
"int",
"delay",
")",
"{",
"if",
"(",
"this",
".",
"topology",
"!=",
"null",
")",
"{",
"// TODO: possible refactor this code later",
"System",
".",
"out",
".",
"println",
"(",
"\"Topology has b... | Initiates topology with a specific name and a delay between consecutive instances.
@param topologyName
@param delay
delay between injections of two instances from source (in milliseconds) | [
"Initiates",
"topology",
"with",
"a",
"specific",
"name",
"and",
"a",
"delay",
"between",
"consecutive",
"instances",
"."
] | train | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java#L76-L83 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.setHeader | public static void setHeader(HttpServletResponse response, String name, Object value) {
if (value instanceof String) {
response.setHeader(name, (String) value);
} else if (Date.class.isAssignableFrom(value.getClass())) {
response.setDateHeader(name, ((Date) value).getTime());
} else if (value instanceof Integer || "int".equals(value.getClass().getSimpleName().toLowerCase())) {
response.setIntHeader(name, (Integer) value);
} else {
response.setHeader(name, value.toString());
}
} | java | public static void setHeader(HttpServletResponse response, String name, Object value) {
if (value instanceof String) {
response.setHeader(name, (String) value);
} else if (Date.class.isAssignableFrom(value.getClass())) {
response.setDateHeader(name, ((Date) value).getTime());
} else if (value instanceof Integer || "int".equals(value.getClass().getSimpleName().toLowerCase())) {
response.setIntHeader(name, (Integer) value);
} else {
response.setHeader(name, value.toString());
}
} | [
"public",
"static",
"void",
"setHeader",
"(",
"HttpServletResponse",
"response",
",",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"response",
".",
"setHeader",
"(",
"name",
",",
"(",
"String",
"... | 设置响应的Header
@param response 响应对象{@link HttpServletResponse}
@param name 名
@param value 值,可以是String,Date, int | [
"设置响应的Header"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L578-L588 |
structr/structr | structr-core/src/main/java/org/structr/schema/action/Function.java | Function.assertArrayHasLengthAndAllElementsNotNull | protected void assertArrayHasLengthAndAllElementsNotNull(final Object[] array, final Integer length) throws ArgumentCountException, ArgumentNullException {
if (array.length != length) {
throw ArgumentCountException.notEqual(array.length, length);
}
for (final Object element : array) {
if (element == null) {
throw new ArgumentNullException();
}
}
} | java | protected void assertArrayHasLengthAndAllElementsNotNull(final Object[] array, final Integer length) throws ArgumentCountException, ArgumentNullException {
if (array.length != length) {
throw ArgumentCountException.notEqual(array.length, length);
}
for (final Object element : array) {
if (element == null) {
throw new ArgumentNullException();
}
}
} | [
"protected",
"void",
"assertArrayHasLengthAndAllElementsNotNull",
"(",
"final",
"Object",
"[",
"]",
"array",
",",
"final",
"Integer",
"length",
")",
"throws",
"ArgumentCountException",
",",
"ArgumentNullException",
"{",
"if",
"(",
"array",
".",
"length",
"!=",
"leng... | Test if the given object array has exact the given length and all its elements are not null.
@param array
@param length
@throws ArgumentCountException in case of wrong number of parameters
@throws ArgumentNullException in case of a null parameter | [
"Test",
"if",
"the",
"given",
"object",
"array",
"has",
"exact",
"the",
"given",
"length",
"and",
"all",
"its",
"elements",
"are",
"not",
"null",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/action/Function.java#L169-L181 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.intersectLineCircle | public static boolean intersectLineCircle(float x0, float y0, float x1, float y1, float centerX, float centerY, float radius, Vector3f intersectionCenterAndHL) {
// Build general line equation from two points and use the other method
return intersectLineCircle(y0 - y1, x1 - x0, (x0 - x1) * y0 + (y1 - y0) * x0, centerX, centerY, radius, intersectionCenterAndHL);
} | java | public static boolean intersectLineCircle(float x0, float y0, float x1, float y1, float centerX, float centerY, float radius, Vector3f intersectionCenterAndHL) {
// Build general line equation from two points and use the other method
return intersectLineCircle(y0 - y1, x1 - x0, (x0 - x1) * y0 + (y1 - y0) * x0, centerX, centerY, radius, intersectionCenterAndHL);
} | [
"public",
"static",
"boolean",
"intersectLineCircle",
"(",
"float",
"x0",
",",
"float",
"y0",
",",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"centerX",
",",
"float",
"centerY",
",",
"float",
"radius",
",",
"Vector3f",
"intersectionCenterAndHL",
")",
"... | Test whether the line defined by the two points <code>(x0, y0)</code> and <code>(x1, y1)</code> intersects the circle with center
<code>(centerX, centerY)</code> and <code>radius</code>, and store the center of the line segment of
intersection in the <code>(x, y)</code> components of the supplied vector and the half-length of that line segment in the z component.
<p>
Reference: <a href="http://math.stackexchange.com/questions/943383/determine-circle-of-intersection-of-plane-and-sphere">http://math.stackexchange.com</a>
@param x0
the x coordinate of the first point on the line
@param y0
the y coordinate of the first point on the line
@param x1
the x coordinate of the second point on the line
@param y1
the y coordinate of the second point on the line
@param centerX
the x coordinate of the circle's center
@param centerY
the y coordinate of the circle's center
@param radius
the radius of the circle
@param intersectionCenterAndHL
will hold the center of the line segment of intersection in the <code>(x, y)</code> components and the half-length in the z component
@return <code>true</code> iff the line intersects the circle; <code>false</code> otherwise | [
"Test",
"whether",
"the",
"line",
"defined",
"by",
"the",
"two",
"points",
"<code",
">",
"(",
"x0",
"y0",
")",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"(",
"x1",
"y1",
")",
"<",
"/",
"code",
">",
"intersects",
"the",
"circle",
"with",
"center",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L3470-L3473 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java | JQLChecker.analyzeVariableStatementInternal | protected <L extends JqlBaseListener> void analyzeVariableStatementInternal(JQLContext jqlContext, final String jql, L listener) {
walker.walk(listener, prepareVariableStatement(jqlContext, jql).value0);
} | java | protected <L extends JqlBaseListener> void analyzeVariableStatementInternal(JQLContext jqlContext, final String jql, L listener) {
walker.walk(listener, prepareVariableStatement(jqlContext, jql).value0);
} | [
"protected",
"<",
"L",
"extends",
"JqlBaseListener",
">",
"void",
"analyzeVariableStatementInternal",
"(",
"JQLContext",
"jqlContext",
",",
"final",
"String",
"jql",
",",
"L",
"listener",
")",
"{",
"walker",
".",
"walk",
"(",
"listener",
",",
"prepareVariableState... | Analyze variable statement internal.
@param <L>
the generic type
@param jqlContext
the jql context
@param jql
the jql
@param listener
the listener | [
"Analyze",
"variable",
"statement",
"internal",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L131-L133 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/network/NettyUtils.java | NettyUtils.createEventLoop | public static EventLoopGroup createEventLoop(ChannelType type, int numThreads,
String threadPrefix, boolean isDaemon) {
ThreadFactory threadFactory = ThreadFactoryUtils.build(threadPrefix, isDaemon);
switch (type) {
case NIO:
return new NioEventLoopGroup(numThreads, threadFactory);
case EPOLL:
return new EpollEventLoopGroup(numThreads, threadFactory);
default:
throw new IllegalArgumentException("Unknown io type: " + type);
}
} | java | public static EventLoopGroup createEventLoop(ChannelType type, int numThreads,
String threadPrefix, boolean isDaemon) {
ThreadFactory threadFactory = ThreadFactoryUtils.build(threadPrefix, isDaemon);
switch (type) {
case NIO:
return new NioEventLoopGroup(numThreads, threadFactory);
case EPOLL:
return new EpollEventLoopGroup(numThreads, threadFactory);
default:
throw new IllegalArgumentException("Unknown io type: " + type);
}
} | [
"public",
"static",
"EventLoopGroup",
"createEventLoop",
"(",
"ChannelType",
"type",
",",
"int",
"numThreads",
",",
"String",
"threadPrefix",
",",
"boolean",
"isDaemon",
")",
"{",
"ThreadFactory",
"threadFactory",
"=",
"ThreadFactoryUtils",
".",
"build",
"(",
"threa... | Creates a Netty {@link EventLoopGroup} based on {@link ChannelType}.
@param type Selector for which form of low-level IO we should use
@param numThreads target number of threads
@param threadPrefix name pattern for each thread. should contain '%d' to distinguish between
threads.
@param isDaemon if true, the {@link java.util.concurrent.ThreadFactory} will create daemon
threads.
@return EventLoopGroup matching the ChannelType | [
"Creates",
"a",
"Netty",
"{",
"@link",
"EventLoopGroup",
"}",
"based",
"on",
"{",
"@link",
"ChannelType",
"}",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NettyUtils.java#L64-L76 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | SpringApplication.bindToSpringApplication | protected void bindToSpringApplication(ConfigurableEnvironment environment) {
try {
Binder.get(environment).bind("spring.main", Bindable.ofInstance(this));
}
catch (Exception ex) {
throw new IllegalStateException("Cannot bind to SpringApplication", ex);
}
} | java | protected void bindToSpringApplication(ConfigurableEnvironment environment) {
try {
Binder.get(environment).bind("spring.main", Bindable.ofInstance(this));
}
catch (Exception ex) {
throw new IllegalStateException("Cannot bind to SpringApplication", ex);
}
} | [
"protected",
"void",
"bindToSpringApplication",
"(",
"ConfigurableEnvironment",
"environment",
")",
"{",
"try",
"{",
"Binder",
".",
"get",
"(",
"environment",
")",
".",
"bind",
"(",
"\"spring.main\"",
",",
"Bindable",
".",
"ofInstance",
"(",
"this",
")",
")",
... | Bind the environment to the {@link SpringApplication}.
@param environment the environment to bind | [
"Bind",
"the",
"environment",
"to",
"the",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L562-L569 |
deeplearning4j/deeplearning4j | datavec/datavec-local/src/main/java/org/datavec/local/transforms/LocalTransformExecutor.java | LocalTransformExecutor.executeToSequence | public static List<List<List<Writable>>> executeToSequence(List<List<Writable>> inputWritables,
TransformProcess transformProcess) {
if (!(transformProcess.getFinalSchema() instanceof SequenceSchema)) {
throw new IllegalStateException("Cannot return non-sequence data with this method");
}
return execute(inputWritables, null, transformProcess).getSecond();
} | java | public static List<List<List<Writable>>> executeToSequence(List<List<Writable>> inputWritables,
TransformProcess transformProcess) {
if (!(transformProcess.getFinalSchema() instanceof SequenceSchema)) {
throw new IllegalStateException("Cannot return non-sequence data with this method");
}
return execute(inputWritables, null, transformProcess).getSecond();
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
">",
"executeToSequence",
"(",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
"inputWritables",
",",
"TransformProcess",
"transformProcess",
")",
"{",
"if",
"(",
"!",
"(",
... | Execute the specified TransformProcess with the given input data<br>
Note: this method can only be used if the TransformProcess
starts with non-sequential data,
but returns <it>sequence</it>
data (after grouping or converting to a sequence as one of the steps)
@param inputWritables Input data to process
@param transformProcess TransformProcess to execute
@return Processed (sequence) data | [
"Execute",
"the",
"specified",
"TransformProcess",
"with",
"the",
"given",
"input",
"data<br",
">",
"Note",
":",
"this",
"method",
"can",
"only",
"be",
"used",
"if",
"the",
"TransformProcess",
"starts",
"with",
"non",
"-",
"sequential",
"data",
"but",
"returns... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-local/src/main/java/org/datavec/local/transforms/LocalTransformExecutor.java#L107-L114 |
alkacon/opencms-core | src/org/opencms/gwt/shared/property/CmsClientProperty.java | CmsClientProperty.getPathValue | public CmsPathValue getPathValue() {
if (!CmsStringUtil.isEmpty(m_structureValue)) {
return new CmsPathValue(m_structureValue, PATH_STRUCTURE_VALUE);
} else if (!CmsStringUtil.isEmpty(m_resourceValue)) {
return new CmsPathValue(m_resourceValue, PATH_RESOURCE_VALUE);
} else {
return new CmsPathValue(null, PATH_STRUCTURE_VALUE);
}
} | java | public CmsPathValue getPathValue() {
if (!CmsStringUtil.isEmpty(m_structureValue)) {
return new CmsPathValue(m_structureValue, PATH_STRUCTURE_VALUE);
} else if (!CmsStringUtil.isEmpty(m_resourceValue)) {
return new CmsPathValue(m_resourceValue, PATH_RESOURCE_VALUE);
} else {
return new CmsPathValue(null, PATH_STRUCTURE_VALUE);
}
} | [
"public",
"CmsPathValue",
"getPathValue",
"(",
")",
"{",
"if",
"(",
"!",
"CmsStringUtil",
".",
"isEmpty",
"(",
"m_structureValue",
")",
")",
"{",
"return",
"new",
"CmsPathValue",
"(",
"m_structureValue",
",",
"PATH_STRUCTURE_VALUE",
")",
";",
"}",
"else",
"if"... | Returns the effective path value of the property.<p>
@return the effective path value of the property | [
"Returns",
"the",
"effective",
"path",
"value",
"of",
"the",
"property",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/shared/property/CmsClientProperty.java#L287-L296 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.preg_match | public static int preg_match(String regex, String subject) {
Pattern p = Pattern.compile(regex);
return preg_match(p, subject);
} | java | public static int preg_match(String regex, String subject) {
Pattern p = Pattern.compile(regex);
return preg_match(p, subject);
} | [
"public",
"static",
"int",
"preg_match",
"(",
"String",
"regex",
",",
"String",
"subject",
")",
"{",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"regex",
")",
";",
"return",
"preg_match",
"(",
"p",
",",
"subject",
")",
";",
"}"
] | Matches a string with a regex.
@param regex
@param subject
@return | [
"Matches",
"a",
"string",
"with",
"a",
"regex",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L137-L140 |
infinispan/infinispan | query/src/main/java/org/infinispan/query/dsl/embedded/impl/HibernateSearchPropertyHelper.java | HibernateSearchPropertyHelper.hasEmbeddedProperty | @Override
public boolean hasEmbeddedProperty(Class<?> entityType, String[] propertyPath) {
EntityIndexBinding indexBinding = searchFactory.getIndexBindings().get(entityType);
if (indexBinding != null) {
ResolvedProperty resolvedProperty = resolveProperty(indexBinding, propertyPath);
if (resolvedProperty != null) {
return resolvedProperty.propertyMetadata == null;
}
}
return super.hasEmbeddedProperty(entityType, propertyPath);
} | java | @Override
public boolean hasEmbeddedProperty(Class<?> entityType, String[] propertyPath) {
EntityIndexBinding indexBinding = searchFactory.getIndexBindings().get(entityType);
if (indexBinding != null) {
ResolvedProperty resolvedProperty = resolveProperty(indexBinding, propertyPath);
if (resolvedProperty != null) {
return resolvedProperty.propertyMetadata == null;
}
}
return super.hasEmbeddedProperty(entityType, propertyPath);
} | [
"@",
"Override",
"public",
"boolean",
"hasEmbeddedProperty",
"(",
"Class",
"<",
"?",
">",
"entityType",
",",
"String",
"[",
"]",
"propertyPath",
")",
"{",
"EntityIndexBinding",
"indexBinding",
"=",
"searchFactory",
".",
"getIndexBindings",
"(",
")",
".",
"get",
... | Determines whether the given property path denotes an embedded entity (not a property of such entity).
@param entityType the indexed type
@param propertyPath the path of interest
@return {@code true} if the given path denotes an embedded entity of the given indexed type, {@code false}
otherwise. | [
"Determines",
"whether",
"the",
"given",
"property",
"path",
"denotes",
"an",
"embedded",
"entity",
"(",
"not",
"a",
"property",
"of",
"such",
"entity",
")",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/dsl/embedded/impl/HibernateSearchPropertyHelper.java#L276-L286 |
twitter/hraven | hraven-core/src/main/java/com/twitter/hraven/datasource/AppVersionService.java | AppVersionService.getDistinctVersions | public List<VersionInfo> getDistinctVersions(String cluster, String user,
String appId) throws IOException {
Get get = new Get(getRowKey(cluster, user, appId));
List<VersionInfo> versions = Lists.newArrayList();
Long ts = 0L;
Table versionsTable = null;
try {
versionsTable = hbaseConnection
.getTable(TableName.valueOf(Constants.HISTORY_APP_VERSION_TABLE));
Result r = versionsTable.get(get);
if (r != null && !r.isEmpty()) {
for (Cell c : r.listCells()) {
ts = 0L;
try {
ts = Bytes.toLong(CellUtil.cloneValue(c));
versions.add(new VersionInfo(
Bytes.toString(CellUtil.cloneQualifier(c)), ts));
} catch (IllegalArgumentException e1) {
// Bytes.toLong may throw IllegalArgumentException, although
// unlikely.
LOG.error(
"Caught conversion error while converting timestamp to long value "
+ e1.getMessage());
// rethrow the exception in order to propagate it
throw e1;
}
}
}
if (versions.size() > 0) {
Collections.sort(versions);
}
} finally {
if (versionsTable != null) {
versionsTable.close();
}
}
return versions;
} | java | public List<VersionInfo> getDistinctVersions(String cluster, String user,
String appId) throws IOException {
Get get = new Get(getRowKey(cluster, user, appId));
List<VersionInfo> versions = Lists.newArrayList();
Long ts = 0L;
Table versionsTable = null;
try {
versionsTable = hbaseConnection
.getTable(TableName.valueOf(Constants.HISTORY_APP_VERSION_TABLE));
Result r = versionsTable.get(get);
if (r != null && !r.isEmpty()) {
for (Cell c : r.listCells()) {
ts = 0L;
try {
ts = Bytes.toLong(CellUtil.cloneValue(c));
versions.add(new VersionInfo(
Bytes.toString(CellUtil.cloneQualifier(c)), ts));
} catch (IllegalArgumentException e1) {
// Bytes.toLong may throw IllegalArgumentException, although
// unlikely.
LOG.error(
"Caught conversion error while converting timestamp to long value "
+ e1.getMessage());
// rethrow the exception in order to propagate it
throw e1;
}
}
}
if (versions.size() > 0) {
Collections.sort(versions);
}
} finally {
if (versionsTable != null) {
versionsTable.close();
}
}
return versions;
} | [
"public",
"List",
"<",
"VersionInfo",
">",
"getDistinctVersions",
"(",
"String",
"cluster",
",",
"String",
"user",
",",
"String",
"appId",
")",
"throws",
"IOException",
"{",
"Get",
"get",
"=",
"new",
"Get",
"(",
"getRowKey",
"(",
"cluster",
",",
"user",
",... | Returns the list of distinct versions for the given application sorted in
reverse chronological order
@param cluster
@param user
@param appId
@return the list of versions sorted in reverse chronological order (the
list will be empty if no versions are found)
@throws IOException | [
"Returns",
"the",
"list",
"of",
"distinct",
"versions",
"for",
"the",
"given",
"application",
"sorted",
"in",
"reverse",
"chronological",
"order"
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/AppVersionService.java#L110-L149 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WFieldLayoutExample.java | WFieldLayoutExample.recursiveFieldLayout | private WFieldLayout recursiveFieldLayout(final int curr, final int startAt) {
WFieldLayout innerLayout = new WFieldLayout();
innerLayout.setLabelWidth(20);
if (curr == 0 && startAt == 0) {
innerLayout.setMargin(new Margin(Size.LARGE, null, null, null));
}
innerLayout.setOrdered(true);
if (startAt > 1) {
innerLayout.setOrderedOffset(startAt);
}
innerLayout.addField("Test " + String.valueOf(startAt > 1 ? startAt : 1), new WTextField());
innerLayout.addField("Test " + String.valueOf(startAt > 1 ? startAt + 1 : 2),
new WTextField());
innerLayout.addField("Test " + String.valueOf(startAt > 1 ? startAt + 2 : 2),
new WTextField());
if (curr < 4) {
int next = curr + 1;
innerLayout.addField("indent level " + String.valueOf(next), recursiveFieldLayout(next, 0));
}
innerLayout.addField("Test after nest", new WTextField());
return innerLayout;
} | java | private WFieldLayout recursiveFieldLayout(final int curr, final int startAt) {
WFieldLayout innerLayout = new WFieldLayout();
innerLayout.setLabelWidth(20);
if (curr == 0 && startAt == 0) {
innerLayout.setMargin(new Margin(Size.LARGE, null, null, null));
}
innerLayout.setOrdered(true);
if (startAt > 1) {
innerLayout.setOrderedOffset(startAt);
}
innerLayout.addField("Test " + String.valueOf(startAt > 1 ? startAt : 1), new WTextField());
innerLayout.addField("Test " + String.valueOf(startAt > 1 ? startAt + 1 : 2),
new WTextField());
innerLayout.addField("Test " + String.valueOf(startAt > 1 ? startAt + 2 : 2),
new WTextField());
if (curr < 4) {
int next = curr + 1;
innerLayout.addField("indent level " + String.valueOf(next), recursiveFieldLayout(next, 0));
}
innerLayout.addField("Test after nest", new WTextField());
return innerLayout;
} | [
"private",
"WFieldLayout",
"recursiveFieldLayout",
"(",
"final",
"int",
"curr",
",",
"final",
"int",
"startAt",
")",
"{",
"WFieldLayout",
"innerLayout",
"=",
"new",
"WFieldLayout",
"(",
")",
";",
"innerLayout",
".",
"setLabelWidth",
"(",
"20",
")",
";",
"if",
... | Create a recursive field layout.
@param curr recursion index
@param startAt the ordered offset
@return the recursive field layout. | [
"Create",
"a",
"recursive",
"field",
"layout",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WFieldLayoutExample.java#L194-L217 |
syphr42/libmythtv-java | commons/src/main/java/org/syphr/mythtv/commons/socket/CommandUtils.java | CommandUtils.expectOk | public static void expectOk(String response) throws ProtocolException
{
if (!"OK".equalsIgnoreCase(response))
{
throw new ProtocolException(response, Direction.RECEIVE);
}
} | java | public static void expectOk(String response) throws ProtocolException
{
if (!"OK".equalsIgnoreCase(response))
{
throw new ProtocolException(response, Direction.RECEIVE);
}
} | [
"public",
"static",
"void",
"expectOk",
"(",
"String",
"response",
")",
"throws",
"ProtocolException",
"{",
"if",
"(",
"!",
"\"OK\"",
".",
"equalsIgnoreCase",
"(",
"response",
")",
")",
"{",
"throw",
"new",
"ProtocolException",
"(",
"response",
",",
"Direction... | Check the response for an "OK" message. Throw an exception if response is not
expected.
@param response
the response to check
@throws ProtocolException
if the response is not the expected case-insensitive "OK" | [
"Check",
"the",
"response",
"for",
"an",
"OK",
"message",
".",
"Throw",
"an",
"exception",
"if",
"response",
"is",
"not",
"expected",
"."
] | train | https://github.com/syphr42/libmythtv-java/blob/cc7a2012fbd4a4ba2562dda6b2614fb0548526ea/commons/src/main/java/org/syphr/mythtv/commons/socket/CommandUtils.java#L51-L57 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/TraceNLSResolver.java | TraceNLSResolver.logEvent | protected final static void logEvent(String message, Object[] args) {
// if ( makeNoise && tc.isEventEnabled() )
// {
// if ( args == null )
// com.ibm.websphere.ras.Tr.event(tc, message);
// else
// com.ibm.websphere.ras.Tr.event(tc, MessageFormat.format(message,
// args));
// }
System.err.println("com.ibm.ejs.ras.hpel.TraceNLSResolver: "+MessageFormat.format(message, args));
Thread.dumpStack();
} | java | protected final static void logEvent(String message, Object[] args) {
// if ( makeNoise && tc.isEventEnabled() )
// {
// if ( args == null )
// com.ibm.websphere.ras.Tr.event(tc, message);
// else
// com.ibm.websphere.ras.Tr.event(tc, MessageFormat.format(message,
// args));
// }
System.err.println("com.ibm.ejs.ras.hpel.TraceNLSResolver: "+MessageFormat.format(message, args));
Thread.dumpStack();
} | [
"protected",
"final",
"static",
"void",
"logEvent",
"(",
"String",
"message",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"// if ( makeNoise && tc.isEventEnabled() )",
"// {",
"// if ( args == null )",
"// com.ibm.websphere.ras.Tr.event(tc, message);",
"// else",
"// com.ibm.w... | Common method to use Tr to log that something above couldn't be resolved.
This method further checks whether or not the
<code>com.ibm.ejs.ras.debugTraceNLSResolver</code> property has been set
before calling Tr to log the event.
@param message
Event message
@param args
Parameters for message formatter | [
"Common",
"method",
"to",
"use",
"Tr",
"to",
"log",
"that",
"something",
"above",
"couldn",
"t",
"be",
"resolved",
".",
"This",
"method",
"further",
"checks",
"whether",
"or",
"not",
"the",
"<code",
">",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/TraceNLSResolver.java#L385-L396 |
joniles/mpxj | src/main/java/net/sf/mpxj/planner/PlannerWriter.java | PlannerWriter.isWorkingDay | private boolean isWorkingDay(ProjectCalendar mpxjCalendar, Day day)
{
boolean result = false;
net.sf.mpxj.DayType type = mpxjCalendar.getWorkingDay(day);
if (type == null)
{
type = net.sf.mpxj.DayType.DEFAULT;
}
switch (type)
{
case WORKING:
{
result = true;
break;
}
case NON_WORKING:
{
result = false;
break;
}
case DEFAULT:
{
if (mpxjCalendar.getParent() == null)
{
result = false;
}
else
{
result = isWorkingDay(mpxjCalendar.getParent(), day);
}
break;
}
}
return (result);
} | java | private boolean isWorkingDay(ProjectCalendar mpxjCalendar, Day day)
{
boolean result = false;
net.sf.mpxj.DayType type = mpxjCalendar.getWorkingDay(day);
if (type == null)
{
type = net.sf.mpxj.DayType.DEFAULT;
}
switch (type)
{
case WORKING:
{
result = true;
break;
}
case NON_WORKING:
{
result = false;
break;
}
case DEFAULT:
{
if (mpxjCalendar.getParent() == null)
{
result = false;
}
else
{
result = isWorkingDay(mpxjCalendar.getParent(), day);
}
break;
}
}
return (result);
} | [
"private",
"boolean",
"isWorkingDay",
"(",
"ProjectCalendar",
"mpxjCalendar",
",",
"Day",
"day",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"net",
".",
"sf",
".",
"mpxj",
".",
"DayType",
"type",
"=",
"mpxjCalendar",
".",
"getWorkingDay",
"(",
"day",
... | Used to determine if a particular day of the week is normally
a working day.
@param mpxjCalendar ProjectCalendar instance
@param day Day instance
@return boolean flag | [
"Used",
"to",
"determine",
"if",
"a",
"particular",
"day",
"of",
"the",
"week",
"is",
"normally",
"a",
"working",
"day",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/planner/PlannerWriter.java#L613-L651 |
steveash/jopenfst | src/main/java/com/github/steveash/jopenfst/semiring/UnionSemiring.java | UnionSemiring.makeForNaturalOrdering | public static <W extends Comparable<W>, S extends GenericSemiring<W>> UnionSemiring<W, S> makeForNaturalOrdering(
S weightSemiring) {
return makeForOrdering(weightSemiring, Ordering.natural(), defaultMerge());
} | java | public static <W extends Comparable<W>, S extends GenericSemiring<W>> UnionSemiring<W, S> makeForNaturalOrdering(
S weightSemiring) {
return makeForOrdering(weightSemiring, Ordering.natural(), defaultMerge());
} | [
"public",
"static",
"<",
"W",
"extends",
"Comparable",
"<",
"W",
">",
",",
"S",
"extends",
"GenericSemiring",
"<",
"W",
">",
">",
"UnionSemiring",
"<",
"W",
",",
"S",
">",
"makeForNaturalOrdering",
"(",
"S",
"weightSemiring",
")",
"{",
"return",
"makeForOr... | Creates a union semiring for the given semiring (that has naturally comparable weights where the default
merge strategy will work just fine)
@param weightSemiring underlying weight semiring, this will use the natural ordering and the default merge
@param <W> the underlying weight type
@param <S> the underlying semiring type for W
@return | [
"Creates",
"a",
"union",
"semiring",
"for",
"the",
"given",
"semiring",
"(",
"that",
"has",
"naturally",
"comparable",
"weights",
"where",
"the",
"default",
"merge",
"strategy",
"will",
"work",
"just",
"fine",
")"
] | train | https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/semiring/UnionSemiring.java#L68-L71 |
dbracewell/mango | src/main/java/com/davidbracewell/DynamicEnum.java | DynamicEnum.isDefined | public static boolean isDefined(@NonNull Class<? extends EnumValue> enumClass, @NonNull String name) {
return GLOBAL_REPOSITORY.containsKey(toKey(enumClass, name));
} | java | public static boolean isDefined(@NonNull Class<? extends EnumValue> enumClass, @NonNull String name) {
return GLOBAL_REPOSITORY.containsKey(toKey(enumClass, name));
} | [
"public",
"static",
"boolean",
"isDefined",
"(",
"@",
"NonNull",
"Class",
"<",
"?",
"extends",
"EnumValue",
">",
"enumClass",
",",
"@",
"NonNull",
"String",
"name",
")",
"{",
"return",
"GLOBAL_REPOSITORY",
".",
"containsKey",
"(",
"toKey",
"(",
"enumClass",
... | <p>Determines if the specified name is a defined value of the specified {@link EnumValue} class}.</p>
@param enumClass Class information for the EnumValue that we will check.
@param name the name of the specified value
@return True if the specified value has been defined for the given EnumValue class
@throws NullPointerException if either the enumClass or name are null | [
"<p",
">",
"Determines",
"if",
"the",
"specified",
"name",
"is",
"a",
"defined",
"value",
"of",
"the",
"specified",
"{",
"@link",
"EnumValue",
"}",
"class",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/DynamicEnum.java#L82-L84 |
vakinge/jeesuite-libs | jeesuite-common2/src/main/java/com/jeesuite/common2/excel/ExcelReader.java | ExcelReader.getCellValue | public String getCellValue(int rowNumber, int cellNumber) {
String result;
checkRowAndCell(rowNumber, cellNumber);
Sheet sheet = this.workbook.getSheet(this.sheetName);
Row row = sheet.getRow(--rowNumber);
Cell cell = row.getCell(--cellNumber);
switch (cell.getCellTypeEnum()) {
case BLANK:
result = cell.getStringCellValue();
break;
case BOOLEAN:
result = String.valueOf(cell.getBooleanCellValue());
break;
case ERROR:
result = String.valueOf(cell.getErrorCellValue());
break;
case FORMULA:
result = cell.getCellFormula();
break;
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
result = format.format(cell.getDateCellValue());
} else {
result = String.valueOf(cell.getNumericCellValue());
}
break;
case STRING:
result = cell.getRichStringCellValue().getString();
break;
default:
result = cell.getStringCellValue();
break;
}
return result;
} | java | public String getCellValue(int rowNumber, int cellNumber) {
String result;
checkRowAndCell(rowNumber, cellNumber);
Sheet sheet = this.workbook.getSheet(this.sheetName);
Row row = sheet.getRow(--rowNumber);
Cell cell = row.getCell(--cellNumber);
switch (cell.getCellTypeEnum()) {
case BLANK:
result = cell.getStringCellValue();
break;
case BOOLEAN:
result = String.valueOf(cell.getBooleanCellValue());
break;
case ERROR:
result = String.valueOf(cell.getErrorCellValue());
break;
case FORMULA:
result = cell.getCellFormula();
break;
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
result = format.format(cell.getDateCellValue());
} else {
result = String.valueOf(cell.getNumericCellValue());
}
break;
case STRING:
result = cell.getRichStringCellValue().getString();
break;
default:
result = cell.getStringCellValue();
break;
}
return result;
} | [
"public",
"String",
"getCellValue",
"(",
"int",
"rowNumber",
",",
"int",
"cellNumber",
")",
"{",
"String",
"result",
";",
"checkRowAndCell",
"(",
"rowNumber",
",",
"cellNumber",
")",
";",
"Sheet",
"sheet",
"=",
"this",
".",
"workbook",
".",
"getSheet",
"(",
... | 获取指定单元格的值
@param rowNumber 行数,从1开始
@param cellNumber 列数,从1开始
@return 该单元格的值 | [
"获取指定单元格的值"
] | train | https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-common2/src/main/java/com/jeesuite/common2/excel/ExcelReader.java#L270-L304 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java | XLogPDescriptor.getDoubleBondedCarbonsCount | private int getDoubleBondedCarbonsCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
IBond bond;
int cdbcounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("C")) {
bond = ac.getBond(neighbour, atom);
if (bond.getOrder() == IBond.Order.DOUBLE) {
cdbcounter += 1;
}
}
}
return cdbcounter;
} | java | private int getDoubleBondedCarbonsCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
IBond bond;
int cdbcounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("C")) {
bond = ac.getBond(neighbour, atom);
if (bond.getOrder() == IBond.Order.DOUBLE) {
cdbcounter += 1;
}
}
}
return cdbcounter;
} | [
"private",
"int",
"getDoubleBondedCarbonsCount",
"(",
"IAtomContainer",
"ac",
",",
"IAtom",
"atom",
")",
"{",
"List",
"<",
"IAtom",
">",
"neighbours",
"=",
"ac",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
"IBond",
"bond",
";",
"int",
"cdbcounter",
... | Gets the doubleBondedCarbonsCount attribute of the XLogPDescriptor object.
@param ac Description of the Parameter
@param atom Description of the Parameter
@return The doubleBondedCarbonsCount value | [
"Gets",
"the",
"doubleBondedCarbonsCount",
"attribute",
"of",
"the",
"XLogPDescriptor",
"object",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1132-L1145 |
vincentbrison/dualcache | dualcache-library/src/main/java/com/vincentbrison/openlibraries/android/dualcache/Builder.java | Builder.useSerializerInDisk | public Builder<T> useSerializerInDisk(
int maxDiskSizeBytes,
boolean usePrivateFiles,
CacheSerializer<T> serializer,
Context context
) {
File folder = getDefaultDiskCacheFolder(usePrivateFiles, context);
return useSerializerInDisk(maxDiskSizeBytes, folder, serializer);
} | java | public Builder<T> useSerializerInDisk(
int maxDiskSizeBytes,
boolean usePrivateFiles,
CacheSerializer<T> serializer,
Context context
) {
File folder = getDefaultDiskCacheFolder(usePrivateFiles, context);
return useSerializerInDisk(maxDiskSizeBytes, folder, serializer);
} | [
"public",
"Builder",
"<",
"T",
">",
"useSerializerInDisk",
"(",
"int",
"maxDiskSizeBytes",
",",
"boolean",
"usePrivateFiles",
",",
"CacheSerializer",
"<",
"T",
">",
"serializer",
",",
"Context",
"context",
")",
"{",
"File",
"folder",
"=",
"getDefaultDiskCacheFolde... | Use custom serialization/deserialization to store and retrieve objects from disk cache.
@param maxDiskSizeBytes is the max size of disk in bytes which an be used by the disk cache
layer.
@param usePrivateFiles is true if you want to use {@link Context#MODE_PRIVATE} with the
default disk cache folder.
@param serializer provides serialization/deserialization methods for the disk cache
layer.
@param context is used to access file system.
@return the builder. | [
"Use",
"custom",
"serialization",
"/",
"deserialization",
"to",
"store",
"and",
"retrieve",
"objects",
"from",
"disk",
"cache",
"."
] | train | https://github.com/vincentbrison/dualcache/blob/76ec6e08d5b8b17aca97d01e5fb5f36cb4beff5f/dualcache-library/src/main/java/com/vincentbrison/openlibraries/android/dualcache/Builder.java#L154-L162 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/CallActivityBehavior.java | CallActivityBehavior.findProcessDefinition | protected ProcessDefinition findProcessDefinition(String processDefinitionKey, String tenantId) {
if (tenantId == null || ProcessEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {
return Context.getProcessEngineConfiguration().getDeploymentManager().findDeployedLatestProcessDefinitionByKey(processDefinitionKey);
} else {
return Context.getProcessEngineConfiguration().getDeploymentManager().findDeployedLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);
}
} | java | protected ProcessDefinition findProcessDefinition(String processDefinitionKey, String tenantId) {
if (tenantId == null || ProcessEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {
return Context.getProcessEngineConfiguration().getDeploymentManager().findDeployedLatestProcessDefinitionByKey(processDefinitionKey);
} else {
return Context.getProcessEngineConfiguration().getDeploymentManager().findDeployedLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);
}
} | [
"protected",
"ProcessDefinition",
"findProcessDefinition",
"(",
"String",
"processDefinitionKey",
",",
"String",
"tenantId",
")",
"{",
"if",
"(",
"tenantId",
"==",
"null",
"||",
"ProcessEngineConfiguration",
".",
"NO_TENANT_ID",
".",
"equals",
"(",
"tenantId",
")",
... | Allow subclass to determine which version of a process to start. | [
"Allow",
"subclass",
"to",
"determine",
"which",
"version",
"of",
"a",
"process",
"to",
"start",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/CallActivityBehavior.java#L175-L181 |
paypal/SeLion | client/src/main/java/com/paypal/selion/internal/reports/services/ReporterDateFormatter.java | ReporterDateFormatter.getISO8601StringWithSpecificTimeZone | public static String getISO8601StringWithSpecificTimeZone(Date date, TimeZone zone) {
DateFormat formatter = getFormatter();
formatter.setTimeZone(zone);
return formatter.format(date);
} | java | public static String getISO8601StringWithSpecificTimeZone(Date date, TimeZone zone) {
DateFormat formatter = getFormatter();
formatter.setTimeZone(zone);
return formatter.format(date);
} | [
"public",
"static",
"String",
"getISO8601StringWithSpecificTimeZone",
"(",
"Date",
"date",
",",
"TimeZone",
"zone",
")",
"{",
"DateFormat",
"formatter",
"=",
"getFormatter",
"(",
")",
";",
"formatter",
".",
"setTimeZone",
"(",
"zone",
")",
";",
"return",
"format... | Return an ISO 8601 combined date and time string for specified date/time. The returned date and time format is
compatible with JavaScript on Internet Explorer.
@param date
Date
@param zone
Time zone to be used.
@return String with format "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" where XXX corresponds to the input time zone. example:
UTC time is represented as '2015-01-21T02:21:33.955Z' example: PST time is represented as
'2015-01-20T18:21:33.955-08:00' | [
"Return",
"an",
"ISO",
"8601",
"combined",
"date",
"and",
"time",
"string",
"for",
"specified",
"date",
"/",
"time",
".",
"The",
"returned",
"date",
"and",
"time",
"format",
"is",
"compatible",
"with",
"JavaScript",
"on",
"Internet",
"Explorer",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/reports/services/ReporterDateFormatter.java#L69-L73 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/io/UrlIO.java | UrlIO.addRequestProperties | @Scope(DocScope.IO)
public UrlIO addRequestProperties(final Map<String, String> params) {
requestProperties.putAll(params);
return this;
} | java | @Scope(DocScope.IO)
public UrlIO addRequestProperties(final Map<String, String> params) {
requestProperties.putAll(params);
return this;
} | [
"@",
"Scope",
"(",
"DocScope",
".",
"IO",
")",
"public",
"UrlIO",
"addRequestProperties",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"requestProperties",
".",
"putAll",
"(",
"params",
")",
";",
"return",
"this",
";",
"}"
... | Allows to add some request properties.
@param params
@return this for convenience. | [
"Allows",
"to",
"add",
"some",
"request",
"properties",
"."
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/io/UrlIO.java#L98-L102 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java | ST_AddPoint.computeDistance | private static double computeDistance(Geometry geometry, Point vertexPoint, double tolerance) {
DistanceOp distanceOp = new DistanceOp(geometry, vertexPoint, tolerance);
return distanceOp.distance();
} | java | private static double computeDistance(Geometry geometry, Point vertexPoint, double tolerance) {
DistanceOp distanceOp = new DistanceOp(geometry, vertexPoint, tolerance);
return distanceOp.distance();
} | [
"private",
"static",
"double",
"computeDistance",
"(",
"Geometry",
"geometry",
",",
"Point",
"vertexPoint",
",",
"double",
"tolerance",
")",
"{",
"DistanceOp",
"distanceOp",
"=",
"new",
"DistanceOp",
"(",
"geometry",
",",
"vertexPoint",
",",
"tolerance",
")",
";... | Return minimum distance between a geometry and a point.
@param geometry
@param vertexPoint
@param tolerance
@return | [
"Return",
"minimum",
"distance",
"between",
"a",
"geometry",
"and",
"a",
"point",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java#L234-L237 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/CopyJobConfiguration.java | CopyJobConfiguration.newBuilder | public static Builder newBuilder(TableId destinationTable, List<TableId> sourceTables) {
return new Builder().setDestinationTable(destinationTable).setSourceTables(sourceTables);
} | java | public static Builder newBuilder(TableId destinationTable, List<TableId> sourceTables) {
return new Builder().setDestinationTable(destinationTable).setSourceTables(sourceTables);
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"TableId",
"destinationTable",
",",
"List",
"<",
"TableId",
">",
"sourceTables",
")",
"{",
"return",
"new",
"Builder",
"(",
")",
".",
"setDestinationTable",
"(",
"destinationTable",
")",
".",
"setSourceTables",
"... | Creates a builder for a BigQuery Copy Job configuration given destination and source tables. | [
"Creates",
"a",
"builder",
"for",
"a",
"BigQuery",
"Copy",
"Job",
"configuration",
"given",
"destination",
"and",
"source",
"tables",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/CopyJobConfiguration.java#L262-L264 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.abortMultipartUpload | private void abortMultipartUpload(String bucketName, String objectName, String uploadId)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
Map<String,String> queryParamMap = new HashMap<>();
queryParamMap.put(UPLOAD_ID, uploadId);
executeDelete(bucketName, objectName, queryParamMap);
} | java | private void abortMultipartUpload(String bucketName, String objectName, String uploadId)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
Map<String,String> queryParamMap = new HashMap<>();
queryParamMap.put(UPLOAD_ID, uploadId);
executeDelete(bucketName, objectName, queryParamMap);
} | [
"private",
"void",
"abortMultipartUpload",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"String",
"uploadId",
")",
"throws",
"InvalidBucketNameException",
",",
"NoSuchAlgorithmException",
",",
"InsufficientDataException",
",",
"IOException",
",",
"Invali... | Aborts multipart upload of given bucket name, object name and upload ID. | [
"Aborts",
"multipart",
"upload",
"of",
"given",
"bucket",
"name",
"object",
"name",
"and",
"upload",
"ID",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L4907-L4914 |
classgraph/classgraph | src/main/java/io/github/classgraph/AnnotationInfoList.java | AnnotationInfoList.findMetaAnnotations | private static void findMetaAnnotations(final AnnotationInfo ai, final AnnotationInfoList allAnnotationsOut,
final Set<ClassInfo> visited) {
final ClassInfo annotationClassInfo = ai.getClassInfo();
if (annotationClassInfo != null && annotationClassInfo.annotationInfo != null
// Don't get in a cycle
&& visited.add(annotationClassInfo)) {
for (final AnnotationInfo metaAnnotationInfo : annotationClassInfo.annotationInfo) {
final ClassInfo metaAnnotationClassInfo = metaAnnotationInfo.getClassInfo();
final String metaAnnotationClassName = metaAnnotationClassInfo.getName();
// Don't treat java.lang.annotation annotations as meta-annotations
if (!metaAnnotationClassName.startsWith("java.lang.annotation.")) {
// Add the meta-annotation to the transitive closure
allAnnotationsOut.add(metaAnnotationInfo);
// Recurse to meta-meta-annotation
findMetaAnnotations(metaAnnotationInfo, allAnnotationsOut, visited);
}
}
}
} | java | private static void findMetaAnnotations(final AnnotationInfo ai, final AnnotationInfoList allAnnotationsOut,
final Set<ClassInfo> visited) {
final ClassInfo annotationClassInfo = ai.getClassInfo();
if (annotationClassInfo != null && annotationClassInfo.annotationInfo != null
// Don't get in a cycle
&& visited.add(annotationClassInfo)) {
for (final AnnotationInfo metaAnnotationInfo : annotationClassInfo.annotationInfo) {
final ClassInfo metaAnnotationClassInfo = metaAnnotationInfo.getClassInfo();
final String metaAnnotationClassName = metaAnnotationClassInfo.getName();
// Don't treat java.lang.annotation annotations as meta-annotations
if (!metaAnnotationClassName.startsWith("java.lang.annotation.")) {
// Add the meta-annotation to the transitive closure
allAnnotationsOut.add(metaAnnotationInfo);
// Recurse to meta-meta-annotation
findMetaAnnotations(metaAnnotationInfo, allAnnotationsOut, visited);
}
}
}
} | [
"private",
"static",
"void",
"findMetaAnnotations",
"(",
"final",
"AnnotationInfo",
"ai",
",",
"final",
"AnnotationInfoList",
"allAnnotationsOut",
",",
"final",
"Set",
"<",
"ClassInfo",
">",
"visited",
")",
"{",
"final",
"ClassInfo",
"annotationClassInfo",
"=",
"ai"... | Find the transitive closure of meta-annotations.
@param ai
the annotationInfo object
@param allAnnotationsOut
annotations out
@param visited
visited | [
"Find",
"the",
"transitive",
"closure",
"of",
"meta",
"-",
"annotations",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/AnnotationInfoList.java#L268-L286 |
inferred/FreeBuilder | src/main/java/org/inferred/freebuilder/processor/source/ObjectsExcerpts.java | ObjectsExcerpts.notEquals | public static Excerpt notEquals(Object a, Object b, TypeKind kind) {
return equalsExcerpt(false, a, b, kind);
} | java | public static Excerpt notEquals(Object a, Object b, TypeKind kind) {
return equalsExcerpt(false, a, b, kind);
} | [
"public",
"static",
"Excerpt",
"notEquals",
"(",
"Object",
"a",
",",
"Object",
"b",
",",
"TypeKind",
"kind",
")",
"{",
"return",
"equalsExcerpt",
"(",
"false",
",",
"a",
",",
"b",
",",
"kind",
")",
";",
"}"
] | Returns an Excerpt equivalent to {@code !Objects.equals(a, b)}.
<p>Uses != for primitive types, as this avoids boxing. | [
"Returns",
"an",
"Excerpt",
"equivalent",
"to",
"{",
"@code",
"!Objects",
".",
"equals",
"(",
"a",
"b",
")",
"}",
"."
] | train | https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/ObjectsExcerpts.java#L25-L27 |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/BiConsumerCallbackManager.java | BiConsumerCallbackManager.removeCallback | public boolean removeCallback(final S symbol, final BiConsumer<S, T> callback) throws BitfinexClientException {
final List<BiConsumer<S, T>> callbackList = callbacks.get(symbol);
if(callbackList == null) {
throw new BitfinexClientException("Unknown ticker string: " + symbol);
}
return callbackList.remove(callback);
} | java | public boolean removeCallback(final S symbol, final BiConsumer<S, T> callback) throws BitfinexClientException {
final List<BiConsumer<S, T>> callbackList = callbacks.get(symbol);
if(callbackList == null) {
throw new BitfinexClientException("Unknown ticker string: " + symbol);
}
return callbackList.remove(callback);
} | [
"public",
"boolean",
"removeCallback",
"(",
"final",
"S",
"symbol",
",",
"final",
"BiConsumer",
"<",
"S",
",",
"T",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{",
"final",
"List",
"<",
"BiConsumer",
"<",
"S",
",",
"T",
">",
">",
"callbackL... | Remove the a callback
@param symbol
@param callback
@return
@throws BitfinexClientException | [
"Remove",
"the",
"a",
"callback"
] | train | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/BiConsumerCallbackManager.java#L64-L73 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKRGraph.java | CDKRGraph.parseRec | private void parseRec(BitSet traversed, BitSet extension, BitSet forbidden) throws CDKException {
BitSet newTraversed = null;
BitSet newExtension = null;
BitSet newForbidden = null;
BitSet potentialNode = null;
checkTimeOut();
// if there is no more extension possible we
// have reached a potential new solution
if (extension.isEmpty()) {
solution(traversed);
} // carry on with each possible extension
else {
// calculates the set of nodes that may still
// be reached at this stage (not forbidden)
potentialNode = ((BitSet) getGraphBitSet().clone());
potentialNode.andNot(forbidden);
potentialNode.or(traversed);
// checks if we must continue the search
// according to the potential node set
if (mustContinue(potentialNode)) {
// carry on research and update iteration count
setNbIteration(getNbIteration() + 1);
// for each node in the set of possible extension (neighbors of
// the current partial solution, include the node to the solution
// and parse recursively the CDKRGraph with the new context.
for (int x = extension.nextSetBit(0); x >= 0 && !isStop(); x = extension.nextSetBit(x + 1)) {
// evaluates the new set of forbidden nodes
// by including the nodes not compatible with the
// newly accepted node.
newForbidden = (BitSet) forbidden.clone();
newForbidden.or((getGraph().get(x)).getForbidden());
// if maxIterator is the first time we are here then
// traversed is empty and we initialize the set of
// possible extensions to the extension of the first
// accepted node in the solution.
if (traversed.isEmpty()) {
newExtension = (BitSet) ((getGraph().get(x)).getExtension().clone());
} // else we simply update the set of solution by
// including the neighbors of the newly accepted node
else {
newExtension = (BitSet) extension.clone();
newExtension.or((getGraph().get(x)).getExtension());
}
// extension my not contain forbidden nodes
newExtension.andNot(newForbidden);
// create the new set of traversed node
// (update current partial solution)
// and add x to the set of forbidden node
// (a node may only appear once in a solution)
newTraversed = (BitSet) traversed.clone();
newTraversed.set(x);
forbidden.set(x);
// parse recursively the CDKRGraph
parseRec(newTraversed, newExtension, newForbidden);
}
}
}
} | java | private void parseRec(BitSet traversed, BitSet extension, BitSet forbidden) throws CDKException {
BitSet newTraversed = null;
BitSet newExtension = null;
BitSet newForbidden = null;
BitSet potentialNode = null;
checkTimeOut();
// if there is no more extension possible we
// have reached a potential new solution
if (extension.isEmpty()) {
solution(traversed);
} // carry on with each possible extension
else {
// calculates the set of nodes that may still
// be reached at this stage (not forbidden)
potentialNode = ((BitSet) getGraphBitSet().clone());
potentialNode.andNot(forbidden);
potentialNode.or(traversed);
// checks if we must continue the search
// according to the potential node set
if (mustContinue(potentialNode)) {
// carry on research and update iteration count
setNbIteration(getNbIteration() + 1);
// for each node in the set of possible extension (neighbors of
// the current partial solution, include the node to the solution
// and parse recursively the CDKRGraph with the new context.
for (int x = extension.nextSetBit(0); x >= 0 && !isStop(); x = extension.nextSetBit(x + 1)) {
// evaluates the new set of forbidden nodes
// by including the nodes not compatible with the
// newly accepted node.
newForbidden = (BitSet) forbidden.clone();
newForbidden.or((getGraph().get(x)).getForbidden());
// if maxIterator is the first time we are here then
// traversed is empty and we initialize the set of
// possible extensions to the extension of the first
// accepted node in the solution.
if (traversed.isEmpty()) {
newExtension = (BitSet) ((getGraph().get(x)).getExtension().clone());
} // else we simply update the set of solution by
// including the neighbors of the newly accepted node
else {
newExtension = (BitSet) extension.clone();
newExtension.or((getGraph().get(x)).getExtension());
}
// extension my not contain forbidden nodes
newExtension.andNot(newForbidden);
// create the new set of traversed node
// (update current partial solution)
// and add x to the set of forbidden node
// (a node may only appear once in a solution)
newTraversed = (BitSet) traversed.clone();
newTraversed.set(x);
forbidden.set(x);
// parse recursively the CDKRGraph
parseRec(newTraversed, newExtension, newForbidden);
}
}
}
} | [
"private",
"void",
"parseRec",
"(",
"BitSet",
"traversed",
",",
"BitSet",
"extension",
",",
"BitSet",
"forbidden",
")",
"throws",
"CDKException",
"{",
"BitSet",
"newTraversed",
"=",
"null",
";",
"BitSet",
"newExtension",
"=",
"null",
";",
"BitSet",
"newForbidden... | Parsing of the CDKRGraph. This is the recursive method
to perform a query. The method will recursively
parse the CDKRGraph thru connected nodes and visiting the
CDKRGraph using allowed adjacency relationship.
@param traversed node already parsed
@param extension possible extension node (allowed neighbors)
@param forbiden node forbidden (set of node incompatible with the current solution) | [
"Parsing",
"of",
"the",
"CDKRGraph",
".",
"This",
"is",
"the",
"recursive",
"method",
"to",
"perform",
"a",
"query",
".",
"The",
"method",
"will",
"recursively",
"parse",
"the",
"CDKRGraph",
"thru",
"connected",
"nodes",
"and",
"visiting",
"the",
"CDKRGraph",
... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKRGraph.java#L255-L320 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallPolicies | @SuppressWarnings("unchecked")
public static PoliciesBean unmarshallPolicies(Map<String, Object> source) {
if (source == null) {
return null;
}
PoliciesBean bean = new PoliciesBean();
bean.setOrganizationId(asString(source.get("organizationId")));
bean.setEntityId(asString(source.get("entityId")));
bean.setEntityVersion(asString(source.get("entityVersion")));
bean.setType(asEnum(source.get("type"), PolicyType.class));
List<Map<String, Object>> policies = (List<Map<String, Object>>) source.get("policies");
if (policies != null) {
for (Map<String, Object> policyMap : policies) {
PolicyBean policy = new PolicyBean();
policy.setOrganizationId(bean.getOrganizationId());
policy.setEntityId(bean.getEntityId());
policy.setEntityVersion(bean.getEntityVersion());
policy.setType(bean.getType());
policy.setConfiguration(asString(policyMap.get("configuration")));
policy.setCreatedBy(asString(policyMap.get("createdBy")));
policy.setCreatedOn(asDate(policyMap.get("createdOn")));
PolicyDefinitionBean def = new PolicyDefinitionBean();
def.setId(asString(policyMap.get("definitionId")));
// Note: this is a placeholder that needs to be resolved later.
policy.setDefinition(def);
policy.setId(asLong(policyMap.get("id")));
policy.setModifiedBy(asString(policyMap.get("modifiedBy")));
policy.setModifiedOn(asDate(policyMap.get("modifiedOn")));
policy.setName(asString(policyMap.get("name")));
policy.setOrderIndex(asInt(policyMap.get("orderIndex")));
bean.getPolicies().add(policy);
}
}
postMarshall(bean);
return bean;
} | java | @SuppressWarnings("unchecked")
public static PoliciesBean unmarshallPolicies(Map<String, Object> source) {
if (source == null) {
return null;
}
PoliciesBean bean = new PoliciesBean();
bean.setOrganizationId(asString(source.get("organizationId")));
bean.setEntityId(asString(source.get("entityId")));
bean.setEntityVersion(asString(source.get("entityVersion")));
bean.setType(asEnum(source.get("type"), PolicyType.class));
List<Map<String, Object>> policies = (List<Map<String, Object>>) source.get("policies");
if (policies != null) {
for (Map<String, Object> policyMap : policies) {
PolicyBean policy = new PolicyBean();
policy.setOrganizationId(bean.getOrganizationId());
policy.setEntityId(bean.getEntityId());
policy.setEntityVersion(bean.getEntityVersion());
policy.setType(bean.getType());
policy.setConfiguration(asString(policyMap.get("configuration")));
policy.setCreatedBy(asString(policyMap.get("createdBy")));
policy.setCreatedOn(asDate(policyMap.get("createdOn")));
PolicyDefinitionBean def = new PolicyDefinitionBean();
def.setId(asString(policyMap.get("definitionId")));
// Note: this is a placeholder that needs to be resolved later.
policy.setDefinition(def);
policy.setId(asLong(policyMap.get("id")));
policy.setModifiedBy(asString(policyMap.get("modifiedBy")));
policy.setModifiedOn(asDate(policyMap.get("modifiedOn")));
policy.setName(asString(policyMap.get("name")));
policy.setOrderIndex(asInt(policyMap.get("orderIndex")));
bean.getPolicies().add(policy);
}
}
postMarshall(bean);
return bean;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"PoliciesBean",
"unmarshallPolicies",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Polic... | Unmarshals the given map source into a bean.
@param source the source
@return the policy beans | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L659-L694 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getSkillInfo | public void getSkillInfo(int[] ids, Callback<List<Skill>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getSkillInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getSkillInfo(int[] ids, Callback<List<Skill>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getSkillInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getSkillInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Skill",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
"... | For more info on Skills API go <a href="https://wiki.guildwars2.com/wiki/API:2/skills">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of skill id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Skill skill info | [
"For",
"more",
"info",
"on",
"Skills",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"skills",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
"t... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2350-L2353 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.andNotLike | public ZealotKhala andNotLike(String field, Object value) {
return this.doLike(ZealotConst.AND_PREFIX, field, value, true, false);
} | java | public ZealotKhala andNotLike(String field, Object value) {
return this.doLike(ZealotConst.AND_PREFIX, field, value, true, false);
} | [
"public",
"ZealotKhala",
"andNotLike",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"return",
"this",
".",
"doLike",
"(",
"ZealotConst",
".",
"AND_PREFIX",
",",
"field",
",",
"value",
",",
"true",
",",
"false",
")",
";",
"}"
] | 生成带" AND "前缀的" NOT LIKE "模糊查询的SQL片段.
<p>示例:传入 {"b.title", "Spring"} 两个参数,生成的SQL片段为:" AND b.title NOT LIKE ? ", SQL参数为:{"%Spring%"}</p>
@param field 数据库字段
@param value 值
@return ZealotKhala实例 | [
"生成带",
"AND",
"前缀的",
"NOT",
"LIKE",
"模糊查询的SQL片段",
".",
"<p",
">",
"示例:传入",
"{",
"b",
".",
"title",
"Spring",
"}",
"两个参数,生成的SQL片段为:",
"AND",
"b",
".",
"title",
"NOT",
"LIKE",
"?",
"SQL参数为",
":",
"{",
"%Spring%",
"}",
"<",
"/",
"p",
">"
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L990-L992 |
infinispan/infinispan | core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java | IndexingConfigurationBuilder.addKeyTransformer | public IndexingConfigurationBuilder addKeyTransformer(Class<?> keyClass, Class<?> keyTransformerClass) {
Map<Class<?>, Class<?>> indexedEntities = keyTransformers();
indexedEntities.put(keyClass, keyTransformerClass);
attributes.attribute(KEY_TRANSFORMERS).set(indexedEntities);
return this;
} | java | public IndexingConfigurationBuilder addKeyTransformer(Class<?> keyClass, Class<?> keyTransformerClass) {
Map<Class<?>, Class<?>> indexedEntities = keyTransformers();
indexedEntities.put(keyClass, keyTransformerClass);
attributes.attribute(KEY_TRANSFORMERS).set(indexedEntities);
return this;
} | [
"public",
"IndexingConfigurationBuilder",
"addKeyTransformer",
"(",
"Class",
"<",
"?",
">",
"keyClass",
",",
"Class",
"<",
"?",
">",
"keyTransformerClass",
")",
"{",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"Class",
"<",
"?",
">",
">",
"indexedEntities",
"... | Registers a transformer for a key class.
@param keyClass the class of the key
@param keyTransformerClass the class of the org.infinispan.query.Transformer that handles this key type
@return <code>this</code>, for method chaining | [
"Registers",
"a",
"transformer",
"for",
"a",
"key",
"class",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java#L106-L111 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getAvailableLocaleNameSet | public static Set<String> getAvailableLocaleNameSet(String bundlePrefix, ClassLoader loader) {
return getAvailEntry(bundlePrefix, loader).getLocaleNameSet();
} | java | public static Set<String> getAvailableLocaleNameSet(String bundlePrefix, ClassLoader loader) {
return getAvailEntry(bundlePrefix, loader).getLocaleNameSet();
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"getAvailableLocaleNameSet",
"(",
"String",
"bundlePrefix",
",",
"ClassLoader",
"loader",
")",
"{",
"return",
"getAvailEntry",
"(",
"bundlePrefix",
",",
"loader",
")",
".",
"getLocaleNameSet",
"(",
")",
";",
"}"
] | Return a set of the locale names supported by a collection of resource
bundles.
@param bundlePrefix the prefix of the resource bundles to use. | [
"Return",
"a",
"set",
"of",
"the",
"locale",
"names",
"supported",
"by",
"a",
"collection",
"of",
"resource",
"bundles",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L441-L443 |
Stratio/deep-spark | deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java | Cells.getByteBuffer | public ByteBuffer getByteBuffer(String nameSpace, String cellName) {
return getValue(nameSpace, cellName, ByteBuffer.class);
} | java | public ByteBuffer getByteBuffer(String nameSpace, String cellName) {
return getValue(nameSpace, cellName, ByteBuffer.class);
} | [
"public",
"ByteBuffer",
"getByteBuffer",
"(",
"String",
"nameSpace",
",",
"String",
"cellName",
")",
"{",
"return",
"getValue",
"(",
"nameSpace",
",",
"cellName",
",",
"ByteBuffer",
".",
"class",
")",
";",
"}"
] | Returns the {@code ByteBuffer} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or
null if this Cells object contains no cell whose name is cellName.
@param nameSpace the name of the owning table
@param cellName the name of the Cell we want to retrieve from this Cells object.
@return the {@code ByteBuffer} value of the {@link Cell} (associated to {@code table}) whose name is cellName, or
null if this Cells object contains no cell whose name is cellName | [
"Returns",
"the",
"{",
"@code",
"ByteBuffer",
"}",
"value",
"of",
"the",
"{",
"@link",
"Cell",
"}",
"(",
"associated",
"to",
"{",
"@code",
"table",
"}",
")",
"whose",
"name",
"iscellName",
"or",
"null",
"if",
"this",
"Cells",
"object",
"contains",
"no",
... | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L1315-L1317 |
overturetool/overture | core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java | SyntaxReader.idToName | protected LexNameToken idToName(LexIdentifierToken id)
{
LexNameToken name = new LexNameToken(reader.currentModule, id);
return name;
} | java | protected LexNameToken idToName(LexIdentifierToken id)
{
LexNameToken name = new LexNameToken(reader.currentModule, id);
return name;
} | [
"protected",
"LexNameToken",
"idToName",
"(",
"LexIdentifierToken",
"id",
")",
"{",
"LexNameToken",
"name",
"=",
"new",
"LexNameToken",
"(",
"reader",
".",
"currentModule",
",",
"id",
")",
";",
"return",
"name",
";",
"}"
] | Convert an identifier into a name. A name is an identifier that has a module name qualifier, so this method uses
the current module to convert the identifier passed in.
@param id
The identifier to convert
@return The corresponding name. | [
"Convert",
"an",
"identifier",
"into",
"a",
"name",
".",
"A",
"name",
"is",
"an",
"identifier",
"that",
"has",
"a",
"module",
"name",
"qualifier",
"so",
"this",
"method",
"uses",
"the",
"current",
"module",
"to",
"convert",
"the",
"identifier",
"passed",
"... | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java#L167-L171 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java | CacheUnitImpl.getEntry | public CacheEntry getEntry(String cacheName, Object id, boolean ignoreCounting ) {
if (tc.isEntryEnabled())
Tr.entry(tc, "getEntry: {0}", id);
DCache cache = ServerCache.getCache(cacheName);
CacheEntry cacheEntry = null;
if ( cache != null ) {
cacheEntry = (CacheEntry) cache.getEntry(id, CachePerf.REMOTE, ignoreCounting, DCacheBase.INCREMENT_REFF_COUNT);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "getEntry: {0}", id);
return cacheEntry;
} | java | public CacheEntry getEntry(String cacheName, Object id, boolean ignoreCounting ) {
if (tc.isEntryEnabled())
Tr.entry(tc, "getEntry: {0}", id);
DCache cache = ServerCache.getCache(cacheName);
CacheEntry cacheEntry = null;
if ( cache != null ) {
cacheEntry = (CacheEntry) cache.getEntry(id, CachePerf.REMOTE, ignoreCounting, DCacheBase.INCREMENT_REFF_COUNT);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "getEntry: {0}", id);
return cacheEntry;
} | [
"public",
"CacheEntry",
"getEntry",
"(",
"String",
"cacheName",
",",
"Object",
"id",
",",
"boolean",
"ignoreCounting",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getEntry: {0}\"",
",",
"id",
")... | This implements the method in the CacheUnit interface.
This is called by DRSNotificationService and DRSMessageListener.
A returned null indicates that the local cache should
execute it and return the result to the coordinating CacheUnit.
@param cacheName The cache name
@param id The cache id for the entry. The id cannot be null.
@param ignoreCounting true to ignore statistics counting
@return The entry indentified by the cache id. | [
"This",
"implements",
"the",
"method",
"in",
"the",
"CacheUnit",
"interface",
".",
"This",
"is",
"called",
"by",
"DRSNotificationService",
"and",
"DRSMessageListener",
".",
"A",
"returned",
"null",
"indicates",
"that",
"the",
"local",
"cache",
"should",
"execute",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java#L153-L166 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.SquaredEuclidean | public static double SquaredEuclidean(double x1, double y1, double x2, double y2) {
double dx = x2 - x1;
double dy = y2 - y1;
return dx * dx + dy * dy;
} | java | public static double SquaredEuclidean(double x1, double y1, double x2, double y2) {
double dx = x2 - x1;
double dy = y2 - y1;
return dx * dx + dy * dy;
} | [
"public",
"static",
"double",
"SquaredEuclidean",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
")",
"{",
"double",
"dx",
"=",
"x2",
"-",
"x1",
";",
"double",
"dy",
"=",
"y2",
"-",
"y1",
";",
"return",
"dx",
"*... | Gets the Squared Euclidean distance between two points.
@param x1 X1 axis coordinates.
@param y1 Y1 axis coordinates.
@param x2 X2 axis coordinates.
@param y2 Y2 axis coordinates.
@return The Squared euclidean distance between x and y. | [
"Gets",
"the",
"Squared",
"Euclidean",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L821-L827 |
negusoft/holoaccent | HoloAccent/src/com/negusoft/holoaccent/widget/AccentSearchView.java | AccentSearchView.setBackground | @SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void setBackground(View view, Drawable drawable) {
if (Build.VERSION.SDK_INT >= SET_DRAWABLE_MIN_SDK)
view.setBackground(drawable);
else
view.setBackgroundDrawable(drawable);
} | java | @SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void setBackground(View view, Drawable drawable) {
if (Build.VERSION.SDK_INT >= SET_DRAWABLE_MIN_SDK)
view.setBackground(drawable);
else
view.setBackgroundDrawable(drawable);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"private",
"void",
"setBackground",
"(",
"View",
"view",
",",
"Drawable",
"drawable",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"SET_... | Call the appropriate method to set the background to the View | [
"Call",
"the",
"appropriate",
"method",
"to",
"set",
"the",
"background",
"to",
"the",
"View"
] | train | https://github.com/negusoft/holoaccent/blob/7121a02dde94834e770cb81174d0bdc596323324/HoloAccent/src/com/negusoft/holoaccent/widget/AccentSearchView.java#L51-L58 |
graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.invalidPropertyUse | public static TransactionException invalidPropertyUse(Concept concept, Schema.VertexProperty property) {
return create(INVALID_PROPERTY_USE.getMessage(concept, property));
} | java | public static TransactionException invalidPropertyUse(Concept concept, Schema.VertexProperty property) {
return create(INVALID_PROPERTY_USE.getMessage(concept, property));
} | [
"public",
"static",
"TransactionException",
"invalidPropertyUse",
"(",
"Concept",
"concept",
",",
"Schema",
".",
"VertexProperty",
"property",
")",
"{",
"return",
"create",
"(",
"INVALID_PROPERTY_USE",
".",
"getMessage",
"(",
"concept",
",",
"property",
")",
")",
... | Thrown when trying to add a Schema.VertexProperty to a Concept which does not accept that type
of Schema.VertexProperty | [
"Thrown",
"when",
"trying",
"to",
"add",
"a",
"Schema",
".",
"VertexProperty",
"to",
"a",
"Concept",
"which",
"does",
"not",
"accept",
"that",
"type",
"of",
"Schema",
".",
"VertexProperty"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L256-L258 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraSchemaMgr.java | CassandraSchemaMgr.columnFamilyExists | public boolean columnFamilyExists(DBConn dbConn, String keyspace, String cfName) {
KsDef ksDef = null;
try {
ksDef = dbConn.getClientSession().describe_keyspace(keyspace);
} catch (Exception ex) {
throw new RuntimeException("Failed to get keyspace definition for '" + keyspace + "'", ex);
}
List<CfDef> cfDefList = ksDef.getCf_defs();
for (CfDef cfDef : cfDefList) {
if (cfDef.getName().equals(cfName)) {
return true;
}
}
return false;
} | java | public boolean columnFamilyExists(DBConn dbConn, String keyspace, String cfName) {
KsDef ksDef = null;
try {
ksDef = dbConn.getClientSession().describe_keyspace(keyspace);
} catch (Exception ex) {
throw new RuntimeException("Failed to get keyspace definition for '" + keyspace + "'", ex);
}
List<CfDef> cfDefList = ksDef.getCf_defs();
for (CfDef cfDef : cfDefList) {
if (cfDef.getName().equals(cfName)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"columnFamilyExists",
"(",
"DBConn",
"dbConn",
",",
"String",
"keyspace",
",",
"String",
"cfName",
")",
"{",
"KsDef",
"ksDef",
"=",
"null",
";",
"try",
"{",
"ksDef",
"=",
"dbConn",
".",
"getClientSession",
"(",
")",
".",
"describe_keyspa... | Return true if the given store name currently exists in the given keyspace. This
method can be used with a connection connected to any keyspace.
@param dbConn Database connection to use.
@param cfName Candidate ColumnFamily name.
@return True if the CF exists in the database. | [
"Return",
"true",
"if",
"the",
"given",
"store",
"name",
"currently",
"exists",
"in",
"the",
"given",
"keyspace",
".",
"This",
"method",
"can",
"be",
"used",
"with",
"a",
"connection",
"connected",
"to",
"any",
"keyspace",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraSchemaMgr.java#L200-L215 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1Instance.java | V1Instance.getAsset | private Asset getAsset(Object id, String assetTypeToken) {
Asset result = assetCache.get(id);
if (result == null) {
try {
IAssetType assetType = getMetaModel().getAssetType(
assetTypeToken);
if (id instanceof AssetID) {
AssetID assetId = (AssetID) id;
result = new Asset(Oid.fromToken(assetId.getToken(),
getMetaModel()));
} else {
result = new Asset(assetType);
}
setAsset(id, result);
} catch (OidException e) {
throw new ApplicationUnavailableException(e);
}
}
return result;
} | java | private Asset getAsset(Object id, String assetTypeToken) {
Asset result = assetCache.get(id);
if (result == null) {
try {
IAssetType assetType = getMetaModel().getAssetType(
assetTypeToken);
if (id instanceof AssetID) {
AssetID assetId = (AssetID) id;
result = new Asset(Oid.fromToken(assetId.getToken(),
getMetaModel()));
} else {
result = new Asset(assetType);
}
setAsset(id, result);
} catch (OidException e) {
throw new ApplicationUnavailableException(e);
}
}
return result;
} | [
"private",
"Asset",
"getAsset",
"(",
"Object",
"id",
",",
"String",
"assetTypeToken",
")",
"{",
"Asset",
"result",
"=",
"assetCache",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"try",
"{",
"IAssetType",
"assetType",
"... | Find an asset in the asset cache or create one for this id.
@param id asset will be found for.
@param assetTypeToken The Asset Type Token of the asset to create if one
does not already exist.
@return An Asset that will exist in the asset cache. | [
"Find",
"an",
"asset",
"in",
"the",
"asset",
"cache",
"or",
"create",
"one",
"for",
"this",
"id",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1Instance.java#L554-L575 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/AABBUtils.java | AABBUtils.isColliding | public static boolean isColliding(AxisAlignedBB[] aabbs1, AxisAlignedBB[] aabbs2)
{
if (ArrayUtils.isEmpty(aabbs1) || ArrayUtils.isEmpty(aabbs2))
return false;
for (AxisAlignedBB aabb1 : aabbs1)
{
if (aabb1 != null)
{
for (AxisAlignedBB aabb2 : aabbs2)
if (aabb2 != null && aabb1.intersects(aabb2))
return true;
}
}
return false;
} | java | public static boolean isColliding(AxisAlignedBB[] aabbs1, AxisAlignedBB[] aabbs2)
{
if (ArrayUtils.isEmpty(aabbs1) || ArrayUtils.isEmpty(aabbs2))
return false;
for (AxisAlignedBB aabb1 : aabbs1)
{
if (aabb1 != null)
{
for (AxisAlignedBB aabb2 : aabbs2)
if (aabb2 != null && aabb1.intersects(aabb2))
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isColliding",
"(",
"AxisAlignedBB",
"[",
"]",
"aabbs1",
",",
"AxisAlignedBB",
"[",
"]",
"aabbs2",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isEmpty",
"(",
"aabbs1",
")",
"||",
"ArrayUtils",
".",
"isEmpty",
"(",
"aabbs2",
")",... | Checks if an {@link AxisAlignedBB} array is colliding with another one.
@param aabbs1 the aabbs1
@param aabbs2 the aabbs2
@return true, if is colliding | [
"Checks",
"if",
"an",
"{",
"@link",
"AxisAlignedBB",
"}",
"array",
"is",
"colliding",
"with",
"another",
"one",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/AABBUtils.java#L379-L395 |
Jasig/uPortal | uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/node/UserLayoutChannelDescription.java | UserLayoutChannelDescription.setParameterValue | @Override
public String setParameterValue(String parameterName, String parameterValue) {
// don't try to store a null value
if (parameterValue == null) return null;
return (String) parameters.put(parameterName, parameterValue);
} | java | @Override
public String setParameterValue(String parameterName, String parameterValue) {
// don't try to store a null value
if (parameterValue == null) return null;
return (String) parameters.put(parameterName, parameterValue);
} | [
"@",
"Override",
"public",
"String",
"setParameterValue",
"(",
"String",
"parameterName",
",",
"String",
"parameterValue",
")",
"{",
"// don't try to store a null value",
"if",
"(",
"parameterValue",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"String",... | Set a channel parameter value.
@param parameterValue a <code>String</code> value
@param parameterName a <code>String</code> value
@return a <code>String</code> value that was set. | [
"Set",
"a",
"channel",
"parameter",
"value",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/node/UserLayoutChannelDescription.java#L374-L379 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.headerFragment | public T headerFragment(Object model, String mapperName) {
Assert.notNull(applicationContext, "Citrus application context is not initialized!");
if (applicationContext.containsBean(mapperName)) {
Object mapper = applicationContext.getBean(mapperName);
if (Marshaller.class.isAssignableFrom(mapper.getClass())) {
return headerFragment(model, (Marshaller) mapper);
} else if (ObjectMapper.class.isAssignableFrom(mapper.getClass())) {
return headerFragment(model, (ObjectMapper) mapper);
} else {
throw new CitrusRuntimeException(String.format("Invalid bean type for mapper '%s' expected ObjectMapper or Marshaller but was '%s'", mapperName, mapper.getClass()));
}
}
throw new CitrusRuntimeException("Unable to find default object mapper or marshaller in application context");
} | java | public T headerFragment(Object model, String mapperName) {
Assert.notNull(applicationContext, "Citrus application context is not initialized!");
if (applicationContext.containsBean(mapperName)) {
Object mapper = applicationContext.getBean(mapperName);
if (Marshaller.class.isAssignableFrom(mapper.getClass())) {
return headerFragment(model, (Marshaller) mapper);
} else if (ObjectMapper.class.isAssignableFrom(mapper.getClass())) {
return headerFragment(model, (ObjectMapper) mapper);
} else {
throw new CitrusRuntimeException(String.format("Invalid bean type for mapper '%s' expected ObjectMapper or Marshaller but was '%s'", mapperName, mapper.getClass()));
}
}
throw new CitrusRuntimeException("Unable to find default object mapper or marshaller in application context");
} | [
"public",
"T",
"headerFragment",
"(",
"Object",
"model",
",",
"String",
"mapperName",
")",
"{",
"Assert",
".",
"notNull",
"(",
"applicationContext",
",",
"\"Citrus application context is not initialized!\"",
")",
";",
"if",
"(",
"applicationContext",
".",
"containsBea... | Expect this message header data as model object which is marshalled to a character sequence using the given object to xml mapper that
is accessed by its bean name in Spring bean application context.
@param model
@param mapperName
@return | [
"Expect",
"this",
"message",
"header",
"data",
"as",
"model",
"object",
"which",
"is",
"marshalled",
"to",
"a",
"character",
"sequence",
"using",
"the",
"given",
"object",
"to",
"xml",
"mapper",
"that",
"is",
"accessed",
"by",
"its",
"bean",
"name",
"in",
... | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L360-L376 |
tianjing/tgtools.web.develop | src/main/java/tgtools/web/develop/util/ValidHelper.java | ValidHelper.validBigTextLength | public static void validBigTextLength(String pContent,int pLength,String pParamName) throws APPErrorException {
if(!StringUtil.isNullOrEmpty(pContent)&&pContent.length()>pLength)
{
throw new APPErrorException((null==pParamName?StringUtil.EMPTY_STRING:pParamName)+"长度不能超过"+pLength+",请调整;");
}
} | java | public static void validBigTextLength(String pContent,int pLength,String pParamName) throws APPErrorException {
if(!StringUtil.isNullOrEmpty(pContent)&&pContent.length()>pLength)
{
throw new APPErrorException((null==pParamName?StringUtil.EMPTY_STRING:pParamName)+"长度不能超过"+pLength+",请调整;");
}
} | [
"public",
"static",
"void",
"validBigTextLength",
"(",
"String",
"pContent",
",",
"int",
"pLength",
",",
"String",
"pParamName",
")",
"throws",
"APPErrorException",
"{",
"if",
"(",
"!",
"StringUtil",
".",
"isNullOrEmpty",
"(",
"pContent",
")",
"&&",
"pContent",
... | 验证大文本长度
@param pContent 文本
@param pLength 规则长度
@param pParamName 参数名称
@throws APPErrorException | [
"验证大文本长度"
] | train | https://github.com/tianjing/tgtools.web.develop/blob/a18567f3ccf877249f2e33028d1e7c479900e4eb/src/main/java/tgtools/web/develop/util/ValidHelper.java#L62-L67 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/wikipedia/Descriptor.java | Descriptor.setOutgoingLinks | public void setOutgoingLinks(int i, Title v) {
if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_outgoingLinks == null)
jcasType.jcas.throwFeatMissing("outgoingLinks", "de.julielab.jules.types.wikipedia.Descriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_outgoingLinks), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_outgoingLinks), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setOutgoingLinks(int i, Title v) {
if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_outgoingLinks == null)
jcasType.jcas.throwFeatMissing("outgoingLinks", "de.julielab.jules.types.wikipedia.Descriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_outgoingLinks), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_outgoingLinks), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setOutgoingLinks",
"(",
"int",
"i",
",",
"Title",
"v",
")",
"{",
"if",
"(",
"Descriptor_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Descriptor_Type",
")",
"jcasType",
")",
".",
"casFeat_outgoingLinks",
"==",
"null",
")",
"jcasType",
".",
"... | indexed setter for outgoingLinks - sets an indexed value - List of outgoing links pointing to other Wikipedia pages starting at a Wikipedia page.
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"outgoingLinks",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"List",
"of",
"outgoing",
"links",
"pointing",
"to",
"other",
"Wikipedia",
"pages",
"starting",
"at",
"a",
"Wikipedia",
"page",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/wikipedia/Descriptor.java#L205-L209 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.forAllMemberTags | public void forAllMemberTags(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
forAllMemberTags(template, attributes, FOR_FIELD, XDocletTagshandlerMessages.ONLY_CALL_FIELD_NOT_NULL, new String[]{"forAllMemberTags"});
}
else if (getCurrentMethod() != null) {
forAllMemberTags(template, attributes, FOR_METHOD, XDocletTagshandlerMessages.ONLY_CALL_METHOD_NOT_NULL, new String[]{"forAllMemberTags"});
}
} | java | public void forAllMemberTags(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
forAllMemberTags(template, attributes, FOR_FIELD, XDocletTagshandlerMessages.ONLY_CALL_FIELD_NOT_NULL, new String[]{"forAllMemberTags"});
}
else if (getCurrentMethod() != null) {
forAllMemberTags(template, attributes, FOR_METHOD, XDocletTagshandlerMessages.ONLY_CALL_METHOD_NOT_NULL, new String[]{"forAllMemberTags"});
}
} | [
"public",
"void",
"forAllMemberTags",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"forAllMemberTags",
"(",
"template",
",",
"attributes",
",",... | Iterates over all tags of current member and evaluates the template for each one.
@param template The template to be evaluated
@param attributes The attributes of the template tag
@exception XDocletException If an error occurs
@doc.tag type="block"
@doc.param name="tagName" optional="false" description="The tag name."
@doc.param name="paramName" optional="true" description="The parameter name." | [
"Iterates",
"over",
"all",
"tags",
"of",
"current",
"member",
"and",
"evaluates",
"the",
"template",
"for",
"each",
"one",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L239-L247 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale2x.java | RawScale2x.getSourcePixel | private int getSourcePixel(int[] srcImage, int x, int y)
{
int x1 = Math.max(0, x);
x1 = Math.min(width - 1, x1);
int y1 = Math.max(0, y);
y1 = Math.min(height - 1, y1);
return srcImage[x1 + y1 * width];
} | java | private int getSourcePixel(int[] srcImage, int x, int y)
{
int x1 = Math.max(0, x);
x1 = Math.min(width - 1, x1);
int y1 = Math.max(0, y);
y1 = Math.min(height - 1, y1);
return srcImage[x1 + y1 * width];
} | [
"private",
"int",
"getSourcePixel",
"(",
"int",
"[",
"]",
"srcImage",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"x1",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"x",
")",
";",
"x1",
"=",
"Math",
".",
"min",
"(",
"width",
"-",
"1",
",",
... | Get pixel source.
@param srcImage The image source.
@param x The location x.
@param y The location y.
@return The pixel value found. | [
"Get",
"pixel",
"source",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale2x.java#L89-L97 |
mikepenz/FastAdapter | library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java | AbstractWrapAdapter.onCreateViewHolder | @Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//TODO OPTIMIZE
for (Item item : mItems) {
if (item.getType() == viewType) {
return item.getViewHolder(parent);
}
}
return mAdapter.onCreateViewHolder(parent, viewType);
} | java | @Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//TODO OPTIMIZE
for (Item item : mItems) {
if (item.getType() == viewType) {
return item.getViewHolder(parent);
}
}
return mAdapter.onCreateViewHolder(parent, viewType);
} | [
"@",
"Override",
"public",
"RecyclerView",
".",
"ViewHolder",
"onCreateViewHolder",
"(",
"ViewGroup",
"parent",
",",
"int",
"viewType",
")",
"{",
"//TODO OPTIMIZE",
"for",
"(",
"Item",
"item",
":",
"mItems",
")",
"{",
"if",
"(",
"item",
".",
"getType",
"(",
... | the onCreateViewHolder is managed by the FastAdapter so forward this correctly
@param parent
@param viewType
@return | [
"the",
"onCreateViewHolder",
"is",
"managed",
"by",
"the",
"FastAdapter",
"so",
"forward",
"this",
"correctly"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java#L157-L166 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/PosixParser.java | PosixParser.burstToken | protected void burstToken(String token, boolean stopAtNonOption)
{
for (int i = 1; i < token.length(); i++)
{
String ch = String.valueOf(token.charAt(i));
if (options.hasOption(ch))
{
tokens.add("-" + ch);
currentOption = options.getOption(ch);
if (currentOption.hasArg() && token.length() != i + 1)
{
tokens.add(token.substring(i + 1));
break;
}
}
else if (stopAtNonOption)
{
processNonOptionToken(token.substring(i), true);
break;
}
else
{
tokens.add(token);
break;
}
}
} | java | protected void burstToken(String token, boolean stopAtNonOption)
{
for (int i = 1; i < token.length(); i++)
{
String ch = String.valueOf(token.charAt(i));
if (options.hasOption(ch))
{
tokens.add("-" + ch);
currentOption = options.getOption(ch);
if (currentOption.hasArg() && token.length() != i + 1)
{
tokens.add(token.substring(i + 1));
break;
}
}
else if (stopAtNonOption)
{
processNonOptionToken(token.substring(i), true);
break;
}
else
{
tokens.add(token);
break;
}
}
} | [
"protected",
"void",
"burstToken",
"(",
"String",
"token",
",",
"boolean",
"stopAtNonOption",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"token",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"ch",
"=",
"String",
".",... | Breaks <code>token</code> into its constituent parts
using the following algorithm.
<ul>
<li>ignore the first character ("<b>-</b>")</li>
<li>foreach remaining character check if an {@link Option}
exists with that id.</li>
<li>if an {@link Option} does exist then add that character
prepended with "<b>-</b>" to the list of processed tokens.</li>
<li>if the {@link Option} can have an argument value and there
are remaining characters in the token then add the remaining
characters as a token to the list of processed tokens.</li>
<li>if an {@link Option} does <b>NOT</b> exist <b>AND</b>
<code>stopAtNonOption</code> <b>IS</b> set then add the special token
"<b>--</b>" followed by the remaining characters and also
the remaining tokens directly to the processed tokens list.</li>
<li>if an {@link Option} does <b>NOT</b> exist <b>AND</b>
<code>stopAtNonOption</code> <b>IS NOT</b> set then add that
character prepended with "<b>-</b>".</li>
</ul>
@param token The current token to be <b>burst</b>
@param stopAtNonOption Specifies whether to stop processing
at the first non-Option encountered. | [
"Breaks",
"<code",
">",
"token<",
"/",
"code",
">",
"into",
"its",
"constituent",
"parts",
"using",
"the",
"following",
"algorithm",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/PosixParser.java#L264-L293 |
calrissian/mango | mango-core/src/main/java/org/calrissian/mango/net/MoreInetAddresses.java | MoreInetAddresses.parseCIDR | public static CidrInfo parseCIDR(String cidr) {
requireNonNull(cidr);
try {
String[] parts = cidr.split("/");
checkArgument(parts.length == 2);
byte[] bytes = forString(parts[0]).getAddress();
int maskBits = parseInt(parts[1]);
checkArgument(maskBits >= 0 && maskBits <= bytes.length * 8);
int remainingBits = maskBits;
byte[] network = new byte[bytes.length];
byte[] broadcast = new byte[bytes.length];
for (int i = 0; i< bytes.length; i++) {
if (remainingBits >= 8) {
network[i] = bytes[i];
broadcast[i] = bytes[i];
} else if (remainingBits > 0) {
int byteMask = -1 << (8 - remainingBits);
network [i] = (byte) (bytes[i] & byteMask);
broadcast [i] = (byte) (bytes[i] | ~byteMask);
} else {
network[i] = 0;
broadcast[i] = (byte)0xff;
}
remainingBits -= 8;
}
return new CidrInfo(maskBits, bytesToInetAddress(network), bytesToInetAddress(broadcast));
}catch(Exception ignored){}
throw new IllegalArgumentException(format("Invalid CIDR string: %s", cidr));
} | java | public static CidrInfo parseCIDR(String cidr) {
requireNonNull(cidr);
try {
String[] parts = cidr.split("/");
checkArgument(parts.length == 2);
byte[] bytes = forString(parts[0]).getAddress();
int maskBits = parseInt(parts[1]);
checkArgument(maskBits >= 0 && maskBits <= bytes.length * 8);
int remainingBits = maskBits;
byte[] network = new byte[bytes.length];
byte[] broadcast = new byte[bytes.length];
for (int i = 0; i< bytes.length; i++) {
if (remainingBits >= 8) {
network[i] = bytes[i];
broadcast[i] = bytes[i];
} else if (remainingBits > 0) {
int byteMask = -1 << (8 - remainingBits);
network [i] = (byte) (bytes[i] & byteMask);
broadcast [i] = (byte) (bytes[i] | ~byteMask);
} else {
network[i] = 0;
broadcast[i] = (byte)0xff;
}
remainingBits -= 8;
}
return new CidrInfo(maskBits, bytesToInetAddress(network), bytesToInetAddress(broadcast));
}catch(Exception ignored){}
throw new IllegalArgumentException(format("Invalid CIDR string: %s", cidr));
} | [
"public",
"static",
"CidrInfo",
"parseCIDR",
"(",
"String",
"cidr",
")",
"{",
"requireNonNull",
"(",
"cidr",
")",
";",
"try",
"{",
"String",
"[",
"]",
"parts",
"=",
"cidr",
".",
"split",
"(",
"\"/\"",
")",
";",
"checkArgument",
"(",
"parts",
".",
"leng... | Examines a CIDR {@code 192.168.0.0/16} or {@code 1234::/16} string representation and calculates the network and
broadcast IP addresses for that subnet. This accepts both IPv4 and IPv6 representations of a CIDR and will return
the appropriate {@link InetAddress} classes for the provided value.
<p>Note: This supports IPv6 "IPv4 mapped" addresses and will create a valid Inet6Address to account for them. | [
"Examines",
"a",
"CIDR",
"{",
"@code",
"192",
".",
"168",
".",
"0",
".",
"0",
"/",
"16",
"}",
"or",
"{",
"@code",
"1234",
"::",
"/",
"16",
"}",
"string",
"representation",
"and",
"calculates",
"the",
"network",
"and",
"broadcast",
"IP",
"addresses",
... | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/net/MoreInetAddresses.java#L335-L368 |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/ChatService.java | ChatService.createSessionListener | public ParticipantListener createSessionListener(String sessionId, ISessionUpdate callback) {
return SessionService.create(self, sessionId, eventManager, callback);
} | java | public ParticipantListener createSessionListener(String sessionId, ISessionUpdate callback) {
return SessionService.create(self, sessionId, eventManager, callback);
} | [
"public",
"ParticipantListener",
"createSessionListener",
"(",
"String",
"sessionId",
",",
"ISessionUpdate",
"callback",
")",
"{",
"return",
"SessionService",
".",
"create",
"(",
"self",
",",
"sessionId",
",",
"eventManager",
",",
"callback",
")",
";",
"}"
] | Creates a session listener.
@param sessionId Chat session identifier.
@param callback The callback interface to invoke when a session update event has been
received.
@return The newly created session listener. | [
"Creates",
"a",
"session",
"listener",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/ChatService.java#L166-L168 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/triplet/RandomMatrices_DSTL.java | RandomMatrices_DSTL.uniform | public static DMatrixSparseTriplet uniform(int numRows , int numCols , int nz_total ,
double min , double max , Random rand ) {
// Create a list of all the possible element values
int N = numCols*numRows;
if( N < 0 )
throw new IllegalArgumentException("matrix size is too large");
nz_total = Math.min(N,nz_total);
int selected[] = new int[N];
for (int i = 0; i < N; i++) {
selected[i] = i;
}
for (int i = 0; i < nz_total; i++) {
int s = rand.nextInt(N);
int tmp = selected[s];
selected[s] = selected[i];
selected[i] = tmp;
}
// Create a sparse matrix
DMatrixSparseTriplet ret = new DMatrixSparseTriplet(numRows,numCols,nz_total);
for (int i = 0; i < nz_total; i++) {
int row = selected[i]/numCols;
int col = selected[i]%numCols;
double value = rand.nextDouble()*(max-min)+min;
ret.addItem(row,col, value);
}
return ret;
} | java | public static DMatrixSparseTriplet uniform(int numRows , int numCols , int nz_total ,
double min , double max , Random rand ) {
// Create a list of all the possible element values
int N = numCols*numRows;
if( N < 0 )
throw new IllegalArgumentException("matrix size is too large");
nz_total = Math.min(N,nz_total);
int selected[] = new int[N];
for (int i = 0; i < N; i++) {
selected[i] = i;
}
for (int i = 0; i < nz_total; i++) {
int s = rand.nextInt(N);
int tmp = selected[s];
selected[s] = selected[i];
selected[i] = tmp;
}
// Create a sparse matrix
DMatrixSparseTriplet ret = new DMatrixSparseTriplet(numRows,numCols,nz_total);
for (int i = 0; i < nz_total; i++) {
int row = selected[i]/numCols;
int col = selected[i]%numCols;
double value = rand.nextDouble()*(max-min)+min;
ret.addItem(row,col, value);
}
return ret;
} | [
"public",
"static",
"DMatrixSparseTriplet",
"uniform",
"(",
"int",
"numRows",
",",
"int",
"numCols",
",",
"int",
"nz_total",
",",
"double",
"min",
",",
"double",
"max",
",",
"Random",
"rand",
")",
"{",
"// Create a list of all the possible element values",
"int",
... | Randomly generates matrix with the specified number of matrix elements filled with values from min to max.
@param numRows Number of rows
@param numCols Number of columns
@param nz_total Total number of non-zero elements in the matrix
@param min Minimum value
@param max maximum value
@param rand Random number generated
@return Randomly generated matrix | [
"Randomly",
"generates",
"matrix",
"with",
"the",
"specified",
"number",
"of",
"matrix",
"elements",
"filled",
"with",
"values",
"from",
"min",
"to",
"max",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/triplet/RandomMatrices_DSTL.java#L40-L73 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/execution/impl/RuntimeStepExecution.java | RuntimeStepExecution.setCommittedMetrics | public void setCommittedMetrics() {
for (MetricImpl.MetricType metricType : this.tranCoordinatedMetricTypes) {
committedMetrics.put(metricType.name(), new MetricImpl(metricType, this.getMetric(metricType).getValue()));
}
} | java | public void setCommittedMetrics() {
for (MetricImpl.MetricType metricType : this.tranCoordinatedMetricTypes) {
committedMetrics.put(metricType.name(), new MetricImpl(metricType, this.getMetric(metricType).getValue()));
}
} | [
"public",
"void",
"setCommittedMetrics",
"(",
")",
"{",
"for",
"(",
"MetricImpl",
".",
"MetricType",
"metricType",
":",
"this",
".",
"tranCoordinatedMetricTypes",
")",
"{",
"committedMetrics",
".",
"put",
"(",
"metricType",
".",
"name",
"(",
")",
",",
"new",
... | Creates/Updates the committedMetrics variable using the passed in metric types | [
"Creates",
"/",
"Updates",
"the",
"committedMetrics",
"variable",
"using",
"the",
"passed",
"in",
"metric",
"types"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/execution/impl/RuntimeStepExecution.java#L137-L141 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.sadd | @Override
public Long sadd(final byte[] key, final byte[]... members) {
checkIsInMultiOrPipeline();
client.sadd(key, members);
return client.getIntegerReply();
} | java | @Override
public Long sadd(final byte[] key, final byte[]... members) {
checkIsInMultiOrPipeline();
client.sadd(key, members);
return client.getIntegerReply();
} | [
"@",
"Override",
"public",
"Long",
"sadd",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"...",
"members",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"sadd",
"(",
"key",
",",
"members",
")",
";",
"ret... | Add the specified member to the set value stored at key. If member is already a member of the
set no operation is performed. If key does not exist a new set with the specified member as
sole member is created. If the key exists but does not hold a set value an error is returned.
<p>
Time complexity O(1)
@param key
@param members
@return Integer reply, specifically: 1 if the new element was added 0 if the element was
already a member of the set | [
"Add",
"the",
"specified",
"member",
"to",
"the",
"set",
"value",
"stored",
"at",
"key",
".",
"If",
"member",
"is",
"already",
"a",
"member",
"of",
"the",
"set",
"no",
"operation",
"is",
"performed",
".",
"If",
"key",
"does",
"not",
"exist",
"a",
"new"... | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1383-L1388 |
dbracewell/hermes | hermes-core/src/main/java/com/davidbracewell/hermes/AnnotatorCache.java | AnnotatorCache.remove | public void remove(@NonNull AnnotationType annotationType, @NonNull Language language) {
cache.invalidate(createKey(annotationType, language));
} | java | public void remove(@NonNull AnnotationType annotationType, @NonNull Language language) {
cache.invalidate(createKey(annotationType, language));
} | [
"public",
"void",
"remove",
"(",
"@",
"NonNull",
"AnnotationType",
"annotationType",
",",
"@",
"NonNull",
"Language",
"language",
")",
"{",
"cache",
".",
"invalidate",
"(",
"createKey",
"(",
"annotationType",
",",
"language",
")",
")",
";",
"}"
] | Invalidates an item in the cache of
@param annotationType the annotation type
@param language The language | [
"Invalidates",
"an",
"item",
"in",
"the",
"cache",
"of"
] | train | https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/AnnotatorCache.java#L96-L98 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java | ParseUtil.convertSet | static Selector convertSet(Selector expr, List set) {
Selector ans = null;
for (int i = 0; i < set.size(); i++) {
Selector comparand = (Selector) set.get(i);
Selector comparison = new OperatorImpl(Operator.EQ, (Selector) expr.clone(), comparand);
if (ans == null)
ans = comparison;
else
ans = new OperatorImpl(Operator.OR, ans, comparison);
}
return ans;
} | java | static Selector convertSet(Selector expr, List set) {
Selector ans = null;
for (int i = 0; i < set.size(); i++) {
Selector comparand = (Selector) set.get(i);
Selector comparison = new OperatorImpl(Operator.EQ, (Selector) expr.clone(), comparand);
if (ans == null)
ans = comparison;
else
ans = new OperatorImpl(Operator.OR, ans, comparison);
}
return ans;
} | [
"static",
"Selector",
"convertSet",
"(",
"Selector",
"expr",
",",
"List",
"set",
")",
"{",
"Selector",
"ans",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"set",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Selector",
... | Convert a partially parsed set expression into its more primitive form as a
disjunction of equalities.
@param expr the expression whose set membership is being tested
@param set the set itself, as a FastVector containing Selector trees representing
expressions
@return a Selector representing the set expression its more primitive form | [
"Convert",
"a",
"partially",
"parsed",
"set",
"expression",
"into",
"its",
"more",
"primitive",
"form",
"as",
"a",
"disjunction",
"of",
"equalities",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java#L100-L111 |
santhosh-tekuri/jlibs | core/src/main/java/jlibs/core/lang/ref/Finalizer.java | Finalizer.trackGC | public void trackGC(Object obj, String message){
if(message==null)
message = obj.getClass().getName()+'@'+System.identityHashCode(obj);
track(obj, new MessagePrinter(message));
} | java | public void trackGC(Object obj, String message){
if(message==null)
message = obj.getClass().getName()+'@'+System.identityHashCode(obj);
track(obj, new MessagePrinter(message));
} | [
"public",
"void",
"trackGC",
"(",
"Object",
"obj",
",",
"String",
"message",
")",
"{",
"if",
"(",
"message",
"==",
"null",
")",
"message",
"=",
"obj",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"'",
"'",
"+",
"System",
".",
"identity... | Prints {@code message} to {@code System.out} when {@code obj} gets garbage collected
@param obj object needs to be tracked
@param message message to be printed when {@code obj} gets garbage collected.
if null, the message will be {@code obj.getClass().getName()+'@'+System.identityHashCode(obj)} | [
"Prints",
"{",
"@code",
"message",
"}",
"to",
"{",
"@code",
"System",
".",
"out",
"}",
"when",
"{",
"@code",
"obj",
"}",
"gets",
"garbage",
"collected"
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/ref/Finalizer.java#L164-L168 |
JohnPersano/SuperToasts | library/src/main/java/com/github/johnpersano/supertoasts/library/utils/ListenerUtils.java | ListenerUtils.putListener | public ListenerUtils putListener(String tag, SuperToast.OnDismissListener onDismissListener) {
this.mOnDismissListenerHashMap.put(tag, onDismissListener);
return this;
} | java | public ListenerUtils putListener(String tag, SuperToast.OnDismissListener onDismissListener) {
this.mOnDismissListenerHashMap.put(tag, onDismissListener);
return this;
} | [
"public",
"ListenerUtils",
"putListener",
"(",
"String",
"tag",
",",
"SuperToast",
".",
"OnDismissListener",
"onDismissListener",
")",
"{",
"this",
".",
"mOnDismissListenerHashMap",
".",
"put",
"(",
"tag",
",",
"onDismissListener",
")",
";",
"return",
"this",
";",... | Add either an {@link SuperToast.OnDismissListener}
or a {@link SuperActivityToast.OnButtonClickListener}
to a stored HashMap along with a String tag. This is used to reattach listeners to a
{@link SuperActivityToast} when recreated from an
orientation change.
@param tag A unique tag for the listener
@param onDismissListener The listener to be reattached
@return The current instance of the {@link ListenerUtils} | [
"Add",
"either",
"an",
"{",
"@link",
"SuperToast",
".",
"OnDismissListener",
"}",
"or",
"a",
"{",
"@link",
"SuperActivityToast",
".",
"OnButtonClickListener",
"}",
"to",
"a",
"stored",
"HashMap",
"along",
"with",
"a",
"String",
"tag",
".",
"This",
"is",
"use... | train | https://github.com/JohnPersano/SuperToasts/blob/5394db6a2f5c38410586d5d001d61f731da1132a/library/src/main/java/com/github/johnpersano/supertoasts/library/utils/ListenerUtils.java#L55-L58 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/TextCharacter.java | TextCharacter.withModifier | public TextCharacter withModifier(SGR modifier) {
if(modifiers.contains(modifier)) {
return this;
}
EnumSet<SGR> newSet = EnumSet.copyOf(this.modifiers);
newSet.add(modifier);
return new TextCharacter(character, foregroundColor, backgroundColor, newSet);
} | java | public TextCharacter withModifier(SGR modifier) {
if(modifiers.contains(modifier)) {
return this;
}
EnumSet<SGR> newSet = EnumSet.copyOf(this.modifiers);
newSet.add(modifier);
return new TextCharacter(character, foregroundColor, backgroundColor, newSet);
} | [
"public",
"TextCharacter",
"withModifier",
"(",
"SGR",
"modifier",
")",
"{",
"if",
"(",
"modifiers",
".",
"contains",
"(",
"modifier",
")",
")",
"{",
"return",
"this",
";",
"}",
"EnumSet",
"<",
"SGR",
">",
"newSet",
"=",
"EnumSet",
".",
"copyOf",
"(",
... | Returns a copy of this TextCharacter with an additional SGR modifier. All of the currently active SGR codes
will be carried over to the copy, in addition to the one specified.
@param modifier SGR modifiers the copy should have in additional to all currently present
@return Copy of the TextCharacter with a new SGR modifier | [
"Returns",
"a",
"copy",
"of",
"this",
"TextCharacter",
"with",
"an",
"additional",
"SGR",
"modifier",
".",
"All",
"of",
"the",
"currently",
"active",
"SGR",
"codes",
"will",
"be",
"carried",
"over",
"to",
"the",
"copy",
"in",
"addition",
"to",
"the",
"one"... | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TextCharacter.java#L264-L271 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.