repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.getPlan | public Plan getPlan(final String planCode) {
if (planCode == null || planCode.isEmpty())
throw new RuntimeException("planCode cannot be empty!");
return doGET(Plan.PLANS_RESOURCE + "/" + planCode, Plan.class);
} | java | public Plan getPlan(final String planCode) {
if (planCode == null || planCode.isEmpty())
throw new RuntimeException("planCode cannot be empty!");
return doGET(Plan.PLANS_RESOURCE + "/" + planCode, Plan.class);
} | [
"public",
"Plan",
"getPlan",
"(",
"final",
"String",
"planCode",
")",
"{",
"if",
"(",
"planCode",
"==",
"null",
"||",
"planCode",
".",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"planCode cannot be empty!\"",
")",
";",
"return",
"do... | Get a Plan's details
<p>
@param planCode recurly id of plan
@return the plan object as identified by the passed in ID | [
"Get",
"a",
"Plan",
"s",
"details",
"<p",
">"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1377-L1382 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/ui/groupeditor/CmsGroupContainerEditor.java | CmsGroupContainerEditor.openGroupcontainerEditor | public static CmsGroupContainerEditor openGroupcontainerEditor(
CmsGroupContainerElementPanel groupContainer,
CmsContainerpageController controller,
CmsContainerpageHandler handler) {
// making sure only a single instance of the group-container editor is open
if (INSTANCE != null) {
CmsDebugLog.getInstance().printLine("group-container editor already open");
} else {
CmsGroupContainerEditor editor = new CmsGroupContainerEditor(groupContainer, controller, handler);
RootPanel.get().add(editor);
editor.openDialog(Messages.get().key(Messages.GUI_GROUPCONTAINER_CAPTION_0));
editor.getGroupContainerWidget().refreshHighlighting();
INSTANCE = editor;
}
return INSTANCE;
} | java | public static CmsGroupContainerEditor openGroupcontainerEditor(
CmsGroupContainerElementPanel groupContainer,
CmsContainerpageController controller,
CmsContainerpageHandler handler) {
// making sure only a single instance of the group-container editor is open
if (INSTANCE != null) {
CmsDebugLog.getInstance().printLine("group-container editor already open");
} else {
CmsGroupContainerEditor editor = new CmsGroupContainerEditor(groupContainer, controller, handler);
RootPanel.get().add(editor);
editor.openDialog(Messages.get().key(Messages.GUI_GROUPCONTAINER_CAPTION_0));
editor.getGroupContainerWidget().refreshHighlighting();
INSTANCE = editor;
}
return INSTANCE;
} | [
"public",
"static",
"CmsGroupContainerEditor",
"openGroupcontainerEditor",
"(",
"CmsGroupContainerElementPanel",
"groupContainer",
",",
"CmsContainerpageController",
"controller",
",",
"CmsContainerpageHandler",
"handler",
")",
"{",
"// making sure only a single instance of the group-c... | Opens the group container editor.<p>
@param groupContainer the group container
@param controller the container page controller
@param handler the container page handler
@return the editor instance | [
"Opens",
"the",
"group",
"container",
"editor",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/groupeditor/CmsGroupContainerEditor.java#L134-L150 |
stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | SpiceService.createRequestProcessor | protected RequestProcessor createRequestProcessor(CacheManager cacheManager, RequestProgressManager requestProgressManager, RequestRunner requestRunner) {
return new RequestProcessor(cacheManager, requestProgressManager, requestRunner);
} | java | protected RequestProcessor createRequestProcessor(CacheManager cacheManager, RequestProgressManager requestProgressManager, RequestRunner requestRunner) {
return new RequestProcessor(cacheManager, requestProgressManager, requestRunner);
} | [
"protected",
"RequestProcessor",
"createRequestProcessor",
"(",
"CacheManager",
"cacheManager",
",",
"RequestProgressManager",
"requestProgressManager",
",",
"RequestRunner",
"requestRunner",
")",
"{",
"return",
"new",
"RequestProcessor",
"(",
"cacheManager",
",",
"requestPro... | Factory method to create an entity responsible for processing requests
send to the SpiceService. The default implementation of this method will
return a {@link RequestProcessor}. Override this method if you want to
inject a custom request processor. This feature has been implemented
following a request from Christopher Jenkins.
@param cacheManager
the cache manager used by this service.
@param requestProgressManager
will notify of requests progress.
@param requestRunner
executes requests.
@return a {@link RequestProcessor} that will be used to process requests. | [
"Factory",
"method",
"to",
"create",
"an",
"entity",
"responsible",
"for",
"processing",
"requests",
"send",
"to",
"the",
"SpiceService",
".",
"The",
"default",
"implementation",
"of",
"this",
"method",
"will",
"return",
"a",
"{"
] | train | https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java#L171-L173 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/ds/LDAP.java | LDAP.setupKerberosContext | @SuppressWarnings({ "rawtypes", "unchecked" })
protected DirContext setupKerberosContext(Hashtable<String,Object> env)
throws NamingException
{
LoginContext lc = null;
try
{
lc = new LoginContext(getClass().getName(), new JXCallbackHandler());
lc.login();
}
catch (LoginException ex)
{
throw new NamingException("login problem: " + ex);
}
DirContext ctx = (DirContext) Subject.doAs(lc.getSubject(), new JndiAction(env));
if (ctx == null)
throw new NamingException("another problem with GSSAPI");
else
return ctx;
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
protected DirContext setupKerberosContext(Hashtable<String,Object> env)
throws NamingException
{
LoginContext lc = null;
try
{
lc = new LoginContext(getClass().getName(), new JXCallbackHandler());
lc.login();
}
catch (LoginException ex)
{
throw new NamingException("login problem: " + ex);
}
DirContext ctx = (DirContext) Subject.doAs(lc.getSubject(), new JndiAction(env));
if (ctx == null)
throw new NamingException("another problem with GSSAPI");
else
return ctx;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"protected",
"DirContext",
"setupKerberosContext",
"(",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"env",
")",
"throws",
"NamingException",
"{",
"LoginContext",
"lc",
"=",
"n... | Initial LDAP for kerberos support
@param env
@throws NamingException | [
"Initial",
"LDAP",
"for",
"kerberos",
"support"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/ds/LDAP.java#L156-L181 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.plus | public static String plus(CharSequence left, Object value) {
return left + DefaultGroovyMethods.toString(value);
} | java | public static String plus(CharSequence left, Object value) {
return left + DefaultGroovyMethods.toString(value);
} | [
"public",
"static",
"String",
"plus",
"(",
"CharSequence",
"left",
",",
"Object",
"value",
")",
"{",
"return",
"left",
"+",
"DefaultGroovyMethods",
".",
"toString",
"(",
"value",
")",
";",
"}"
] | Appends the String representation of the given operand to this CharSequence.
@param left a CharSequence
@param value any Object
@return the original toString() of the CharSequence with the object appended
@since 1.8.2 | [
"Appends",
"the",
"String",
"representation",
"of",
"the",
"given",
"operand",
"to",
"this",
"CharSequence",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2325-L2327 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java | ParameterBuilder.storePropertiesParameter | private void storePropertiesParameter(final Map.Entry<Object, Object> entry) {
this.propertiesParametersMap.put(entry.getKey().toString(), new ParameterEntry(entry.getValue().toString()));
} | java | private void storePropertiesParameter(final Map.Entry<Object, Object> entry) {
this.propertiesParametersMap.put(entry.getKey().toString(), new ParameterEntry(entry.getValue().toString()));
} | [
"private",
"void",
"storePropertiesParameter",
"(",
"final",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
")",
"{",
"this",
".",
"propertiesParametersMap",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
".",
"toString",
"(",
")",
... | Store a parameter read from properties files.<br />
The parameter is wrapped into a parameterEntry
@param entry the entry to store | [
"Store",
"a",
"parameter",
"read",
"from",
"properties",
"files",
".",
"<br",
"/",
">",
"The",
"parameter",
"is",
"wrapped",
"into",
"a",
"parameterEntry"
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java#L151-L153 |
dnsjava/dnsjava | org/xbill/DNS/Message.java | Message.setTSIG | public void
setTSIG(TSIG key, int error, TSIGRecord querytsig) {
this.tsigkey = key;
this.tsigerror = error;
this.querytsig = querytsig;
} | java | public void
setTSIG(TSIG key, int error, TSIGRecord querytsig) {
this.tsigkey = key;
this.tsigerror = error;
this.querytsig = querytsig;
} | [
"public",
"void",
"setTSIG",
"(",
"TSIG",
"key",
",",
"int",
"error",
",",
"TSIGRecord",
"querytsig",
")",
"{",
"this",
".",
"tsigkey",
"=",
"key",
";",
"this",
".",
"tsigerror",
"=",
"error",
";",
"this",
".",
"querytsig",
"=",
"querytsig",
";",
"}"
] | Sets the TSIG key and other necessary information to sign a message.
@param key The TSIG key.
@param error The value of the TSIG error field.
@param querytsig If this is a response, the TSIG from the request. | [
"Sets",
"the",
"TSIG",
"key",
"and",
"other",
"necessary",
"information",
"to",
"sign",
"a",
"message",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L543-L548 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UPropertyAliases.java | UPropertyAliases.getPropertyValueEnumNoThrow | public int getPropertyValueEnumNoThrow(int property, CharSequence alias) {
int valueMapIndex=findProperty(property);
if(valueMapIndex==0) {
return UProperty.UNDEFINED;
}
valueMapIndex=valueMaps[valueMapIndex+1];
if(valueMapIndex==0) {
return UProperty.UNDEFINED;
}
// valueMapIndex is the start of the property's valueMap,
// where the first word is the BytesTrie offset.
return getPropertyOrValueEnum(valueMaps[valueMapIndex], alias);
} | java | public int getPropertyValueEnumNoThrow(int property, CharSequence alias) {
int valueMapIndex=findProperty(property);
if(valueMapIndex==0) {
return UProperty.UNDEFINED;
}
valueMapIndex=valueMaps[valueMapIndex+1];
if(valueMapIndex==0) {
return UProperty.UNDEFINED;
}
// valueMapIndex is the start of the property's valueMap,
// where the first word is the BytesTrie offset.
return getPropertyOrValueEnum(valueMaps[valueMapIndex], alias);
} | [
"public",
"int",
"getPropertyValueEnumNoThrow",
"(",
"int",
"property",
",",
"CharSequence",
"alias",
")",
"{",
"int",
"valueMapIndex",
"=",
"findProperty",
"(",
"property",
")",
";",
"if",
"(",
"valueMapIndex",
"==",
"0",
")",
"{",
"return",
"UProperty",
".",... | Returns a value enum given a property enum and one of its value names. Does not throw.
@return value enum, or UProperty.UNDEFINED if not defined for that property | [
"Returns",
"a",
"value",
"enum",
"given",
"a",
"property",
"enum",
"and",
"one",
"of",
"its",
"value",
"names",
".",
"Does",
"not",
"throw",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UPropertyAliases.java#L314-L326 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.getAccessControlList | public CmsAccessControlList getAccessControlList(CmsDbContext dbc, CmsResource resource) throws CmsException {
return getAccessControlList(dbc, resource, false);
} | java | public CmsAccessControlList getAccessControlList(CmsDbContext dbc, CmsResource resource) throws CmsException {
return getAccessControlList(dbc, resource, false);
} | [
"public",
"CmsAccessControlList",
"getAccessControlList",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"return",
"getAccessControlList",
"(",
"dbc",
",",
"resource",
",",
"false",
")",
";",
"}"
] | Returns the full access control list of a given resource.<p>
@param dbc the current database context
@param resource the resource
@return the access control list of the resource
@throws CmsException if something goes wrong | [
"Returns",
"the",
"full",
"access",
"control",
"list",
"of",
"a",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L3459-L3462 |
glookast/commons-timecode | src/main/java/com/glookast/commons/timecode/MutableTimecode.java | MutableTimecode.valueOf | public static MutableTimecode valueOf(String timecode, int timecodeBase) throws IllegalArgumentException
{
return valueOf(timecode, timecodeBase, StringType.NORMAL);
} | java | public static MutableTimecode valueOf(String timecode, int timecodeBase) throws IllegalArgumentException
{
return valueOf(timecode, timecodeBase, StringType.NORMAL);
} | [
"public",
"static",
"MutableTimecode",
"valueOf",
"(",
"String",
"timecode",
",",
"int",
"timecodeBase",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"valueOf",
"(",
"timecode",
",",
"timecodeBase",
",",
"StringType",
".",
"NORMAL",
")",
";",
"}"
] | Returns a Timecode instance for given timecode string and timecode base. Acceptable inputs are
the normal representation HH:MM:SS:FF for non drop frame and HH:MM:SS:FF for drop frame
@param timecode
@param timecodeBase
@return the timecode
@throws IllegalArgumentException | [
"Returns",
"a",
"Timecode",
"instance",
"for",
"given",
"timecode",
"string",
"and",
"timecode",
"base",
".",
"Acceptable",
"inputs",
"are",
"the",
"normal",
"representation",
"HH",
":",
"MM",
":",
"SS",
":",
"FF",
"for",
"non",
"drop",
"frame",
"and",
"HH... | train | https://github.com/glookast/commons-timecode/blob/ec2f682a51d1cc435d0b42d80de48ff15adb4ee8/src/main/java/com/glookast/commons/timecode/MutableTimecode.java#L73-L76 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.replaceColumnsAndStripLastChar | private StringBuilder replaceColumnsAndStripLastChar(String columnFamilyQuery, StringBuilder queryBuilder)
{
// strip last ",".
if (queryBuilder.length() > 0)
{
queryBuilder.deleteCharAt(queryBuilder.length() - 1);
columnFamilyQuery = StringUtils.replace(columnFamilyQuery, CQLTranslator.COLUMNS, queryBuilder.toString());
queryBuilder = new StringBuilder(columnFamilyQuery);
}
return queryBuilder;
} | java | private StringBuilder replaceColumnsAndStripLastChar(String columnFamilyQuery, StringBuilder queryBuilder)
{
// strip last ",".
if (queryBuilder.length() > 0)
{
queryBuilder.deleteCharAt(queryBuilder.length() - 1);
columnFamilyQuery = StringUtils.replace(columnFamilyQuery, CQLTranslator.COLUMNS, queryBuilder.toString());
queryBuilder = new StringBuilder(columnFamilyQuery);
}
return queryBuilder;
} | [
"private",
"StringBuilder",
"replaceColumnsAndStripLastChar",
"(",
"String",
"columnFamilyQuery",
",",
"StringBuilder",
"queryBuilder",
")",
"{",
"// strip last \",\".",
"if",
"(",
"queryBuilder",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"queryBuilder",
".",
"de... | Strip last char.
@param columnFamilyQuery
the column family query
@param queryBuilder
the query builder
@return the string builder | [
"Strip",
"last",
"char",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L1345-L1356 |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java | Resources.getInteger | public int getInteger( String key, int defaultValue )
throws MissingResourceException
{
try
{
return getInteger( key );
}
catch( MissingResourceException mre )
{
return defaultValue;
}
} | java | public int getInteger( String key, int defaultValue )
throws MissingResourceException
{
try
{
return getInteger( key );
}
catch( MissingResourceException mre )
{
return defaultValue;
}
} | [
"public",
"int",
"getInteger",
"(",
"String",
"key",
",",
"int",
"defaultValue",
")",
"throws",
"MissingResourceException",
"{",
"try",
"{",
"return",
"getInteger",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"mre",
")",
"{",
"return",... | Retrieve a integer from bundle.
@param key the key of resource
@param defaultValue the default value if key is missing
@return the resource integer
@throws MissingResourceException if the requested key is unknown | [
"Retrieve",
"a",
"integer",
"from",
"bundle",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L327-L338 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/utils/ExtractionUtil.java | ExtractionUtil.extractFiles | public static void extractFiles(File archive, File extractTo) throws ExtractionException {
extractFiles(archive, extractTo, null);
} | java | public static void extractFiles(File archive, File extractTo) throws ExtractionException {
extractFiles(archive, extractTo, null);
} | [
"public",
"static",
"void",
"extractFiles",
"(",
"File",
"archive",
",",
"File",
"extractTo",
")",
"throws",
"ExtractionException",
"{",
"extractFiles",
"(",
"archive",
",",
"extractTo",
",",
"null",
")",
";",
"}"
] | Extracts the contents of an archive into the specified directory.
@param archive an archive file such as a WAR or EAR
@param extractTo a directory to extract the contents to
@throws ExtractionException thrown if an exception occurs while
extracting the files | [
"Extracts",
"the",
"contents",
"of",
"an",
"archive",
"into",
"the",
"specified",
"directory",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/ExtractionUtil.java#L70-L72 |
Erudika/para | para-server/src/main/java/com/erudika/para/security/SimpleRequestCache.java | SimpleRequestCache.saveRequest | @Override
public void saveRequest(HttpServletRequest request, HttpServletResponse response) {
if (anyRequestMatcher.matches(request) && !ajaxRequestMatcher.matches(request)) {
DefaultSavedRequest savedRequest = new DefaultSavedRequest(request, portResolver);
HttpUtils.setStateParam(Config.RETURNTO_COOKIE,
Utils.base64enc(savedRequest.getRedirectUrl().getBytes()), request, response);
}
} | java | @Override
public void saveRequest(HttpServletRequest request, HttpServletResponse response) {
if (anyRequestMatcher.matches(request) && !ajaxRequestMatcher.matches(request)) {
DefaultSavedRequest savedRequest = new DefaultSavedRequest(request, portResolver);
HttpUtils.setStateParam(Config.RETURNTO_COOKIE,
Utils.base64enc(savedRequest.getRedirectUrl().getBytes()), request, response);
}
} | [
"@",
"Override",
"public",
"void",
"saveRequest",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"{",
"if",
"(",
"anyRequestMatcher",
".",
"matches",
"(",
"request",
")",
"&&",
"!",
"ajaxRequestMatcher",
".",
"matches",
"(",
"... | Saves a request in cache.
@param request HTTP request
@param response HTTP response | [
"Saves",
"a",
"request",
"in",
"cache",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/SimpleRequestCache.java#L48-L55 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java | FactoryKernelGaussian.gaussian1D_F32 | protected static Kernel1D_F32 gaussian1D_F32(double sigma, int radius, boolean odd, boolean normalize) {
Kernel1D_F32 ret;
if( odd ) {
ret = new Kernel1D_F32(radius * 2 + 1);
int index = 0;
for (int i = radius; i >= -radius; i--) {
ret.data[index++] = (float) UtilGaussian.computePDF(0, sigma, i);
}
} else {
ret = new Kernel1D_F32(radius * 2);
int index = 0;
for (int i = radius; i > -radius; i--) {
ret.data[index++] = (float) UtilGaussian.computePDF(0, sigma, i-0.5);
}
}
if (normalize) {
KernelMath.normalizeSumToOne(ret);
}
return ret;
} | java | protected static Kernel1D_F32 gaussian1D_F32(double sigma, int radius, boolean odd, boolean normalize) {
Kernel1D_F32 ret;
if( odd ) {
ret = new Kernel1D_F32(radius * 2 + 1);
int index = 0;
for (int i = radius; i >= -radius; i--) {
ret.data[index++] = (float) UtilGaussian.computePDF(0, sigma, i);
}
} else {
ret = new Kernel1D_F32(radius * 2);
int index = 0;
for (int i = radius; i > -radius; i--) {
ret.data[index++] = (float) UtilGaussian.computePDF(0, sigma, i-0.5);
}
}
if (normalize) {
KernelMath.normalizeSumToOne(ret);
}
return ret;
} | [
"protected",
"static",
"Kernel1D_F32",
"gaussian1D_F32",
"(",
"double",
"sigma",
",",
"int",
"radius",
",",
"boolean",
"odd",
",",
"boolean",
"normalize",
")",
"{",
"Kernel1D_F32",
"ret",
";",
"if",
"(",
"odd",
")",
"{",
"ret",
"=",
"new",
"Kernel1D_F32",
... | <p>
Creates a floating point Gaussian kernel with the sigma and radius.
If normalized is set to true then the elements in the kernel will sum up to one.
</p>
@param sigma Distributions standard deviation.
@param radius Kernel's radius.
@param odd Does the kernel have an even or add width
@param normalize If the kernel should be normalized to one or not. | [
"<p",
">",
"Creates",
"a",
"floating",
"point",
"Gaussian",
"kernel",
"with",
"the",
"sigma",
"and",
"radius",
".",
"If",
"normalized",
"is",
"set",
"to",
"true",
"then",
"the",
"elements",
"in",
"the",
"kernel",
"will",
"sum",
"up",
"to",
"one",
".",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L218-L238 |
dnsjava/dnsjava | org/xbill/DNS/TSIG.java | TSIG.apply | public void
apply(Message m, int error, TSIGRecord old) {
Record r = generate(m, m.toWire(), error, old);
m.addRecord(r, Section.ADDITIONAL);
m.tsigState = Message.TSIG_SIGNED;
} | java | public void
apply(Message m, int error, TSIGRecord old) {
Record r = generate(m, m.toWire(), error, old);
m.addRecord(r, Section.ADDITIONAL);
m.tsigState = Message.TSIG_SIGNED;
} | [
"public",
"void",
"apply",
"(",
"Message",
"m",
",",
"int",
"error",
",",
"TSIGRecord",
"old",
")",
"{",
"Record",
"r",
"=",
"generate",
"(",
"m",
",",
"m",
".",
"toWire",
"(",
")",
",",
"error",
",",
"old",
")",
";",
"m",
".",
"addRecord",
"(",
... | Generates a TSIG record with a specific error for a message and adds it
to the message.
@param m The message
@param error The error
@param old If this message is a response, the TSIG from the request | [
"Generates",
"a",
"TSIG",
"record",
"with",
"a",
"specific",
"error",
"for",
"a",
"message",
"and",
"adds",
"it",
"to",
"the",
"message",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/TSIG.java#L350-L355 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.rotateZYX | public Matrix4x3d rotateZYX(Vector3d angles) {
return rotateZYX(angles.z, angles.y, angles.x);
} | java | public Matrix4x3d rotateZYX(Vector3d angles) {
return rotateZYX(angles.z, angles.y, angles.x);
} | [
"public",
"Matrix4x3d",
"rotateZYX",
"(",
"Vector3d",
"angles",
")",
"{",
"return",
"rotateZYX",
"(",
"angles",
".",
"z",
",",
"angles",
".",
"y",
",",
"angles",
".",
"x",
")",
";",
"}"
] | Apply rotation of <code>angles.z</code> radians about the Z axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and
followed by a rotation of <code>angles.x</code> radians about the X axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateZ(angles.z).rotateY(angles.y).rotateX(angles.x)</code>
@param angles
the Euler angles
@return this | [
"Apply",
"rotation",
"of",
"<code",
">",
"angles",
".",
"z<",
"/",
"code",
">",
"radians",
"about",
"the",
"Z",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"y<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axi... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L4484-L4486 |
canoo/open-dolphin | subprojects/shared/src/main/groovy/org/opendolphin/core/BasePresentationModel.java | BasePresentationModel.getValue | public int getValue(String attributeName, int defaultValue) {
A attribute = getAt(attributeName);
Object attributeValue = (attribute == null) ? null : attribute.getValue();
return (attributeValue == null) ? defaultValue : Integer.parseInt(attributeValue.toString());
} | java | public int getValue(String attributeName, int defaultValue) {
A attribute = getAt(attributeName);
Object attributeValue = (attribute == null) ? null : attribute.getValue();
return (attributeValue == null) ? defaultValue : Integer.parseInt(attributeValue.toString());
} | [
"public",
"int",
"getValue",
"(",
"String",
"attributeName",
",",
"int",
"defaultValue",
")",
"{",
"A",
"attribute",
"=",
"getAt",
"(",
"attributeName",
")",
";",
"Object",
"attributeValue",
"=",
"(",
"attribute",
"==",
"null",
")",
"?",
"null",
":",
"attr... | Convenience method to get the value of an attribute if it exists or a default value otherwise. | [
"Convenience",
"method",
"to",
"get",
"the",
"value",
"of",
"an",
"attribute",
"if",
"it",
"exists",
"or",
"a",
"default",
"value",
"otherwise",
"."
] | train | https://github.com/canoo/open-dolphin/blob/50166defc3ef2de473d7a7246c32dc04304d80ef/subprojects/shared/src/main/groovy/org/opendolphin/core/BasePresentationModel.java#L126-L130 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/JobManager.java | JobManager.main | public static void main(String[] args) {
// determine if a valid log4j config exists and initialize a default logger if not
if (System.getProperty("log4j.configuration") == null) {
Logger root = Logger.getRootLogger();
root.removeAllAppenders();
PatternLayout layout = new PatternLayout("%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n");
ConsoleAppender appender = new ConsoleAppender(layout, "System.err");
root.addAppender(appender);
root.setLevel(Level.INFO);
}
JobManager jobManager;
try {
jobManager = initialize(args);
// Start info server for jobmanager
jobManager.startInfoServer();
}
catch (Exception e) {
LOG.fatal(e.getMessage(), e);
System.exit(FAILURE_RETURN_CODE);
}
// Clean up is triggered through a shutdown hook
// freeze this thread to keep the JVM alive (the job manager threads are daemon threads)
Object w = new Object();
synchronized (w) {
try {
w.wait();
} catch (InterruptedException e) {}
}
} | java | public static void main(String[] args) {
// determine if a valid log4j config exists and initialize a default logger if not
if (System.getProperty("log4j.configuration") == null) {
Logger root = Logger.getRootLogger();
root.removeAllAppenders();
PatternLayout layout = new PatternLayout("%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n");
ConsoleAppender appender = new ConsoleAppender(layout, "System.err");
root.addAppender(appender);
root.setLevel(Level.INFO);
}
JobManager jobManager;
try {
jobManager = initialize(args);
// Start info server for jobmanager
jobManager.startInfoServer();
}
catch (Exception e) {
LOG.fatal(e.getMessage(), e);
System.exit(FAILURE_RETURN_CODE);
}
// Clean up is triggered through a shutdown hook
// freeze this thread to keep the JVM alive (the job manager threads are daemon threads)
Object w = new Object();
synchronized (w) {
try {
w.wait();
} catch (InterruptedException e) {}
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// determine if a valid log4j config exists and initialize a default logger if not",
"if",
"(",
"System",
".",
"getProperty",
"(",
"\"log4j.configuration\"",
")",
"==",
"null",
")",
"{",
"... | Entry point for the program
@param args
arguments from the command line | [
"Entry",
"point",
"for",
"the",
"program"
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/JobManager.java#L332-L362 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java | VCard.setAvatar | public void setAvatar(byte[] bytes, String mimeType) {
// If bytes is null, remove the avatar
if (bytes == null) {
removeAvatar();
return;
}
// Otherwise, add to mappings.
String encodedImage = Base64.encodeToString(bytes);
setAvatar(encodedImage, mimeType);
} | java | public void setAvatar(byte[] bytes, String mimeType) {
// If bytes is null, remove the avatar
if (bytes == null) {
removeAvatar();
return;
}
// Otherwise, add to mappings.
String encodedImage = Base64.encodeToString(bytes);
setAvatar(encodedImage, mimeType);
} | [
"public",
"void",
"setAvatar",
"(",
"byte",
"[",
"]",
"bytes",
",",
"String",
"mimeType",
")",
"{",
"// If bytes is null, remove the avatar",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"removeAvatar",
"(",
")",
";",
"return",
";",
"}",
"// Otherwise, add to m... | Specify the bytes for the avatar to use as well as the mime type.
@param bytes the bytes of the avatar.
@param mimeType the mime type of the avatar. | [
"Specify",
"the",
"bytes",
"for",
"the",
"avatar",
"to",
"use",
"as",
"well",
"as",
"the",
"mime",
"type",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java#L402-L413 |
apiman/apiman | manager/api/core/src/main/java/io/apiman/manager/api/core/metrics/AbstractMetricsAccessor.java | AbstractMetricsAccessor.generateHistogramSkeleton | public static <T extends HistogramDataPoint> Map<String, T> generateHistogramSkeleton(HistogramBean<T> rval, DateTime from, DateTime to,
HistogramIntervalType interval, Class<T> dataType) {
return generateHistogramSkeleton(rval, from, to, interval, dataType, String.class);
} | java | public static <T extends HistogramDataPoint> Map<String, T> generateHistogramSkeleton(HistogramBean<T> rval, DateTime from, DateTime to,
HistogramIntervalType interval, Class<T> dataType) {
return generateHistogramSkeleton(rval, from, to, interval, dataType, String.class);
} | [
"public",
"static",
"<",
"T",
"extends",
"HistogramDataPoint",
">",
"Map",
"<",
"String",
",",
"T",
">",
"generateHistogramSkeleton",
"(",
"HistogramBean",
"<",
"T",
">",
"rval",
",",
"DateTime",
"from",
",",
"DateTime",
"to",
",",
"HistogramIntervalType",
"in... | Shortcut for the label (string) based histogram index.
@param rval
@param from
@param to
@param interval
@param dataType | [
"Shortcut",
"for",
"the",
"label",
"(",
"string",
")",
"based",
"histogram",
"index",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/core/src/main/java/io/apiman/manager/api/core/metrics/AbstractMetricsAccessor.java#L106-L109 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.writeXML | public static void writeXML(Document xmldocument, Writer writer) throws IOException {
assert xmldocument != null : AssertMessages.notNullParameter(0);
assert writer != null : AssertMessages.notNullParameter(1);
writeNode(xmldocument, writer);
} | java | public static void writeXML(Document xmldocument, Writer writer) throws IOException {
assert xmldocument != null : AssertMessages.notNullParameter(0);
assert writer != null : AssertMessages.notNullParameter(1);
writeNode(xmldocument, writer);
} | [
"public",
"static",
"void",
"writeXML",
"(",
"Document",
"xmldocument",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"assert",
"xmldocument",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";",
"assert",
"writer",
"... | Write the given node tree into a XML file.
@param xmldocument is the object that contains the node tree
@param writer is the target stream
@throws IOException if the stream cannot be read. | [
"Write",
"the",
"given",
"node",
"tree",
"into",
"a",
"XML",
"file",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2390-L2394 |
zaproxy/zaproxy | src/org/parosproxy/paros/extension/history/ExtensionHistory.java | ExtensionHistory.showAlertAddDialog | @Deprecated
public void showAlertAddDialog(HttpMessage httpMessage, int historyType) {
ExtensionAlert extAlert = Control.getSingleton().getExtensionLoader().getExtension(ExtensionAlert.class);
if (extAlert == null) {
return;
}
extAlert.showAlertAddDialog(httpMessage, historyType);
} | java | @Deprecated
public void showAlertAddDialog(HttpMessage httpMessage, int historyType) {
ExtensionAlert extAlert = Control.getSingleton().getExtensionLoader().getExtension(ExtensionAlert.class);
if (extAlert == null) {
return;
}
extAlert.showAlertAddDialog(httpMessage, historyType);
} | [
"@",
"Deprecated",
"public",
"void",
"showAlertAddDialog",
"(",
"HttpMessage",
"httpMessage",
",",
"int",
"historyType",
")",
"{",
"ExtensionAlert",
"extAlert",
"=",
"Control",
".",
"getSingleton",
"(",
")",
".",
"getExtensionLoader",
"(",
")",
".",
"getExtension"... | Sets the {@code HttpMessage} and the history type of the
{@code HistoryReference} that will be created if the user creates the
alert. The current session will be used to create the
{@code HistoryReference}. The alert created will be added to the newly
created {@code HistoryReference}.
<p>
Should be used when the alert is added to a temporary
{@code HistoryReference} as the temporary {@code HistoryReference}s are
deleted when the session is closed.
</p>
@deprecated (2.7.0) Use {@link ExtensionAlert#showAlertAddDialog(HttpMessage, int)} instead.
@param httpMessage
the {@code HttpMessage} that will be used to create the
{@code HistoryReference}, must not be {@code null}
@param historyType
the type of the history reference that will be used to create
the {@code HistoryReference}
@see Model#getSession()
@see HistoryReference#HistoryReference(org.parosproxy.paros.model.Session,
int, HttpMessage) | [
"Sets",
"the",
"{",
"@code",
"HttpMessage",
"}",
"and",
"the",
"history",
"type",
"of",
"the",
"{",
"@code",
"HistoryReference",
"}",
"that",
"will",
"be",
"created",
"if",
"the",
"user",
"creates",
"the",
"alert",
".",
"The",
"current",
"session",
"will",... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/extension/history/ExtensionHistory.java#L677-L684 |
arquillian/arquillian-cube | docker/docker/src/main/java/org/arquillian/cube/docker/impl/docker/DockerClientExecutor.java | DockerClientExecutor.execStartVerbose | public ExecInspection execStartVerbose(String containerId, String... commands) {
this.readWriteLock.readLock().lock();
try {
String id = execCreate(containerId, commands);
CubeOutput output = execStartOutput(id);
return new ExecInspection(output, inspectExec(id));
} finally {
this.readWriteLock.readLock().unlock();
}
} | java | public ExecInspection execStartVerbose(String containerId, String... commands) {
this.readWriteLock.readLock().lock();
try {
String id = execCreate(containerId, commands);
CubeOutput output = execStartOutput(id);
return new ExecInspection(output, inspectExec(id));
} finally {
this.readWriteLock.readLock().unlock();
}
} | [
"public",
"ExecInspection",
"execStartVerbose",
"(",
"String",
"containerId",
",",
"String",
"...",
"commands",
")",
"{",
"this",
".",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"String",
"id",
"=",
"execCreate",
"(... | EXecutes command to given container returning the inspection object as well. This method does 3 calls to
dockerhost. Create, Start and Inspect.
@param containerId
to execute command. | [
"EXecutes",
"command",
"to",
"given",
"container",
"returning",
"the",
"inspection",
"object",
"as",
"well",
".",
"This",
"method",
"does",
"3",
"calls",
"to",
"dockerhost",
".",
"Create",
"Start",
"and",
"Inspect",
"."
] | train | https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/docker/docker/src/main/java/org/arquillian/cube/docker/impl/docker/DockerClientExecutor.java#L928-L938 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createRecordTypeFromNodes | private JSType createRecordTypeFromNodes(Node n, String sourceName, StaticTypedScope scope) {
RecordTypeBuilder builder = new RecordTypeBuilder(this);
// For each of the fields in the record type.
for (Node fieldTypeNode = n.getFirstChild();
fieldTypeNode != null;
fieldTypeNode = fieldTypeNode.getNext()) {
// Get the property's name.
Node fieldNameNode = fieldTypeNode;
boolean hasType = false;
if (fieldTypeNode.getToken() == Token.COLON) {
fieldNameNode = fieldTypeNode.getFirstChild();
hasType = true;
}
String fieldName = fieldNameNode.getString();
// TODO(user): Move this into the lexer/parser.
// Remove the string literal characters around a field name,
// if any.
if (fieldName.startsWith("'") || fieldName.startsWith("\"")) {
fieldName = fieldName.substring(1, fieldName.length() - 1);
}
// Get the property's type.
JSType fieldType = null;
if (hasType) {
// We have a declared type.
fieldType = createFromTypeNodesInternal(
fieldTypeNode.getLastChild(), sourceName, scope, true);
} else {
// Otherwise, the type is UNKNOWN.
fieldType = getNativeType(JSTypeNative.UNKNOWN_TYPE);
}
builder.addProperty(fieldName, fieldType, fieldNameNode);
}
return builder.build();
} | java | private JSType createRecordTypeFromNodes(Node n, String sourceName, StaticTypedScope scope) {
RecordTypeBuilder builder = new RecordTypeBuilder(this);
// For each of the fields in the record type.
for (Node fieldTypeNode = n.getFirstChild();
fieldTypeNode != null;
fieldTypeNode = fieldTypeNode.getNext()) {
// Get the property's name.
Node fieldNameNode = fieldTypeNode;
boolean hasType = false;
if (fieldTypeNode.getToken() == Token.COLON) {
fieldNameNode = fieldTypeNode.getFirstChild();
hasType = true;
}
String fieldName = fieldNameNode.getString();
// TODO(user): Move this into the lexer/parser.
// Remove the string literal characters around a field name,
// if any.
if (fieldName.startsWith("'") || fieldName.startsWith("\"")) {
fieldName = fieldName.substring(1, fieldName.length() - 1);
}
// Get the property's type.
JSType fieldType = null;
if (hasType) {
// We have a declared type.
fieldType = createFromTypeNodesInternal(
fieldTypeNode.getLastChild(), sourceName, scope, true);
} else {
// Otherwise, the type is UNKNOWN.
fieldType = getNativeType(JSTypeNative.UNKNOWN_TYPE);
}
builder.addProperty(fieldName, fieldType, fieldNameNode);
}
return builder.build();
} | [
"private",
"JSType",
"createRecordTypeFromNodes",
"(",
"Node",
"n",
",",
"String",
"sourceName",
",",
"StaticTypedScope",
"scope",
")",
"{",
"RecordTypeBuilder",
"builder",
"=",
"new",
"RecordTypeBuilder",
"(",
"this",
")",
";",
"// For each of the fields in the record ... | Creates a RecordType from the nodes representing said record type.
@param n The node with type info.
@param sourceName The source file name.
@param scope A scope for doing type name lookups. | [
"Creates",
"a",
"RecordType",
"from",
"the",
"nodes",
"representing",
"said",
"record",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L2208-L2251 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/MatchPatternIterator.java | MatchPatternIterator.setRoot | public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
m_traverser = m_cdtm.getAxisTraverser(m_superAxis);
} | java | public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
m_traverser = m_cdtm.getAxisTraverser(m_superAxis);
} | [
"public",
"void",
"setRoot",
"(",
"int",
"context",
",",
"Object",
"environment",
")",
"{",
"super",
".",
"setRoot",
"(",
"context",
",",
"environment",
")",
";",
"m_traverser",
"=",
"m_cdtm",
".",
"getAxisTraverser",
"(",
"m_superAxis",
")",
";",
"}"
] | Initialize the context values for this expression
after it is cloned.
@param context The XPath runtime context for this
transformation. | [
"Initialize",
"the",
"context",
"values",
"for",
"this",
"expression",
"after",
"it",
"is",
"cloned",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/MatchPatternIterator.java#L160-L164 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java | CopyManager.copyIn | public long copyIn(final String sql, Reader from, int bufferSize)
throws SQLException, IOException {
char[] cbuf = new char[bufferSize];
int len;
CopyIn cp = copyIn(sql);
try {
while ((len = from.read(cbuf)) >= 0) {
if (len > 0) {
byte[] buf = encoding.encode(new String(cbuf, 0, len));
cp.writeToCopy(buf, 0, buf.length);
}
}
return cp.endCopy();
} finally { // see to it that we do not leave the connection locked
if (cp.isActive()) {
cp.cancelCopy();
}
}
} | java | public long copyIn(final String sql, Reader from, int bufferSize)
throws SQLException, IOException {
char[] cbuf = new char[bufferSize];
int len;
CopyIn cp = copyIn(sql);
try {
while ((len = from.read(cbuf)) >= 0) {
if (len > 0) {
byte[] buf = encoding.encode(new String(cbuf, 0, len));
cp.writeToCopy(buf, 0, buf.length);
}
}
return cp.endCopy();
} finally { // see to it that we do not leave the connection locked
if (cp.isActive()) {
cp.cancelCopy();
}
}
} | [
"public",
"long",
"copyIn",
"(",
"final",
"String",
"sql",
",",
"Reader",
"from",
",",
"int",
"bufferSize",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"char",
"[",
"]",
"cbuf",
"=",
"new",
"char",
"[",
"bufferSize",
"]",
";",
"int",
"len",
... | Use COPY FROM STDIN for very fast copying from a Reader into a database table.
@param sql COPY FROM STDIN statement
@param from a CSV file or such
@param bufferSize number of characters to buffer and push over network to server at once
@return number of rows updated for server 8.2 or newer; -1 for older
@throws SQLException on database usage issues
@throws IOException upon reader or database connection failure | [
"Use",
"COPY",
"FROM",
"STDIN",
"for",
"very",
"fast",
"copying",
"from",
"a",
"Reader",
"into",
"a",
"database",
"table",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java#L169-L187 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kraken/query/NotifyQuery.java | NotifyQuery.exec | @Override
public void exec(Result<Object> result, Object[] args)
{
TableKelp tableKelp = _table.getTableKelp();
RowCursor minCursor = tableKelp.cursor();
RowCursor maxCursor = tableKelp.cursor();
minCursor.clear();
maxCursor.setKeyMax();
_whereKraken.fillMinCursor(minCursor, args);
_whereKraken.fillMaxCursor(minCursor, args);
//QueryKelp whereKelp = _whereExpr.bind(args);
// XXX: binding should be with unique
EnvKelp whereKelp = new EnvKelp(_whereKelp, args);
//tableKelp.findOne(minCursor, maxCursor, whereKelp,
// new FindDeleteResult(result));
_table.notifyOwner(minCursor.getKey());
// result.completed(null);
result.ok(null);
} | java | @Override
public void exec(Result<Object> result, Object[] args)
{
TableKelp tableKelp = _table.getTableKelp();
RowCursor minCursor = tableKelp.cursor();
RowCursor maxCursor = tableKelp.cursor();
minCursor.clear();
maxCursor.setKeyMax();
_whereKraken.fillMinCursor(minCursor, args);
_whereKraken.fillMaxCursor(minCursor, args);
//QueryKelp whereKelp = _whereExpr.bind(args);
// XXX: binding should be with unique
EnvKelp whereKelp = new EnvKelp(_whereKelp, args);
//tableKelp.findOne(minCursor, maxCursor, whereKelp,
// new FindDeleteResult(result));
_table.notifyOwner(minCursor.getKey());
// result.completed(null);
result.ok(null);
} | [
"@",
"Override",
"public",
"void",
"exec",
"(",
"Result",
"<",
"Object",
">",
"result",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"TableKelp",
"tableKelp",
"=",
"_table",
".",
"getTableKelp",
"(",
")",
";",
"RowCursor",
"minCursor",
"=",
"tableKelp",
".... | /*
@Override
public int partitionHash(Object[] args)
{
if (_keyExpr == null) {
return -1;
}
return _keyExpr.partitionHash(args);
} | [
"/",
"*",
"@Override",
"public",
"int",
"partitionHash",
"(",
"Object",
"[]",
"args",
")",
"{",
"if",
"(",
"_keyExpr",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}"
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kraken/query/NotifyQuery.java#L89-L115 |
mpetazzoni/ttorrent | ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java | CommunicationManager.addTorrent | public TorrentManager addTorrent(String dotTorrentFilePath,
String downloadDirPath,
PieceStorageFactory pieceStorageFactory,
List<TorrentListener> listeners) throws IOException {
FileMetadataProvider metadataProvider = new FileMetadataProvider(dotTorrentFilePath);
TorrentMetadata metadata = metadataProvider.getTorrentMetadata();
FileCollectionStorage fileCollectionStorage = FileCollectionStorage.create(metadata, new File(downloadDirPath));
PieceStorage pieceStorage = pieceStorageFactory.createStorage(metadata, fileCollectionStorage);
return addTorrent(metadataProvider, pieceStorage, listeners);
} | java | public TorrentManager addTorrent(String dotTorrentFilePath,
String downloadDirPath,
PieceStorageFactory pieceStorageFactory,
List<TorrentListener> listeners) throws IOException {
FileMetadataProvider metadataProvider = new FileMetadataProvider(dotTorrentFilePath);
TorrentMetadata metadata = metadataProvider.getTorrentMetadata();
FileCollectionStorage fileCollectionStorage = FileCollectionStorage.create(metadata, new File(downloadDirPath));
PieceStorage pieceStorage = pieceStorageFactory.createStorage(metadata, fileCollectionStorage);
return addTorrent(metadataProvider, pieceStorage, listeners);
} | [
"public",
"TorrentManager",
"addTorrent",
"(",
"String",
"dotTorrentFilePath",
",",
"String",
"downloadDirPath",
",",
"PieceStorageFactory",
"pieceStorageFactory",
",",
"List",
"<",
"TorrentListener",
">",
"listeners",
")",
"throws",
"IOException",
"{",
"FileMetadataProvi... | Adds torrent to storage with specified {@link PieceStorageFactory}.
It can be used for skipping initial validation of data
@param dotTorrentFilePath path to torrent metadata file
@param downloadDirPath path to directory where downloaded files are placed
@param pieceStorageFactory factory for creating {@link PieceStorage}.
@return {@link TorrentManager} instance for monitoring torrent state
@throws IOException if IO error occurs in reading metadata file | [
"Adds",
"torrent",
"to",
"storage",
"with",
"specified",
"{",
"@link",
"PieceStorageFactory",
"}",
".",
"It",
"can",
"be",
"used",
"for",
"skipping",
"initial",
"validation",
"of",
"data"
] | train | https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java#L172-L181 |
haifengl/smile | core/src/main/java/smile/association/ARM.java | ARM.getPowerSet | private static int getPowerSet(int[] set, int inputIndex, int[] sofar, int[][] sets, int outputIndex) {
for (int i = inputIndex; i < set.length; i++) {
int n = sofar == null ? 0 : sofar.length;
if (n < set.length-1) {
int[] subset = new int[n + 1];
subset[n] = set[i];
if (sofar != null) {
System.arraycopy(sofar, 0, subset, 0, n);
}
sets[outputIndex] = subset;
outputIndex = getPowerSet(set, i + 1, subset, sets, outputIndex + 1);
}
}
return outputIndex;
} | java | private static int getPowerSet(int[] set, int inputIndex, int[] sofar, int[][] sets, int outputIndex) {
for (int i = inputIndex; i < set.length; i++) {
int n = sofar == null ? 0 : sofar.length;
if (n < set.length-1) {
int[] subset = new int[n + 1];
subset[n] = set[i];
if (sofar != null) {
System.arraycopy(sofar, 0, subset, 0, n);
}
sets[outputIndex] = subset;
outputIndex = getPowerSet(set, i + 1, subset, sets, outputIndex + 1);
}
}
return outputIndex;
} | [
"private",
"static",
"int",
"getPowerSet",
"(",
"int",
"[",
"]",
"set",
",",
"int",
"inputIndex",
",",
"int",
"[",
"]",
"sofar",
",",
"int",
"[",
"]",
"[",
"]",
"sets",
",",
"int",
"outputIndex",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"inputIndex",... | Recursively calculates all possible subsets.
@param set the input item set.
@param inputIndex the index within the input set marking current
element under consideration (0 at start).
@param sofar the current combination determined sofar during the
recursion (null at start).
@param sets the power set to store all combinations when recursion ends.
@param outputIndex the current location in the output set.
@return revised output index. | [
"Recursively",
"calculates",
"all",
"possible",
"subsets",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/ARM.java#L265-L281 |
MenoData/Time4J | base/src/main/java/net/time4j/format/internal/PropertyBundle.java | PropertyBundle.getCandidateLocales | public static List<Locale> getCandidateLocales(Locale locale) {
String language = LanguageMatch.getAlias(locale);
String country = FormatUtils.getRegion(locale);
String variant = locale.getVariant();
if (language.equals("zh") && locale.getScript().equals("Hant")) {
country = "TW";
}
List<Locale> list = new LinkedList<>();
if (!variant.isEmpty()) {
list.add(new Locale(language, country, variant));
}
if (!country.isEmpty()) {
list.add(new Locale(language, country, ""));
}
if (!language.isEmpty()) {
list.add(new Locale(language, "", ""));
if (language.equals("nn")) {
list.add(new Locale("nb", "", ""));
}
}
list.add(Locale.ROOT);
return list;
} | java | public static List<Locale> getCandidateLocales(Locale locale) {
String language = LanguageMatch.getAlias(locale);
String country = FormatUtils.getRegion(locale);
String variant = locale.getVariant();
if (language.equals("zh") && locale.getScript().equals("Hant")) {
country = "TW";
}
List<Locale> list = new LinkedList<>();
if (!variant.isEmpty()) {
list.add(new Locale(language, country, variant));
}
if (!country.isEmpty()) {
list.add(new Locale(language, country, ""));
}
if (!language.isEmpty()) {
list.add(new Locale(language, "", ""));
if (language.equals("nn")) {
list.add(new Locale("nb", "", ""));
}
}
list.add(Locale.ROOT);
return list;
} | [
"public",
"static",
"List",
"<",
"Locale",
">",
"getCandidateLocales",
"(",
"Locale",
"locale",
")",
"{",
"String",
"language",
"=",
"LanguageMatch",
".",
"getAlias",
"(",
"locale",
")",
";",
"String",
"country",
"=",
"FormatUtils",
".",
"getRegion",
"(",
"l... | /*[deutsch]
<p>Erstellt eine Kandidatenliste. </p>
@param locale requested locale
@return list of candidates in roughly same order as in {@code java.util.ResourceBundle} | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Erstellt",
"eine",
"Kandidatenliste",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/format/internal/PropertyBundle.java#L351-L381 |
HeidelTime/heideltime | src/de/unihd/dbs/uima/annotator/heideltime/ProcessorManager.java | ProcessorManager.executeProcessors | public void executeProcessors(JCas jcas, ProcessorManager.Priority prio) {
if(!this.initialized) {
Logger.printError(component, "Unable to execute Processors; initialization was not concluded successfully.");
System.exit(-1);
}
LinkedList<GenericProcessor> myList = processors.get(prio);
for(GenericProcessor gp : myList) {
try {
gp.process(jcas);
} catch (Exception exception) {
exception.printStackTrace();
Logger.printError(component, "Unable to process registered Processor " + gp.getClass().getName() + ", got: " + exception.toString());
System.exit(-1);
}
}
} | java | public void executeProcessors(JCas jcas, ProcessorManager.Priority prio) {
if(!this.initialized) {
Logger.printError(component, "Unable to execute Processors; initialization was not concluded successfully.");
System.exit(-1);
}
LinkedList<GenericProcessor> myList = processors.get(prio);
for(GenericProcessor gp : myList) {
try {
gp.process(jcas);
} catch (Exception exception) {
exception.printStackTrace();
Logger.printError(component, "Unable to process registered Processor " + gp.getClass().getName() + ", got: " + exception.toString());
System.exit(-1);
}
}
} | [
"public",
"void",
"executeProcessors",
"(",
"JCas",
"jcas",
",",
"ProcessorManager",
".",
"Priority",
"prio",
")",
"{",
"if",
"(",
"!",
"this",
".",
"initialized",
")",
"{",
"Logger",
".",
"printError",
"(",
"component",
",",
"\"Unable to execute Processors; ini... | Based on reflection, this method instantiates and executes all of the
registered Processors.
@param jcas | [
"Based",
"on",
"reflection",
"this",
"method",
"instantiates",
"and",
"executes",
"all",
"of",
"the",
"registered",
"Processors",
"."
] | train | https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/heideltime/ProcessorManager.java#L92-L108 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_historyTollfreeConsumption_GET | public ArrayList<Date> billingAccount_historyTollfreeConsumption_GET(String billingAccount) throws IOException {
String qPath = "/telephony/{billingAccount}/historyTollfreeConsumption";
StringBuilder sb = path(qPath, billingAccount);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public ArrayList<Date> billingAccount_historyTollfreeConsumption_GET(String billingAccount) throws IOException {
String qPath = "/telephony/{billingAccount}/historyTollfreeConsumption";
StringBuilder sb = path(qPath, billingAccount);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"ArrayList",
"<",
"Date",
">",
"billingAccount_historyTollfreeConsumption_GET",
"(",
"String",
"billingAccount",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/historyTollfreeConsumption\"",
";",
"StringBuilder",
"sb",
"=",... | Previous tollfree bill
REST: GET /telephony/{billingAccount}/historyTollfreeConsumption
@param billingAccount [required] The name of your billingAccount | [
"Previous",
"tollfree",
"bill"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4620-L4625 |
JavaMoney/jsr354-api | src/main/java/javax/money/convert/ProviderContextBuilder.java | ProviderContextBuilder.of | public static ProviderContextBuilder of(String provider, Collection<RateType> rateTypes) {
return new ProviderContextBuilder(provider, rateTypes);
} | java | public static ProviderContextBuilder of(String provider, Collection<RateType> rateTypes) {
return new ProviderContextBuilder(provider, rateTypes);
} | [
"public",
"static",
"ProviderContextBuilder",
"of",
"(",
"String",
"provider",
",",
"Collection",
"<",
"RateType",
">",
"rateTypes",
")",
"{",
"return",
"new",
"ProviderContextBuilder",
"(",
"provider",
",",
"rateTypes",
")",
";",
"}"
] | Create a new ProviderContextBuilder instance.
@param provider the provider name, not {@code null}.
@param rateTypes the rate types, not null and not empty.
@return a new {@link javax.money.convert.ProviderContextBuilder} instance, never null. | [
"Create",
"a",
"new",
"ProviderContextBuilder",
"instance",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/ProviderContextBuilder.java#L144-L146 |
Viascom/groundwork | foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/response/serviceresult/FoxHttpServiceResultResponse.java | FoxHttpServiceResultResponse.getContent | @SuppressWarnings("unchecked")
public <T extends Serializable> T getContent(Class<T> contentClass, boolean checkHash) throws FoxHttpResponseException {
try {
Type parameterizedType = new ServiceResultParameterizedType(contentClass);
String body = getStringBody();
ServiceResult<T> result = parser.fromJson(body, parameterizedType);
foxHttpClient.getFoxHttpLogger().log("processServiceResult(" + result + ")");
this.content = result.getContent();
checkHash(checkHash, body, result);
return (T) this.content;
} catch (IOException e) {
throw new FoxHttpResponseException(e);
}
} | java | @SuppressWarnings("unchecked")
public <T extends Serializable> T getContent(Class<T> contentClass, boolean checkHash) throws FoxHttpResponseException {
try {
Type parameterizedType = new ServiceResultParameterizedType(contentClass);
String body = getStringBody();
ServiceResult<T> result = parser.fromJson(body, parameterizedType);
foxHttpClient.getFoxHttpLogger().log("processServiceResult(" + result + ")");
this.content = result.getContent();
checkHash(checkHash, body, result);
return (T) this.content;
} catch (IOException e) {
throw new FoxHttpResponseException(e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"Serializable",
">",
"T",
"getContent",
"(",
"Class",
"<",
"T",
">",
"contentClass",
",",
"boolean",
"checkHash",
")",
"throws",
"FoxHttpResponseException",
"{",
"try",
"{",
"Ty... | Get the content of the service result
@param contentClass class of the return object
@param checkHash should the result be checked
@return deserialized content of the service result
@throws FoxHttpResponseException Exception during the deserialization | [
"Get",
"the",
"content",
"of",
"the",
"service",
"result"
] | train | https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/response/serviceresult/FoxHttpServiceResultResponse.java#L237-L256 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/LazyPatternBy.java | LazyPatternBy.fillPattern | private String fillPattern(String pattern, String[] parameters) {
boolean containsSingleQuote = false;
boolean containsDoubleQuote = false;
Object[] escapedParams = new Object[parameters.length];
for (int i = 0; i < parameters.length; i++) {
String param = parameters[i];
containsSingleQuote = containsSingleQuote || param.contains("'");
containsDoubleQuote = containsDoubleQuote || param.contains("\"");
escapedParams[i] = param;
}
if (containsDoubleQuote && containsSingleQuote) {
throw new RuntimeException("Unsupported combination of single and double quotes");
}
String patternToUse;
if (containsSingleQuote) {
patternToUse = SINGLE_QUOTE_PATTERN.matcher(pattern).replaceAll("\"");
} else {
patternToUse = pattern;
}
return String.format(patternToUse, escapedParams);
} | java | private String fillPattern(String pattern, String[] parameters) {
boolean containsSingleQuote = false;
boolean containsDoubleQuote = false;
Object[] escapedParams = new Object[parameters.length];
for (int i = 0; i < parameters.length; i++) {
String param = parameters[i];
containsSingleQuote = containsSingleQuote || param.contains("'");
containsDoubleQuote = containsDoubleQuote || param.contains("\"");
escapedParams[i] = param;
}
if (containsDoubleQuote && containsSingleQuote) {
throw new RuntimeException("Unsupported combination of single and double quotes");
}
String patternToUse;
if (containsSingleQuote) {
patternToUse = SINGLE_QUOTE_PATTERN.matcher(pattern).replaceAll("\"");
} else {
patternToUse = pattern;
}
return String.format(patternToUse, escapedParams);
} | [
"private",
"String",
"fillPattern",
"(",
"String",
"pattern",
",",
"String",
"[",
"]",
"parameters",
")",
"{",
"boolean",
"containsSingleQuote",
"=",
"false",
";",
"boolean",
"containsDoubleQuote",
"=",
"false",
";",
"Object",
"[",
"]",
"escapedParams",
"=",
"... | Fills in placeholders in pattern using the supplied parameters.
@param pattern pattern to fill (in String.format style).
@param parameters parameters to use.
@return filled in pattern. | [
"Fills",
"in",
"placeholders",
"in",
"pattern",
"using",
"the",
"supplied",
"parameters",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/LazyPatternBy.java#L86-L106 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/automata/ads/ADSUtil.java | ADSUtil.computeMaximumSplittingWordLength | public static long computeMaximumSplittingWordLength(final int n, final int i, final int m) {
if (m == 2) {
return n;
}
return LongMath.binomial(n, i) - LongMath.binomial(m - 1, i - 1) - 1;
} | java | public static long computeMaximumSplittingWordLength(final int n, final int i, final int m) {
if (m == 2) {
return n;
}
return LongMath.binomial(n, i) - LongMath.binomial(m - 1, i - 1) - 1;
} | [
"public",
"static",
"long",
"computeMaximumSplittingWordLength",
"(",
"final",
"int",
"n",
",",
"final",
"int",
"i",
",",
"final",
"int",
"m",
")",
"{",
"if",
"(",
"m",
"==",
"2",
")",
"{",
"return",
"n",
";",
"}",
"return",
"LongMath",
".",
"binomial"... | Computes an upper bound for the length of a splitting word. Based on
<p>
I.V. Kogan. "Estimated Length of a Minimal Simple Conditional Diagnostic Experiment". In: Automation and Remote
Control 34 (1973)
@param n
the size of the automaton (number of states)
@param i
the number of states that should be distinguished by the current splitting word
@param m
the number of states that should originally be distinguished
@return upper bound for the length of a splitting word | [
"Computes",
"an",
"upper",
"bound",
"for",
"the",
"length",
"of",
"a",
"splitting",
"word",
".",
"Based",
"on",
"<p",
">",
"I",
".",
"V",
".",
"Kogan",
".",
"Estimated",
"Length",
"of",
"a",
"Minimal",
"Simple",
"Conditional",
"Diagnostic",
"Experiment",
... | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/ads/ADSUtil.java#L150-L156 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java | PhotosetsInterface.removePhoto | public void removePhoto(String photosetId, String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_REMOVE_PHOTO);
parameters.put("photoset_id", photosetId);
parameters.put("photo_id", photoId);
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void removePhoto(String photosetId, String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_REMOVE_PHOTO);
parameters.put("photoset_id", photosetId);
parameters.put("photo_id", photoId);
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"removePhoto",
"(",
"String",
"photosetId",
",",
"String",
"photoId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
... | Remove a photo from the set.
@param photosetId
The photoset ID
@param photoId
The photo ID
@throws FlickrException | [
"Remove",
"a",
"photo",
"from",
"the",
"set",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L587-L598 |
Erudika/para | para-core/src/main/java/com/erudika/para/utils/RegistryUtils.java | RegistryUtils.getValue | public static Object getValue(String registryName, String key) {
Map<String, Object> registry = getRegistry(registryName);
if (registry == null || StringUtils.isBlank(key)) {
return null;
}
return registry.get(key);
} | java | public static Object getValue(String registryName, String key) {
Map<String, Object> registry = getRegistry(registryName);
if (registry == null || StringUtils.isBlank(key)) {
return null;
}
return registry.get(key);
} | [
"public",
"static",
"Object",
"getValue",
"(",
"String",
"registryName",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"registry",
"=",
"getRegistry",
"(",
"registryName",
")",
";",
"if",
"(",
"registry",
"==",
"null",
"||",
"... | Retrieve one specific value from a registry.
@param registryName the name of the registry.
@param key the unique key corresponding to the value to retrieve (typically an appid).
@return the value corresponding to the registry key, null if no value is found for the specified key. | [
"Retrieve",
"one",
"specific",
"value",
"from",
"a",
"registry",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/RegistryUtils.java#L65-L71 |
scribejava/scribejava | scribejava-apis/src/main/java/com/github/scribejava/apis/facebook/FacebookAccessTokenJsonExtractor.java | FacebookAccessTokenJsonExtractor.generateError | @Override
public void generateError(String response) {
extractParameter(response, MESSAGE_REGEX_PATTERN, false);
throw new FacebookAccessTokenErrorResponse(extractParameter(response, MESSAGE_REGEX_PATTERN, false),
extractParameter(response, TYPE_REGEX_PATTERN, false),
extractParameter(response, CODE_REGEX_PATTERN, false),
extractParameter(response, FBTRACE_ID_REGEX_PATTERN, false), response);
} | java | @Override
public void generateError(String response) {
extractParameter(response, MESSAGE_REGEX_PATTERN, false);
throw new FacebookAccessTokenErrorResponse(extractParameter(response, MESSAGE_REGEX_PATTERN, false),
extractParameter(response, TYPE_REGEX_PATTERN, false),
extractParameter(response, CODE_REGEX_PATTERN, false),
extractParameter(response, FBTRACE_ID_REGEX_PATTERN, false), response);
} | [
"@",
"Override",
"public",
"void",
"generateError",
"(",
"String",
"response",
")",
"{",
"extractParameter",
"(",
"response",
",",
"MESSAGE_REGEX_PATTERN",
",",
"false",
")",
";",
"throw",
"new",
"FacebookAccessTokenErrorResponse",
"(",
"extractParameter",
"(",
"res... | non standard. examples:<br>
'{"error":{"message":"This authorization code has been
used.","type":"OAuthException","code":100,"fbtrace_id":"DtxvtGRaxbB"}}'<br>
'{"error":{"message":"Error validating application. Invalid application
ID.","type":"OAuthException","code":101,"fbtrace_id":"CvDR+X4WWIx"}}' | [
"non",
"standard",
".",
"examples",
":",
"<br",
">"
] | train | https://github.com/scribejava/scribejava/blob/030d76872fe371a84b5d05c6c3c33c34e8f611f1/scribejava-apis/src/main/java/com/github/scribejava/apis/facebook/FacebookAccessTokenJsonExtractor.java#L37-L45 |
lessthanoptimal/ddogleg | src/org/ddogleg/nn/alg/VpTree.java | VpTree.listSwap | private <E> void listSwap(E[] list, int a, int b) {
final E tmp = list[a];
list[a] = list[b];
list[b] = tmp;
} | java | private <E> void listSwap(E[] list, int a, int b) {
final E tmp = list[a];
list[a] = list[b];
list[b] = tmp;
} | [
"private",
"<",
"E",
">",
"void",
"listSwap",
"(",
"E",
"[",
"]",
"list",
",",
"int",
"a",
",",
"int",
"b",
")",
"{",
"final",
"E",
"tmp",
"=",
"list",
"[",
"a",
"]",
";",
"list",
"[",
"a",
"]",
"=",
"list",
"[",
"b",
"]",
";",
"list",
"[... | Swaps two items in the given list.
@param list list to swap the items in
@param a index of the first item
@param b index of the second item
@param <E> list type | [
"Swaps",
"two",
"items",
"in",
"the",
"given",
"list",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L173-L177 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java | ConfigValueHelper.checkNormalWithCommaColon | protected static void checkNormalWithCommaColon(String configKey, String configValue)
throws SofaRpcRuntimeException {
checkPattern(configKey, configValue, NORMAL_COMMA_COLON, "only allow a-zA-Z0-9 '-' '_' '.' ':' ','");
} | java | protected static void checkNormalWithCommaColon(String configKey, String configValue)
throws SofaRpcRuntimeException {
checkPattern(configKey, configValue, NORMAL_COMMA_COLON, "only allow a-zA-Z0-9 '-' '_' '.' ':' ','");
} | [
"protected",
"static",
"void",
"checkNormalWithCommaColon",
"(",
"String",
"configKey",
",",
"String",
"configValue",
")",
"throws",
"SofaRpcRuntimeException",
"{",
"checkPattern",
"(",
"configKey",
",",
"configValue",
",",
"NORMAL_COMMA_COLON",
",",
"\"only allow a-zA-Z0... | 检查字符串是否是正常值(含冒号),不是则抛出异常
@param configKey 配置项
@param configValue 配置值
@throws SofaRpcRuntimeException 非法异常 | [
"检查字符串是否是正常值(含冒号),不是则抛出异常"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java#L130-L133 |
graknlabs/grakn | server/src/graql/gremlin/sets/EquivalentFragmentSets.java | EquivalentFragmentSets.relates | public static EquivalentFragmentSet relates(VarProperty varProperty, Variable relationType, Variable role) {
return new AutoValue_RelatesFragmentSet(varProperty, relationType, role);
} | java | public static EquivalentFragmentSet relates(VarProperty varProperty, Variable relationType, Variable role) {
return new AutoValue_RelatesFragmentSet(varProperty, relationType, role);
} | [
"public",
"static",
"EquivalentFragmentSet",
"relates",
"(",
"VarProperty",
"varProperty",
",",
"Variable",
"relationType",
",",
"Variable",
"role",
")",
"{",
"return",
"new",
"AutoValue_RelatesFragmentSet",
"(",
"varProperty",
",",
"relationType",
",",
"role",
")",
... | An {@link EquivalentFragmentSet} that indicates a variable is a relation type which involves a role. | [
"An",
"{"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/sets/EquivalentFragmentSets.java#L99-L101 |
igniterealtime/REST-API-Client | src/main/java/org/igniterealtime/restclient/RestApiClient.java | RestApiClient.deleteOutcastGroup | public Response deleteOutcastGroup(String roomName, String groupName) {
return restClient.delete("chatrooms/" + roomName + "/outcasts/group/" + groupName,
new HashMap<String, String>());
} | java | public Response deleteOutcastGroup(String roomName, String groupName) {
return restClient.delete("chatrooms/" + roomName + "/outcasts/group/" + groupName,
new HashMap<String, String>());
} | [
"public",
"Response",
"deleteOutcastGroup",
"(",
"String",
"roomName",
",",
"String",
"groupName",
")",
"{",
"return",
"restClient",
".",
"delete",
"(",
"\"chatrooms/\"",
"+",
"roomName",
"+",
"\"/outcasts/group/\"",
"+",
"groupName",
",",
"new",
"HashMap",
"<",
... | Delete outcast group from chatroom.
@param roomName
the room name
@param groupName
the groupName
@return the response | [
"Delete",
"outcast",
"group",
"from",
"chatroom",
"."
] | train | https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L450-L453 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.xor | public static Boolean xor(Boolean left, Boolean right) {
return left ^ Boolean.TRUE.equals(right);
} | java | public static Boolean xor(Boolean left, Boolean right) {
return left ^ Boolean.TRUE.equals(right);
} | [
"public",
"static",
"Boolean",
"xor",
"(",
"Boolean",
"left",
",",
"Boolean",
"right",
")",
"{",
"return",
"left",
"^",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"right",
")",
";",
"}"
] | Exclusive disjunction of two boolean operators
@param left left operator
@param right right operator
@return result of exclusive disjunction
@since 1.0 | [
"Exclusive",
"disjunction",
"of",
"two",
"boolean",
"operators"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16633-L16635 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/ValueGraphElements.java | ValueGraphElements.getElement | public ValueGraphElement getElement(int i) {
if((i < 0) || (i >= values.length)) {
throw new NoSuchElementException();
}
int minHeight = config.valueMinHeight;
// normalize height to value between 0 and 1:
float value = ((float) values[i]) / ((float) maxValue);
float usableHeight = height - minHeight;
int valueHeight = (int) (usableHeight * value) + minHeight;
int elX = Graph.xlateX(width, values.length, i);
int elW = Graph.xlateX(width, values.length, i+1) - elX;
int elY = height - valueHeight;
boolean hot = i == highlightValue;
return new ValueGraphElement(x + elX, y + elY, elW, valueHeight, hot, config);
} | java | public ValueGraphElement getElement(int i) {
if((i < 0) || (i >= values.length)) {
throw new NoSuchElementException();
}
int minHeight = config.valueMinHeight;
// normalize height to value between 0 and 1:
float value = ((float) values[i]) / ((float) maxValue);
float usableHeight = height - minHeight;
int valueHeight = (int) (usableHeight * value) + minHeight;
int elX = Graph.xlateX(width, values.length, i);
int elW = Graph.xlateX(width, values.length, i+1) - elX;
int elY = height - valueHeight;
boolean hot = i == highlightValue;
return new ValueGraphElement(x + elX, y + elY, elW, valueHeight, hot, config);
} | [
"public",
"ValueGraphElement",
"getElement",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"(",
"i",
"<",
"0",
")",
"||",
"(",
"i",
">=",
"values",
".",
"length",
")",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";",
"}",
"int",
"minHeight"... | return the i'th ValueGraphElement
@param i the index of the element to return
@return the ValueGraphElement at index i | [
"return",
"the",
"i",
"th",
"ValueGraphElement"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/ValueGraphElements.java#L63-L79 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.booleanSupplier | public static BooleanSupplier booleanSupplier(CheckedBooleanSupplier supplier, Consumer<Throwable> handler) {
return () -> {
try {
return supplier.getAsBoolean();
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static BooleanSupplier booleanSupplier(CheckedBooleanSupplier supplier, Consumer<Throwable> handler) {
return () -> {
try {
return supplier.getAsBoolean();
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"BooleanSupplier",
"booleanSupplier",
"(",
"CheckedBooleanSupplier",
"supplier",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"(",
")",
"->",
"{",
"try",
"{",
"return",
"supplier",
".",
"getAsBoolean",
"(",
")",
";... | Wrap a {@link CheckedBooleanSupplier} in a {@link BooleanSupplier} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
ResultSet rs = statement.executeQuery();
Stream.generate(Unchecked.booleanSupplier(
() -> rs.getBoolean(1),
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{",
"@link",
"CheckedBooleanSupplier",
"}",
"in",
"a",
"{",
"@link",
"BooleanSupplier",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"ResultSet",
"rs",
"=",
... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1856-L1867 |
beeinstant-dev/beeinstant-java-sdk | src/main/java/com/beeinstant/metrics/MetricsLogger.java | MetricsLogger.extendMultipleDimensionsIncludeRoot | public Metrics extendMultipleDimensionsIncludeRoot(final String... dimensionsGroup) {
final String[] dimensionsGroupWithRoot = Arrays.copyOf(dimensionsGroup, dimensionsGroup.length + 1);
// root dimensions is equivalent to extend root dimensions with no new dimension
dimensionsGroupWithRoot[dimensionsGroup.length] = getRootDimensionsString();
return new MetricsGroup(this, dimensionsGroupWithRoot);
} | java | public Metrics extendMultipleDimensionsIncludeRoot(final String... dimensionsGroup) {
final String[] dimensionsGroupWithRoot = Arrays.copyOf(dimensionsGroup, dimensionsGroup.length + 1);
// root dimensions is equivalent to extend root dimensions with no new dimension
dimensionsGroupWithRoot[dimensionsGroup.length] = getRootDimensionsString();
return new MetricsGroup(this, dimensionsGroupWithRoot);
} | [
"public",
"Metrics",
"extendMultipleDimensionsIncludeRoot",
"(",
"final",
"String",
"...",
"dimensionsGroup",
")",
"{",
"final",
"String",
"[",
"]",
"dimensionsGroupWithRoot",
"=",
"Arrays",
".",
"copyOf",
"(",
"dimensionsGroup",
",",
"dimensionsGroup",
".",
"length",... | Extend the root dimensions with a group of new dimensions, but also include the root dimensions into the group.
For example:
The root dimensions is "service=AwesomeService".
extendMultipleDimensionsIncludeRoot("api=Upload") will create a metrics object which contains
the root dimensions "service=AwesomeService" and the new one "service=AwesomeService, api=Upload".
@param dimensionsGroup, group of dimensions
@return metrics object which contains a group of dimensions | [
"Extend",
"the",
"root",
"dimensions",
"with",
"a",
"group",
"of",
"new",
"dimensions",
"but",
"also",
"include",
"the",
"root",
"dimensions",
"into",
"the",
"group",
".",
"For",
"example",
":",
"The",
"root",
"dimensions",
"is",
"service",
"=",
"AwesomeServ... | train | https://github.com/beeinstant-dev/beeinstant-java-sdk/blob/c51d7e931bd5f057f77406d393760cf42caf0599/src/main/java/com/beeinstant/metrics/MetricsLogger.java#L91-L96 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/tasks/AbstractInvokable.java | AbstractInvokable.triggerCheckpoint | public boolean triggerCheckpoint(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions, boolean advanceToEndOfEventTime) throws Exception {
throw new UnsupportedOperationException(String.format("triggerCheckpoint not supported by %s", this.getClass().getName()));
} | java | public boolean triggerCheckpoint(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions, boolean advanceToEndOfEventTime) throws Exception {
throw new UnsupportedOperationException(String.format("triggerCheckpoint not supported by %s", this.getClass().getName()));
} | [
"public",
"boolean",
"triggerCheckpoint",
"(",
"CheckpointMetaData",
"checkpointMetaData",
",",
"CheckpointOptions",
"checkpointOptions",
",",
"boolean",
"advanceToEndOfEventTime",
")",
"throws",
"Exception",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"String"... | This method is called to trigger a checkpoint, asynchronously by the checkpoint
coordinator.
<p>This method is called for tasks that start the checkpoints by injecting the initial barriers,
i.e., the source tasks. In contrast, checkpoints on downstream operators, which are the result of
receiving checkpoint barriers, invoke the {@link #triggerCheckpointOnBarrier(CheckpointMetaData, CheckpointOptions, CheckpointMetrics)}
method.
@param checkpointMetaData Meta data for about this checkpoint
@param checkpointOptions Options for performing this checkpoint
@param advanceToEndOfEventTime Flag indicating if the source should inject a {@code MAX_WATERMARK} in the pipeline
to fire any registered event-time timers
@return {@code false} if the checkpoint can not be carried out, {@code true} otherwise | [
"This",
"method",
"is",
"called",
"to",
"trigger",
"a",
"checkpoint",
"asynchronously",
"by",
"the",
"checkpoint",
"coordinator",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/tasks/AbstractInvokable.java#L211-L213 |
m-m-m/util | cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java | CliState.findPropertyAnnotations | protected boolean findPropertyAnnotations(PojoDescriptorBuilder descriptorBuilder) {
boolean annotationFound = false;
PojoDescriptor<?> descriptor = descriptorBuilder.getDescriptor(getStateClass());
for (PojoPropertyDescriptor propertyDescriptor : descriptor.getPropertyDescriptors()) {
PojoPropertyAccessorOneArg setter = propertyDescriptor.getAccessor(PojoPropertyAccessorOneArgMode.SET);
if (setter != null) {
AccessibleObject accessible = setter.getAccessibleObject();
CliOption option = accessible.getAnnotation(CliOption.class);
CliArgument argument = accessible.getAnnotation(CliArgument.class);
if ((option != null) && (argument != null)) {
// property can not both be option and argument
throw new CliOptionAndArgumentAnnotationException(propertyDescriptor.getName());
} else if ((option != null) || (argument != null)) {
annotationFound = true;
PojoPropertyAccessorNonArg getter = propertyDescriptor.getAccessor(PojoPropertyAccessorNonArgMode.GET);
ValueValidator<?> validator = this.validatorBuilder.newValidator(getStateClass(), propertyDescriptor.getName());
if (option != null) {
CliOptionContainer optionContainer = new CliOptionContainer(option, setter, getter, validator);
addOption(optionContainer);
} else {
assert (argument != null);
CliArgumentContainer argumentContainer = new CliArgumentContainer(argument, setter, getter, validator);
addArgument(argumentContainer);
}
}
}
}
return annotationFound;
} | java | protected boolean findPropertyAnnotations(PojoDescriptorBuilder descriptorBuilder) {
boolean annotationFound = false;
PojoDescriptor<?> descriptor = descriptorBuilder.getDescriptor(getStateClass());
for (PojoPropertyDescriptor propertyDescriptor : descriptor.getPropertyDescriptors()) {
PojoPropertyAccessorOneArg setter = propertyDescriptor.getAccessor(PojoPropertyAccessorOneArgMode.SET);
if (setter != null) {
AccessibleObject accessible = setter.getAccessibleObject();
CliOption option = accessible.getAnnotation(CliOption.class);
CliArgument argument = accessible.getAnnotation(CliArgument.class);
if ((option != null) && (argument != null)) {
// property can not both be option and argument
throw new CliOptionAndArgumentAnnotationException(propertyDescriptor.getName());
} else if ((option != null) || (argument != null)) {
annotationFound = true;
PojoPropertyAccessorNonArg getter = propertyDescriptor.getAccessor(PojoPropertyAccessorNonArgMode.GET);
ValueValidator<?> validator = this.validatorBuilder.newValidator(getStateClass(), propertyDescriptor.getName());
if (option != null) {
CliOptionContainer optionContainer = new CliOptionContainer(option, setter, getter, validator);
addOption(optionContainer);
} else {
assert (argument != null);
CliArgumentContainer argumentContainer = new CliArgumentContainer(argument, setter, getter, validator);
addArgument(argumentContainer);
}
}
}
}
return annotationFound;
} | [
"protected",
"boolean",
"findPropertyAnnotations",
"(",
"PojoDescriptorBuilder",
"descriptorBuilder",
")",
"{",
"boolean",
"annotationFound",
"=",
"false",
";",
"PojoDescriptor",
"<",
"?",
">",
"descriptor",
"=",
"descriptorBuilder",
".",
"getDescriptor",
"(",
"getState... | This method finds the properties annotated with {@link CliOption} or {@link CliArgument}.
@param descriptorBuilder is the {@link PojoDescriptorBuilder} to use (determines if fields or setters are used).
@return {@code true} if at least one annotated property has been found, {@code false} otherwise. | [
"This",
"method",
"finds",
"the",
"properties",
"annotated",
"with",
"{",
"@link",
"CliOption",
"}",
"or",
"{",
"@link",
"CliArgument",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java#L267-L296 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.regressionSuites | public Collection<RegressionSuite> regressionSuites(RegressionSuiteFilter filter) {
return get(RegressionSuite.class, (filter != null) ? filter : new RegressionSuiteFilter());
} | java | public Collection<RegressionSuite> regressionSuites(RegressionSuiteFilter filter) {
return get(RegressionSuite.class, (filter != null) ? filter : new RegressionSuiteFilter());
} | [
"public",
"Collection",
"<",
"RegressionSuite",
">",
"regressionSuites",
"(",
"RegressionSuiteFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"RegressionSuite",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"RegressionSuiteFi... | Get Regression Suite filtered by the criteria specified in the passed in filter.
@param filter Limit the items returned. If null, then all items are returned.
@return Collection of items as specified in the filter. | [
"Get",
"Regression",
"Suite",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"in",
"filter",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L380-L382 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/TwoInputTransformation.java | TwoInputTransformation.setStateKeySelectors | public void setStateKeySelectors(KeySelector<IN1, ?> stateKeySelector1, KeySelector<IN2, ?> stateKeySelector2) {
this.stateKeySelector1 = stateKeySelector1;
this.stateKeySelector2 = stateKeySelector2;
} | java | public void setStateKeySelectors(KeySelector<IN1, ?> stateKeySelector1, KeySelector<IN2, ?> stateKeySelector2) {
this.stateKeySelector1 = stateKeySelector1;
this.stateKeySelector2 = stateKeySelector2;
} | [
"public",
"void",
"setStateKeySelectors",
"(",
"KeySelector",
"<",
"IN1",
",",
"?",
">",
"stateKeySelector1",
",",
"KeySelector",
"<",
"IN2",
",",
"?",
">",
"stateKeySelector2",
")",
"{",
"this",
".",
"stateKeySelector1",
"=",
"stateKeySelector1",
";",
"this",
... | Sets the {@link KeySelector KeySelectors} that must be used for partitioning keyed state of
this transformation.
@param stateKeySelector1 The {@code KeySelector} to set for the first input
@param stateKeySelector2 The {@code KeySelector} to set for the first input | [
"Sets",
"the",
"{",
"@link",
"KeySelector",
"KeySelectors",
"}",
"that",
"must",
"be",
"used",
"for",
"partitioning",
"keyed",
"state",
"of",
"this",
"transformation",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/TwoInputTransformation.java#L120-L123 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java | WorkManagerImpl.fireWorkContextSetupFailed | private void fireWorkContextSetupFailed(Object workContext, String errorCode,
WorkListener workListener, Work work, WorkException exception)
{
if (workListener != null)
{
WorkEvent event = new WorkEvent(this, WorkEvent.WORK_STARTED, work, null);
workListener.workStarted(event);
}
if (workContext instanceof WorkContextLifecycleListener)
{
WorkContextLifecycleListener listener = (WorkContextLifecycleListener) workContext;
listener.contextSetupFailed(errorCode);
}
if (workListener != null)
{
WorkEvent event = new WorkEvent(this, WorkEvent.WORK_COMPLETED, work, exception);
workListener.workCompleted(event);
}
} | java | private void fireWorkContextSetupFailed(Object workContext, String errorCode,
WorkListener workListener, Work work, WorkException exception)
{
if (workListener != null)
{
WorkEvent event = new WorkEvent(this, WorkEvent.WORK_STARTED, work, null);
workListener.workStarted(event);
}
if (workContext instanceof WorkContextLifecycleListener)
{
WorkContextLifecycleListener listener = (WorkContextLifecycleListener) workContext;
listener.contextSetupFailed(errorCode);
}
if (workListener != null)
{
WorkEvent event = new WorkEvent(this, WorkEvent.WORK_COMPLETED, work, exception);
workListener.workCompleted(event);
}
} | [
"private",
"void",
"fireWorkContextSetupFailed",
"(",
"Object",
"workContext",
",",
"String",
"errorCode",
",",
"WorkListener",
"workListener",
",",
"Work",
"work",
",",
"WorkException",
"exception",
")",
"{",
"if",
"(",
"workListener",
"!=",
"null",
")",
"{",
"... | Calls listener with given error code.
@param workContext work context listener
@param errorCode error code
@param workListener work listener
@param work work instance
@param exception exception | [
"Calls",
"listener",
"with",
"given",
"error",
"code",
"."
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java#L1307-L1327 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java | HttpRequestFactory.buildPutRequest | public HttpRequest buildPutRequest(GenericUrl url, HttpContent content) throws IOException {
return buildRequest(HttpMethods.PUT, url, content);
} | java | public HttpRequest buildPutRequest(GenericUrl url, HttpContent content) throws IOException {
return buildRequest(HttpMethods.PUT, url, content);
} | [
"public",
"HttpRequest",
"buildPutRequest",
"(",
"GenericUrl",
"url",
",",
"HttpContent",
"content",
")",
"throws",
"IOException",
"{",
"return",
"buildRequest",
"(",
"HttpMethods",
".",
"PUT",
",",
"url",
",",
"content",
")",
";",
"}"
] | Builds a {@code PUT} request for the given URL and content.
@param url HTTP request URL or {@code null} for none
@param content HTTP request content or {@code null} for none
@return new HTTP request | [
"Builds",
"a",
"{",
"@code",
"PUT",
"}",
"request",
"for",
"the",
"given",
"URL",
"and",
"content",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java#L138-L140 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/GenericUtils.java | GenericUtils.interfaceGenericTypeFor | protected TypeMirror interfaceGenericTypeFor(TypeElement element, Class interfaceType) {
return interfaceGenericTypeFor(element, interfaceType.getName());
} | java | protected TypeMirror interfaceGenericTypeFor(TypeElement element, Class interfaceType) {
return interfaceGenericTypeFor(element, interfaceType.getName());
} | [
"protected",
"TypeMirror",
"interfaceGenericTypeFor",
"(",
"TypeElement",
"element",
",",
"Class",
"interfaceType",
")",
"{",
"return",
"interfaceGenericTypeFor",
"(",
"element",
",",
"interfaceType",
".",
"getName",
"(",
")",
")",
";",
"}"
] | Finds the generic type for the given interface for the given class element.
<p>
For example, for <code>class AProvider implements Provider</code>
element = AProvider
interfaceType = interface javax.inject.Provider.class
return A
@param element The class element
@param interfaceType The interface
@return The generic type or null | [
"Finds",
"the",
"generic",
"type",
"for",
"the",
"given",
"interface",
"for",
"the",
"given",
"class",
"element",
".",
"<p",
">",
"For",
"example",
"for",
"<code",
">",
"class",
"AProvider",
"implements",
"Provider<",
"/",
"code",
">",
"element",
"=",
"APr... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/GenericUtils.java#L80-L82 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java | FaceListsImpl.updateWithServiceResponseAsync | public Observable<ServiceResponse<Void>> updateWithServiceResponseAsync(String faceListId, UpdateFaceListsOptionalParameter updateOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (faceListId == null) {
throw new IllegalArgumentException("Parameter faceListId is required and cannot be null.");
}
final String name = updateOptionalParameter != null ? updateOptionalParameter.name() : null;
final String userData = updateOptionalParameter != null ? updateOptionalParameter.userData() : null;
return updateWithServiceResponseAsync(faceListId, name, userData);
} | java | public Observable<ServiceResponse<Void>> updateWithServiceResponseAsync(String faceListId, UpdateFaceListsOptionalParameter updateOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (faceListId == null) {
throw new IllegalArgumentException("Parameter faceListId is required and cannot be null.");
}
final String name = updateOptionalParameter != null ? updateOptionalParameter.name() : null;
final String userData = updateOptionalParameter != null ? updateOptionalParameter.userData() : null;
return updateWithServiceResponseAsync(faceListId, name, userData);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Void",
">",
">",
"updateWithServiceResponseAsync",
"(",
"String",
"faceListId",
",",
"UpdateFaceListsOptionalParameter",
"updateOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"azureRegion",
"(... | Update information of a face list.
@param faceListId Id referencing a particular face list.
@param updateOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Update",
"information",
"of",
"a",
"face",
"list",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L400-L411 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java | TiledMap.getObjectType | public String getObjectType(int groupID, int objectID) {
if (groupID >= 0 && groupID < objectGroups.size()) {
ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID);
if (objectID >= 0 && objectID < grp.objects.size()) {
GroupObject object = (GroupObject) grp.objects.get(objectID);
return object.type;
}
}
return null;
} | java | public String getObjectType(int groupID, int objectID) {
if (groupID >= 0 && groupID < objectGroups.size()) {
ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID);
if (objectID >= 0 && objectID < grp.objects.size()) {
GroupObject object = (GroupObject) grp.objects.get(objectID);
return object.type;
}
}
return null;
} | [
"public",
"String",
"getObjectType",
"(",
"int",
"groupID",
",",
"int",
"objectID",
")",
"{",
"if",
"(",
"groupID",
">=",
"0",
"&&",
"groupID",
"<",
"objectGroups",
".",
"size",
"(",
")",
")",
"{",
"ObjectGroup",
"grp",
"=",
"(",
"ObjectGroup",
")",
"o... | Return the type of an specific object from a specific group.
@param groupID
Index of a group
@param objectID
Index of an object
@return The type of an object or null, when error occurred | [
"Return",
"the",
"type",
"of",
"an",
"specific",
"object",
"from",
"a",
"specific",
"group",
"."
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L826-L835 |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/HelpConverterMojo.java | HelpConverterMojo.registerExternalLoaders | private void registerExternalLoaders() throws MojoExecutionException {
if (archiveLoaders != null) {
for (String entry : archiveLoaders) {
try {
SourceLoader loader = (SourceLoader) Class.forName(entry).newInstance();
registerLoader(loader);
} catch (Exception e) {
throw new MojoExecutionException("Error registering archive loader for class: " + entry, e);
}
}
}
} | java | private void registerExternalLoaders() throws MojoExecutionException {
if (archiveLoaders != null) {
for (String entry : archiveLoaders) {
try {
SourceLoader loader = (SourceLoader) Class.forName(entry).newInstance();
registerLoader(loader);
} catch (Exception e) {
throw new MojoExecutionException("Error registering archive loader for class: " + entry, e);
}
}
}
} | [
"private",
"void",
"registerExternalLoaders",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"archiveLoaders",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"entry",
":",
"archiveLoaders",
")",
"{",
"try",
"{",
"SourceLoader",
"loader",
"=",
"("... | Adds any additional source loaders specified in configuration.
@throws MojoExecutionException Error registering external loader. | [
"Adds",
"any",
"additional",
"source",
"loaders",
"specified",
"in",
"configuration",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/HelpConverterMojo.java#L165-L176 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/XMLViewer.java | XMLViewer.showCWF | public static Window showCWF(BaseComponent root, String... excludedProperties) {
Window window = showXML(CWF2XML.toDocument(root, excludedProperties));
window.setTitle("CWF Markup");
return window;
} | java | public static Window showCWF(BaseComponent root, String... excludedProperties) {
Window window = showXML(CWF2XML.toDocument(root, excludedProperties));
window.setTitle("CWF Markup");
return window;
} | [
"public",
"static",
"Window",
"showCWF",
"(",
"BaseComponent",
"root",
",",
"String",
"...",
"excludedProperties",
")",
"{",
"Window",
"window",
"=",
"showXML",
"(",
"CWF2XML",
".",
"toDocument",
"(",
"root",
",",
"excludedProperties",
")",
")",
";",
"window",... | Display the CWF markup for the component tree rooted at root.
@param root Root component of tree.
@param excludedProperties Excluded properties.
@return The dialog. | [
"Display",
"the",
"CWF",
"markup",
"for",
"the",
"component",
"tree",
"rooted",
"at",
"root",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/XMLViewer.java#L89-L93 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java | MetricContext.contextAwareCounter | public ContextAwareCounter contextAwareCounter(String name, ContextAwareMetricFactory<ContextAwareCounter> factory) {
return this.innerMetricContext.getOrCreate(name, factory);
} | java | public ContextAwareCounter contextAwareCounter(String name, ContextAwareMetricFactory<ContextAwareCounter> factory) {
return this.innerMetricContext.getOrCreate(name, factory);
} | [
"public",
"ContextAwareCounter",
"contextAwareCounter",
"(",
"String",
"name",
",",
"ContextAwareMetricFactory",
"<",
"ContextAwareCounter",
">",
"factory",
")",
"{",
"return",
"this",
".",
"innerMetricContext",
".",
"getOrCreate",
"(",
"name",
",",
"factory",
")",
... | Get a {@link ContextAwareCounter} with a given name.
@param name name of the {@link ContextAwareCounter}
@param factory a {@link ContextAwareMetricFactory} for building {@link ContextAwareCounter}s
@return the {@link ContextAwareCounter} with the given name | [
"Get",
"a",
"{",
"@link",
"ContextAwareCounter",
"}",
"with",
"a",
"given",
"name",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java#L436-L438 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.andHeader | public Response andHeader(HttpString key, String value) {
Objects.requireNonNull(key, Required.KEY.toString());
this.headers.put(key, value);
return this;
} | java | public Response andHeader(HttpString key, String value) {
Objects.requireNonNull(key, Required.KEY.toString());
this.headers.put(key, value);
return this;
} | [
"public",
"Response",
"andHeader",
"(",
"HttpString",
"key",
",",
"String",
"value",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"headers",
".",
"put",
"(",
"key... | Adds an additional header to the request response. If an header
key already exists, it will we overwritten with the latest value.
@param key The header constant from Headers class (e.g. Header.CONTENT_TYPE.toString())
@param value The header value
@return A response object {@link io.mangoo.routing.Response} | [
"Adds",
"an",
"additional",
"header",
"to",
"the",
"request",
"response",
".",
"If",
"an",
"header",
"key",
"already",
"exists",
"it",
"will",
"we",
"overwritten",
"with",
"the",
"latest",
"value",
"."
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L411-L416 |
VueGWT/vue-gwt | processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java | ComponentExposedTypeGenerator.initFieldsValues | private void initFieldsValues(TypeElement component, MethodSpec.Builder createdMethodBuilder) {
// Do not init instance fields for abstract components
if (component.getModifiers().contains(Modifier.ABSTRACT)) {
return;
}
createdMethodBuilder.addStatement(
"$T.initComponentInstanceFields(this, new $T())",
VueGWTTools.class,
component);
} | java | private void initFieldsValues(TypeElement component, MethodSpec.Builder createdMethodBuilder) {
// Do not init instance fields for abstract components
if (component.getModifiers().contains(Modifier.ABSTRACT)) {
return;
}
createdMethodBuilder.addStatement(
"$T.initComponentInstanceFields(this, new $T())",
VueGWTTools.class,
component);
} | [
"private",
"void",
"initFieldsValues",
"(",
"TypeElement",
"component",
",",
"MethodSpec",
".",
"Builder",
"createdMethodBuilder",
")",
"{",
"// Do not init instance fields for abstract components",
"if",
"(",
"component",
".",
"getModifiers",
"(",
")",
".",
"contains",
... | Init fields at creation by using an instance of the Java class
@param component {@link IsVueComponent} to process
@param createdMethodBuilder Builder for our Create method | [
"Init",
"fields",
"at",
"creation",
"by",
"using",
"an",
"instance",
"of",
"the",
"Java",
"class"
] | train | https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L736-L746 |
realtime-framework/RealtimeStorage-Android | library/src/main/java/co/realtime/storage/TableRef.java | TableRef.greaterThan | public TableRef greaterThan(String attributeName, ItemAttribute value){
filters.add(new Filter(StorageFilter.GREATERTHAN, attributeName, value, null));
return this;
} | java | public TableRef greaterThan(String attributeName, ItemAttribute value){
filters.add(new Filter(StorageFilter.GREATERTHAN, attributeName, value, null));
return this;
} | [
"public",
"TableRef",
"greaterThan",
"(",
"String",
"attributeName",
",",
"ItemAttribute",
"value",
")",
"{",
"filters",
".",
"add",
"(",
"new",
"Filter",
"(",
"StorageFilter",
".",
"GREATERTHAN",
",",
"attributeName",
",",
"value",
",",
"null",
")",
")",
";... | Applies a filter to the table. When fetched, it will return the items greater than the filter property value.
<pre>
StorageRef storage = new StorageRef("your_app_key", "your_token");
TableRef tableRef = storage.table("your_table");
// Retrieve all items that have their "itemProperty" value greater than 10
tableRef.greaterThan("itemProperty",new ItemAttribute(10)).getItems(new OnItemSnapshot() {
@Override
public void run(ItemSnapshot itemSnapshot) {
if (itemSnapshot != null) {
Log.d("TableRef", "Item retrieved: " + itemSnapshot.val());
}
}
}, new OnError() {
@Override
public void run(Integer code, String errorMessage) {
Log.e("TableRef", "Error retrieving items: " + errorMessage);
}
});
</pre>
@param attributeName
The name of the property to filter.
@param value
The value of the property to filter.
@return Current table reference | [
"Applies",
"a",
"filter",
"to",
"the",
"table",
".",
"When",
"fetched",
"it",
"will",
"return",
"the",
"items",
"greater",
"than",
"the",
"filter",
"property",
"value",
"."
] | train | https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/TableRef.java#L693-L696 |
js-lib-com/commons | src/main/java/js/converter/TimeZoneConverter.java | TimeZoneConverter.asObject | @Override
public <T> T asObject(String string, Class<T> valueType) {
// at this point value type is guaranteed to be a kind of TimeZone
return (T) TimeZone.getTimeZone(string);
} | java | @Override
public <T> T asObject(String string, Class<T> valueType) {
// at this point value type is guaranteed to be a kind of TimeZone
return (T) TimeZone.getTimeZone(string);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"asObject",
"(",
"String",
"string",
",",
"Class",
"<",
"T",
">",
"valueType",
")",
"{",
"// at this point value type is guaranteed to be a kind of TimeZone\r",
"return",
"(",
"T",
")",
"TimeZone",
".",
"getTimeZone",... | Create time zone instance from time zone ID. If time zone ID is not recognized return UTC. | [
"Create",
"time",
"zone",
"instance",
"from",
"time",
"zone",
"ID",
".",
"If",
"time",
"zone",
"ID",
"is",
"not",
"recognized",
"return",
"UTC",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/TimeZoneConverter.java#L18-L22 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CreditUrl.java | CreditUrl.getCreditUrl | public static MozuUrl getCreditUrl(String code, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/credits/{code}?responseFields={responseFields}");
formatter.formatUrl("code", code);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getCreditUrl(String code, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/credits/{code}?responseFields={responseFields}");
formatter.formatUrl("code", code);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getCreditUrl",
"(",
"String",
"code",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/credits/{code}?responseFields={responseFields}\"",
")",
";",
"formatter",... | Get Resource Url for GetCredit
@param code User-defined code that uniqely identifies the channel group.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetCredit"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CreditUrl.java#L42-L48 |
apiman/apiman | gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/ConfigDrivenComponentRegistry.java | ConfigDrivenComponentRegistry.addComponentMapping | protected void addComponentMapping(Class<? extends IComponent> klazz, IComponent component) {
components.put(klazz, component);
} | java | protected void addComponentMapping(Class<? extends IComponent> klazz, IComponent component) {
components.put(klazz, component);
} | [
"protected",
"void",
"addComponentMapping",
"(",
"Class",
"<",
"?",
"extends",
"IComponent",
">",
"klazz",
",",
"IComponent",
"component",
")",
"{",
"components",
".",
"put",
"(",
"klazz",
",",
"component",
")",
";",
"}"
] | Add a component that may have been instantiated elsewhere.
@param klazz component class
@param component instantiated component of same class | [
"Add",
"a",
"component",
"that",
"may",
"have",
"been",
"instantiated",
"elsewhere",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/ConfigDrivenComponentRegistry.java#L125-L127 |
mucaho/jnetrobust | jnetrobust-core/src/main/java/com/github/mucaho/jnetrobust/util/IdComparator.java | IdComparator.difference | private final static int difference(int seq1, int seq2, int maxSequence) {
int diff = seq1 - seq2;
if (Math.abs(diff) <= maxSequence / 2)
return diff;
else
return (-Integer.signum(diff) * maxSequence) + diff;
} | java | private final static int difference(int seq1, int seq2, int maxSequence) {
int diff = seq1 - seq2;
if (Math.abs(diff) <= maxSequence / 2)
return diff;
else
return (-Integer.signum(diff) * maxSequence) + diff;
} | [
"private",
"final",
"static",
"int",
"difference",
"(",
"int",
"seq1",
",",
"int",
"seq2",
",",
"int",
"maxSequence",
")",
"{",
"int",
"diff",
"=",
"seq1",
"-",
"seq2",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"diff",
")",
"<=",
"maxSequence",
"/",
... | /*
Example: maxSequence = 100; maxSequence/2 = 50;
seq1 = 10;
seq2 = 30;
diff = -20;
abs(-20 ) <= 50 ==> return -20;
seq1 = 30;
seq2 = 10;
diff = 20;
abs(20) <= 50 ==> return 20;
seq1 = 70;
seq2 = 10;
diff = 60;
abs(60) !<= 50 ==> return (-1 * 100) + 60 = -40
seq1 = 10;
seq2 = 70;
diff = -60;
abs(-60) !<= 50 ==> return (--1 * 100) - 60 = 40 | [
"/",
"*",
"Example",
":",
"maxSequence",
"=",
"100",
";",
"maxSequence",
"/",
"2",
"=",
"50",
";",
"seq1",
"=",
"10",
";",
"seq2",
"=",
"30",
";",
"diff",
"=",
"-",
"20",
";",
"abs",
"(",
"-",
"20",
")",
"<",
"=",
"50",
"==",
">",
"return",
... | train | https://github.com/mucaho/jnetrobust/blob/b82150eb2a4371dae9e4f40814cb8f538917c0fb/jnetrobust-core/src/main/java/com/github/mucaho/jnetrobust/util/IdComparator.java#L49-L55 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/Viewport.java | Viewport.viewGlobalArea | public final void viewGlobalArea(double x, double y, double width, double height)
{
if ((width <= 0) || (height <= 0))
{
return;
}
final Transform t = getTransform();
if (null != t)
{
final Point2D a = new Point2D(x, y);
final Point2D b = new Point2D(x + width, y + height);
final Transform inv = t.getInverse();
inv.transform(a, a);
inv.transform(b, b);
x = a.getX();
y = a.getY();
width = b.getX() - x;
height = b.getY() - y;
}
viewLocalArea(x, y, width, height);
} | java | public final void viewGlobalArea(double x, double y, double width, double height)
{
if ((width <= 0) || (height <= 0))
{
return;
}
final Transform t = getTransform();
if (null != t)
{
final Point2D a = new Point2D(x, y);
final Point2D b = new Point2D(x + width, y + height);
final Transform inv = t.getInverse();
inv.transform(a, a);
inv.transform(b, b);
x = a.getX();
y = a.getY();
width = b.getX() - x;
height = b.getY() - y;
}
viewLocalArea(x, y, width, height);
} | [
"public",
"final",
"void",
"viewGlobalArea",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"width",
",",
"double",
"height",
")",
"{",
"if",
"(",
"(",
"width",
"<=",
"0",
")",
"||",
"(",
"height",
"<=",
"0",
")",
")",
"{",
"return",
";",
... | Change the viewport's transform so that the specified area (in global or canvas coordinates)
is visible.
@param x
@param y
@param width
@param height | [
"Change",
"the",
"viewport",
"s",
"transform",
"so",
"that",
"the",
"specified",
"area",
"(",
"in",
"global",
"or",
"canvas",
"coordinates",
")",
"is",
"visible",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Viewport.java#L506-L535 |
shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.containsAll | public static boolean containsAll(final String value, final String[] needles) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Arrays.stream(needles).allMatch(needle -> contains(value, needle, false));
} | java | public static boolean containsAll(final String value, final String[] needles) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Arrays.stream(needles).allMatch(needle -> contains(value, needle, false));
} | [
"public",
"static",
"boolean",
"containsAll",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"[",
"]",
"needles",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"Arrays",
".",
"s... | Verifies that all needles are contained in value. The search is case insensitive
@param value input String to search
@param needles needles to find
@return true if all needles are found else false. | [
"Verifies",
"that",
"all",
"needles",
"are",
"contained",
"in",
"value",
".",
"The",
"search",
"is",
"case",
"insensitive"
] | train | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L180-L183 |
teatrove/teatrove | teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java | FileSystemContext.writeToFile | public void writeToFile(String filePath, String fileData, boolean append)
throws IOException {
// synchronized on an interned string makes has all the
// makings for exclusive write access as far as this
// process is concerned.
String path = (String) Utils.intern(filePath);
synchronized (path) {
File file = null;
FileWriter fileWriter = null;
try {
file = new File(path);
boolean exists = file.exists();
if (!exists) {
exists = file.getParentFile().mkdirs();
exists = file.createNewFile();
}
if (exists) {
fileWriter = new FileWriter(file, append);
fileWriter.write(fileData);
fileWriter.flush();
} else {
String msg =
"File could not be created. (" + filePath + ")";
mLog.error(msg);
throw new IOException(msg);
}
} catch (IOException e) {
mLog.error("Error writing: " + filePath);
mLog.error(e);
throw e;
} finally {
if (fileWriter != null) {
fileWriter.close();
}
}
}
} | java | public void writeToFile(String filePath, String fileData, boolean append)
throws IOException {
// synchronized on an interned string makes has all the
// makings for exclusive write access as far as this
// process is concerned.
String path = (String) Utils.intern(filePath);
synchronized (path) {
File file = null;
FileWriter fileWriter = null;
try {
file = new File(path);
boolean exists = file.exists();
if (!exists) {
exists = file.getParentFile().mkdirs();
exists = file.createNewFile();
}
if (exists) {
fileWriter = new FileWriter(file, append);
fileWriter.write(fileData);
fileWriter.flush();
} else {
String msg =
"File could not be created. (" + filePath + ")";
mLog.error(msg);
throw new IOException(msg);
}
} catch (IOException e) {
mLog.error("Error writing: " + filePath);
mLog.error(e);
throw e;
} finally {
if (fileWriter != null) {
fileWriter.close();
}
}
}
} | [
"public",
"void",
"writeToFile",
"(",
"String",
"filePath",
",",
"String",
"fileData",
",",
"boolean",
"append",
")",
"throws",
"IOException",
"{",
"// synchronized on an interned string makes has all the",
"// makings for exclusive write access as far as this",
"// process is co... | Write the contents of the given file data to the file at the given path.
If the append flag is <code>true</code>, the file data will be appended
to the end of the file if it already exists. Note that this will attempt
to create any and all parent directories if the path does not exist.
@param filePath The path to the file to write to
@param fileData The data to write to the given file
@param append Whether to append the file data or replace existing data
@throws IOException if an error occurs writing the data | [
"Write",
"the",
"contents",
"of",
"the",
"given",
"file",
"data",
"to",
"the",
"file",
"at",
"the",
"given",
"path",
".",
"If",
"the",
"append",
"flag",
"is",
"<code",
">",
"true<",
"/",
"code",
">",
"the",
"file",
"data",
"will",
"be",
"appended",
"... | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java#L268-L305 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.putAsync | public CompletableFuture<Object> putAsync(final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> put(configuration), getExecutor());
} | java | public CompletableFuture<Object> putAsync(final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> put(configuration), getExecutor());
} | [
"public",
"CompletableFuture",
"<",
"Object",
">",
"putAsync",
"(",
"final",
"Consumer",
"<",
"HttpConfig",
">",
"configuration",
")",
"{",
"return",
"CompletableFuture",
".",
"supplyAsync",
"(",
"(",
")",
"->",
"put",
"(",
"configuration",
")",
",",
"getExecu... | Executes an asynchronous PUT request on the configured URI (asynchronous alias to `put(Consumer)`), with additional configuration provided by the
configuration function.
This method is generally used for Java-specific configuration.
[source,java]
----
HttpBuilder http = HttpBuilder.configure(config -> {
config.getRequest().setUri("http://localhost:10101");
});
CompletableFuture<Object> future = http.putAsync(config -> {
config.getRequest().getUri().setPath("/foo");
});
Object result = future.get();
----
The `configuration` function allows additional configuration for this request based on the {@link HttpConfig} interface.
@param configuration the additional configuration closure (delegated to {@link HttpConfig})
@return the resulting content wrapped in a {@link CompletableFuture} | [
"Executes",
"an",
"asynchronous",
"PUT",
"request",
"on",
"the",
"configured",
"URI",
"(",
"asynchronous",
"alias",
"to",
"put",
"(",
"Consumer",
")",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configuration",
"function",
"."
] | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1025-L1027 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.sshKey_keyName_PUT | public void sshKey_keyName_PUT(String keyName, OvhSshKey body) throws IOException {
String qPath = "/me/sshKey/{keyName}";
StringBuilder sb = path(qPath, keyName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void sshKey_keyName_PUT(String keyName, OvhSshKey body) throws IOException {
String qPath = "/me/sshKey/{keyName}";
StringBuilder sb = path(qPath, keyName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"sshKey_keyName_PUT",
"(",
"String",
"keyName",
",",
"OvhSshKey",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/sshKey/{keyName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"keyName",
")",
";",
... | Alter this object properties
REST: PUT /me/sshKey/{keyName}
@param body [required] New object properties
@param keyName [required] Name of this public SSH key | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1306-L1310 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java | FileOperations.getFileFromComputeNode | public void getFileFromComputeNode(String poolId, String nodeId, String fileName, OutputStream outputStream) throws BatchErrorException, IOException {
getFileFromComputeNode(poolId, nodeId, fileName, null, outputStream);
} | java | public void getFileFromComputeNode(String poolId, String nodeId, String fileName, OutputStream outputStream) throws BatchErrorException, IOException {
getFileFromComputeNode(poolId, nodeId, fileName, null, outputStream);
} | [
"public",
"void",
"getFileFromComputeNode",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"fileName",
",",
"OutputStream",
"outputStream",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"getFileFromComputeNode",
"(",
"poolId",
",",
... | Downloads the specified file from the specified compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node.
@param fileName The name of the file to download.
@param outputStream A stream into which the file contents will be written.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Downloads",
"the",
"specified",
"file",
"from",
"the",
"specified",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L297-L299 |
ops4j/org.ops4j.pax.wicket | service/src/main/java/org/ops4j/pax/wicket/api/support/DefaultPageMounter.java | DefaultPageMounter.dispose | public void dispose() {
synchronized (this) {
if (serviceRegistration == null) {
throw new IllegalStateException(String.format("%s [%s] had not been registered.", getClass()
.getSimpleName(), this));
}
serviceRegistration.unregister();
serviceRegistration = null;
}
} | java | public void dispose() {
synchronized (this) {
if (serviceRegistration == null) {
throw new IllegalStateException(String.format("%s [%s] had not been registered.", getClass()
.getSimpleName(), this));
}
serviceRegistration.unregister();
serviceRegistration = null;
}
} | [
"public",
"void",
"dispose",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"serviceRegistration",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"\"%s [%s] had not been registered.\"",
",",
... | Automatically unregister the {@link org.ops4j.pax.wicket.api.PageMounter} from the OSGi registry | [
"Automatically",
"unregister",
"the",
"{"
] | train | https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/api/support/DefaultPageMounter.java#L87-L96 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java | ByteArrayUtil.writeDouble | public static int writeDouble(byte[] array, int offset, double v) {
return writeLong(array, offset, Double.doubleToLongBits(v));
} | java | public static int writeDouble(byte[] array, int offset, double v) {
return writeLong(array, offset, Double.doubleToLongBits(v));
} | [
"public",
"static",
"int",
"writeDouble",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"double",
"v",
")",
"{",
"return",
"writeLong",
"(",
"array",
",",
"offset",
",",
"Double",
".",
"doubleToLongBits",
"(",
"v",
")",
")",
";",
"}"
] | Write a double to the byte array at the given offset.
@param array Array to write to
@param offset Offset to write to
@param v data
@return number of bytes written | [
"Write",
"a",
"double",
"to",
"the",
"byte",
"array",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java#L168-L170 |
joniles/mpxj | src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java | ProjectTreeController.addHours | private void addHours(MpxjTreeNode parentNode, ProjectCalendarDateRanges hours)
{
for (DateRange range : hours)
{
final DateRange r = range;
MpxjTreeNode rangeNode = new MpxjTreeNode(range)
{
@Override public String toString()
{
return m_timeFormat.format(r.getStart()) + " - " + m_timeFormat.format(r.getEnd());
}
};
parentNode.add(rangeNode);
}
} | java | private void addHours(MpxjTreeNode parentNode, ProjectCalendarDateRanges hours)
{
for (DateRange range : hours)
{
final DateRange r = range;
MpxjTreeNode rangeNode = new MpxjTreeNode(range)
{
@Override public String toString()
{
return m_timeFormat.format(r.getStart()) + " - " + m_timeFormat.format(r.getEnd());
}
};
parentNode.add(rangeNode);
}
} | [
"private",
"void",
"addHours",
"(",
"MpxjTreeNode",
"parentNode",
",",
"ProjectCalendarDateRanges",
"hours",
")",
"{",
"for",
"(",
"DateRange",
"range",
":",
"hours",
")",
"{",
"final",
"DateRange",
"r",
"=",
"range",
";",
"MpxjTreeNode",
"rangeNode",
"=",
"ne... | Add hours to a parent object.
@param parentNode parent node
@param hours list of ranges | [
"Add",
"hours",
"to",
"a",
"parent",
"object",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L311-L325 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.getOperationStatus | public OperationStatusResponseInner getOperationStatus(String userName, String operationUrl) {
return getOperationStatusWithServiceResponseAsync(userName, operationUrl).toBlocking().single().body();
} | java | public OperationStatusResponseInner getOperationStatus(String userName, String operationUrl) {
return getOperationStatusWithServiceResponseAsync(userName, operationUrl).toBlocking().single().body();
} | [
"public",
"OperationStatusResponseInner",
"getOperationStatus",
"(",
"String",
"userName",
",",
"String",
"operationUrl",
")",
"{",
"return",
"getOperationStatusWithServiceResponseAsync",
"(",
"userName",
",",
"operationUrl",
")",
".",
"toBlocking",
"(",
")",
".",
"sing... | Gets the status of long running operation.
@param userName The name of the user.
@param operationUrl The operation url of long running operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatusResponseInner object if successful. | [
"Gets",
"the",
"status",
"of",
"long",
"running",
"operation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L382-L384 |
rometools/rome | rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedCollection.java | FileBasedCollection.createFileName | private String createFileName(final String title, final String contentType) {
if (handle == null) {
throw new IllegalArgumentException("weblog handle cannot be null");
}
if (contentType == null) {
throw new IllegalArgumentException("contentType cannot be null");
}
String fileName = null;
final SimpleDateFormat sdf = new SimpleDateFormat();
sdf.applyPattern("yyyyMMddHHssSSS");
// Determine the extension based on the contentType. This is a hack.
// The info we need to map from contentType to file extension is in
// JRE/lib/content-type.properties, but Java Activation doesn't provide
// a way to do a reverse mapping or to get at the data.
final String[] typeTokens = contentType.split("/");
final String ext = typeTokens[1];
if (title != null && !title.trim().equals("")) {
// We've got a title, so use it to build file name
final String base = Utilities.replaceNonAlphanumeric(title, ' ');
final StringTokenizer toker = new StringTokenizer(base);
String tmp = null;
int count = 0;
while (toker.hasMoreTokens() && count < 5) {
String s = toker.nextToken();
s = s.toLowerCase();
tmp = tmp == null ? s : tmp + "_" + s;
count++;
}
fileName = tmp + "-" + sdf.format(new Date()) + "." + ext;
} else {
// No title or text, so instead we'll use the item's date
// in YYYYMMDD format to form the file name
fileName = handle + "-" + sdf.format(new Date()) + "." + ext;
}
return fileName;
} | java | private String createFileName(final String title, final String contentType) {
if (handle == null) {
throw new IllegalArgumentException("weblog handle cannot be null");
}
if (contentType == null) {
throw new IllegalArgumentException("contentType cannot be null");
}
String fileName = null;
final SimpleDateFormat sdf = new SimpleDateFormat();
sdf.applyPattern("yyyyMMddHHssSSS");
// Determine the extension based on the contentType. This is a hack.
// The info we need to map from contentType to file extension is in
// JRE/lib/content-type.properties, but Java Activation doesn't provide
// a way to do a reverse mapping or to get at the data.
final String[] typeTokens = contentType.split("/");
final String ext = typeTokens[1];
if (title != null && !title.trim().equals("")) {
// We've got a title, so use it to build file name
final String base = Utilities.replaceNonAlphanumeric(title, ' ');
final StringTokenizer toker = new StringTokenizer(base);
String tmp = null;
int count = 0;
while (toker.hasMoreTokens() && count < 5) {
String s = toker.nextToken();
s = s.toLowerCase();
tmp = tmp == null ? s : tmp + "_" + s;
count++;
}
fileName = tmp + "-" + sdf.format(new Date()) + "." + ext;
} else {
// No title or text, so instead we'll use the item's date
// in YYYYMMDD format to form the file name
fileName = handle + "-" + sdf.format(new Date()) + "." + ext;
}
return fileName;
} | [
"private",
"String",
"createFileName",
"(",
"final",
"String",
"title",
",",
"final",
"String",
"contentType",
")",
"{",
"if",
"(",
"handle",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"weblog handle cannot be null\"",
")",
";",
"... | Creates a file name for a file based on a weblog handle, title string and a content-type.
@param handle Weblog handle
@param title Title to be used as basis for file name (or null)
@param contentType Content type of file (must not be null)
If a title is specified, the method will apply the same create-anchor logic we use
for weblog entries to create a file name based on the title.
If title is null, the base file name will be the weblog handle plus a YYYYMMDDHHSS
timestamp.
The extension will be formed by using the part of content type that comes after he
slash.
For example: weblog.handle = "daveblog" title = "Port Antonio" content-type =
"image/jpg" Would result in port_antonio.jpg
Another example: weblog.handle = "daveblog" title = null content-type =
"image/jpg" Might result in daveblog-200608201034.jpg | [
"Creates",
"a",
"file",
"name",
"for",
"a",
"file",
"based",
"on",
"a",
"weblog",
"handle",
"title",
"string",
"and",
"a",
"content",
"-",
"type",
"."
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedCollection.java#L699-L741 |
icode/ameba | src/main/java/ameba/websocket/internal/LocalizationMessages.java | LocalizationMessages.ENDPOINT_MAX_MESSAGE_SIZE_TOO_LONG | public static String ENDPOINT_MAX_MESSAGE_SIZE_TOO_LONG(Object arg0, Object arg1, Object arg2, Object arg3) {
return localizer.localize(localizableENDPOINT_MAX_MESSAGE_SIZE_TOO_LONG(arg0, arg1, arg2, arg3));
} | java | public static String ENDPOINT_MAX_MESSAGE_SIZE_TOO_LONG(Object arg0, Object arg1, Object arg2, Object arg3) {
return localizer.localize(localizableENDPOINT_MAX_MESSAGE_SIZE_TOO_LONG(arg0, arg1, arg2, arg3));
} | [
"public",
"static",
"String",
"ENDPOINT_MAX_MESSAGE_SIZE_TOO_LONG",
"(",
"Object",
"arg0",
",",
"Object",
"arg1",
",",
"Object",
"arg2",
",",
"Object",
"arg3",
")",
"{",
"return",
"localizer",
".",
"localize",
"(",
"localizableENDPOINT_MAX_MESSAGE_SIZE_TOO_LONG",
"(",... | MaxMessageSize {0} on method {1} in endpoint {2} is larger than the container incoming buffer size {3}. | [
"MaxMessageSize",
"{",
"0",
"}",
"on",
"method",
"{",
"1",
"}",
"in",
"endpoint",
"{",
"2",
"}",
"is",
"larger",
"than",
"the",
"container",
"incoming",
"buffer",
"size",
"{",
"3",
"}",
"."
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/websocket/internal/LocalizationMessages.java#L33-L35 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NamespacesInner.java | NamespacesInner.listKeysAsync | public Observable<SharedAccessAuthorizationRuleListResultInner> listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) {
return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1<ServiceResponse<SharedAccessAuthorizationRuleListResultInner>, SharedAccessAuthorizationRuleListResultInner>() {
@Override
public SharedAccessAuthorizationRuleListResultInner call(ServiceResponse<SharedAccessAuthorizationRuleListResultInner> response) {
return response.body();
}
});
} | java | public Observable<SharedAccessAuthorizationRuleListResultInner> listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) {
return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1<ServiceResponse<SharedAccessAuthorizationRuleListResultInner>, SharedAccessAuthorizationRuleListResultInner>() {
@Override
public SharedAccessAuthorizationRuleListResultInner call(ServiceResponse<SharedAccessAuthorizationRuleListResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SharedAccessAuthorizationRuleListResultInner",
">",
"listKeysAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
",",
"String",
"authorizationRuleName",
")",
"{",
"return",
"listKeysWithServiceResponseAsync",
"(",
"resourc... | Gets the Primary and Secondary ConnectionStrings to the namespace.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param authorizationRuleName The connection string of the namespace for the specified authorizationRule.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SharedAccessAuthorizationRuleListResultInner object | [
"Gets",
"the",
"Primary",
"and",
"Secondary",
"ConnectionStrings",
"to",
"the",
"namespace",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NamespacesInner.java#L1327-L1334 |
deeplearning4j/deeplearning4j | gym-java-client/src/main/java/org/deeplearning4j/gym/Client.java | Client.monitorStart | public void monitorStart(String directory, boolean force, boolean resume) {
JSONObject json = new JSONObject().put("directory", directory).put("force", force).put("resume", resume);
monitorStartPost(json);
} | java | public void monitorStart(String directory, boolean force, boolean resume) {
JSONObject json = new JSONObject().put("directory", directory).put("force", force).put("resume", resume);
monitorStartPost(json);
} | [
"public",
"void",
"monitorStart",
"(",
"String",
"directory",
",",
"boolean",
"force",
",",
"boolean",
"resume",
")",
"{",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
")",
".",
"put",
"(",
"\"directory\"",
",",
"directory",
")",
".",
"put",
"(",
... | Start monitoring.
@param directory path to directory in which store the monitoring file
@param force clear out existing training data from this directory (by deleting every file prefixed with "openaigym.")
@param resume retain the training data already in this directory, which will be merged with our new data | [
"Start",
"monitoring",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/gym-java-client/src/main/java/org/deeplearning4j/gym/Client.java#L139-L143 |
the-fascinator/plugin-indexer-solr | src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java | SolrIndexer.addToBuffer | private void addToBuffer(String index, String document) {
JsonObject message = new JsonObject();
message.put("event", "index");
message.put("index", index);
message.put("document", document);
sendToIndex(message.toString());
} | java | private void addToBuffer(String index, String document) {
JsonObject message = new JsonObject();
message.put("event", "index");
message.put("index", index);
message.put("document", document);
sendToIndex(message.toString());
} | [
"private",
"void",
"addToBuffer",
"(",
"String",
"index",
",",
"String",
"document",
")",
"{",
"JsonObject",
"message",
"=",
"new",
"JsonObject",
"(",
")",
";",
"message",
".",
"put",
"(",
"\"event\"",
",",
"\"index\"",
")",
";",
"message",
".",
"put",
"... | Add a new document into the buffer, and check if submission is required
@param document
: The Solr document to add to the buffer. | [
"Add",
"a",
"new",
"document",
"into",
"the",
"buffer",
"and",
"check",
"if",
"submission",
"is",
"required"
] | train | https://github.com/the-fascinator/plugin-indexer-solr/blob/001159b18b78a87daa5d8b2a17ced28694bae156/src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java#L815-L821 |
apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleClient.java | ExternalShuffleClient.registerWithShuffleServer | public void registerWithShuffleServer(
String host,
int port,
String execId,
ExecutorShuffleInfo executorInfo) throws IOException, InterruptedException {
checkInit();
try (TransportClient client = clientFactory.createUnmanagedClient(host, port)) {
ByteBuffer registerMessage = new RegisterExecutor(appId, execId, executorInfo).toByteBuffer();
client.sendRpcSync(registerMessage, registrationTimeoutMs);
}
} | java | public void registerWithShuffleServer(
String host,
int port,
String execId,
ExecutorShuffleInfo executorInfo) throws IOException, InterruptedException {
checkInit();
try (TransportClient client = clientFactory.createUnmanagedClient(host, port)) {
ByteBuffer registerMessage = new RegisterExecutor(appId, execId, executorInfo).toByteBuffer();
client.sendRpcSync(registerMessage, registrationTimeoutMs);
}
} | [
"public",
"void",
"registerWithShuffleServer",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"execId",
",",
"ExecutorShuffleInfo",
"executorInfo",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"checkInit",
"(",
")",
";",
"try",
"(",
... | Registers this executor with an external shuffle server. This registration is required to
inform the shuffle server about where and how we store our shuffle files.
@param host Host of shuffle server.
@param port Port of shuffle server.
@param execId This Executor's id.
@param executorInfo Contains all info necessary for the service to find our shuffle files. | [
"Registers",
"this",
"executor",
"with",
"an",
"external",
"shuffle",
"server",
".",
"This",
"registration",
"is",
"required",
"to",
"inform",
"the",
"shuffle",
"server",
"about",
"where",
"and",
"how",
"we",
"store",
"our",
"shuffle",
"files",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleClient.java#L136-L146 |
infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/Annotateds.java | Annotateds.createParameterId | public static <X> String createParameterId(Type type, Set<Annotation> annotations) {
StringBuilder builder = new StringBuilder();
if (type instanceof Class<?>) {
Class<?> c = (Class<?>) type;
builder.append(c.getName());
} else {
builder.append(type.toString());
}
builder.append(createAnnotationCollectionId(annotations));
return builder.toString();
} | java | public static <X> String createParameterId(Type type, Set<Annotation> annotations) {
StringBuilder builder = new StringBuilder();
if (type instanceof Class<?>) {
Class<?> c = (Class<?>) type;
builder.append(c.getName());
} else {
builder.append(type.toString());
}
builder.append(createAnnotationCollectionId(annotations));
return builder.toString();
} | [
"public",
"static",
"<",
"X",
">",
"String",
"createParameterId",
"(",
"Type",
"type",
",",
"Set",
"<",
"Annotation",
">",
"annotations",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"type",
"instanceof",
"Cl... | Creates a string representation of a given type and set of annotations. | [
"Creates",
"a",
"string",
"representation",
"of",
"a",
"given",
"type",
"and",
"set",
"of",
"annotations",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/Annotateds.java#L288-L298 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/ICU.java | ICU.getCurrencySymbol | public static String getCurrencySymbol(Locale locale, String currencyCode) {
return getCurrencySymbol(locale.toLanguageTag(), currencyCode);
} | java | public static String getCurrencySymbol(Locale locale, String currencyCode) {
return getCurrencySymbol(locale.toLanguageTag(), currencyCode);
} | [
"public",
"static",
"String",
"getCurrencySymbol",
"(",
"Locale",
"locale",
",",
"String",
"currencyCode",
")",
"{",
"return",
"getCurrencySymbol",
"(",
"locale",
".",
"toLanguageTag",
"(",
")",
",",
"currencyCode",
")",
";",
"}"
] | public static native int getCurrencyNumericCode(String currencyCode); J2ObjC unused. | [
"public",
"static",
"native",
"int",
"getCurrencyNumericCode",
"(",
"String",
"currencyCode",
")",
";",
"J2ObjC",
"unused",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/ICU.java#L411-L413 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/Widgets.java | Widgets.makeActionLabel | public static Label makeActionLabel (Label label, ClickHandler onClick)
{
return makeActionable(label, onClick, null);
} | java | public static Label makeActionLabel (Label label, ClickHandler onClick)
{
return makeActionable(label, onClick, null);
} | [
"public",
"static",
"Label",
"makeActionLabel",
"(",
"Label",
"label",
",",
"ClickHandler",
"onClick",
")",
"{",
"return",
"makeActionable",
"(",
"label",
",",
"onClick",
",",
"null",
")",
";",
"}"
] | Makes the supplied label into an action label. The label will be styled such that it
configures the mouse pointer and adds underline to the text. | [
"Makes",
"the",
"supplied",
"label",
"into",
"an",
"action",
"label",
".",
"The",
"label",
"will",
"be",
"styled",
"such",
"that",
"it",
"configures",
"the",
"mouse",
"pointer",
"and",
"adds",
"underline",
"to",
"the",
"text",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L213-L216 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java | MapBasedXPathFunctionResolver.addAllFrom | @Nonnull
public EChange addAllFrom (@Nonnull final MapBasedXPathFunctionResolver aOther, final boolean bOverwrite)
{
ValueEnforcer.notNull (aOther, "Other");
EChange eChange = EChange.UNCHANGED;
for (final Map.Entry <XPathFunctionKey, XPathFunction> aEntry : aOther.m_aMap.entrySet ())
if (bOverwrite || !m_aMap.containsKey (aEntry.getKey ()))
{
m_aMap.put (aEntry.getKey (), aEntry.getValue ());
eChange = EChange.CHANGED;
}
return eChange;
} | java | @Nonnull
public EChange addAllFrom (@Nonnull final MapBasedXPathFunctionResolver aOther, final boolean bOverwrite)
{
ValueEnforcer.notNull (aOther, "Other");
EChange eChange = EChange.UNCHANGED;
for (final Map.Entry <XPathFunctionKey, XPathFunction> aEntry : aOther.m_aMap.entrySet ())
if (bOverwrite || !m_aMap.containsKey (aEntry.getKey ()))
{
m_aMap.put (aEntry.getKey (), aEntry.getValue ());
eChange = EChange.CHANGED;
}
return eChange;
} | [
"@",
"Nonnull",
"public",
"EChange",
"addAllFrom",
"(",
"@",
"Nonnull",
"final",
"MapBasedXPathFunctionResolver",
"aOther",
",",
"final",
"boolean",
"bOverwrite",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aOther",
",",
"\"Other\"",
")",
";",
"EChange",
"e... | Add all functions from the other function resolver into this resolver.
@param aOther
The function resolver to import the functions from. May not be
<code>null</code>.
@param bOverwrite
if <code>true</code> existing functions will be overwritten with the
new functions, otherwise the old functions are kept.
@return {@link EChange} | [
"Add",
"all",
"functions",
"from",
"the",
"other",
"function",
"resolver",
"into",
"this",
"resolver",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java#L129-L141 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcHttpAsyncClient.java | JsonRpcHttpAsyncClient.doInvoke | @SuppressWarnings("unchecked")
private <T> Future<T> doInvoke(String methodName, Object argument, Class<T> returnType, Map<String, String> extraHeaders, JsonRpcCallback<T> callback) {
String path = serviceUrl.getPath() + (serviceUrl.getQuery() != null ? "?" + serviceUrl.getQuery() : "");
int port = serviceUrl.getPort() != -1 ? serviceUrl.getPort() : serviceUrl.getDefaultPort();
HttpRequest request = new BasicHttpEntityEnclosingRequest("POST", path);
addHeaders(request, headers);
addHeaders(request, extraHeaders);
try {
writeRequest(methodName, argument, request);
} catch (IOException e) {
callback.onError(e);
}
HttpHost target = new HttpHost(serviceUrl.getHost(), port, serviceUrl.getProtocol());
BasicAsyncRequestProducer asyncRequestProducer = new BasicAsyncRequestProducer(target, request);
BasicAsyncResponseConsumer asyncResponseConsumer = new BasicAsyncResponseConsumer();
RequestAsyncFuture<T> futureCallback = new RequestAsyncFuture<>(returnType, callback);
BasicHttpContext httpContext = new BasicHttpContext();
requester.execute(asyncRequestProducer, asyncResponseConsumer, pool, httpContext, futureCallback);
return (callback instanceof JsonRpcFuture ? (Future<T>) callback : null);
} | java | @SuppressWarnings("unchecked")
private <T> Future<T> doInvoke(String methodName, Object argument, Class<T> returnType, Map<String, String> extraHeaders, JsonRpcCallback<T> callback) {
String path = serviceUrl.getPath() + (serviceUrl.getQuery() != null ? "?" + serviceUrl.getQuery() : "");
int port = serviceUrl.getPort() != -1 ? serviceUrl.getPort() : serviceUrl.getDefaultPort();
HttpRequest request = new BasicHttpEntityEnclosingRequest("POST", path);
addHeaders(request, headers);
addHeaders(request, extraHeaders);
try {
writeRequest(methodName, argument, request);
} catch (IOException e) {
callback.onError(e);
}
HttpHost target = new HttpHost(serviceUrl.getHost(), port, serviceUrl.getProtocol());
BasicAsyncRequestProducer asyncRequestProducer = new BasicAsyncRequestProducer(target, request);
BasicAsyncResponseConsumer asyncResponseConsumer = new BasicAsyncResponseConsumer();
RequestAsyncFuture<T> futureCallback = new RequestAsyncFuture<>(returnType, callback);
BasicHttpContext httpContext = new BasicHttpContext();
requester.execute(asyncRequestProducer, asyncResponseConsumer, pool, httpContext, futureCallback);
return (callback instanceof JsonRpcFuture ? (Future<T>) callback : null);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"doInvoke",
"(",
"String",
"methodName",
",",
"Object",
"argument",
",",
"Class",
"<",
"T",
">",
"returnType",
",",
"Map",
"<",
"String",
",",
"String"... | Invokes the given method with the given arguments and invokes the
{@code JsonRpcCallback} with the result cast to the given
{@code returnType}, or null if void. The {@code extraHeaders} are added
to the request.
@param methodName the name of the method to invoke
@param argument the arguments to the method
@param extraHeaders extra headers to add to the request
@param returnType the return type
@param callback the {@code JsonRpcCallback} | [
"Invokes",
"the",
"given",
"method",
"with",
"the",
"given",
"arguments",
"and",
"invokes",
"the",
"{",
"@code",
"JsonRpcCallback",
"}",
"with",
"the",
"result",
"cast",
"to",
"the",
"given",
"{",
"@code",
"returnType",
"}",
"or",
"null",
"if",
"void",
"."... | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcHttpAsyncClient.java#L227-L253 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/Interval.java | Interval.toInterval | public static <E extends Comparable<E>> Interval<E> toInterval(E a, E b) {
return toInterval(a,b,0);
} | java | public static <E extends Comparable<E>> Interval<E> toInterval(E a, E b) {
return toInterval(a,b,0);
} | [
"public",
"static",
"<",
"E",
"extends",
"Comparable",
"<",
"E",
">",
">",
"Interval",
"<",
"E",
">",
"toInterval",
"(",
"E",
"a",
",",
"E",
"b",
")",
"{",
"return",
"toInterval",
"(",
"a",
",",
"b",
",",
"0",
")",
";",
"}"
] | Create an interval with the specified endpoints in the specified order,
Returns null if a does not come before b (invalid interval)
@param a start endpoints
@param b end endpoint
@param <E> type of the interval endpoints
@return Interval with endpoints in specified order, null if a does not come before b | [
"Create",
"an",
"interval",
"with",
"the",
"specified",
"endpoints",
"in",
"the",
"specified",
"order",
"Returns",
"null",
"if",
"a",
"does",
"not",
"come",
"before",
"b",
"(",
"invalid",
"interval",
")"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Interval.java#L339-L341 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/r/interpolation2d/core/TPSInterpolator.java | TPSInterpolator.calculateFunctionU | private double calculateFunctionU( Coordinate p_i, Coordinate p_j ) {
double distance = p_i.distance(p_j);
return functionU(distance);
} | java | private double calculateFunctionU( Coordinate p_i, Coordinate p_j ) {
double distance = p_i.distance(p_j);
return functionU(distance);
} | [
"private",
"double",
"calculateFunctionU",
"(",
"Coordinate",
"p_i",
",",
"Coordinate",
"p_j",
")",
"{",
"double",
"distance",
"=",
"p_i",
".",
"distance",
"(",
"p_j",
")",
";",
"return",
"functionU",
"(",
"distance",
")",
";",
"}"
] | Calculates U function where distance = ||p<sub>i</sub>, p<sub>j</sub>|| (from source points)
@param p_i p_i
@param p_j p_j
@return log(distance)*distance<sub>2</sub> or 0 if distance = 0 | [
"Calculates",
"U",
"function",
"where",
"distance",
"=",
"||p<sub",
">",
"i<",
"/",
"sub",
">",
"p<sub",
">",
"j<",
"/",
"sub",
">",
"||",
"(",
"from",
"source",
"points",
")"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/interpolation2d/core/TPSInterpolator.java#L108-L111 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.setBlockAppearance | public void setBlockAppearance(StoredBlock block, boolean bestChain, int relativityOffset) {
long blockTime = block.getHeader().getTimeSeconds() * 1000;
if (bestChain && (updatedAt == null || updatedAt.getTime() == 0 || updatedAt.getTime() > blockTime)) {
updatedAt = new Date(blockTime);
}
addBlockAppearance(block.getHeader().getHash(), relativityOffset);
if (bestChain) {
TransactionConfidence transactionConfidence = getConfidence();
// This sets type to BUILDING and depth to one.
transactionConfidence.setAppearedAtChainHeight(block.getHeight());
}
} | java | public void setBlockAppearance(StoredBlock block, boolean bestChain, int relativityOffset) {
long blockTime = block.getHeader().getTimeSeconds() * 1000;
if (bestChain && (updatedAt == null || updatedAt.getTime() == 0 || updatedAt.getTime() > blockTime)) {
updatedAt = new Date(blockTime);
}
addBlockAppearance(block.getHeader().getHash(), relativityOffset);
if (bestChain) {
TransactionConfidence transactionConfidence = getConfidence();
// This sets type to BUILDING and depth to one.
transactionConfidence.setAppearedAtChainHeight(block.getHeight());
}
} | [
"public",
"void",
"setBlockAppearance",
"(",
"StoredBlock",
"block",
",",
"boolean",
"bestChain",
",",
"int",
"relativityOffset",
")",
"{",
"long",
"blockTime",
"=",
"block",
".",
"getHeader",
"(",
")",
".",
"getTimeSeconds",
"(",
")",
"*",
"1000",
";",
"if"... | <p>Puts the given block in the internal set of blocks in which this transaction appears. This is
used by the wallet to ensure transactions that appear on side chains are recorded properly even though the
block stores do not save the transaction data at all.</p>
<p>If there is a re-org this will be called once for each block that was previously seen, to update which block
is the best chain. The best chain block is guaranteed to be called last. So this must be idempotent.</p>
<p>Sets updatedAt to be the earliest valid block time where this tx was seen.</p>
@param block The {@link StoredBlock} in which the transaction has appeared.
@param bestChain whether to set the updatedAt timestamp from the block header (only if not already set)
@param relativityOffset A number that disambiguates the order of transactions within a block. | [
"<p",
">",
"Puts",
"the",
"given",
"block",
"in",
"the",
"internal",
"set",
"of",
"blocks",
"in",
"which",
"this",
"transaction",
"appears",
".",
"This",
"is",
"used",
"by",
"the",
"wallet",
"to",
"ensure",
"transactions",
"that",
"appear",
"on",
"side",
... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L394-L407 |
bartprokop/rxtx | src/main/java/name/prokop/bart/rxtx/Demo1.java | Demo1.getSerialPort | public static SerialPort getSerialPort(String portName) throws IOException {
try {
CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(portName);
//Enumeration portList = CommPortIdentifier.getPortIdentifiers();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals(portName)) {
return (SerialPort) portId.open("Bart Prokop Comm Helper", 3000);
}
}
} catch (NoSuchPortException e) {
throw new IOException("NoSuchPortException @ " + portName, e);
} catch (PortInUseException e) {
throw new IOException("PortInUseException @ " + portName, e);
}
throw new IOException("To nie jest port szeregowy");
} | java | public static SerialPort getSerialPort(String portName) throws IOException {
try {
CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(portName);
//Enumeration portList = CommPortIdentifier.getPortIdentifiers();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals(portName)) {
return (SerialPort) portId.open("Bart Prokop Comm Helper", 3000);
}
}
} catch (NoSuchPortException e) {
throw new IOException("NoSuchPortException @ " + portName, e);
} catch (PortInUseException e) {
throw new IOException("PortInUseException @ " + portName, e);
}
throw new IOException("To nie jest port szeregowy");
} | [
"public",
"static",
"SerialPort",
"getSerialPort",
"(",
"String",
"portName",
")",
"throws",
"IOException",
"{",
"try",
"{",
"CommPortIdentifier",
"portId",
"=",
"CommPortIdentifier",
".",
"getPortIdentifier",
"(",
"portName",
")",
";",
"//Enumeration portList = CommPor... | Zwraca <b>otwarty</b> port szeregowy o zadanej nazwie
@return Zwraca port szeregowy o zadanej nazwie
@param portName Nazwa portu
@throws IOException W przypadku, gdy nie uda�o si� otworzy� portu
szeregowego, wraz z opisem. | [
"Zwraca",
"<b",
">",
"otwarty<",
"/",
"b",
">",
"port",
"szeregowy",
"o",
"zadanej",
"nazwie"
] | train | https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/name/prokop/bart/rxtx/Demo1.java#L148-L164 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java | SwingGroovyMethods.getAt | public static AbstractButton getAt(ButtonGroup self, int index) {
int size = self.getButtonCount();
if (index < 0 || index >= size) return null;
Enumeration buttons = self.getElements();
for (int i = 0; i <= index; i++) {
AbstractButton b = (AbstractButton) buttons.nextElement();
if (i == index) return b;
}
return null;
} | java | public static AbstractButton getAt(ButtonGroup self, int index) {
int size = self.getButtonCount();
if (index < 0 || index >= size) return null;
Enumeration buttons = self.getElements();
for (int i = 0; i <= index; i++) {
AbstractButton b = (AbstractButton) buttons.nextElement();
if (i == index) return b;
}
return null;
} | [
"public",
"static",
"AbstractButton",
"getAt",
"(",
"ButtonGroup",
"self",
",",
"int",
"index",
")",
"{",
"int",
"size",
"=",
"self",
".",
"getButtonCount",
"(",
")",
";",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"size",
")",
"return",
"null"... | Support the subscript operator for ButtonGroup.
@param self a ButtonGroup
@param index the index of the AbstractButton to get
@return the button at the given index
@since 1.6.4 | [
"Support",
"the",
"subscript",
"operator",
"for",
"ButtonGroup",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L121-L130 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/CmsGalleryFactory.java | CmsGalleryFactory.createDialog | @SuppressWarnings("unused")
public static CmsGalleryDialog createDialog(I_CmsGalleryHandler galleryHandler, CmsGalleryDataBean data) {
CmsGalleryDialog galleryDialog = new CmsGalleryDialog(galleryHandler);
new CmsGalleryController(new CmsGalleryControllerHandler(galleryDialog), data, null);
return galleryDialog;
} | java | @SuppressWarnings("unused")
public static CmsGalleryDialog createDialog(I_CmsGalleryHandler galleryHandler, CmsGalleryDataBean data) {
CmsGalleryDialog galleryDialog = new CmsGalleryDialog(galleryHandler);
new CmsGalleryController(new CmsGalleryControllerHandler(galleryDialog), data, null);
return galleryDialog;
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"static",
"CmsGalleryDialog",
"createDialog",
"(",
"I_CmsGalleryHandler",
"galleryHandler",
",",
"CmsGalleryDataBean",
"data",
")",
"{",
"CmsGalleryDialog",
"galleryDialog",
"=",
"new",
"CmsGalleryDialog",
"(",
... | Creates a new gallery dialog.<p>
@param galleryHandler the gallery handler
@param data the gallery data
@return the gallery dialog instance | [
"Creates",
"a",
"new",
"gallery",
"dialog",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryFactory.java#L123-L129 |
couchbase/couchbase-lite-java-core | vendor/sqlite/src/java/com/couchbase/lite/internal/database/sqlite/SQLiteConnection.java | SQLiteConnection.dumpUnsafe | void dumpUnsafe(Printer printer, boolean verbose) {
printer.println("Connection #" + mConnectionId + ":");
if (verbose) {
printer.println(" connectionPtr: 0x" + Long.toHexString(mConnectionPtr));
}
printer.println(" isPrimaryConnection: " + mIsPrimaryConnection);
printer.println(" onlyAllowReadOnlyOperations: " + mOnlyAllowReadOnlyOperations);
mRecentOperations.dump(printer, verbose);
} | java | void dumpUnsafe(Printer printer, boolean verbose) {
printer.println("Connection #" + mConnectionId + ":");
if (verbose) {
printer.println(" connectionPtr: 0x" + Long.toHexString(mConnectionPtr));
}
printer.println(" isPrimaryConnection: " + mIsPrimaryConnection);
printer.println(" onlyAllowReadOnlyOperations: " + mOnlyAllowReadOnlyOperations);
mRecentOperations.dump(printer, verbose);
} | [
"void",
"dumpUnsafe",
"(",
"Printer",
"printer",
",",
"boolean",
"verbose",
")",
"{",
"printer",
".",
"println",
"(",
"\"Connection #\"",
"+",
"mConnectionId",
"+",
"\":\"",
")",
";",
"if",
"(",
"verbose",
")",
"{",
"printer",
".",
"println",
"(",
"\" con... | Dumps debugging information about this connection, in the case where the
caller might not actually own the connection.
This function is written so that it may be called by a thread that does not
own the connection. We need to be very careful because the connection state is
not synchronized.
At worst, the method may return stale or slightly wrong data, however
it should not crash. This is ok as it is only used for diagnostic purposes.
@param printer The printer to receive the dump, not null.
@param verbose True to dump more verbose information. | [
"Dumps",
"debugging",
"information",
"about",
"this",
"connection",
"in",
"the",
"case",
"where",
"the",
"caller",
"might",
"not",
"actually",
"own",
"the",
"connection",
"."
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/vendor/sqlite/src/java/com/couchbase/lite/internal/database/sqlite/SQLiteConnection.java#L876-L885 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/gui2/dialogs/ActionListDialogBuilder.java | ActionListDialogBuilder.addAction | public ActionListDialogBuilder addAction(final String label, final Runnable action) {
return addAction(new Runnable() {
@Override
public String toString() {
return label;
}
@Override
public void run() {
action.run();
}
});
} | java | public ActionListDialogBuilder addAction(final String label, final Runnable action) {
return addAction(new Runnable() {
@Override
public String toString() {
return label;
}
@Override
public void run() {
action.run();
}
});
} | [
"public",
"ActionListDialogBuilder",
"addAction",
"(",
"final",
"String",
"label",
",",
"final",
"Runnable",
"action",
")",
"{",
"return",
"addAction",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"re... | Adds an additional action to the {@code ActionListBox} that is to be displayed when the dialog is opened
@param label Label of the new action
@param action Action to perform if the user selects this item
@return Itself | [
"Adds",
"an",
"additional",
"action",
"to",
"the",
"{"
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/dialogs/ActionListDialogBuilder.java#L111-L123 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java | ContainerGroupsInner.getByResourceGroupAsync | public Observable<ContainerGroupInner> getByResourceGroupAsync(String resourceGroupName, String containerGroupName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() {
@Override
public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) {
return response.body();
}
});
} | java | public Observable<ContainerGroupInner> getByResourceGroupAsync(String resourceGroupName, String containerGroupName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() {
@Override
public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ContainerGroupInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGroupName",
... | Get the properties of the specified container group.
Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ContainerGroupInner object | [
"Get",
"the",
"properties",
"of",
"the",
"specified",
"container",
"group",
".",
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"container",
"group",
"in",
"the",
"specified",
"subscription",
"and",
"resource",
"group",
".",
"The",
"operation",
"returns"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java#L377-L384 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/client/gui/element/position/Positions.java | Positions.leftAligned | public static IntSupplier leftAligned(IChild<?> owner, int spacing)
{
return () -> {
return Padding.of(owner.getParent()).left() + spacing;
};
} | java | public static IntSupplier leftAligned(IChild<?> owner, int spacing)
{
return () -> {
return Padding.of(owner.getParent()).left() + spacing;
};
} | [
"public",
"static",
"IntSupplier",
"leftAligned",
"(",
"IChild",
"<",
"?",
">",
"owner",
",",
"int",
"spacing",
")",
"{",
"return",
"(",
")",
"->",
"{",
"return",
"Padding",
".",
"of",
"(",
"owner",
".",
"getParent",
"(",
")",
")",
".",
"left",
"(",
... | Positions the owner to the left inside its parent.<br>
Respects the parent padding.
@param spacing the spacing
@return the int supplier | [
"Positions",
"the",
"owner",
"to",
"the",
"left",
"inside",
"its",
"parent",
".",
"<br",
">",
"Respects",
"the",
"parent",
"padding",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L53-L58 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/ruts/process/ActionFormMapper.java | ActionFormMapper.throwRequestJsonParseFailureException | protected void throwRequestJsonParseFailureException(String msg, List<JsonDebugChallenge> challengeList, RuntimeException cause) {
throw new RequestJsonParseFailureException(msg, getRequestJsonParseFailureMessages(), cause).withChallengeList(challengeList);
} | java | protected void throwRequestJsonParseFailureException(String msg, List<JsonDebugChallenge> challengeList, RuntimeException cause) {
throw new RequestJsonParseFailureException(msg, getRequestJsonParseFailureMessages(), cause).withChallengeList(challengeList);
} | [
"protected",
"void",
"throwRequestJsonParseFailureException",
"(",
"String",
"msg",
",",
"List",
"<",
"JsonDebugChallenge",
">",
"challengeList",
",",
"RuntimeException",
"cause",
")",
"{",
"throw",
"new",
"RequestJsonParseFailureException",
"(",
"msg",
",",
"getRequest... | while, is likely to due to client bugs (or server) so request client error | [
"while",
"is",
"likely",
"to",
"due",
"to",
"client",
"bugs",
"(",
"or",
"server",
")",
"so",
"request",
"client",
"error"
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/ruts/process/ActionFormMapper.java#L1569-L1571 |
Jasig/uPortal | uPortal-events/src/main/java/org/apereo/portal/events/aggr/EventDateTimeUtils.java | EventDateTimeUtils.createStandardQuarters | public static List<QuarterDetail> createStandardQuarters() {
return ImmutableList.<QuarterDetail>of(
new QuarterDetailImpl(new MonthDay(1, 1), new MonthDay(4, 1), 0),
new QuarterDetailImpl(new MonthDay(4, 1), new MonthDay(7, 1), 1),
new QuarterDetailImpl(new MonthDay(7, 1), new MonthDay(10, 1), 2),
new QuarterDetailImpl(new MonthDay(10, 1), new MonthDay(1, 1), 3));
} | java | public static List<QuarterDetail> createStandardQuarters() {
return ImmutableList.<QuarterDetail>of(
new QuarterDetailImpl(new MonthDay(1, 1), new MonthDay(4, 1), 0),
new QuarterDetailImpl(new MonthDay(4, 1), new MonthDay(7, 1), 1),
new QuarterDetailImpl(new MonthDay(7, 1), new MonthDay(10, 1), 2),
new QuarterDetailImpl(new MonthDay(10, 1), new MonthDay(1, 1), 3));
} | [
"public",
"static",
"List",
"<",
"QuarterDetail",
">",
"createStandardQuarters",
"(",
")",
"{",
"return",
"ImmutableList",
".",
"<",
"QuarterDetail",
">",
"of",
"(",
"new",
"QuarterDetailImpl",
"(",
"new",
"MonthDay",
"(",
"1",
",",
"1",
")",
",",
"new",
"... | Create a new set of quarter details in the standard 1/1-4/1, 4/1-7/1, 7/1-10/1, 10/1-1/1
arrangement | [
"Create",
"a",
"new",
"set",
"of",
"quarter",
"details",
"in",
"the",
"standard",
"1",
"/",
"1",
"-",
"4",
"/",
"1",
"4",
"/",
"1",
"-",
"7",
"/",
"1",
"7",
"/",
"1",
"-",
"10",
"/",
"1",
"10",
"/",
"1",
"-",
"1",
"/",
"1",
"arrangement"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-events/src/main/java/org/apereo/portal/events/aggr/EventDateTimeUtils.java#L192-L198 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.