repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
Jasig/uPortal | uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java | UpdatePreferencesServlet.moveTab | @RequestMapping(method = RequestMethod.POST, params = "action=moveTab")
public ModelAndView moveTab(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam(value = "sourceID") String sourceId,
@RequestParam String method,
@RequestParam(value = "elementID") String destinationId)
throws IOException {
IUserInstance ui = userInstanceManager.getUserInstance(request);
UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
IUserLayoutManager ulm = upm.getUserLayoutManager();
final Locale locale = RequestContextUtils.getLocale(request);
// If we're moving this element before another one, we need
// to know what the target is. If there's no target, just
// assume we're moving it to the very end of the list.
String siblingId = null;
if ("insertBefore".equals(method)) siblingId = destinationId;
try {
// move the node as requested and save the layout
if (!ulm.moveNode(sourceId, ulm.getParentId(destinationId), siblingId)) {
logger.warn("Failed to move tab in user layout. moveNode returned false");
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return new ModelAndView(
"jsonView",
Collections.singletonMap(
"response",
getMessage(
"error.move.tab",
"There was an issue moving the tab, please refresh the page and try again.",
locale)));
}
ulm.saveUserLayout();
} catch (PortalException e) {
return handlePersistError(request, response, e);
}
return new ModelAndView(
"jsonView",
Collections.singletonMap(
"response",
getMessage("success.move.tab", "Tab moved successfully", locale)));
} | java | @RequestMapping(method = RequestMethod.POST, params = "action=moveTab")
public ModelAndView moveTab(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam(value = "sourceID") String sourceId,
@RequestParam String method,
@RequestParam(value = "elementID") String destinationId)
throws IOException {
IUserInstance ui = userInstanceManager.getUserInstance(request);
UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
IUserLayoutManager ulm = upm.getUserLayoutManager();
final Locale locale = RequestContextUtils.getLocale(request);
// If we're moving this element before another one, we need
// to know what the target is. If there's no target, just
// assume we're moving it to the very end of the list.
String siblingId = null;
if ("insertBefore".equals(method)) siblingId = destinationId;
try {
// move the node as requested and save the layout
if (!ulm.moveNode(sourceId, ulm.getParentId(destinationId), siblingId)) {
logger.warn("Failed to move tab in user layout. moveNode returned false");
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return new ModelAndView(
"jsonView",
Collections.singletonMap(
"response",
getMessage(
"error.move.tab",
"There was an issue moving the tab, please refresh the page and try again.",
locale)));
}
ulm.saveUserLayout();
} catch (PortalException e) {
return handlePersistError(request, response, e);
}
return new ModelAndView(
"jsonView",
Collections.singletonMap(
"response",
getMessage("success.move.tab", "Tab moved successfully", locale)));
} | [
"@",
"RequestMapping",
"(",
"method",
"=",
"RequestMethod",
".",
"POST",
",",
"params",
"=",
"\"action=moveTab\"",
")",
"public",
"ModelAndView",
"moveTab",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"@",
"RequestParam",
"(",
... | Move a tab left or right.
@param sourceId node ID of tab to move
@param method insertBefore or appendAfter. If appendAfter, tab is added as last tab (parent
of destinationId).
@param destinationId insertBefore: node ID of tab to move sourceId before. insertAfter: node
ID of another tab
@param request
@param response
@throws PortalException
@throws IOException | [
"Move",
"a",
"tab",
"left",
"or",
"right",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L530-L575 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.mapping | public static void mapping(String mappedFieldName, String mappedClassName, String targetClassName){
throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException3,mappedFieldName,mappedClassName,targetClassName));
} | java | public static void mapping(String mappedFieldName, String mappedClassName, String targetClassName){
throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException3,mappedFieldName,mappedClassName,targetClassName));
} | [
"public",
"static",
"void",
"mapping",
"(",
"String",
"mappedFieldName",
",",
"String",
"mappedClassName",
",",
"String",
"targetClassName",
")",
"{",
"throw",
"new",
"MappingErrorException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"mappingErrorException3"... | Thrown when the target class doesn't exist in classes parameter.
@param mappedFieldName name of the mapped field
@param mappedClassName name of the mapped field's class
@param targetClassName name of the target field's class | [
"Thrown",
"when",
"the",
"target",
"class",
"doesn",
"t",
"exist",
"in",
"classes",
"parameter",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L472-L474 |
Waikato/jclasslocator | src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java | ClassLocator.matches | public static boolean matches(Class superclassOrIntf, Class otherclass) {
return isSubclass(superclassOrIntf, otherclass) || hasInterface(superclassOrIntf, otherclass);
} | java | public static boolean matches(Class superclassOrIntf, Class otherclass) {
return isSubclass(superclassOrIntf, otherclass) || hasInterface(superclassOrIntf, otherclass);
} | [
"public",
"static",
"boolean",
"matches",
"(",
"Class",
"superclassOrIntf",
",",
"Class",
"otherclass",
")",
"{",
"return",
"isSubclass",
"(",
"superclassOrIntf",
",",
"otherclass",
")",
"||",
"hasInterface",
"(",
"superclassOrIntf",
",",
"otherclass",
")",
";",
... | Checks whether the "otherclass" is a subclass of the given "superclassOrIntf"
or whether it implements "superclassOrIntf".
@param superclassOrIntf the superclass/interface to check against
@param otherclass this class is checked whether it is a subclass
of the the superclass
@return TRUE if "otherclass" is a true subclass or implements the interface | [
"Checks",
"whether",
"the",
"otherclass",
"is",
"a",
"subclass",
"of",
"the",
"given",
"superclassOrIntf",
"or",
"whether",
"it",
"implements",
"superclassOrIntf",
"."
] | train | https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L703-L705 |
timtiemens/secretshare | src/main/java/com/tiemens/secretshare/engine/SecretShare.java | SecretShare.createRandomModulusForSecret | public static BigInteger createRandomModulusForSecret(BigInteger secret)
{
Random random = new SecureRandom();
return createRandomModulusForSecret(secret, random);
} | java | public static BigInteger createRandomModulusForSecret(BigInteger secret)
{
Random random = new SecureRandom();
return createRandomModulusForSecret(secret, random);
} | [
"public",
"static",
"BigInteger",
"createRandomModulusForSecret",
"(",
"BigInteger",
"secret",
")",
"{",
"Random",
"random",
"=",
"new",
"SecureRandom",
"(",
")",
";",
"return",
"createRandomModulusForSecret",
"(",
"secret",
",",
"random",
")",
";",
"}"
] | NOTE: you should prefer createAppropriateModulusForSecret() over this method.
@param secret as biginteger
@return prime modulus big enough for secret | [
"NOTE",
":",
"you",
"should",
"prefer",
"createAppropriateModulusForSecret",
"()",
"over",
"this",
"method",
"."
] | train | https://github.com/timtiemens/secretshare/blob/f5f88929af99ae0ed0df02dc802e40cdb25fceac/src/main/java/com/tiemens/secretshare/engine/SecretShare.java#L136-L141 |
OpenTSDB/opentsdb | src/meta/TSMeta.java | TSMeta.getTSMeta | public static Deferred<TSMeta> getTSMeta(final TSDB tsdb, final String tsuid) {
return getFromStorage(tsdb, UniqueId.stringToUid(tsuid))
.addCallbackDeferring(new LoadUIDs(tsdb, tsuid));
} | java | public static Deferred<TSMeta> getTSMeta(final TSDB tsdb, final String tsuid) {
return getFromStorage(tsdb, UniqueId.stringToUid(tsuid))
.addCallbackDeferring(new LoadUIDs(tsdb, tsuid));
} | [
"public",
"static",
"Deferred",
"<",
"TSMeta",
">",
"getTSMeta",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"String",
"tsuid",
")",
"{",
"return",
"getFromStorage",
"(",
"tsdb",
",",
"UniqueId",
".",
"stringToUid",
"(",
"tsuid",
")",
")",
".",
"addCallbac... | Attempts to fetch the timeseries meta data and associated UIDMeta objects
from storage.
<b>Note:</b> Until we have a caching layer implemented, this will make at
least 4 reads to the storage system, 1 for the TSUID meta, 1 for the
metric UIDMeta and 1 each for every tagk/tagv UIDMeta object.
<p>
See {@link #getFromStorage(TSDB, byte[])} for details.
@param tsdb The TSDB to use for storage access
@param tsuid The UID of the meta to fetch
@return A TSMeta object if found, null if not
@throws HBaseException if there was an issue fetching
@throws IllegalArgumentException if parsing failed
@throws JSONException if the data was corrupted
@throws NoSuchUniqueName if one of the UIDMeta objects does not exist | [
"Attempts",
"to",
"fetch",
"the",
"timeseries",
"meta",
"data",
"and",
"associated",
"UIDMeta",
"objects",
"from",
"storage",
".",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"Until",
"we",
"have",
"a",
"caching",
"layer",
"implemented",
"this",
"will",
... | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/TSMeta.java#L389-L392 |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java | ZipFileContainerUtils.locatePath | @Trivial
public static int locatePath(ZipEntryData[] entryData, final String r_path) {
ZipEntryData targetData = new SearchZipEntryData(r_path);
// Given:
//
// 0 gp
// 1 gp/p1
// 2 gp/p1/c1
// 3 gp/p2/c2
//
// A search for "a" answers "-1" (inexact; insertion point is 0)
// A search for "gp" answers "0" (exact)
// A search for "gp/p1/c1" answers "2" (exact)
// A search for "gp/p1/c0" answers "-3" (inexact; insertion point is 2)
// A search for "z" answers "-5" (inexact; insertion point is 4)
return Arrays.binarySearch(
entryData,
targetData,
ZipFileContainerUtils.ZIP_ENTRY_DATA_COMPARATOR);
} | java | @Trivial
public static int locatePath(ZipEntryData[] entryData, final String r_path) {
ZipEntryData targetData = new SearchZipEntryData(r_path);
// Given:
//
// 0 gp
// 1 gp/p1
// 2 gp/p1/c1
// 3 gp/p2/c2
//
// A search for "a" answers "-1" (inexact; insertion point is 0)
// A search for "gp" answers "0" (exact)
// A search for "gp/p1/c1" answers "2" (exact)
// A search for "gp/p1/c0" answers "-3" (inexact; insertion point is 2)
// A search for "z" answers "-5" (inexact; insertion point is 4)
return Arrays.binarySearch(
entryData,
targetData,
ZipFileContainerUtils.ZIP_ENTRY_DATA_COMPARATOR);
} | [
"@",
"Trivial",
"public",
"static",
"int",
"locatePath",
"(",
"ZipEntryData",
"[",
"]",
"entryData",
",",
"final",
"String",
"r_path",
")",
"{",
"ZipEntryData",
"targetData",
"=",
"new",
"SearchZipEntryData",
"(",
"r_path",
")",
";",
"// Given:",
"//",
"// 0 g... | Locate a path in a collection of entries.
Answer the offset of the entry which has the specified path. If the
path is not found, answer -1 times ( the insertion point of the path
minus one ).
@param entryData The entries which are to be searched.
@param r_path The path to fine in the entries.
@return The offset to the path. | [
"Locate",
"a",
"path",
"in",
"a",
"collection",
"of",
"entries",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerUtils.java#L608-L629 |
aoindustries/ao-encoding | src/main/java/com/aoindustries/encoding/TextInMysqlEncoder.java | TextInMysqlEncoder.getEscapedCharacter | private static String getEscapedCharacter(char c) throws IOException {
switch(c) {
case '\0' : return "\\0";
case '\'' : return "''";
// Not needed inside single quotes overall: case '"' : return "\\\"";
case '\b' : return "\\b";
case '\n' : return null;
case '\r' : return "\\r";
case '\t' : return "\\t";
case 26 : return "\\Z";
case '\\' : return "\\\\";
}
if(
(c >= 0x20 && c <= 0x7E) // common case first
|| (c >= 0xA0 && c <= 0xFFFD)
) return null;
throw new IOException(ApplicationResources.accessor.getMessage("MysqlValidator.invalidCharacter", Integer.toHexString(c)));
} | java | private static String getEscapedCharacter(char c) throws IOException {
switch(c) {
case '\0' : return "\\0";
case '\'' : return "''";
// Not needed inside single quotes overall: case '"' : return "\\\"";
case '\b' : return "\\b";
case '\n' : return null;
case '\r' : return "\\r";
case '\t' : return "\\t";
case 26 : return "\\Z";
case '\\' : return "\\\\";
}
if(
(c >= 0x20 && c <= 0x7E) // common case first
|| (c >= 0xA0 && c <= 0xFFFD)
) return null;
throw new IOException(ApplicationResources.accessor.getMessage("MysqlValidator.invalidCharacter", Integer.toHexString(c)));
} | [
"private",
"static",
"String",
"getEscapedCharacter",
"(",
"char",
"c",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"return",
"\"\\\\0\"",
";",
"case",
"'",
"'",
":",
"return",
"\"''\"",
";",
"// Not needed insid... | Encodes a single character and returns its String representation
or null if no modification is necessary. Implemented as
<a href="https://dev.mysql.com/doc/en/string-literals.html#character-escape-sequences">Table 9.1 Special Character Escape Sequences</a>.
@see MysqlValidator#checkCharacter(char)
@throws IOException if any text character cannot be converted for use in the mysql command line | [
"Encodes",
"a",
"single",
"character",
"and",
"returns",
"its",
"String",
"representation",
"or",
"null",
"if",
"no",
"modification",
"is",
"necessary",
".",
"Implemented",
"as",
"<a",
"href",
"=",
"https",
":",
"//",
"dev",
".",
"mysql",
".",
"com",
"/",
... | train | https://github.com/aoindustries/ao-encoding/blob/54eeb8ff58ab7b44bb02549bbe2572625b449e4e/src/main/java/com/aoindustries/encoding/TextInMysqlEncoder.java#L46-L63 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.getEpisodeCredits | public MediaCreditList getEpisodeCredits(int tvID, int seasonNumber, int episodeNumber) throws MovieDbException {
return tmdbEpisodes.getEpisodeCredits(tvID, seasonNumber, episodeNumber);
} | java | public MediaCreditList getEpisodeCredits(int tvID, int seasonNumber, int episodeNumber) throws MovieDbException {
return tmdbEpisodes.getEpisodeCredits(tvID, seasonNumber, episodeNumber);
} | [
"public",
"MediaCreditList",
"getEpisodeCredits",
"(",
"int",
"tvID",
",",
"int",
"seasonNumber",
",",
"int",
"episodeNumber",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbEpisodes",
".",
"getEpisodeCredits",
"(",
"tvID",
",",
"seasonNumber",
",",
"episode... | Get the TV episode credits by combination of season and episode number.
@param tvID tvID
@param seasonNumber seasonNumber
@param episodeNumber episodeNumber
@return
@throws MovieDbException exception | [
"Get",
"the",
"TV",
"episode",
"credits",
"by",
"combination",
"of",
"season",
"and",
"episode",
"number",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1815-L1817 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java | CmsFocalPointController.updateScaling | private void updateScaling() {
List<I_CmsTransform> transforms = new ArrayList<>();
CmsCroppingParamBean crop = m_croppingProvider.get();
CmsImageInfoBean info = m_imageInfoProvider.get();
double wv = m_image.getElement().getParentElement().getOffsetWidth();
double hv = m_image.getElement().getParentElement().getOffsetHeight();
if (crop == null) {
transforms.add(
new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, info.getWidth(), info.getHeight()));
} else {
int wt, ht;
wt = crop.getTargetWidth() >= 0 ? crop.getTargetWidth() : info.getWidth();
ht = crop.getTargetHeight() >= 0 ? crop.getTargetHeight() : info.getHeight();
transforms.add(new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, wt, ht));
if (crop.isCropped()) {
transforms.add(
new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getCropWidth(), crop.getCropHeight()));
transforms.add(new CmsTranslate(crop.getCropX(), crop.getCropY()));
} else {
transforms.add(
new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getOrgWidth(), crop.getOrgHeight()));
}
}
CmsCompositeTransform chain = new CmsCompositeTransform(transforms);
m_coordinateTransform = chain;
if ((crop == null) || !crop.isCropped()) {
m_region = transformRegionBack(
m_coordinateTransform,
CmsRectangle.fromLeftTopWidthHeight(0, 0, info.getWidth(), info.getHeight()));
} else {
m_region = transformRegionBack(
m_coordinateTransform,
CmsRectangle.fromLeftTopWidthHeight(
crop.getCropX(),
crop.getCropY(),
crop.getCropWidth(),
crop.getCropHeight()));
}
} | java | private void updateScaling() {
List<I_CmsTransform> transforms = new ArrayList<>();
CmsCroppingParamBean crop = m_croppingProvider.get();
CmsImageInfoBean info = m_imageInfoProvider.get();
double wv = m_image.getElement().getParentElement().getOffsetWidth();
double hv = m_image.getElement().getParentElement().getOffsetHeight();
if (crop == null) {
transforms.add(
new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, info.getWidth(), info.getHeight()));
} else {
int wt, ht;
wt = crop.getTargetWidth() >= 0 ? crop.getTargetWidth() : info.getWidth();
ht = crop.getTargetHeight() >= 0 ? crop.getTargetHeight() : info.getHeight();
transforms.add(new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, wt, ht));
if (crop.isCropped()) {
transforms.add(
new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getCropWidth(), crop.getCropHeight()));
transforms.add(new CmsTranslate(crop.getCropX(), crop.getCropY()));
} else {
transforms.add(
new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getOrgWidth(), crop.getOrgHeight()));
}
}
CmsCompositeTransform chain = new CmsCompositeTransform(transforms);
m_coordinateTransform = chain;
if ((crop == null) || !crop.isCropped()) {
m_region = transformRegionBack(
m_coordinateTransform,
CmsRectangle.fromLeftTopWidthHeight(0, 0, info.getWidth(), info.getHeight()));
} else {
m_region = transformRegionBack(
m_coordinateTransform,
CmsRectangle.fromLeftTopWidthHeight(
crop.getCropX(),
crop.getCropY(),
crop.getCropWidth(),
crop.getCropHeight()));
}
} | [
"private",
"void",
"updateScaling",
"(",
")",
"{",
"List",
"<",
"I_CmsTransform",
">",
"transforms",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"CmsCroppingParamBean",
"crop",
"=",
"m_croppingProvider",
".",
"get",
"(",
")",
";",
"CmsImageInfoBean",
"info",... | Sets up the coordinate transformations between the coordinate system of the parent element of the image element and the native coordinate system
of the original image. | [
"Sets",
"up",
"the",
"coordinate",
"transformations",
"between",
"the",
"coordinate",
"system",
"of",
"the",
"parent",
"element",
"of",
"the",
"image",
"element",
"and",
"the",
"native",
"coordinate",
"system",
"of",
"the",
"original",
"image",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java#L439-L479 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java | InterceptorContext.createInterceptor | protected static Interceptor createInterceptor( InterceptorConfig config, Class baseClassOrInterface )
{
assert Interceptor.class.isAssignableFrom( baseClassOrInterface )
: baseClassOrInterface.getName() + " cannot be assigned to " + Interceptor.class.getName();
ClassLoader cl = DiscoveryUtils.getClassLoader();
String className = config.getInterceptorClass();
try
{
Class interceptorClass = cl.loadClass( className );
if ( ! baseClassOrInterface.isAssignableFrom( interceptorClass ) )
{
_log.error( "Interceptor " + interceptorClass.getName() + " does not implement or extend "
+ baseClassOrInterface.getName() );
return null;
}
Interceptor interceptor = ( Interceptor ) interceptorClass.newInstance();
interceptor.init( config );
return interceptor;
}
catch ( ClassNotFoundException e )
{
_log.error( "Could not find interceptor class " + className, e );
}
catch ( InstantiationException e )
{
_log.error( "Could not instantiate interceptor class " + className, e );
}
catch ( IllegalAccessException e )
{
_log.error( "Could not instantiate interceptor class " + className, e );
}
return null;
} | java | protected static Interceptor createInterceptor( InterceptorConfig config, Class baseClassOrInterface )
{
assert Interceptor.class.isAssignableFrom( baseClassOrInterface )
: baseClassOrInterface.getName() + " cannot be assigned to " + Interceptor.class.getName();
ClassLoader cl = DiscoveryUtils.getClassLoader();
String className = config.getInterceptorClass();
try
{
Class interceptorClass = cl.loadClass( className );
if ( ! baseClassOrInterface.isAssignableFrom( interceptorClass ) )
{
_log.error( "Interceptor " + interceptorClass.getName() + " does not implement or extend "
+ baseClassOrInterface.getName() );
return null;
}
Interceptor interceptor = ( Interceptor ) interceptorClass.newInstance();
interceptor.init( config );
return interceptor;
}
catch ( ClassNotFoundException e )
{
_log.error( "Could not find interceptor class " + className, e );
}
catch ( InstantiationException e )
{
_log.error( "Could not instantiate interceptor class " + className, e );
}
catch ( IllegalAccessException e )
{
_log.error( "Could not instantiate interceptor class " + className, e );
}
return null;
} | [
"protected",
"static",
"Interceptor",
"createInterceptor",
"(",
"InterceptorConfig",
"config",
",",
"Class",
"baseClassOrInterface",
")",
"{",
"assert",
"Interceptor",
".",
"class",
".",
"isAssignableFrom",
"(",
"baseClassOrInterface",
")",
":",
"baseClassOrInterface",
... | Instantiates an interceptor using the class name in the given InterceptorConfig.
@param config the {@link InterceptorConfig} used to determine the {@link Interceptor} class.
@param baseClassOrInterface the required base class or interface. May be <code>null</code>.
@return an initialized Interceptor, or <code>null</code> if an error occurred. | [
"Instantiates",
"an",
"interceptor",
"using",
"the",
"class",
"name",
"in",
"the",
"given",
"InterceptorConfig",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java#L121-L158 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java | ComponentsInner.createOrUpdate | public ApplicationInsightsComponentInner createOrUpdate(String resourceGroupName, String resourceName, ApplicationInsightsComponentInner insightProperties) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, insightProperties).toBlocking().single().body();
} | java | public ApplicationInsightsComponentInner createOrUpdate(String resourceGroupName, String resourceName, ApplicationInsightsComponentInner insightProperties) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, insightProperties).toBlocking().single().body();
} | [
"public",
"ApplicationInsightsComponentInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"ApplicationInsightsComponentInner",
"insightProperties",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",... | Creates (or updates) an Application Insights component. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param insightProperties Properties that need to be specified to create an Application Insights component.
@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 ApplicationInsightsComponentInner object if successful. | [
"Creates",
"(",
"or",
"updates",
")",
"an",
"Application",
"Insights",
"component",
".",
"Note",
":",
"You",
"cannot",
"specify",
"a",
"different",
"value",
"for",
"InstrumentationKey",
"nor",
"AppId",
"in",
"the",
"Put",
"operation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java#L519-L521 |
actorapp/actor-platform | actor-sdk/sdk-core/runtime/runtime-android/src/main/java/im/actor/runtime/android/crypto/PRNGFixes.java | PRNGFixes.generateSeed | private static byte[] generateSeed() {
try {
ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream();
DataOutputStream seedBufferOut =
new DataOutputStream(seedBuffer);
seedBufferOut.writeLong(System.currentTimeMillis());
seedBufferOut.writeLong(System.nanoTime());
seedBufferOut.writeInt(Process.myPid());
seedBufferOut.writeInt(Process.myUid());
seedBufferOut.write(BUILD_FINGERPRINT_AND_DEVICE_SERIAL);
seedBufferOut.close();
return seedBuffer.toByteArray();
} catch (IOException e) {
throw new SecurityException("Failed to generate seed", e);
}
} | java | private static byte[] generateSeed() {
try {
ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream();
DataOutputStream seedBufferOut =
new DataOutputStream(seedBuffer);
seedBufferOut.writeLong(System.currentTimeMillis());
seedBufferOut.writeLong(System.nanoTime());
seedBufferOut.writeInt(Process.myPid());
seedBufferOut.writeInt(Process.myUid());
seedBufferOut.write(BUILD_FINGERPRINT_AND_DEVICE_SERIAL);
seedBufferOut.close();
return seedBuffer.toByteArray();
} catch (IOException e) {
throw new SecurityException("Failed to generate seed", e);
}
} | [
"private",
"static",
"byte",
"[",
"]",
"generateSeed",
"(",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"seedBuffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"DataOutputStream",
"seedBufferOut",
"=",
"new",
"DataOutputStream",
"(",
"seedBuffer",
")"... | Generates a device- and invocation-specific seed to be mixed into the
Linux PRNG. | [
"Generates",
"a",
"device",
"-",
"and",
"invocation",
"-",
"specific",
"seed",
"to",
"be",
"mixed",
"into",
"the",
"Linux",
"PRNG",
"."
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-android/src/main/java/im/actor/runtime/android/crypto/PRNGFixes.java#L304-L319 |
phax/ph-commons | ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java | AbstractMapBasedWALDAO.internalMarkItemDeleted | @MustBeLocked (ELockType.WRITE)
protected final void internalMarkItemDeleted (@Nonnull final IMPLTYPE aItem, final boolean bInvokeCallbacks)
{
// Trigger save changes
super.markAsChanged (aItem, EDAOActionType.UPDATE);
if (bInvokeCallbacks)
{
// Invoke callbacks
m_aCallbacks.forEach (aCB -> aCB.onMarkItemDeleted (aItem));
}
} | java | @MustBeLocked (ELockType.WRITE)
protected final void internalMarkItemDeleted (@Nonnull final IMPLTYPE aItem, final boolean bInvokeCallbacks)
{
// Trigger save changes
super.markAsChanged (aItem, EDAOActionType.UPDATE);
if (bInvokeCallbacks)
{
// Invoke callbacks
m_aCallbacks.forEach (aCB -> aCB.onMarkItemDeleted (aItem));
}
} | [
"@",
"MustBeLocked",
"(",
"ELockType",
".",
"WRITE",
")",
"protected",
"final",
"void",
"internalMarkItemDeleted",
"(",
"@",
"Nonnull",
"final",
"IMPLTYPE",
"aItem",
",",
"final",
"boolean",
"bInvokeCallbacks",
")",
"{",
"// Trigger save changes",
"super",
".",
"m... | Mark an item as "deleted" without actually deleting it from the map. This
method only triggers the update action but does not alter the item. Must
only be invoked inside a write-lock.
@param aItem
The item that was marked as "deleted"
@param bInvokeCallbacks
<code>true</code> to invoke callbacks, <code>false</code> to not do
so.
@since 9.2.1 | [
"Mark",
"an",
"item",
"as",
"deleted",
"without",
"actually",
"deleting",
"it",
"from",
"the",
"map",
".",
"This",
"method",
"only",
"triggers",
"the",
"update",
"action",
"but",
"does",
"not",
"alter",
"the",
"item",
".",
"Must",
"only",
"be",
"invoked",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java#L454-L465 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.checkXACommandCompletionStatus | public synchronized void checkXACommandCompletionStatus(int expected, Conversation conversation)
throws XAException, Exception
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkXACommandCompletionStatus", new Object[]{expected, conversation});
checkReleased();
if (receivedData != null)
{
// First get the completion code
int exceptionType = getCommandCompletionCode(expected);
// If this indicates an exception, then create it and throw it
if (exceptionType != CommsConstants.SI_NO_EXCEPTION)
{
throw getException(conversation);
}
// Otherwise there was no exception
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "No exception");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "checkXACommandCompletionStatus");
} | java | public synchronized void checkXACommandCompletionStatus(int expected, Conversation conversation)
throws XAException, Exception
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkXACommandCompletionStatus", new Object[]{expected, conversation});
checkReleased();
if (receivedData != null)
{
// First get the completion code
int exceptionType = getCommandCompletionCode(expected);
// If this indicates an exception, then create it and throw it
if (exceptionType != CommsConstants.SI_NO_EXCEPTION)
{
throw getException(conversation);
}
// Otherwise there was no exception
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "No exception");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "checkXACommandCompletionStatus");
} | [
"public",
"synchronized",
"void",
"checkXACommandCompletionStatus",
"(",
"int",
"expected",
",",
"Conversation",
"conversation",
")",
"throws",
"XAException",
",",
"Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
... | This method will check the return status of a remote XA call. An XA call can
return in two ways:
<ul>
<li>It can return with SI_NOEXCEPTION. In which case the call was successful and the data
buffer probably contains reply information. As such, if this occurs this method will
return without looking further into the buffer.
<li>It can return something else. In which case we assume the call has failed and the
buffer only contains details about the exception. Here we will parse the buffer for
the exception message, probe id and reason code (if those properties are there).
Then, an XA exception will be thrown.
</ul>
<p>
This method also checks that the data we have received was what we are expecting. As such,
if the segment in the reply does not match what we expect, a comms exception will be thrown.
<p>
<strong>This method should only be called when this buffer represents received data.</strong>
@param expected The segment type that we are expecting in the reply.
@param conversation The conversation that the XA command completion data was received over.
In the case where a XAException is built from the data, this information
is used to determine the FAP version - and hence the encoding of the
exception.
@throws XAException An exception.
@throws Exception It is possible that something else went wrong on the server side and
another exception was sent back. In this case, we should throw this. | [
"This",
"method",
"will",
"check",
"the",
"return",
"status",
"of",
"a",
"remote",
"XA",
"call",
".",
"An",
"XA",
"call",
"can",
"return",
"in",
"two",
"ways",
":",
"<ul",
">",
"<li",
">",
"It",
"can",
"return",
"with",
"SI_NOEXCEPTION",
".",
"In",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L1179-L1202 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java | FeaturesImpl.listPhraseListsAsync | public Observable<List<PhraseListFeatureInfo>> listPhraseListsAsync(UUID appId, String versionId, ListPhraseListsOptionalParameter listPhraseListsOptionalParameter) {
return listPhraseListsWithServiceResponseAsync(appId, versionId, listPhraseListsOptionalParameter).map(new Func1<ServiceResponse<List<PhraseListFeatureInfo>>, List<PhraseListFeatureInfo>>() {
@Override
public List<PhraseListFeatureInfo> call(ServiceResponse<List<PhraseListFeatureInfo>> response) {
return response.body();
}
});
} | java | public Observable<List<PhraseListFeatureInfo>> listPhraseListsAsync(UUID appId, String versionId, ListPhraseListsOptionalParameter listPhraseListsOptionalParameter) {
return listPhraseListsWithServiceResponseAsync(appId, versionId, listPhraseListsOptionalParameter).map(new Func1<ServiceResponse<List<PhraseListFeatureInfo>>, List<PhraseListFeatureInfo>>() {
@Override
public List<PhraseListFeatureInfo> call(ServiceResponse<List<PhraseListFeatureInfo>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"PhraseListFeatureInfo",
">",
">",
"listPhraseListsAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListPhraseListsOptionalParameter",
"listPhraseListsOptionalParameter",
")",
"{",
"return",
"listPhraseListsWithServic... | Gets all the phraselist features.
@param appId The application ID.
@param versionId The version ID.
@param listPhraseListsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<PhraseListFeatureInfo> object | [
"Gets",
"all",
"the",
"phraselist",
"features",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java#L228-L235 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/ImgCompressUtils.java | ImgCompressUtils.imgCompressByWH | public static BufferedImage imgCompressByWH(Image srcImg, int width, int height, Float quality,
boolean isForceWh) {
if (!isForceWh && (srcImg.getHeight(null) < height || srcImg.getWidth(null) < width)) {
width = srcImg.getWidth(null);
height = srcImg.getHeight(null);
}
//指定目标图片
BufferedImage desImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
//根据源图片绘制目标图片
desImg.getGraphics().drawImage(srcImg, 0, 0, width, height, null);
return ImgCompressUtils.encodeImg(desImg, quality);
} | java | public static BufferedImage imgCompressByWH(Image srcImg, int width, int height, Float quality,
boolean isForceWh) {
if (!isForceWh && (srcImg.getHeight(null) < height || srcImg.getWidth(null) < width)) {
width = srcImg.getWidth(null);
height = srcImg.getHeight(null);
}
//指定目标图片
BufferedImage desImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
//根据源图片绘制目标图片
desImg.getGraphics().drawImage(srcImg, 0, 0, width, height, null);
return ImgCompressUtils.encodeImg(desImg, quality);
} | [
"public",
"static",
"BufferedImage",
"imgCompressByWH",
"(",
"Image",
"srcImg",
",",
"int",
"width",
",",
"int",
"height",
",",
"Float",
"quality",
",",
"boolean",
"isForceWh",
")",
"{",
"if",
"(",
"!",
"isForceWh",
"&&",
"(",
"srcImg",
".",
"getHeight",
"... | 根据指定宽高和压缩质量进行压缩,当isForceWh为false时,如果指定宽或者高大于源图片则按照源图片大小宽高压缩,
当isForceWh为true时,不论怎样均按照指定宽高压缩
@param srcImg 指定原图片对象
@param width 指定压缩宽
@param height 指定压缩高
@param quality 指定压缩质量,范围[0.0,1.0],如果指定为null则按照默认值
@param isForceWh 指定是否强制使用指定宽高进行压缩,true代表强制,false反之 | [
"根据指定宽高和压缩质量进行压缩,当isForceWh为false时",
"如果指定宽或者高大于源图片则按照源图片大小宽高压缩",
"当isForceWh为true时",
"不论怎样均按照指定宽高压缩"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/ImgCompressUtils.java#L125-L136 |
opendigitaleducation/web-utils | src/main/java/org/vertx/java/core/http/RouteMatcher.java | RouteMatcher.putWithRegEx | public RouteMatcher putWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, putBindings);
return this;
} | java | public RouteMatcher putWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, putBindings);
return this;
} | [
"public",
"RouteMatcher",
"putWithRegEx",
"(",
"String",
"regex",
",",
"Handler",
"<",
"HttpServerRequest",
">",
"handler",
")",
"{",
"addRegEx",
"(",
"regex",
",",
"handler",
",",
"putBindings",
")",
";",
"return",
"this",
";",
"}"
] | Specify a handler that will be called for a matching HTTP PUT
@param regex A regular expression
@param handler The handler to call | [
"Specify",
"a",
"handler",
"that",
"will",
"be",
"called",
"for",
"a",
"matching",
"HTTP",
"PUT"
] | train | https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L219-L222 |
kubernetes-client/java | kubernetes/src/main/java/io/kubernetes/client/apis/CoreV1Api.java | CoreV1Api.connectPutNamespacedPodProxyAsync | public com.squareup.okhttp.Call connectPutNamespacedPodProxyAsync(String name, String namespace, String path, final ApiCallback<String> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = connectPutNamespacedPodProxyValidateBeforeCall(name, namespace, path, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<String>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call connectPutNamespacedPodProxyAsync(String name, String namespace, String path, final ApiCallback<String> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = connectPutNamespacedPodProxyValidateBeforeCall(name, namespace, path, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<String>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"connectPutNamespacedPodProxyAsync",
"(",
"String",
"name",
",",
"String",
"namespace",
",",
"String",
"path",
",",
"final",
"ApiCallback",
"<",
"String",
">",
"callback",
")",
"throws",
"ApiException... | (asynchronously)
connect PUT requests to proxy of Pod
@param name name of the PodProxyOptions (required)
@param namespace object name and auth scope, such as for teams and projects (required)
@param path Path is the URL path to use for the current proxy request to pod. (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"(",
"asynchronously",
")",
"connect",
"PUT",
"requests",
"to",
"proxy",
"of",
"Pod"
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/apis/CoreV1Api.java#L6385-L6410 |
iron-io/iron_mq_java | src/main/java/io/iron/ironmq/Queue.java | Queue.deletePushMessageForSubscriber | public void deletePushMessageForSubscriber(String messageId, String reservationId, String subscriberName) throws IOException {
deleteMessage(messageId, reservationId, subscriberName);
} | java | public void deletePushMessageForSubscriber(String messageId, String reservationId, String subscriberName) throws IOException {
deleteMessage(messageId, reservationId, subscriberName);
} | [
"public",
"void",
"deletePushMessageForSubscriber",
"(",
"String",
"messageId",
",",
"String",
"reservationId",
",",
"String",
"subscriberName",
")",
"throws",
"IOException",
"{",
"deleteMessage",
"(",
"messageId",
",",
"reservationId",
",",
"subscriberName",
")",
";"... | Delete push message for subscriber by subscriber ID and message ID. If there is no message or subscriber,
an EmptyQueueException is thrown.
@param subscriberName The name of Subscriber.
@param messageId The Message ID.
@throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK.
@throws java.io.IOException If there is an error accessing the IronMQ server. | [
"Delete",
"push",
"message",
"for",
"subscriber",
"by",
"subscriber",
"ID",
"and",
"message",
"ID",
".",
"If",
"there",
"is",
"no",
"message",
"or",
"subscriber",
"an",
"EmptyQueueException",
"is",
"thrown",
"."
] | train | https://github.com/iron-io/iron_mq_java/blob/62d6a86545ca7ef31b7b4797aae0c5b31394a507/src/main/java/io/iron/ironmq/Queue.java#L676-L678 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java | SarlDocumentationParser.reportError | protected static void reportError(String message, Object... parameters) {
Throwable cause = null;
for (int i = 0; cause == null && i < parameters.length; ++i) {
if (parameters[i] instanceof Throwable) {
cause = (Throwable) parameters[i];
}
}
final String msg = MessageFormat.format(message, parameters);
if (cause != null) {
throw new ParsingException(msg, null, 1, Throwables.getRootCause(cause));
}
throw new ParsingException(msg, null, 1);
} | java | protected static void reportError(String message, Object... parameters) {
Throwable cause = null;
for (int i = 0; cause == null && i < parameters.length; ++i) {
if (parameters[i] instanceof Throwable) {
cause = (Throwable) parameters[i];
}
}
final String msg = MessageFormat.format(message, parameters);
if (cause != null) {
throw new ParsingException(msg, null, 1, Throwables.getRootCause(cause));
}
throw new ParsingException(msg, null, 1);
} | [
"protected",
"static",
"void",
"reportError",
"(",
"String",
"message",
",",
"Object",
"...",
"parameters",
")",
"{",
"Throwable",
"cause",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"cause",
"==",
"null",
"&&",
"i",
"<",
"parameters",
".... | Report an error.
@param message the message in a format compatible with {@link MessageFormat}.
@param parameters the parameters, starting at {1}. | [
"Report",
"an",
"error",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L993-L1005 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/DirectCompactUnorderedSketch.java | DirectCompactUnorderedSketch.wrapInstance | static DirectCompactUnorderedSketch wrapInstance(final Memory srcMem, final long seed) {
final short memSeedHash = srcMem.getShort(SEED_HASH_SHORT);
final short computedSeedHash = computeSeedHash(seed);
checkSeedHashes(memSeedHash, computedSeedHash);
return new DirectCompactUnorderedSketch(srcMem);
} | java | static DirectCompactUnorderedSketch wrapInstance(final Memory srcMem, final long seed) {
final short memSeedHash = srcMem.getShort(SEED_HASH_SHORT);
final short computedSeedHash = computeSeedHash(seed);
checkSeedHashes(memSeedHash, computedSeedHash);
return new DirectCompactUnorderedSketch(srcMem);
} | [
"static",
"DirectCompactUnorderedSketch",
"wrapInstance",
"(",
"final",
"Memory",
"srcMem",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"short",
"memSeedHash",
"=",
"srcMem",
".",
"getShort",
"(",
"SEED_HASH_SHORT",
")",
";",
"final",
"short",
"computedSeedHa... | Wraps the given Memory, which must be a SerVer 3, unordered, Compact Sketch image.
Must check the validity of the Memory before calling.
@param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>.
@return this sketch | [
"Wraps",
"the",
"given",
"Memory",
"which",
"must",
"be",
"a",
"SerVer",
"3",
"unordered",
"Compact",
"Sketch",
"image",
".",
"Must",
"check",
"the",
"validity",
"of",
"the",
"Memory",
"before",
"calling",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/DirectCompactUnorderedSketch.java#L41-L46 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java | RTreeIndexCoreExtension.dropTriggers | public boolean dropTriggers(String tableName, String columnName) {
boolean dropped = has(tableName, columnName);
if (dropped) {
dropAllTriggers(tableName, columnName);
}
return dropped;
} | java | public boolean dropTriggers(String tableName, String columnName) {
boolean dropped = has(tableName, columnName);
if (dropped) {
dropAllTriggers(tableName, columnName);
}
return dropped;
} | [
"public",
"boolean",
"dropTriggers",
"(",
"String",
"tableName",
",",
"String",
"columnName",
")",
"{",
"boolean",
"dropped",
"=",
"has",
"(",
"tableName",
",",
"columnName",
")",
";",
"if",
"(",
"dropped",
")",
"{",
"dropAllTriggers",
"(",
"tableName",
",",... | Check if the table and column has the RTree extension and if found, drop
the triggers
@param tableName
table name
@param columnName
column name
@return true if dropped | [
"Check",
"if",
"the",
"table",
"and",
"column",
"has",
"the",
"RTree",
"extension",
"and",
"if",
"found",
"drop",
"the",
"triggers"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java#L849-L855 |
BioPAX/Paxtools | paxtools-console/src/main/java/org/biopax/paxtools/examples/ProteinNameLister.java | ProteinNameLister.listUnificationXrefsPerPathway | public static void listUnificationXrefsPerPathway(Model model)
{
// This is a visitor for elements in a pathway - direct and indirect
Visitor visitor = new Visitor()
{
public void visit(BioPAXElement domain, Object range, Model model, PropertyEditor editor)
{
if (range instanceof physicalEntity)
{
// Do whatever you want with the pe and xref here
physicalEntity pe = (physicalEntity) range;
ClassFilterSet<xref,unificationXref> unis = new ClassFilterSet<xref,unificationXref>(pe.getXREF(),
unificationXref.class);
for (unificationXref uni : unis)
{
System.out.println("pe.getNAME() = " + pe.getNAME());
System.out.println("uni = " + uni.getID());
}
}
}
};
Traverser traverser = new Traverser(SimpleEditorMap.L2, visitor);
Set<pathway> pathways = model.getObjects(pathway.class);
for (pathway pathway : pathways)
{
traverser.traverse(pathway, model);
}
} | java | public static void listUnificationXrefsPerPathway(Model model)
{
// This is a visitor for elements in a pathway - direct and indirect
Visitor visitor = new Visitor()
{
public void visit(BioPAXElement domain, Object range, Model model, PropertyEditor editor)
{
if (range instanceof physicalEntity)
{
// Do whatever you want with the pe and xref here
physicalEntity pe = (physicalEntity) range;
ClassFilterSet<xref,unificationXref> unis = new ClassFilterSet<xref,unificationXref>(pe.getXREF(),
unificationXref.class);
for (unificationXref uni : unis)
{
System.out.println("pe.getNAME() = " + pe.getNAME());
System.out.println("uni = " + uni.getID());
}
}
}
};
Traverser traverser = new Traverser(SimpleEditorMap.L2, visitor);
Set<pathway> pathways = model.getObjects(pathway.class);
for (pathway pathway : pathways)
{
traverser.traverse(pathway, model);
}
} | [
"public",
"static",
"void",
"listUnificationXrefsPerPathway",
"(",
"Model",
"model",
")",
"{",
"// This is a visitor for elements in a pathway - direct and indirect",
"Visitor",
"visitor",
"=",
"new",
"Visitor",
"(",
")",
"{",
"public",
"void",
"visit",
"(",
"BioPAXElemen... | Here is a more elegant way of doing the previous method!
@param model BioPAX object Model | [
"Here",
"is",
"a",
"more",
"elegant",
"way",
"of",
"doing",
"the",
"previous",
"method!"
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-console/src/main/java/org/biopax/paxtools/examples/ProteinNameLister.java#L136-L165 |
canoo/dolphin-platform | platform/dolphin-platform-core/src/main/java/com/canoo/dp/impl/platform/core/Assert.java | Assert.requireNonNull | public static <T> T requireNonNull(final T value, final String argumentName) {
Objects.requireNonNull(argumentName, String.format(NOT_NULL_MSG_FORMAT, "argumentName"));
return Objects.requireNonNull(value, String.format(NOT_NULL_MSG_FORMAT, argumentName));
} | java | public static <T> T requireNonNull(final T value, final String argumentName) {
Objects.requireNonNull(argumentName, String.format(NOT_NULL_MSG_FORMAT, "argumentName"));
return Objects.requireNonNull(value, String.format(NOT_NULL_MSG_FORMAT, argumentName));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"requireNonNull",
"(",
"final",
"T",
"value",
",",
"final",
"String",
"argumentName",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"argumentName",
",",
"String",
".",
"format",
"(",
"NOT_NULL_MSG_FORMAT",
",",
"\"a... | Checks that the specified {@code value} is null and throws {@link java.lang.NullPointerException} with a customized error message if it is.
@param value the value to be checked.
@param argumentName the name of the argument to be used in the error message.
@return the {@code value}.
@throws java.lang.NullPointerException if {@code value} is null. | [
"Checks",
"that",
"the",
"specified",
"{",
"@code",
"value",
"}",
"is",
"null",
"and",
"throws",
"{",
"@link",
"java",
".",
"lang",
".",
"NullPointerException",
"}",
"with",
"a",
"customized",
"error",
"message",
"if",
"it",
"is",
"."
] | train | https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-core/src/main/java/com/canoo/dp/impl/platform/core/Assert.java#L48-L51 |
adyliu/jafka | src/main/java/io/jafka/utils/Utils.java | Utils.getProps | public static Properties getProps(Properties props, String name, Properties defaultProperties) {
final String propString = props.getProperty(name);
if (propString == null) return defaultProperties;
String[] propValues = propString.split(",");
if (propValues.length < 1) {
throw new IllegalArgumentException("Illegal format of specifying properties '" + propString + "'");
}
Properties properties = new Properties();
for (int i = 0; i < propValues.length; i++) {
String[] prop = propValues[i].split("=");
if (prop.length != 2) throw new IllegalArgumentException("Illegal format of specifying properties '" + propValues[i] + "'");
properties.put(prop[0], prop[1]);
}
return properties;
} | java | public static Properties getProps(Properties props, String name, Properties defaultProperties) {
final String propString = props.getProperty(name);
if (propString == null) return defaultProperties;
String[] propValues = propString.split(",");
if (propValues.length < 1) {
throw new IllegalArgumentException("Illegal format of specifying properties '" + propString + "'");
}
Properties properties = new Properties();
for (int i = 0; i < propValues.length; i++) {
String[] prop = propValues[i].split("=");
if (prop.length != 2) throw new IllegalArgumentException("Illegal format of specifying properties '" + propValues[i] + "'");
properties.put(prop[0], prop[1]);
}
return properties;
} | [
"public",
"static",
"Properties",
"getProps",
"(",
"Properties",
"props",
",",
"String",
"name",
",",
"Properties",
"defaultProperties",
")",
"{",
"final",
"String",
"propString",
"=",
"props",
".",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"propString"... | Get a property of type java.util.Properties or return the default if
no such property is defined
@param props properties
@param name the key
@param defaultProperties default property if empty
@return value from the property | [
"Get",
"a",
"property",
"of",
"type",
"java",
".",
"util",
".",
"Properties",
"or",
"return",
"the",
"default",
"if",
"no",
"such",
"property",
"is",
"defined"
] | train | https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/utils/Utils.java#L70-L84 |
apache/fluo | modules/command/src/main/java/org/apache/fluo/command/FluoWait.java | FluoWait.waitTillNoNotifications | private static boolean waitTillNoNotifications(Environment env, TableRange range)
throws TableNotFoundException {
boolean sawNotifications = false;
long retryTime = MIN_SLEEP_MS;
log.debug("Scanning tablet {} for notifications", range);
long start = System.currentTimeMillis();
while (hasNotifications(env, range)) {
sawNotifications = true;
long sleepTime = Math.max(System.currentTimeMillis() - start, retryTime);
log.debug("Tablet {} had notfications, will rescan in {}ms", range, sleepTime);
UtilWaitThread.sleep(sleepTime);
retryTime = Math.min(MAX_SLEEP_MS, (long) (retryTime * 1.5));
start = System.currentTimeMillis();
}
return sawNotifications;
} | java | private static boolean waitTillNoNotifications(Environment env, TableRange range)
throws TableNotFoundException {
boolean sawNotifications = false;
long retryTime = MIN_SLEEP_MS;
log.debug("Scanning tablet {} for notifications", range);
long start = System.currentTimeMillis();
while (hasNotifications(env, range)) {
sawNotifications = true;
long sleepTime = Math.max(System.currentTimeMillis() - start, retryTime);
log.debug("Tablet {} had notfications, will rescan in {}ms", range, sleepTime);
UtilWaitThread.sleep(sleepTime);
retryTime = Math.min(MAX_SLEEP_MS, (long) (retryTime * 1.5));
start = System.currentTimeMillis();
}
return sawNotifications;
} | [
"private",
"static",
"boolean",
"waitTillNoNotifications",
"(",
"Environment",
"env",
",",
"TableRange",
"range",
")",
"throws",
"TableNotFoundException",
"{",
"boolean",
"sawNotifications",
"=",
"false",
";",
"long",
"retryTime",
"=",
"MIN_SLEEP_MS",
";",
"log",
".... | Wait until a range has no notifications.
@return true if notifications were ever seen while waiting | [
"Wait",
"until",
"a",
"range",
"has",
"no",
"notifications",
"."
] | train | https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/command/src/main/java/org/apache/fluo/command/FluoWait.java#L66-L84 |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRest.java | TemplateRest.getTemplates | @GET
@Produces(MediaType.APPLICATION_XML)
public Response getTemplates() {
logger.debug("StartOf getTemplates - REQUEST for /templates");
TemplateHelper templateRestService = getTemplateHelper();
String serializedTemplate = null;
try {
serializedTemplate = templateRestService.getTemplates();
} catch (HelperException e) {
logger.info("getTemplates exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getTemplates");
return buildResponse(200, serializedTemplate);
} | java | @GET
@Produces(MediaType.APPLICATION_XML)
public Response getTemplates() {
logger.debug("StartOf getTemplates - REQUEST for /templates");
TemplateHelper templateRestService = getTemplateHelper();
String serializedTemplate = null;
try {
serializedTemplate = templateRestService.getTemplates();
} catch (HelperException e) {
logger.info("getTemplates exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getTemplates");
return buildResponse(200, serializedTemplate);
} | [
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_XML",
")",
"public",
"Response",
"getTemplates",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"StartOf getTemplates - REQUEST for /templates\"",
")",
";",
"TemplateHelper",
"templateRestService",
"=",
... | Gets a the list of available templates from where we can get metrics,
host information, etc.
<pre>
GET /templates
Request:
GET /templates HTTP/1.1
Response:
HTTP/1.1 200 Ok
{@code
<?xml version="1.0" encoding="UTF-8"?>
<collection href="/templates">
<items offset="0" total="1">
<wsag:Template>...</wsag:Template>
...
</items>
</collection>
}
</pre>
Example: <li>curl http://localhost:8080/sla-service/templates</li>
@return XML information with the different details and urls of the
templates | [
"Gets",
"a",
"the",
"list",
"of",
"available",
"templates",
"from",
"where",
"we",
"can",
"get",
"metrics",
"host",
"information",
"etc",
"."
] | train | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRest.java#L148-L164 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java | XMLAssert.assertXMLNotEqual | public static void assertXMLNotEqual(Reader control, Reader test)
throws SAXException, IOException {
assertXMLNotEqual(null, control, test);
} | java | public static void assertXMLNotEqual(Reader control, Reader test)
throws SAXException, IOException {
assertXMLNotEqual(null, control, test);
} | [
"public",
"static",
"void",
"assertXMLNotEqual",
"(",
"Reader",
"control",
",",
"Reader",
"test",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"assertXMLNotEqual",
"(",
"null",
",",
"control",
",",
"test",
")",
";",
"}"
] | Assert that two XML documents are NOT similar
@param control XML to be compared against
@param test XML to be tested
@throws SAXException
@throws IOException | [
"Assert",
"that",
"two",
"XML",
"documents",
"are",
"NOT",
"similar"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L302-L305 |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.countObjectsFromClause | public static <T> int countObjectsFromClause(Class<T> clazz, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.countObjectsFromClause(c, clazz, clause, args));
} | java | public static <T> int countObjectsFromClause(Class<T> clazz, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.countObjectsFromClause(c, clazz, clause, args));
} | [
"public",
"static",
"<",
"T",
">",
"int",
"countObjectsFromClause",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"clause",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".",
"countObj... | Counts the number of rows for the given query.
@param clazz the class of the object to query.
@param clause The conditional part of a SQL where clause.
@param args The query parameters used to find the list of objects.
@param <T> the type of object to query.
@return The result count. | [
"Counts",
"the",
"number",
"of",
"rows",
"for",
"the",
"given",
"query",
"."
] | train | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L128-L131 |
bazaarvoice/jolt | cli/src/main/java/com/bazaarvoice/jolt/JoltCliUtilities.java | JoltCliUtilities.printJsonObject | public static boolean printJsonObject( Object output, Boolean uglyPrint, boolean suppressOutput ) {
try {
if ( uglyPrint ) {
printToStandardOut( JsonUtils.toJsonString( output ), suppressOutput );
} else {
printToStandardOut( JsonUtils.toPrettyJsonString( output ), suppressOutput );
}
} catch ( Exception e ) {
printToStandardOut( "An error occured while attempting to print the output.", suppressOutput );
return false;
}
return true;
} | java | public static boolean printJsonObject( Object output, Boolean uglyPrint, boolean suppressOutput ) {
try {
if ( uglyPrint ) {
printToStandardOut( JsonUtils.toJsonString( output ), suppressOutput );
} else {
printToStandardOut( JsonUtils.toPrettyJsonString( output ), suppressOutput );
}
} catch ( Exception e ) {
printToStandardOut( "An error occured while attempting to print the output.", suppressOutput );
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"printJsonObject",
"(",
"Object",
"output",
",",
"Boolean",
"uglyPrint",
",",
"boolean",
"suppressOutput",
")",
"{",
"try",
"{",
"if",
"(",
"uglyPrint",
")",
"{",
"printToStandardOut",
"(",
"JsonUtils",
".",
"toJsonString",
"(",
... | Prints the given json object to standard out, accounting for pretty printing and suppressed output.
@param output The object to print. This method will fail if this object is not well formed JSON.
@param uglyPrint ignore pretty print
@param suppressOutput suppress output to standard out
@return true if printing operation was successful | [
"Prints",
"the",
"given",
"json",
"object",
"to",
"standard",
"out",
"accounting",
"for",
"pretty",
"printing",
"and",
"suppressed",
"output",
"."
] | train | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/cli/src/main/java/com/bazaarvoice/jolt/JoltCliUtilities.java#L74-L86 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/parser/PELoader.java | PELoader.loadMSDOSHeader | private MSDOSHeader loadMSDOSHeader(RandomAccessFile raf, long peSigOffset)
throws IOException {
byte[] headerbytes = loadBytesSafely(0,
MSDOSHeader.FORMATTED_HEADER_SIZE, raf);
return MSDOSHeader.newInstance(headerbytes, peSigOffset);
} | java | private MSDOSHeader loadMSDOSHeader(RandomAccessFile raf, long peSigOffset)
throws IOException {
byte[] headerbytes = loadBytesSafely(0,
MSDOSHeader.FORMATTED_HEADER_SIZE, raf);
return MSDOSHeader.newInstance(headerbytes, peSigOffset);
} | [
"private",
"MSDOSHeader",
"loadMSDOSHeader",
"(",
"RandomAccessFile",
"raf",
",",
"long",
"peSigOffset",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"headerbytes",
"=",
"loadBytesSafely",
"(",
"0",
",",
"MSDOSHeader",
".",
"FORMATTED_HEADER_SIZE",
",",
"r... | Loads the MSDOS header.
@param raf
the random access file instance
@return msdos header
@throws IOException
if unable to read header | [
"Loads",
"the",
"MSDOS",
"header",
"."
] | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PELoader.java#L187-L192 |
aws/aws-sdk-java | aws-java-sdk-codepipeline/src/main/java/com/amazonaws/services/codepipeline/model/PipelineDeclaration.java | PipelineDeclaration.withArtifactStores | public PipelineDeclaration withArtifactStores(java.util.Map<String, ArtifactStore> artifactStores) {
setArtifactStores(artifactStores);
return this;
} | java | public PipelineDeclaration withArtifactStores(java.util.Map<String, ArtifactStore> artifactStores) {
setArtifactStores(artifactStores);
return this;
} | [
"public",
"PipelineDeclaration",
"withArtifactStores",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"ArtifactStore",
">",
"artifactStores",
")",
"{",
"setArtifactStores",
"(",
"artifactStores",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A mapping of artifactStore objects and their corresponding regions. There must be an artifact store for the
pipeline region and for each cross-region action within the pipeline. You can only use either artifactStore or
artifactStores, not both.
</p>
<p>
If you create a cross-region action in your pipeline, you must use artifactStores.
</p>
@param artifactStores
A mapping of artifactStore objects and their corresponding regions. There must be an artifact store for
the pipeline region and for each cross-region action within the pipeline. You can only use either
artifactStore or artifactStores, not both.</p>
<p>
If you create a cross-region action in your pipeline, you must use artifactStores.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"mapping",
"of",
"artifactStore",
"objects",
"and",
"their",
"corresponding",
"regions",
".",
"There",
"must",
"be",
"an",
"artifact",
"store",
"for",
"the",
"pipeline",
"region",
"and",
"for",
"each",
"cross",
"-",
"region",
"action",
"withi... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codepipeline/src/main/java/com/amazonaws/services/codepipeline/model/PipelineDeclaration.java#L263-L266 |
apache/incubator-atlas | graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/graphson/AtlasGraphSONUtility.java | AtlasGraphSONUtility.jsonFromElement | public static JSONObject jsonFromElement(final AtlasElement element, final Set<String> propertyKeys,
final AtlasGraphSONMode mode)
throws JSONException {
final AtlasGraphSONUtility graphson = element instanceof AtlasEdge
? new AtlasGraphSONUtility(mode, null, propertyKeys)
: new AtlasGraphSONUtility(mode, propertyKeys, null);
return graphson.jsonFromElement(element);
} | java | public static JSONObject jsonFromElement(final AtlasElement element, final Set<String> propertyKeys,
final AtlasGraphSONMode mode)
throws JSONException {
final AtlasGraphSONUtility graphson = element instanceof AtlasEdge
? new AtlasGraphSONUtility(mode, null, propertyKeys)
: new AtlasGraphSONUtility(mode, propertyKeys, null);
return graphson.jsonFromElement(element);
} | [
"public",
"static",
"JSONObject",
"jsonFromElement",
"(",
"final",
"AtlasElement",
"element",
",",
"final",
"Set",
"<",
"String",
">",
"propertyKeys",
",",
"final",
"AtlasGraphSONMode",
"mode",
")",
"throws",
"JSONException",
"{",
"final",
"AtlasGraphSONUtility",
"g... | Creates a Jettison JSONObject from a graph element.
@param element
the graph element to convert to JSON.
@param propertyKeys
The property getPropertyKeys() at the root of the element to
serialize. If null, then all getPropertyKeys() are serialized.
@param mode
the type of GraphSON to be generated. | [
"Creates",
"a",
"Jettison",
"JSONObject",
"from",
"a",
"graph",
"element",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/graphson/AtlasGraphSONUtility.java#L189-L197 |
loldevs/riotapi | spectator/src/main/java/net/boreeas/riotapi/spectator/MappedDataCache.java | MappedDataCache.get | public V get(K k, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
await(k, timeout, unit);
return cache.get(k);
} | java | public V get(K k, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
await(k, timeout, unit);
return cache.get(k);
} | [
"public",
"V",
"get",
"(",
"K",
"k",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"await",
"(",
"k",
",",
"timeout",
",",
"unit",
")",
";",
"return",
"cache",
".",
"get",
"(",
"k"... | Retrieve the value associated with the given key, blocking as long as necessary up to the specified maximum.
@param k The key.
@param timeout The length of the timeout.
@param unit The time unit of the timeout.
@return The value associated with the key.
@throws InterruptedException
@throws TimeoutException | [
"Retrieve",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"blocking",
"as",
"long",
"as",
"necessary",
"up",
"to",
"the",
"specified",
"maximum",
"."
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/spectator/src/main/java/net/boreeas/riotapi/spectator/MappedDataCache.java#L81-L85 |
ACINQ/bitcoin-lib | src/main/java/fr/acinq/Secp256k1Loader.java | Secp256k1Loader.loadNativeLibrary | private static boolean loadNativeLibrary(String path, String name) {
File libPath = new File(path, name);
if(libPath.exists()) {
try {
System.load(new File(path, name).getAbsolutePath());
return true;
}
catch(UnsatisfiedLinkError e) {
System.err.println("Failed to load native library:" + name + ". osinfo: " + OSInfo.getNativeLibFolderPathForCurrentOS());
System.err.println(e);
return false;
}
}
else {
return false;
}
} | java | private static boolean loadNativeLibrary(String path, String name) {
File libPath = new File(path, name);
if(libPath.exists()) {
try {
System.load(new File(path, name).getAbsolutePath());
return true;
}
catch(UnsatisfiedLinkError e) {
System.err.println("Failed to load native library:" + name + ". osinfo: " + OSInfo.getNativeLibFolderPathForCurrentOS());
System.err.println(e);
return false;
}
}
else {
return false;
}
} | [
"private",
"static",
"boolean",
"loadNativeLibrary",
"(",
"String",
"path",
",",
"String",
"name",
")",
"{",
"File",
"libPath",
"=",
"new",
"File",
"(",
"path",
",",
"name",
")",
";",
"if",
"(",
"libPath",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{... | Loads native library using the given path and name of the library.
@param path Path of the native library.
@param name Name of the native library.
@return True for successfully loading; false otherwise. | [
"Loads",
"native",
"library",
"using",
"the",
"given",
"path",
"and",
"name",
"of",
"the",
"library",
"."
] | train | https://github.com/ACINQ/bitcoin-lib/blob/74a30b28b1001672359b19890ffa3d3951362d65/src/main/java/fr/acinq/Secp256k1Loader.java#L204-L222 |
schallee/alib4j | core/src/main/java/net/darkmist/alib/res/PkgRes.java | PkgRes.getBytesFor | public static byte[] getBytesFor(String name, Object obj)
{
if(obj == null)
throw new NullPointerException("obj is null");
return getBytesFor(name,obj.getClass());
} | java | public static byte[] getBytesFor(String name, Object obj)
{
if(obj == null)
throw new NullPointerException("obj is null");
return getBytesFor(name,obj.getClass());
} | [
"public",
"static",
"byte",
"[",
"]",
"getBytesFor",
"(",
"String",
"name",
",",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"obj is null\"",
")",
";",
"return",
"getBytesFor",
"(",
"name",... | Get a resource as a byte array.
@param name The name of the resource
@return The contents of the resource as a byte array.
@throws NullPointerException if name or obj are null.
ResourceException if the resource cannot be found. | [
"Get",
"a",
"resource",
"as",
"a",
"byte",
"array",
"."
] | train | https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/res/PkgRes.java#L385-L390 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.joinWith | public static String joinWith(final String separator, final Object... objects) {
if (objects == null) {
throw new IllegalArgumentException("Object varargs must not be null");
}
final String sanitizedSeparator = defaultString(separator, StringUtils.EMPTY);
final StringBuilder result = new StringBuilder();
final Iterator<Object> iterator = Arrays.asList(objects).iterator();
while (iterator.hasNext()) {
final String value = Objects.toString(iterator.next(), "");
result.append(value);
if (iterator.hasNext()) {
result.append(sanitizedSeparator);
}
}
return result.toString();
} | java | public static String joinWith(final String separator, final Object... objects) {
if (objects == null) {
throw new IllegalArgumentException("Object varargs must not be null");
}
final String sanitizedSeparator = defaultString(separator, StringUtils.EMPTY);
final StringBuilder result = new StringBuilder();
final Iterator<Object> iterator = Arrays.asList(objects).iterator();
while (iterator.hasNext()) {
final String value = Objects.toString(iterator.next(), "");
result.append(value);
if (iterator.hasNext()) {
result.append(sanitizedSeparator);
}
}
return result.toString();
} | [
"public",
"static",
"String",
"joinWith",
"(",
"final",
"String",
"separator",
",",
"final",
"Object",
"...",
"objects",
")",
"{",
"if",
"(",
"objects",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Object varargs must not be null\"",... | <p>Joins the elements of the provided varargs into a
single String containing the provided elements.</p>
<p>No delimiter is added before or after the list.
{@code null} elements and separator are treated as empty Strings ("").</p>
<pre>
StringUtils.joinWith(",", {"a", "b"}) = "a,b"
StringUtils.joinWith(",", {"a", "b",""}) = "a,b,"
StringUtils.joinWith(",", {"a", null, "b"}) = "a,,b"
StringUtils.joinWith(null, {"a", "b"}) = "ab"
</pre>
@param separator the separator character to use, null treated as ""
@param objects the varargs providing the values to join together. {@code null} elements are treated as ""
@return the joined String.
@throws java.lang.IllegalArgumentException if a null varargs is provided
@since 3.5 | [
"<p",
">",
"Joins",
"the",
"elements",
"of",
"the",
"provided",
"varargs",
"into",
"a",
"single",
"String",
"containing",
"the",
"provided",
"elements",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L4748-L4768 |
oasp/oasp4j | modules/basic/src/main/java/io/oasp/module/basic/common/api/config/SimpleConfigProperties.java | SimpleConfigProperties.fromFlatMap | protected void fromFlatMap(Map<String, String> map) {
for (Entry<String, String> entry : map.entrySet()) {
SimpleConfigProperties child;
child = (SimpleConfigProperties) getChild(entry.getKey(), true);
child.value = entry.getValue();
}
} | java | protected void fromFlatMap(Map<String, String> map) {
for (Entry<String, String> entry : map.entrySet()) {
SimpleConfigProperties child;
child = (SimpleConfigProperties) getChild(entry.getKey(), true);
child.value = entry.getValue();
}
} | [
"protected",
"void",
"fromFlatMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"SimpleConfigProperties",
"child",
";"... | @see SimpleConfigProperties#ofFlatMap(String, Map)
@param map the flat {@link Map} of the configuration values. | [
"@see",
"SimpleConfigProperties#ofFlatMap",
"(",
"String",
"Map",
")"
] | train | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/basic/src/main/java/io/oasp/module/basic/common/api/config/SimpleConfigProperties.java#L257-L264 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/SortActivity.java | SortActivity.makeItem | private SimpleItem makeItem(@IntRange(from = 0, to = 25) int position) {
SimpleItem result = new SimpleItem();
result.withName(ALPHABET[position]);
position++;
String description = "The " + (position);
if (position == 1 || position == 21) {
description += "st";
} else if (position == 2 || position == 22) {
description += "nd";
} else if (position == 3 || position == 23) {
description += "rd";
} else {
description += "th";
}
return result.withDescription(description + " letter in the alphabet");
} | java | private SimpleItem makeItem(@IntRange(from = 0, to = 25) int position) {
SimpleItem result = new SimpleItem();
result.withName(ALPHABET[position]);
position++;
String description = "The " + (position);
if (position == 1 || position == 21) {
description += "st";
} else if (position == 2 || position == 22) {
description += "nd";
} else if (position == 3 || position == 23) {
description += "rd";
} else {
description += "th";
}
return result.withDescription(description + " letter in the alphabet");
} | [
"private",
"SimpleItem",
"makeItem",
"(",
"@",
"IntRange",
"(",
"from",
"=",
"0",
",",
"to",
"=",
"25",
")",
"int",
"position",
")",
"{",
"SimpleItem",
"result",
"=",
"new",
"SimpleItem",
"(",
")",
";",
"result",
".",
"withName",
"(",
"ALPHABET",
"[",
... | Build a simple item with one letter of the alphabet.
@param position The position of the letter in the alphabet.
@return The new item. | [
"Build",
"a",
"simple",
"item",
"with",
"one",
"letter",
"of",
"the",
"alphabet",
"."
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/SortActivity.java#L228-L248 |
linkedin/dexmaker | dexmaker/src/main/java/com/android/dx/AnnotationId.java | AnnotationId.addToMethod | public void addToMethod(DexMaker dexMaker, MethodId<?, ?> method) {
if (annotatedElement != ElementType.METHOD) {
throw new IllegalStateException("This annotation is not for method");
}
if (!method.declaringType.equals(declaringType)) {
throw new IllegalArgumentException("Method" + method + "'s declaring type is inconsistent with" + this);
}
ClassDefItem classDefItem = dexMaker.getTypeDeclaration(declaringType).toClassDefItem();
if (classDefItem == null) {
throw new NullPointerException("No class defined item is found");
} else {
CstMethodRef cstMethodRef = method.constant;
if (cstMethodRef == null) {
throw new NullPointerException("Method reference is NULL");
} else {
// Generate CstType
CstType cstType = CstType.intern(type.ropType);
// Generate Annotation
Annotation annotation = new Annotation(cstType, AnnotationVisibility.RUNTIME);
// Add generated annotation
Annotations annotations = new Annotations();
for (NameValuePair nvp : elements.values()) {
annotation.add(nvp);
}
annotations.add(annotation);
classDefItem.addMethodAnnotations(cstMethodRef, annotations, dexMaker.getDexFile());
}
}
} | java | public void addToMethod(DexMaker dexMaker, MethodId<?, ?> method) {
if (annotatedElement != ElementType.METHOD) {
throw new IllegalStateException("This annotation is not for method");
}
if (!method.declaringType.equals(declaringType)) {
throw new IllegalArgumentException("Method" + method + "'s declaring type is inconsistent with" + this);
}
ClassDefItem classDefItem = dexMaker.getTypeDeclaration(declaringType).toClassDefItem();
if (classDefItem == null) {
throw new NullPointerException("No class defined item is found");
} else {
CstMethodRef cstMethodRef = method.constant;
if (cstMethodRef == null) {
throw new NullPointerException("Method reference is NULL");
} else {
// Generate CstType
CstType cstType = CstType.intern(type.ropType);
// Generate Annotation
Annotation annotation = new Annotation(cstType, AnnotationVisibility.RUNTIME);
// Add generated annotation
Annotations annotations = new Annotations();
for (NameValuePair nvp : elements.values()) {
annotation.add(nvp);
}
annotations.add(annotation);
classDefItem.addMethodAnnotations(cstMethodRef, annotations, dexMaker.getDexFile());
}
}
} | [
"public",
"void",
"addToMethod",
"(",
"DexMaker",
"dexMaker",
",",
"MethodId",
"<",
"?",
",",
"?",
">",
"method",
")",
"{",
"if",
"(",
"annotatedElement",
"!=",
"ElementType",
".",
"METHOD",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"This ann... | Add this annotation to a method.
@param dexMaker DexMaker instance.
@param method Method to be added to. | [
"Add",
"this",
"annotation",
"to",
"a",
"method",
"."
] | train | https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/AnnotationId.java#L128-L162 |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.getReplacedMazeString | public String getReplacedMazeString(List<Map<Point, Character>> replacements) {
String[] stringMaze = toStringArray();
for (Map<Point, Character> replacement : replacements) {
for (Point p : replacement.keySet()) {
int row = p.y;
int column = p.x;
char c = stringMaze[row].charAt(column);
if (c != Symbol.START.value() && c != Symbol.GOAL.value()) {
stringMaze[row] = replaceChar(stringMaze[row], column, replacement.get(p));
}
}
}
String output = "";
for (String line : stringMaze) {
output += String.format("%s%n", line);
}
return output;
} | java | public String getReplacedMazeString(List<Map<Point, Character>> replacements) {
String[] stringMaze = toStringArray();
for (Map<Point, Character> replacement : replacements) {
for (Point p : replacement.keySet()) {
int row = p.y;
int column = p.x;
char c = stringMaze[row].charAt(column);
if (c != Symbol.START.value() && c != Symbol.GOAL.value()) {
stringMaze[row] = replaceChar(stringMaze[row], column, replacement.get(p));
}
}
}
String output = "";
for (String line : stringMaze) {
output += String.format("%s%n", line);
}
return output;
} | [
"public",
"String",
"getReplacedMazeString",
"(",
"List",
"<",
"Map",
"<",
"Point",
",",
"Character",
">",
">",
"replacements",
")",
"{",
"String",
"[",
"]",
"stringMaze",
"=",
"toStringArray",
"(",
")",
";",
"for",
"(",
"Map",
"<",
"Point",
",",
"Charac... | Generates a string representation of this maze but replacing all the indicated
points with the characters provided.
@param replacements list with maps of point-character replacements.
@return String representation of the maze with the replacements. | [
"Generates",
"a",
"string",
"representation",
"of",
"this",
"maze",
"but",
"replacing",
"all",
"the",
"indicated",
"points",
"with",
"the",
"characters",
"provided",
"."
] | train | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L315-L332 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.forEntireMethod | public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, XMethod xmethod) {
JavaClassAndMethod m = Hierarchy.findMethod(javaClass, xmethod.getName(), xmethod.getSignature());
if (m == null) {
return createUnknown(javaClass.getClassName(), javaClass.getSourceFileName());
} else {
return forEntireMethod(javaClass, m.getMethod());
}
} | java | public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, XMethod xmethod) {
JavaClassAndMethod m = Hierarchy.findMethod(javaClass, xmethod.getName(), xmethod.getSignature());
if (m == null) {
return createUnknown(javaClass.getClassName(), javaClass.getSourceFileName());
} else {
return forEntireMethod(javaClass, m.getMethod());
}
} | [
"public",
"static",
"SourceLineAnnotation",
"forEntireMethod",
"(",
"JavaClass",
"javaClass",
",",
"XMethod",
"xmethod",
")",
"{",
"JavaClassAndMethod",
"m",
"=",
"Hierarchy",
".",
"findMethod",
"(",
"javaClass",
",",
"xmethod",
".",
"getName",
"(",
")",
",",
"x... | Create a SourceLineAnnotation covering an entire method.
@param javaClass
JavaClass containing the method
@param xmethod
the method
@return a SourceLineAnnotation for the entire method | [
"Create",
"a",
"SourceLineAnnotation",
"covering",
"an",
"entire",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L304-L311 |
tvesalainen/util | util/src/main/java/org/vesalainen/navi/Area.java | Area.getSquare | public static Area getSquare(double latFrom, double latTo, double lonFrom, double lonTo)
{
Location[] locs = new Location[4];
locs[0] = new Location(latFrom, lonFrom);
locs[1] = new Location(latFrom, lonTo);
locs[2] = new Location(latTo, lonFrom);
locs[3] = new Location(latTo, lonTo);
return new ConvexArea(locs);
} | java | public static Area getSquare(double latFrom, double latTo, double lonFrom, double lonTo)
{
Location[] locs = new Location[4];
locs[0] = new Location(latFrom, lonFrom);
locs[1] = new Location(latFrom, lonTo);
locs[2] = new Location(latTo, lonFrom);
locs[3] = new Location(latTo, lonTo);
return new ConvexArea(locs);
} | [
"public",
"static",
"Area",
"getSquare",
"(",
"double",
"latFrom",
",",
"double",
"latTo",
",",
"double",
"lonFrom",
",",
"double",
"lonTo",
")",
"{",
"Location",
"[",
"]",
"locs",
"=",
"new",
"Location",
"[",
"4",
"]",
";",
"locs",
"[",
"0",
"]",
"=... | Returns rectangular area. Area is limited by lat/lon coordinates
@param latFrom
@param latTo
@param lonFrom
@param lonTo
@return | [
"Returns",
"rectangular",
"area",
".",
"Area",
"is",
"limited",
"by",
"lat",
"/",
"lon",
"coordinates"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/Area.java#L103-L111 |
wanglinsong/testharness | src/main/java/com/tascape/qa/th/libx/DefaultExecutor.java | DefaultExecutor.createThread | @Override
protected Thread createThread(final Runnable runnable, final String name) {
return new Thread(runnable, Thread.currentThread().getName() + "-exec");
} | java | @Override
protected Thread createThread(final Runnable runnable, final String name) {
return new Thread(runnable, Thread.currentThread().getName() + "-exec");
} | [
"@",
"Override",
"protected",
"Thread",
"createThread",
"(",
"final",
"Runnable",
"runnable",
",",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Thread",
"(",
"runnable",
",",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getName",
"(",
")",
"+"... | Factory method to create a thread waiting for the result of an
asynchronous execution.
@param runnable the runnable passed to the thread
@param name the name of the thread
@return the thread | [
"Factory",
"method",
"to",
"create",
"a",
"thread",
"waiting",
"for",
"the",
"result",
"of",
"an",
"asynchronous",
"execution",
"."
] | train | https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/libx/DefaultExecutor.java#L33-L36 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java | ExpressRouteConnectionsInner.beginCreateOrUpdateAsync | public Observable<ExpressRouteConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() {
@Override
public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() {
@Override
public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteConnectionInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"String",
"connectionName",
",",
"ExpressRouteConnectionInner",
"putExpressRouteConnectionParameters",
"... | Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteConnectionInner object | [
"Creates",
"a",
"connection",
"between",
"an",
"ExpressRoute",
"gateway",
"and",
"an",
"ExpressRoute",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L207-L214 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/ProxyUtil.java | ProxyUtil.createClientProxy | public static <T> T createClientProxy(ClassLoader classLoader, Class<T> proxyInterface, final IJsonRpcClient client) {
return createClientProxy(classLoader, proxyInterface, client, new HashMap<String, String>());
} | java | public static <T> T createClientProxy(ClassLoader classLoader, Class<T> proxyInterface, final IJsonRpcClient client) {
return createClientProxy(classLoader, proxyInterface, client, new HashMap<String, String>());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createClientProxy",
"(",
"ClassLoader",
"classLoader",
",",
"Class",
"<",
"T",
">",
"proxyInterface",
",",
"final",
"IJsonRpcClient",
"client",
")",
"{",
"return",
"createClientProxy",
"(",
"classLoader",
",",
"proxyInter... | Creates a {@link Proxy} of the given {@code proxyInterface} that uses the given {@link JsonRpcHttpClient}.
@param <T> the proxy type
@param classLoader the {@link ClassLoader}
@param proxyInterface the interface to proxy
@param client the {@link JsonRpcHttpClient}
@return the proxied interface | [
"Creates",
"a",
"{",
"@link",
"Proxy",
"}",
"of",
"the",
"given",
"{",
"@code",
"proxyInterface",
"}",
"that",
"uses",
"the",
"given",
"{",
"@link",
"JsonRpcHttpClient",
"}",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/ProxyUtil.java#L188-L190 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/SeleniumSpec.java | SeleniumSpec.assertSeleniumIsDisplayed | @Then("^the element on index '(\\d+?)' (IS|IS NOT) displayed$")
public void assertSeleniumIsDisplayed(Integer index, Boolean isDisplayed) {
assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required")
.hasAtLeast(index);
assertThat(this.commonspec, commonspec.getPreviousWebElements().getPreviousWebElements().get(index).isDisplayed()).as(
"Unexpected element display property").isEqualTo(isDisplayed);
} | java | @Then("^the element on index '(\\d+?)' (IS|IS NOT) displayed$")
public void assertSeleniumIsDisplayed(Integer index, Boolean isDisplayed) {
assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required")
.hasAtLeast(index);
assertThat(this.commonspec, commonspec.getPreviousWebElements().getPreviousWebElements().get(index).isDisplayed()).as(
"Unexpected element display property").isEqualTo(isDisplayed);
} | [
"@",
"Then",
"(",
"\"^the element on index '(\\\\d+?)' (IS|IS NOT) displayed$\"",
")",
"public",
"void",
"assertSeleniumIsDisplayed",
"(",
"Integer",
"index",
",",
"Boolean",
"isDisplayed",
")",
"{",
"assertThat",
"(",
"this",
".",
"commonspec",
",",
"commonspec",
".",
... | Verifies that a webelement previously found {@code isDisplayed}
@param index
@param isDisplayed | [
"Verifies",
"that",
"a",
"webelement",
"previously",
"found",
"{",
"@code",
"isDisplayed",
"}"
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L484-L490 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java | CommerceAddressPersistenceImpl.findAll | @Override
public List<CommerceAddress> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceAddress> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAddress",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce addresses.
@return the commerce addresses | [
"Returns",
"all",
"the",
"commerce",
"addresses",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java#L4199-L4202 |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java | ExtendedListeningPoint.createViaHeader | public ViaHeader createViaHeader(String branch, boolean usePublicAddress) {
try {
String host = getIpAddress(usePublicAddress);
ViaHeader via = SipFactoryImpl.headerFactory.createViaHeader(host, port, transport, branch);
return via;
} catch (ParseException ex) {
logger.error ("Unexpected error while creating a via header",ex);
throw new IllegalArgumentException("Unexpected exception when creating via header ", ex);
} catch (InvalidArgumentException e) {
logger.error ("Unexpected error while creating a via header",e);
throw new IllegalArgumentException("Unexpected exception when creating via header ", e);
}
} | java | public ViaHeader createViaHeader(String branch, boolean usePublicAddress) {
try {
String host = getIpAddress(usePublicAddress);
ViaHeader via = SipFactoryImpl.headerFactory.createViaHeader(host, port, transport, branch);
return via;
} catch (ParseException ex) {
logger.error ("Unexpected error while creating a via header",ex);
throw new IllegalArgumentException("Unexpected exception when creating via header ", ex);
} catch (InvalidArgumentException e) {
logger.error ("Unexpected error while creating a via header",e);
throw new IllegalArgumentException("Unexpected exception when creating via header ", e);
}
} | [
"public",
"ViaHeader",
"createViaHeader",
"(",
"String",
"branch",
",",
"boolean",
"usePublicAddress",
")",
"{",
"try",
"{",
"String",
"host",
"=",
"getIpAddress",
"(",
"usePublicAddress",
")",
";",
"ViaHeader",
"via",
"=",
"SipFactoryImpl",
".",
"headerFactory",
... | Create a Via Header based on the host, port and transport of this listening point
@param usePublicAddress if true, the host will be the global ip address found by STUN otherwise
it will be the local network interface ipaddress
@param branch the branch id to use
@return the via header | [
"Create",
"a",
"Via",
"Header",
"based",
"on",
"the",
"host",
"port",
"and",
"transport",
"of",
"this",
"listening",
"point"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java#L183-L195 |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/util/Ascii.java | Ascii.containsIgnoreCase | public static boolean containsIgnoreCase(CharSequence sequence, CharSequence subSequence) {
// Calling length() is the null pointer check (so do it before we can exit early).
int length = sequence.length();
if (sequence == subSequence) {
return true;
}
// if subSequence is longer than sequence, it is impossible for sequence to contain subSequence
if (subSequence.length() > length) {
return false;
}
return indexOfIgnoreCase(sequence, subSequence) > -1;
} | java | public static boolean containsIgnoreCase(CharSequence sequence, CharSequence subSequence) {
// Calling length() is the null pointer check (so do it before we can exit early).
int length = sequence.length();
if (sequence == subSequence) {
return true;
}
// if subSequence is longer than sequence, it is impossible for sequence to contain subSequence
if (subSequence.length() > length) {
return false;
}
return indexOfIgnoreCase(sequence, subSequence) > -1;
} | [
"public",
"static",
"boolean",
"containsIgnoreCase",
"(",
"CharSequence",
"sequence",
",",
"CharSequence",
"subSequence",
")",
"{",
"// Calling length() is the null pointer check (so do it before we can exit early).",
"int",
"length",
"=",
"sequence",
".",
"length",
"(",
")",... | Indicates whether the character sequence {@code sequence} contains the {@code subSequence},
ignoring the case of any ASCII alphabetic characters between {@code 'a'} and {@code 'z'}
or {@code 'A'} and {@code 'Z'} inclusive.
@since NEXT | [
"Indicates",
"whether",
"the",
"character",
"sequence",
"{",
"@code",
"sequence",
"}",
"contains",
"the",
"{",
"@code",
"subSequence",
"}",
"ignoring",
"the",
"case",
"of",
"any",
"ASCII",
"alphabetic",
"characters",
"between",
"{",
"@code",
"a",
"}",
"and",
... | train | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/util/Ascii.java#L134-L145 |
zanata/openprops | orig/Properties.java | Properties.enumerateStringProperties | private synchronized void enumerateStringProperties(Hashtable<String, String> h) {
if (defaults != null) {
defaults.enumerateStringProperties(h);
}
for (Enumeration e = keys() ; e.hasMoreElements() ;) {
Object k = e.nextElement();
Object v = get(k);
if (k instanceof String && v instanceof String) {
h.put((String) k, (String) v);
}
}
} | java | private synchronized void enumerateStringProperties(Hashtable<String, String> h) {
if (defaults != null) {
defaults.enumerateStringProperties(h);
}
for (Enumeration e = keys() ; e.hasMoreElements() ;) {
Object k = e.nextElement();
Object v = get(k);
if (k instanceof String && v instanceof String) {
h.put((String) k, (String) v);
}
}
} | [
"private",
"synchronized",
"void",
"enumerateStringProperties",
"(",
"Hashtable",
"<",
"String",
",",
"String",
">",
"h",
")",
"{",
"if",
"(",
"defaults",
"!=",
"null",
")",
"{",
"defaults",
".",
"enumerateStringProperties",
"(",
"h",
")",
";",
"}",
"for",
... | Enumerates all key/value pairs in the specified hashtable
and omits the property if the key or value is not a string.
@param h the hashtable | [
"Enumerates",
"all",
"key",
"/",
"value",
"pairs",
"in",
"the",
"specified",
"hashtable",
"and",
"omits",
"the",
"property",
"if",
"the",
"key",
"or",
"value",
"is",
"not",
"a",
"string",
"."
] | train | https://github.com/zanata/openprops/blob/46510e610a765e4a91b302fc0d6a2123ed589603/orig/Properties.java#L1087-L1098 |
highsource/maven-jaxb2-plugin | plugin-core/src/main/java/org/jvnet/jaxb2/maven2/RawXJC2Mojo.java | RawXJC2Mojo.createCatalogResolver | protected CatalogResolver createCatalogResolver() throws MojoExecutionException {
final CatalogManager catalogManager = new CatalogManager();
catalogManager.setIgnoreMissingProperties(true);
catalogManager.setUseStaticCatalog(false);
// TODO Logging
if (getLog().isDebugEnabled()) {
catalogManager.setVerbosity(Integer.MAX_VALUE);
}
if (getCatalogResolver() == null) {
return new MavenCatalogResolver(catalogManager, this, getLog());
} else {
final String catalogResolverClassName = getCatalogResolver().trim();
return createCatalogResolverByClassName(catalogResolverClassName);
}
} | java | protected CatalogResolver createCatalogResolver() throws MojoExecutionException {
final CatalogManager catalogManager = new CatalogManager();
catalogManager.setIgnoreMissingProperties(true);
catalogManager.setUseStaticCatalog(false);
// TODO Logging
if (getLog().isDebugEnabled()) {
catalogManager.setVerbosity(Integer.MAX_VALUE);
}
if (getCatalogResolver() == null) {
return new MavenCatalogResolver(catalogManager, this, getLog());
} else {
final String catalogResolverClassName = getCatalogResolver().trim();
return createCatalogResolverByClassName(catalogResolverClassName);
}
} | [
"protected",
"CatalogResolver",
"createCatalogResolver",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"final",
"CatalogManager",
"catalogManager",
"=",
"new",
"CatalogManager",
"(",
")",
";",
"catalogManager",
".",
"setIgnoreMissingProperties",
"(",
"true",
")",
"... | Creates an instance of catalog resolver.
@return Instance of the catalog resolver.
@throws MojoExecutionException
If catalog resolver cannot be instantiated. | [
"Creates",
"an",
"instance",
"of",
"catalog",
"resolver",
"."
] | train | https://github.com/highsource/maven-jaxb2-plugin/blob/a4d3955be5a8c2a5f6137c0f436798c95ef95176/plugin-core/src/main/java/org/jvnet/jaxb2/maven2/RawXJC2Mojo.java#L891-L905 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/io/BinaryReader.java | BinaryReader.readUInt16 | public int readUInt16() throws IOException {
int b1 = in.read();
if (b1 < 0) {
return 0;
}
int b2 = in.read();
if (b2 < 0) {
throw new IOException("Missing byte 2 to read uint16");
}
return unshift2bytes(b1, b2);
} | java | public int readUInt16() throws IOException {
int b1 = in.read();
if (b1 < 0) {
return 0;
}
int b2 = in.read();
if (b2 < 0) {
throw new IOException("Missing byte 2 to read uint16");
}
return unshift2bytes(b1, b2);
} | [
"public",
"int",
"readUInt16",
"(",
")",
"throws",
"IOException",
"{",
"int",
"b1",
"=",
"in",
".",
"read",
"(",
")",
";",
"if",
"(",
"b1",
"<",
"0",
")",
"{",
"return",
"0",
";",
"}",
"int",
"b2",
"=",
"in",
".",
"read",
"(",
")",
";",
"if",... | Read an unsigned short from the input stream.
@return The number read.
@throws IOException If no number to read. | [
"Read",
"an",
"unsigned",
"short",
"from",
"the",
"input",
"stream",
"."
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/io/BinaryReader.java#L297-L307 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java | ManagedClustersInner.getAccessProfilesAsync | public Observable<ManagedClusterAccessProfileInner> getAccessProfilesAsync(String resourceGroupName, String resourceName, String roleName) {
return getAccessProfilesWithServiceResponseAsync(resourceGroupName, resourceName, roleName).map(new Func1<ServiceResponse<ManagedClusterAccessProfileInner>, ManagedClusterAccessProfileInner>() {
@Override
public ManagedClusterAccessProfileInner call(ServiceResponse<ManagedClusterAccessProfileInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedClusterAccessProfileInner> getAccessProfilesAsync(String resourceGroupName, String resourceName, String roleName) {
return getAccessProfilesWithServiceResponseAsync(resourceGroupName, resourceName, roleName).map(new Func1<ServiceResponse<ManagedClusterAccessProfileInner>, ManagedClusterAccessProfileInner>() {
@Override
public ManagedClusterAccessProfileInner call(ServiceResponse<ManagedClusterAccessProfileInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedClusterAccessProfileInner",
">",
"getAccessProfilesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"roleName",
")",
"{",
"return",
"getAccessProfilesWithServiceResponseAsync",
"(",
"resourceGroupNa... | Gets access profile of a managed cluster.
Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the managed cluster resource.
@param roleName The name of the role for managed cluster accessProfile resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ManagedClusterAccessProfileInner object | [
"Gets",
"access",
"profile",
"of",
"a",
"managed",
"cluster",
".",
"Gets",
"the",
"accessProfile",
"for",
"the",
"specified",
"role",
"name",
"of",
"the",
"managed",
"cluster",
"with",
"a",
"specified",
"resource",
"group",
"and",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java#L476-L483 |
j256/simplejmx | src/main/java/com/j256/simplejmx/client/JmxClient.java | JmxClient.invokeOperation | public Object invokeOperation(String domain, String beanName, String operName, Object... params) throws Exception {
return invokeOperation(ObjectNameUtil.makeObjectName(domain, beanName), operName, params);
} | java | public Object invokeOperation(String domain, String beanName, String operName, Object... params) throws Exception {
return invokeOperation(ObjectNameUtil.makeObjectName(domain, beanName), operName, params);
} | [
"public",
"Object",
"invokeOperation",
"(",
"String",
"domain",
",",
"String",
"beanName",
",",
"String",
"operName",
",",
"Object",
"...",
"params",
")",
"throws",
"Exception",
"{",
"return",
"invokeOperation",
"(",
"ObjectNameUtil",
".",
"makeObjectName",
"(",
... | Invoke a JMX method as an array of objects.
@return The value returned by the method or null if none. | [
"Invoke",
"a",
"JMX",
"method",
"as",
"an",
"array",
"of",
"objects",
"."
] | train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L449-L451 |
apache/incubator-druid | extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java | ApproximateHistogram.foldFast | public ApproximateHistogram foldFast(ApproximateHistogram h, float[] mergedPositions, long[] mergedBins)
{
if (size == 0) {
return copy(h);
} else {
return foldRule(h, mergedPositions, mergedBins);
}
} | java | public ApproximateHistogram foldFast(ApproximateHistogram h, float[] mergedPositions, long[] mergedBins)
{
if (size == 0) {
return copy(h);
} else {
return foldRule(h, mergedPositions, mergedBins);
}
} | [
"public",
"ApproximateHistogram",
"foldFast",
"(",
"ApproximateHistogram",
"h",
",",
"float",
"[",
"]",
"mergedPositions",
",",
"long",
"[",
"]",
"mergedBins",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"return",
"copy",
"(",
"h",
")",
";",
"}",
... | @param h histogram to be merged into the current histogram
@param mergedPositions temporary buffer of size greater or equal to {@link #size}
@param mergedBins temporary buffer of size greater or equal to {@link #size}
@return returns this histogram with h folded into it | [
"@param",
"h",
"histogram",
"to",
"be",
"merged",
"into",
"the",
"current",
"histogram",
"@param",
"mergedPositions",
"temporary",
"buffer",
"of",
"size",
"greater",
"or",
"equal",
"to",
"{",
"@link",
"#size",
"}",
"@param",
"mergedBins",
"temporary",
"buffer",
... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L499-L506 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Input.java | Input.considerDoubleClick | public void considerDoubleClick(int button, int x, int y) {
if (doubleClickTimeout == 0) {
clickX = x;
clickY = y;
clickButton = button;
doubleClickTimeout = System.currentTimeMillis() + doubleClickDelay;
fireMouseClicked(button, x, y, 1);
} else {
if (clickButton == button) {
if ((System.currentTimeMillis() < doubleClickTimeout)) {
fireMouseClicked(button, x, y, 2);
doubleClickTimeout = 0;
}
}
}
} | java | public void considerDoubleClick(int button, int x, int y) {
if (doubleClickTimeout == 0) {
clickX = x;
clickY = y;
clickButton = button;
doubleClickTimeout = System.currentTimeMillis() + doubleClickDelay;
fireMouseClicked(button, x, y, 1);
} else {
if (clickButton == button) {
if ((System.currentTimeMillis() < doubleClickTimeout)) {
fireMouseClicked(button, x, y, 2);
doubleClickTimeout = 0;
}
}
}
} | [
"public",
"void",
"considerDoubleClick",
"(",
"int",
"button",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"doubleClickTimeout",
"==",
"0",
")",
"{",
"clickX",
"=",
"x",
";",
"clickY",
"=",
"y",
";",
"clickButton",
"=",
"button",
";",
"dou... | Notification that the mouse has been pressed and hence we
should consider what we're doing with double clicking
@param button The button pressed/released
@param x The location of the mouse
@param y The location of the mouse | [
"Notification",
"that",
"the",
"mouse",
"has",
"been",
"pressed",
"and",
"hence",
"we",
"should",
"consider",
"what",
"we",
"re",
"doing",
"with",
"double",
"clicking"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L1107-L1122 |
jbundle/jbundle | thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/PaperPrint.java | PaperPrint.printFooter | protected void printFooter(Graphics2D g2d, String footerText)
{
FontMetrics fm = g2d.getFontMetrics();
int stringWidth = fm.stringWidth(footerText);
int textX = (pageRect.width - stringWidth) / 2 + pageRect.x;
int textY = pageRect.y + pageRect.height - BORDER;
g2d.drawString(footerText , textX, textY);
} | java | protected void printFooter(Graphics2D g2d, String footerText)
{
FontMetrics fm = g2d.getFontMetrics();
int stringWidth = fm.stringWidth(footerText);
int textX = (pageRect.width - stringWidth) / 2 + pageRect.x;
int textY = pageRect.y + pageRect.height - BORDER;
g2d.drawString(footerText , textX, textY);
} | [
"protected",
"void",
"printFooter",
"(",
"Graphics2D",
"g2d",
",",
"String",
"footerText",
")",
"{",
"FontMetrics",
"fm",
"=",
"g2d",
".",
"getFontMetrics",
"(",
")",
";",
"int",
"stringWidth",
"=",
"fm",
".",
"stringWidth",
"(",
"footerText",
")",
";",
"i... | Print the page footer.
@param g2d The graphics environment.
@param footerText The text to print in the footer. | [
"Print",
"the",
"page",
"footer",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/PaperPrint.java#L146-L153 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BaseDestinationHandler.java | BaseDestinationHandler.constructPseudoDurableDestName | public String constructPseudoDurableDestName(String meUUID, String durableName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "constructPseudoDurableDestName", new Object[] { meUUID, durableName });
String returnString = meUUID + "##" + durableName;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "constructPseudoDurableDestName", returnString);
return returnString;
} | java | public String constructPseudoDurableDestName(String meUUID, String durableName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "constructPseudoDurableDestName", new Object[] { meUUID, durableName });
String returnString = meUUID + "##" + durableName;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "constructPseudoDurableDestName", returnString);
return returnString;
} | [
"public",
"String",
"constructPseudoDurableDestName",
"(",
"String",
"meUUID",
",",
"String",
"durableName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"... | Creates the pseudo destination name string for remote durable
subscriptions.
The case when the the DME is remote to this ME.
@param meUUID the durable home ME uuid
@param subName the durable sub name
@return a string of the form "localME##subName" | [
"Creates",
"the",
"pseudo",
"destination",
"name",
"string",
"for",
"remote",
"durable",
"subscriptions",
".",
"The",
"case",
"when",
"the",
"the",
"DME",
"is",
"remote",
"to",
"this",
"ME",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BaseDestinationHandler.java#L3384-L3392 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java | AbstractValidate.isNull | public <T> void isNull(final T object, final String message, final Object... values) {
if (object != null) {
fail(String.format(message, values));
}
} | java | public <T> void isNull(final T object, final String message, final Object... values) {
if (object != null) {
fail(String.format(message, values));
}
} | [
"public",
"<",
"T",
">",
"void",
"isNull",
"(",
"final",
"T",
"object",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"object",
"!=",
"null",
")",
"{",
"fail",
"(",
"String",
".",
"format",
"(",
"m... | <p>Validate that the specified argument is {@code null}; otherwise throwing an exception with the specified message.
<pre>Validate.isNull(myObject, "The object must be null");</pre>
@param <T>
the object type
@param object
the object to check
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message
@throws IllegalArgumentValidationException
if the object is not {@code null}
@see #notNull(Object) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"is",
"{",
"@code",
"null",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"<pre",
">",
"Validate",
".",
"isNull",
"(",
"myObject",
"The",
"ob... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L270-L274 |
pmwmedia/tinylog | tinylog-impl/src/main/java/org/tinylog/core/ConfigurationParser.java | ConfigurationParser.getLocale | public static Locale getLocale() {
String tag = Configuration.get("locale");
if (tag == null) {
return Locale.ROOT;
} else {
String[] splittedTag = tag.split("_", MAX_LOCALE_ARGUMENTS);
if (splittedTag.length == 1) {
return new Locale(splittedTag[0]);
} else if (splittedTag.length == 2) {
return new Locale(splittedTag[0], splittedTag[1]);
} else {
return new Locale(splittedTag[0], splittedTag[1], splittedTag[2]);
}
}
} | java | public static Locale getLocale() {
String tag = Configuration.get("locale");
if (tag == null) {
return Locale.ROOT;
} else {
String[] splittedTag = tag.split("_", MAX_LOCALE_ARGUMENTS);
if (splittedTag.length == 1) {
return new Locale(splittedTag[0]);
} else if (splittedTag.length == 2) {
return new Locale(splittedTag[0], splittedTag[1]);
} else {
return new Locale(splittedTag[0], splittedTag[1], splittedTag[2]);
}
}
} | [
"public",
"static",
"Locale",
"getLocale",
"(",
")",
"{",
"String",
"tag",
"=",
"Configuration",
".",
"get",
"(",
"\"locale\"",
")",
";",
"if",
"(",
"tag",
"==",
"null",
")",
"{",
"return",
"Locale",
".",
"ROOT",
";",
"}",
"else",
"{",
"String",
"[",... | Loads the locale from configuration.
@return Locale from configuration or {@link Locale#ROOT} if no locale is configured | [
"Loads",
"the",
"locale",
"from",
"configuration",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/core/ConfigurationParser.java#L50-L64 |
google/closure-compiler | src/com/google/javascript/jscomp/AggressiveInlineAliases.java | AggressiveInlineAliases.tryReplacingAliasingAssignment | private boolean tryReplacingAliasingAssignment(Ref alias, Node aliasLhsNode) {
// either VAR/CONST/LET or ASSIGN.
Node assignment = aliasLhsNode.getParent();
if (!NodeUtil.isNameDeclaration(assignment) && NodeUtil.isExpressionResultUsed(assignment)) {
// e.g. don't change "if (alias = someVariable)" to "if (alias = null)"
// TODO(lharker): instead replace the entire assignment with the RHS - "alias = x" becomes "x"
return false;
}
Node aliasParent = alias.getNode().getParent();
aliasParent.replaceChild(alias.getNode(), IR.nullNode());
alias.name.removeRef(alias);
codeChanged = true;
compiler.reportChangeToEnclosingScope(aliasParent);
return true;
} | java | private boolean tryReplacingAliasingAssignment(Ref alias, Node aliasLhsNode) {
// either VAR/CONST/LET or ASSIGN.
Node assignment = aliasLhsNode.getParent();
if (!NodeUtil.isNameDeclaration(assignment) && NodeUtil.isExpressionResultUsed(assignment)) {
// e.g. don't change "if (alias = someVariable)" to "if (alias = null)"
// TODO(lharker): instead replace the entire assignment with the RHS - "alias = x" becomes "x"
return false;
}
Node aliasParent = alias.getNode().getParent();
aliasParent.replaceChild(alias.getNode(), IR.nullNode());
alias.name.removeRef(alias);
codeChanged = true;
compiler.reportChangeToEnclosingScope(aliasParent);
return true;
} | [
"private",
"boolean",
"tryReplacingAliasingAssignment",
"(",
"Ref",
"alias",
",",
"Node",
"aliasLhsNode",
")",
"{",
"// either VAR/CONST/LET or ASSIGN.",
"Node",
"assignment",
"=",
"aliasLhsNode",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"!",
"NodeUtil",
".",
"... | Replaces the rhs of an aliasing assignment with null, unless the assignment result is used in a
complex expression. | [
"Replaces",
"the",
"rhs",
"of",
"an",
"aliasing",
"assignment",
"with",
"null",
"unless",
"the",
"assignment",
"result",
"is",
"used",
"in",
"a",
"complex",
"expression",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AggressiveInlineAliases.java#L446-L460 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/MethodForConnection.java | MethodForConnection.newParam | public MethodParam newParam(String name, String type)
{
MethodParam p = new MethodParam();
p.setName(name);
p.setType(type);
return p;
} | java | public MethodParam newParam(String name, String type)
{
MethodParam p = new MethodParam();
p.setName(name);
p.setType(type);
return p;
} | [
"public",
"MethodParam",
"newParam",
"(",
"String",
"name",
",",
"String",
"type",
")",
"{",
"MethodParam",
"p",
"=",
"new",
"MethodParam",
"(",
")",
";",
"p",
".",
"setName",
"(",
"name",
")",
";",
"p",
".",
"setType",
"(",
"type",
")",
";",
"return... | new param
@param name param name
@param type param type
@return new param | [
"new",
"param"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/MethodForConnection.java#L66-L72 |
paypal/SeLion | client/src/main/java/com/paypal/selion/internal/platform/grid/LocalNode.java | LocalNode.checkForPresenceOf | private boolean checkForPresenceOf(ConfigProperty property, String systemProperty, String driverBinary) {
if (StringUtils.isBlank(Config.getConfigProperty(property)) && System.getProperty(systemProperty) == null) {
// check the CWD and PATH for the driverBinary
String location = new ExecutableFinder().find(driverBinary.replace(".exe", ""));
return (location != null);
}
return true;
} | java | private boolean checkForPresenceOf(ConfigProperty property, String systemProperty, String driverBinary) {
if (StringUtils.isBlank(Config.getConfigProperty(property)) && System.getProperty(systemProperty) == null) {
// check the CWD and PATH for the driverBinary
String location = new ExecutableFinder().find(driverBinary.replace(".exe", ""));
return (location != null);
}
return true;
} | [
"private",
"boolean",
"checkForPresenceOf",
"(",
"ConfigProperty",
"property",
",",
"String",
"systemProperty",
",",
"String",
"driverBinary",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"Config",
".",
"getConfigProperty",
"(",
"property",
")",
")",
... | Return true when one of the following conditions is met <br>
<br>
1. ConfigProperty for driverBinary is specified and not blank or null. <br>
2. System Property which Selenium uses to find driverBinary is present. <br>
3. driverBinary exists in the current working directory OR the PATH <br> | [
"Return",
"true",
"when",
"one",
"of",
"the",
"following",
"conditions",
"is",
"met",
"<br",
">",
"<br",
">",
"1",
".",
"ConfigProperty",
"for",
"driverBinary",
"is",
"specified",
"and",
"not",
"blank",
"or",
"null",
".",
"<br",
">",
"2",
".",
"System",
... | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/platform/grid/LocalNode.java#L171-L178 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/SwingUtil.java | SwingUtil.setOpaque | public static void setOpaque (JComponent comp, final boolean opaque)
{
applyToHierarchy(comp, new ComponentOp() {
public void apply (Component comp) {
if (comp instanceof JComponent) {
((JComponent) comp).setOpaque(opaque);
}
}
});
} | java | public static void setOpaque (JComponent comp, final boolean opaque)
{
applyToHierarchy(comp, new ComponentOp() {
public void apply (Component comp) {
if (comp instanceof JComponent) {
((JComponent) comp).setOpaque(opaque);
}
}
});
} | [
"public",
"static",
"void",
"setOpaque",
"(",
"JComponent",
"comp",
",",
"final",
"boolean",
"opaque",
")",
"{",
"applyToHierarchy",
"(",
"comp",
",",
"new",
"ComponentOp",
"(",
")",
"{",
"public",
"void",
"apply",
"(",
"Component",
"comp",
")",
"{",
"if",... | Set the opacity on the specified component, <em>and all of its children.</em> | [
"Set",
"the",
"opacity",
"on",
"the",
"specified",
"component",
"<em",
">",
"and",
"all",
"of",
"its",
"children",
".",
"<",
"/",
"em",
">"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/SwingUtil.java#L262-L271 |
alkacon/opencms-core | src/org/opencms/publish/CmsPublishManager.java | CmsPublishManager.removeResourceFromUsersPubList | public void removeResourceFromUsersPubList(CmsObject cms, Collection<CmsUUID> structureIds) throws CmsException {
m_securityManager.removeResourceFromUsersPubList(cms.getRequestContext(), structureIds);
} | java | public void removeResourceFromUsersPubList(CmsObject cms, Collection<CmsUUID> structureIds) throws CmsException {
m_securityManager.removeResourceFromUsersPubList(cms.getRequestContext(), structureIds);
} | [
"public",
"void",
"removeResourceFromUsersPubList",
"(",
"CmsObject",
"cms",
",",
"Collection",
"<",
"CmsUUID",
">",
"structureIds",
")",
"throws",
"CmsException",
"{",
"m_securityManager",
".",
"removeResourceFromUsersPubList",
"(",
"cms",
".",
"getRequestContext",
"("... | Removes the given resource to the given user's publish list.<p>
@param cms the current cms context
@param structureIds the collection of structure IDs to remove
@throws CmsException if something goes wrong | [
"Removes",
"the",
"given",
"resource",
"to",
"the",
"given",
"user",
"s",
"publish",
"list",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishManager.java#L645-L648 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/provisioning/ExportApi.java | ExportApi.exportFile | public String exportFile(List<String> fields, String fileName, List<String> personDBIDs, ExportFilterParams filterParameters) throws ProvisioningApiException {
try {
ExportFileResponse resp = exportApi.exportFile(new ExportFileData()
.fields(fields)
.fileName(fileName)
.personDBIDs(personDBIDs)
.filterParameters(Converters.convertExportFilterParamsToExportFileDataFilterParameters(filterParameters))
);
if (!resp.getStatus().getCode().equals(0)) {
throw new ProvisioningApiException("Error exporting file. Code: " + resp.getStatus().getCode());
}
return resp.getData().getId();
} catch(ApiException e) {
throw new ProvisioningApiException("Error exporting file", e);
}
} | java | public String exportFile(List<String> fields, String fileName, List<String> personDBIDs, ExportFilterParams filterParameters) throws ProvisioningApiException {
try {
ExportFileResponse resp = exportApi.exportFile(new ExportFileData()
.fields(fields)
.fileName(fileName)
.personDBIDs(personDBIDs)
.filterParameters(Converters.convertExportFilterParamsToExportFileDataFilterParameters(filterParameters))
);
if (!resp.getStatus().getCode().equals(0)) {
throw new ProvisioningApiException("Error exporting file. Code: " + resp.getStatus().getCode());
}
return resp.getData().getId();
} catch(ApiException e) {
throw new ProvisioningApiException("Error exporting file", e);
}
} | [
"public",
"String",
"exportFile",
"(",
"List",
"<",
"String",
">",
"fields",
",",
"String",
"fileName",
",",
"List",
"<",
"String",
">",
"personDBIDs",
",",
"ExportFilterParams",
"filterParameters",
")",
"throws",
"ProvisioningApiException",
"{",
"try",
"{",
"Ex... | Export users.
Export the specified users with the properties you list in the **fields** parameter.
@param fields fields.
@param fileName the file name to be exported.
@param personDBIDs DBIDs of users to be exported.
@param filterParameters Filter parameters.
@return Id of the export.
@throws ProvisioningApiException if the call is unsuccessful. | [
"Export",
"users",
".",
"Export",
"the",
"specified",
"users",
"with",
"the",
"properties",
"you",
"list",
"in",
"the",
"**",
"fields",
"**",
"parameter",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/ExportApi.java#L44-L61 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/ShapeFittingOps.java | ShapeFittingOps.fitEllipse_I32 | public static FitData<EllipseRotated_F64> fitEllipse_I32( List<Point2D_I32> points, int iterations ,
boolean computeError ,
FitData<EllipseRotated_F64> outputStorage ) {
List<Point2D_F64> pointsF = convert_I32_F64(points);
return fitEllipse_F64(pointsF,iterations,computeError,outputStorage);
} | java | public static FitData<EllipseRotated_F64> fitEllipse_I32( List<Point2D_I32> points, int iterations ,
boolean computeError ,
FitData<EllipseRotated_F64> outputStorage ) {
List<Point2D_F64> pointsF = convert_I32_F64(points);
return fitEllipse_F64(pointsF,iterations,computeError,outputStorage);
} | [
"public",
"static",
"FitData",
"<",
"EllipseRotated_F64",
">",
"fitEllipse_I32",
"(",
"List",
"<",
"Point2D_I32",
">",
"points",
",",
"int",
"iterations",
",",
"boolean",
"computeError",
",",
"FitData",
"<",
"EllipseRotated_F64",
">",
"outputStorage",
")",
"{",
... | Convenience function. Same as {@link #fitEllipse_F64(java.util.List, int, boolean,FitData)}, but converts the set of integer points
into floating point points.
@param points (Input) Set of unordered points. Not modified.
@param iterations Number of iterations used to refine the fit. If set to zero then an algebraic solution
is returned.
@param computeError If true it will compute the average Euclidean distance error
@param outputStorage (Output/Optional) Storage for the ellipse. Can be null
@return Found ellipse. | [
"Convenience",
"function",
".",
"Same",
"as",
"{"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/ShapeFittingOps.java#L160-L167 |
apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.jodaToCalciteDateString | public static DateString jodaToCalciteDateString(final DateTime dateTime, final DateTimeZone timeZone)
{
return new DateString(CALCITE_DATE_PRINTER.print(dateTime.withZone(timeZone)));
} | java | public static DateString jodaToCalciteDateString(final DateTime dateTime, final DateTimeZone timeZone)
{
return new DateString(CALCITE_DATE_PRINTER.print(dateTime.withZone(timeZone)));
} | [
"public",
"static",
"DateString",
"jodaToCalciteDateString",
"(",
"final",
"DateTime",
"dateTime",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"return",
"new",
"DateString",
"(",
"CALCITE_DATE_PRINTER",
".",
"print",
"(",
"dateTime",
".",
"withZone",
"(",
... | Calcite expects DATE literals to be represented by DateStrings in the local time zone.
@param dateTime joda timestamp
@param timeZone session time zone
@return Calcite style Calendar, appropriate for literals | [
"Calcite",
"expects",
"DATE",
"literals",
"to",
"be",
"represented",
"by",
"DateStrings",
"in",
"the",
"local",
"time",
"zone",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L285-L288 |
kaazing/java.client | amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java | AmqpChannel.openChannel | AmqpChannel openChannel() {
if (readyState == ReadyState.OPEN) {
// If the channel is already open, just bail.
return this;
}
// try {
Object[] args = {""};
WrappedByteBuffer bodyArg = null;
HashMap<String, Object> headersArg = null;
String methodName = "openChannel";
String methodId = "20" + "10";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg};
asyncClient.getStateMachine().enterState("channelReady", "", null);
asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null);
readyState = ReadyState.CONNECTING;
/*}
catch (Exception ex) {
if (errorHandler != null) {
AmqpEvent e = new ChannelEvent(this, Kind.ERROR, ex.getMessage());
errorHandler.error(e);
}
}
*/
return this;
} | java | AmqpChannel openChannel() {
if (readyState == ReadyState.OPEN) {
// If the channel is already open, just bail.
return this;
}
// try {
Object[] args = {""};
WrappedByteBuffer bodyArg = null;
HashMap<String, Object> headersArg = null;
String methodName = "openChannel";
String methodId = "20" + "10";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg};
asyncClient.getStateMachine().enterState("channelReady", "", null);
asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null);
readyState = ReadyState.CONNECTING;
/*}
catch (Exception ex) {
if (errorHandler != null) {
AmqpEvent e = new ChannelEvent(this, Kind.ERROR, ex.getMessage());
errorHandler.error(e);
}
}
*/
return this;
} | [
"AmqpChannel",
"openChannel",
"(",
")",
"{",
"if",
"(",
"readyState",
"==",
"ReadyState",
".",
"OPEN",
")",
"{",
"// If the channel is already open, just bail.",
"return",
"this",
";",
"}",
"// try {",
"Object",
"[",
"]",
"args",
"=",
"{",
"\"\"",
"}",
";",
... | Creates a Channel to the AMQP server on the given clients connection
@return AmqpChannel | [
"Creates",
"a",
"Channel",
"to",
"the",
"AMQP",
"server",
"on",
"the",
"given",
"clients",
"connection"
] | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L309-L338 |
alkacon/opencms-core | src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java | CmsSolrSpellchecker.sendResponse | private void sendResponse(final HttpServletResponse res, final CmsSpellcheckingRequest request) throws IOException {
final PrintWriter pw = res.getWriter();
final JSONObject response = getJsonFormattedSpellcheckResult(request);
pw.println(response.toString());
pw.close();
} | java | private void sendResponse(final HttpServletResponse res, final CmsSpellcheckingRequest request) throws IOException {
final PrintWriter pw = res.getWriter();
final JSONObject response = getJsonFormattedSpellcheckResult(request);
pw.println(response.toString());
pw.close();
} | [
"private",
"void",
"sendResponse",
"(",
"final",
"HttpServletResponse",
"res",
",",
"final",
"CmsSpellcheckingRequest",
"request",
")",
"throws",
"IOException",
"{",
"final",
"PrintWriter",
"pw",
"=",
"res",
".",
"getWriter",
"(",
")",
";",
"final",
"JSONObject",
... | Sends the JSON-formatted spellchecking results to the client.
@param res The HttpServletResponse object.
@param request The spellchecking request object.
@throws IOException in case writing the response fails | [
"Sends",
"the",
"JSON",
"-",
"formatted",
"spellchecking",
"results",
"to",
"the",
"client",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L494-L500 |
GwtMaterialDesign/gwt-material | gwt-material/src/main/java/gwt/material/design/client/base/BaseCheckBox.java | BaseCheckBox.setValue | @Override
public void setValue(Boolean value, boolean fireEvents) {
if (value == null) {
value = Boolean.FALSE;
}
Boolean oldValue = getValue();
inputElem.setChecked(value);
inputElem.setDefaultChecked(value);
if (value.equals(oldValue)) {
return;
}
if (fireEvents) {
ValueChangeEvent.fire(this, value);
}
} | java | @Override
public void setValue(Boolean value, boolean fireEvents) {
if (value == null) {
value = Boolean.FALSE;
}
Boolean oldValue = getValue();
inputElem.setChecked(value);
inputElem.setDefaultChecked(value);
if (value.equals(oldValue)) {
return;
}
if (fireEvents) {
ValueChangeEvent.fire(this, value);
}
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"Boolean",
"value",
",",
"boolean",
"fireEvents",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"Boolean",
".",
"FALSE",
";",
"}",
"Boolean",
"oldValue",
"=",
"getValue",
"(",
")... | Checks or unchecks the check box, firing {@link ValueChangeEvent} if
appropriate.
<p>
Note that this <em>does not</em> set the value property of the checkbox
input element wrapped by this widget. For access to that property, see
{@link #setFormValue(String)}
@param value true to check, false to uncheck; null value implies false
@param fireEvents If true, and value has changed, fire a
{@link ValueChangeEvent} | [
"Checks",
"or",
"unchecks",
"the",
"check",
"box",
"firing",
"{",
"@link",
"ValueChangeEvent",
"}",
"if",
"appropriate",
".",
"<p",
">",
"Note",
"that",
"this",
"<em",
">",
"does",
"not<",
"/",
"em",
">",
"set",
"the",
"value",
"property",
"of",
"the",
... | train | https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/BaseCheckBox.java#L445-L460 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/HFClient.java | HFClient.newChannel | public Channel newChannel(String name) throws InvalidArgumentException {
clientCheck();
if (Utils.isNullOrEmpty(name)) {
throw new InvalidArgumentException("Channel name can not be null or empty string.");
}
synchronized (channels) {
if (channels.containsKey(name)) {
throw new InvalidArgumentException(format("Channel by the name %s already exists", name));
}
logger.trace("Creating channel :" + name);
Channel newChannel = Channel.createNewInstance(name, this);
channels.put(name, newChannel);
return newChannel;
}
} | java | public Channel newChannel(String name) throws InvalidArgumentException {
clientCheck();
if (Utils.isNullOrEmpty(name)) {
throw new InvalidArgumentException("Channel name can not be null or empty string.");
}
synchronized (channels) {
if (channels.containsKey(name)) {
throw new InvalidArgumentException(format("Channel by the name %s already exists", name));
}
logger.trace("Creating channel :" + name);
Channel newChannel = Channel.createNewInstance(name, this);
channels.put(name, newChannel);
return newChannel;
}
} | [
"public",
"Channel",
"newChannel",
"(",
"String",
"name",
")",
"throws",
"InvalidArgumentException",
"{",
"clientCheck",
"(",
")",
";",
"if",
"(",
"Utils",
".",
"isNullOrEmpty",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Ch... | newChannel - already configured channel.
@param name
@return a new channel.
@throws InvalidArgumentException | [
"newChannel",
"-",
"already",
"configured",
"channel",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/HFClient.java#L230-L249 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasDocument.java | BaasDocument.saveSync | public BaasResult<BaasDocument> saveSync(SaveMode mode,BaasACL acl) {
BaasBox box = BaasBox.getDefaultChecked();
if (mode == null) throw new IllegalArgumentException("mode cannot be null");
Save save = new Save(box, mode,acl, this, RequestOptions.DEFAULT, null);
return box.submitSync(save);
} | java | public BaasResult<BaasDocument> saveSync(SaveMode mode,BaasACL acl) {
BaasBox box = BaasBox.getDefaultChecked();
if (mode == null) throw new IllegalArgumentException("mode cannot be null");
Save save = new Save(box, mode,acl, this, RequestOptions.DEFAULT, null);
return box.submitSync(save);
} | [
"public",
"BaasResult",
"<",
"BaasDocument",
">",
"saveSync",
"(",
"SaveMode",
"mode",
",",
"BaasACL",
"acl",
")",
"{",
"BaasBox",
"box",
"=",
"BaasBox",
".",
"getDefaultChecked",
"(",
")",
";",
"if",
"(",
"mode",
"==",
"null",
")",
"throw",
"new",
"Ille... | Synchronously saves the document on the server with initial acl
@param mode {@link com.baasbox.android.SaveMode}
@param acl {@link com.baasbox.android.BaasACL} the initial acl settings
@return the result of the request | [
"Synchronously",
"saves",
"the",
"document",
"on",
"the",
"server",
"with",
"initial",
"acl"
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L656-L661 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/collections/IterableUtils.java | IterableUtils.itemToIndexMap | public static <T> ImmutableMap<T, Integer> itemToIndexMap(final Iterable<T> sequence) {
return itemToIndexMapStartingFrom(sequence, 0);
} | java | public static <T> ImmutableMap<T, Integer> itemToIndexMap(final Iterable<T> sequence) {
return itemToIndexMapStartingFrom(sequence, 0);
} | [
"public",
"static",
"<",
"T",
">",
"ImmutableMap",
"<",
"T",
",",
"Integer",
">",
"itemToIndexMap",
"(",
"final",
"Iterable",
"<",
"T",
">",
"sequence",
")",
"{",
"return",
"itemToIndexMapStartingFrom",
"(",
"sequence",
",",
"0",
")",
";",
"}"
] | Transforms an Iterable<T> to a Map<T, Integer> where each item is mapped to its zero-indexed
position in the Iterable's sequence. If an item occurs twice, an {@link IllegalArgumentException} will
be thrown. | [
"Transforms",
"an",
"Iterable<T",
">",
"to",
"a",
"Map<T",
"Integer",
">",
"where",
"each",
"item",
"is",
"mapped",
"to",
"its",
"zero",
"-",
"indexed",
"position",
"in",
"the",
"Iterable",
"s",
"sequence",
".",
"If",
"an",
"item",
"occurs",
"twice",
"an... | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/IterableUtils.java#L296-L298 |
timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/transport/PacketTransportHub.java | PacketTransportHub.createEndpoint | public synchronized PacketTransportEndpoint createEndpoint() throws JMSException
{
if (closed || transport.isClosed())
throw new FFMQException("Transport is closed", "TRANSPORT_CLOSED");
PacketTransportEndpoint endpoint = new PacketTransportEndpoint(nextEndpointId++, this);
registeredEndpoints.put(Integer.valueOf(endpoint.getId()), endpoint);
return endpoint;
} | java | public synchronized PacketTransportEndpoint createEndpoint() throws JMSException
{
if (closed || transport.isClosed())
throw new FFMQException("Transport is closed", "TRANSPORT_CLOSED");
PacketTransportEndpoint endpoint = new PacketTransportEndpoint(nextEndpointId++, this);
registeredEndpoints.put(Integer.valueOf(endpoint.getId()), endpoint);
return endpoint;
} | [
"public",
"synchronized",
"PacketTransportEndpoint",
"createEndpoint",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"closed",
"||",
"transport",
".",
"isClosed",
"(",
")",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Transport is closed\"",
",",
"\"TRANSPORT... | Create a new transport endpoint
@return a new transport endpoint | [
"Create",
"a",
"new",
"transport",
"endpoint"
] | train | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/transport/PacketTransportHub.java#L42-L50 |
craftercms/commons | utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java | HttpUtils.addValue | public static void addValue(String key, Object value, MultiValueMap<String, String> params) {
if (value != null) {
params.add(key, value.toString());
}
} | java | public static void addValue(String key, Object value, MultiValueMap<String, String> params) {
if (value != null) {
params.add(key, value.toString());
}
} | [
"public",
"static",
"void",
"addValue",
"(",
"String",
"key",
",",
"Object",
"value",
",",
"MultiValueMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"params",
".",
"add",
"(",
"key",
",",
"val... | Adds a param value to a params map. If value is null, nothing is done.
@param key the param key
@param value the param value
@param params the params map | [
"Adds",
"a",
"param",
"value",
"to",
"a",
"params",
"map",
".",
"If",
"value",
"is",
"null",
"nothing",
"is",
"done",
"."
] | train | https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java#L185-L189 |
seedstack/i18n-addon | core/src/main/java/org/seedstack/i18n/internal/data/key/KeyDTO.java | KeyDTO.addTranslationDTO | public void addTranslationDTO(String locale, String value, boolean outdated, boolean approximate) {
translations.add(new TranslationDTO(locale, value, outdated, approximate));
} | java | public void addTranslationDTO(String locale, String value, boolean outdated, boolean approximate) {
translations.add(new TranslationDTO(locale, value, outdated, approximate));
} | [
"public",
"void",
"addTranslationDTO",
"(",
"String",
"locale",
",",
"String",
"value",
",",
"boolean",
"outdated",
",",
"boolean",
"approximate",
")",
"{",
"translations",
".",
"add",
"(",
"new",
"TranslationDTO",
"(",
"locale",
",",
"value",
",",
"outdated",... | Adds a translation to the keyDTO
@param locale translation locale
@param value translation value
@param outdated is the translation outdated
@param approximate is the translation approximate | [
"Adds",
"a",
"translation",
"to",
"the",
"keyDTO"
] | train | https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/core/src/main/java/org/seedstack/i18n/internal/data/key/KeyDTO.java#L36-L38 |
js-lib-com/commons | src/main/java/js/io/FilesInputStream.java | FilesInputStream.getMeta | public String getMeta(String key) {
String value = manifest.getMainAttributes().getValue(key);
if (value == null) {
throw new InvalidFilesArchiveException("Missing |%s| attribute from manifest.", key);
}
return value;
} | java | public String getMeta(String key) {
String value = manifest.getMainAttributes().getValue(key);
if (value == null) {
throw new InvalidFilesArchiveException("Missing |%s| attribute from manifest.", key);
}
return value;
} | [
"public",
"String",
"getMeta",
"(",
"String",
"key",
")",
"{",
"String",
"value",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"getValue",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidFilesArchive... | Get string value from files archive meta data. Meta data was added into archive by
{@link FilesOutputStream#putMeta(String, Object)}.
@param key meta data key.
@return meta data value.
@throws InvalidFilesArchiveException if requested meta data key does not exists. | [
"Get",
"string",
"value",
"from",
"files",
"archive",
"meta",
"data",
".",
"Meta",
"data",
"was",
"added",
"into",
"archive",
"by",
"{",
"@link",
"FilesOutputStream#putMeta",
"(",
"String",
"Object",
")",
"}",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesInputStream.java#L158-L164 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/UpdateItemRequest.java | UpdateItemRequest.withExpected | public UpdateItemRequest withExpected(java.util.Map<String, ExpectedAttributeValue> expected) {
setExpected(expected);
return this;
} | java | public UpdateItemRequest withExpected(java.util.Map<String, ExpectedAttributeValue> expected) {
setExpected(expected);
return this;
} | [
"public",
"UpdateItemRequest",
"withExpected",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"ExpectedAttributeValue",
">",
"expected",
")",
"{",
"setExpected",
"(",
"expected",
")",
";",
"return",
"this",
";",
"}"
] | <p>
This is a legacy parameter. Use <code>ConditionExpression</code> instead. For more information, see <a href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html"
>Expected</a> in the <i>Amazon DynamoDB Developer Guide</i>.
</p>
@param expected
This is a legacy parameter. Use <code>ConditionExpression</code> instead. For more information, see <a
href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html"
>Expected</a> in the <i>Amazon DynamoDB Developer Guide</i>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"This",
"is",
"a",
"legacy",
"parameter",
".",
"Use",
"<code",
">",
"ConditionExpression<",
"/",
"code",
">",
"instead",
".",
"For",
"more",
"information",
"see",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/UpdateItemRequest.java#L800-L803 |
filestack/filestack-android | filestack/src/main/java/com/filestack/android/internal/Util.java | Util.createPictureFile | public static File createPictureFile(Context context) throws IOException {
Locale locale = Locale.getDefault();
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", locale).format(new Date());
String fileName = "JPEG_" + timeStamp + "_";
// Store in normal camera directory
File storageDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
return File.createTempFile(fileName, ".jpg", storageDir);
} | java | public static File createPictureFile(Context context) throws IOException {
Locale locale = Locale.getDefault();
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", locale).format(new Date());
String fileName = "JPEG_" + timeStamp + "_";
// Store in normal camera directory
File storageDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
return File.createTempFile(fileName, ".jpg", storageDir);
} | [
"public",
"static",
"File",
"createPictureFile",
"(",
"Context",
"context",
")",
"throws",
"IOException",
"{",
"Locale",
"locale",
"=",
"Locale",
".",
"getDefault",
"(",
")",
";",
"String",
"timeStamp",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyyMMdd_HHmmss\"",
... | Create a file with a path appropriate to save a photo. Uses directory internal to app. | [
"Create",
"a",
"file",
"with",
"a",
"path",
"appropriate",
"to",
"save",
"a",
"photo",
".",
"Uses",
"directory",
"internal",
"to",
"app",
"."
] | train | https://github.com/filestack/filestack-android/blob/8dafa1cb5c77542c351d631be0742717b5a9d45d/filestack/src/main/java/com/filestack/android/internal/Util.java#L168-L175 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java | ZonedDateTime.ofInstant | public static ZonedDateTime ofInstant(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) {
Objects.requireNonNull(localDateTime, "localDateTime");
Objects.requireNonNull(offset, "offset");
Objects.requireNonNull(zone, "zone");
if (zone.getRules().isValidOffset(localDateTime, offset)) {
return new ZonedDateTime(localDateTime, offset, zone);
}
return create(localDateTime.toEpochSecond(offset), localDateTime.getNano(), zone);
} | java | public static ZonedDateTime ofInstant(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) {
Objects.requireNonNull(localDateTime, "localDateTime");
Objects.requireNonNull(offset, "offset");
Objects.requireNonNull(zone, "zone");
if (zone.getRules().isValidOffset(localDateTime, offset)) {
return new ZonedDateTime(localDateTime, offset, zone);
}
return create(localDateTime.toEpochSecond(offset), localDateTime.getNano(), zone);
} | [
"public",
"static",
"ZonedDateTime",
"ofInstant",
"(",
"LocalDateTime",
"localDateTime",
",",
"ZoneOffset",
"offset",
",",
"ZoneId",
"zone",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"localDateTime",
",",
"\"localDateTime\"",
")",
";",
"Objects",
".",
"requ... | Obtains an instance of {@code ZonedDateTime} from the instant formed by combining
the local date-time and offset.
<p>
This creates a zoned date-time by {@link LocalDateTime#toInstant(ZoneOffset) combining}
the {@code LocalDateTime} and {@code ZoneOffset}.
This combination uniquely specifies an instant without ambiguity.
<p>
Converting an instant to a zoned date-time is simple as there is only one valid
offset for each instant. If the valid offset is different to the offset specified,
then the date-time and offset of the zoned date-time will differ from those specified.
<p>
If the {@code ZoneId} to be used is a {@code ZoneOffset}, this method is equivalent
to {@link #of(LocalDateTime, ZoneId)}.
@param localDateTime the local date-time, not null
@param offset the zone offset, not null
@param zone the time-zone, not null
@return the zoned date-time, not null | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"ZonedDateTime",
"}",
"from",
"the",
"instant",
"formed",
"by",
"combining",
"the",
"local",
"date",
"-",
"time",
"and",
"offset",
".",
"<p",
">",
"This",
"creates",
"a",
"zoned",
"date",
"-",
"time",
"by"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java#L426-L434 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.TABLE | public static HtmlTree TABLE(HtmlStyle styleClass, String summary, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
return htmltree;
} | java | public static HtmlTree TABLE(HtmlStyle styleClass, String summary, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"TABLE",
"(",
"HtmlStyle",
"styleClass",
",",
"String",
"summary",
",",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"TABLE",
",",
"nullCheck",
"(",
"body",
")",
")",
";",... | Generates a Table tag with style class and summary attributes and some content.
@param styleClass style of the table
@param summary summary for the table
@param body content for the table
@return an HtmlTree object for the TABLE tag | [
"Generates",
"a",
"Table",
"tag",
"with",
"style",
"class",
"and",
"summary",
"attributes",
"and",
"some",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L751-L757 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/BrokerHelper.java | BrokerHelper.hasNullPKField | public boolean hasNullPKField(ClassDescriptor cld, Object obj)
{
FieldDescriptor[] fields = cld.getPkFields();
boolean hasNull = false;
// an unmaterialized proxy object can never have nullified PK's
IndirectionHandler handler = ProxyHelper.getIndirectionHandler(obj);
if(handler == null || handler.alreadyMaterialized())
{
if(handler != null) obj = handler.getRealSubject();
FieldDescriptor fld;
for(int i = 0; i < fields.length; i++)
{
fld = fields[i];
hasNull = representsNull(fld, fld.getPersistentField().get(obj));
if(hasNull) break;
}
}
return hasNull;
} | java | public boolean hasNullPKField(ClassDescriptor cld, Object obj)
{
FieldDescriptor[] fields = cld.getPkFields();
boolean hasNull = false;
// an unmaterialized proxy object can never have nullified PK's
IndirectionHandler handler = ProxyHelper.getIndirectionHandler(obj);
if(handler == null || handler.alreadyMaterialized())
{
if(handler != null) obj = handler.getRealSubject();
FieldDescriptor fld;
for(int i = 0; i < fields.length; i++)
{
fld = fields[i];
hasNull = representsNull(fld, fld.getPersistentField().get(obj));
if(hasNull) break;
}
}
return hasNull;
} | [
"public",
"boolean",
"hasNullPKField",
"(",
"ClassDescriptor",
"cld",
",",
"Object",
"obj",
")",
"{",
"FieldDescriptor",
"[",
"]",
"fields",
"=",
"cld",
".",
"getPkFields",
"(",
")",
";",
"boolean",
"hasNull",
"=",
"false",
";",
"// an unmaterialized proxy objec... | Detect if the given object has a PK field represents a 'null' value. | [
"Detect",
"if",
"the",
"given",
"object",
"has",
"a",
"PK",
"field",
"represents",
"a",
"null",
"value",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L286-L304 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java | PyExpressionGenerator._generate | @SuppressWarnings("static-method")
protected XExpression _generate(XClosure closure, IAppendable it, IExtraLanguageGeneratorContext context) {
if (it.hasName(closure)) {
appendReturnIfExpectedReturnedExpression(it, context);
it.append(it.getName(closure)).append("()"); //$NON-NLS-1$
}
return closure;
} | java | @SuppressWarnings("static-method")
protected XExpression _generate(XClosure closure, IAppendable it, IExtraLanguageGeneratorContext context) {
if (it.hasName(closure)) {
appendReturnIfExpectedReturnedExpression(it, context);
it.append(it.getName(closure)).append("()"); //$NON-NLS-1$
}
return closure;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"XExpression",
"_generate",
"(",
"XClosure",
"closure",
",",
"IAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"if",
"(",
"it",
".",
"hasName",
"(",
"closure",
")",... | Generate the given object.
@param closure the closure.
@param it the target for the generated content.
@param context the context.
@return the closure. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L281-L288 |
Atmosphere/atmosphere-samples | samples/meteor-chat/src/main/java/org/atmosphere/samples/chat/MeteorChat.java | MeteorChat.doGet | @Override
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
// Set the logger level to TRACE to see what's happening.
Meteor.build(req).addListener(new AtmosphereResourceEventListenerAdapter());
} | java | @Override
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
// Set the logger level to TRACE to see what's happening.
Meteor.build(req).addListener(new AtmosphereResourceEventListenerAdapter());
} | [
"@",
"Override",
"public",
"void",
"doGet",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"throws",
"IOException",
"{",
"// Set the logger level to TRACE to see what's happening.",
"Meteor",
".",
"build",
"(",
"req",
")",
".",
"addListener",
... | Create a {@link Meteor} and use it to suspend the response.
@param req An {@link HttpServletRequest}
@param res An {@link HttpServletResponse} | [
"Create",
"a",
"{",
"@link",
"Meteor",
"}",
"and",
"use",
"it",
"to",
"suspend",
"the",
"response",
"."
] | train | https://github.com/Atmosphere/atmosphere-samples/blob/2b33c0c7a73b3f9b4597cb52ce5602834b80af99/samples/meteor-chat/src/main/java/org/atmosphere/samples/chat/MeteorChat.java#L51-L55 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/syslog_server.java | syslog_server.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
syslog_server_responses result = (syslog_server_responses) service.get_payload_formatter().string_to_resource(syslog_server_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.syslog_server_response_array);
}
syslog_server[] result_syslog_server = new syslog_server[result.syslog_server_response_array.length];
for(int i = 0; i < result.syslog_server_response_array.length; i++)
{
result_syslog_server[i] = result.syslog_server_response_array[i].syslog_server[0];
}
return result_syslog_server;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
syslog_server_responses result = (syslog_server_responses) service.get_payload_formatter().string_to_resource(syslog_server_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.syslog_server_response_array);
}
syslog_server[] result_syslog_server = new syslog_server[result.syslog_server_response_array.length];
for(int i = 0; i < result.syslog_server_response_array.length; i++)
{
result_syslog_server[i] = result.syslog_server_response_array[i].syslog_server[0];
}
return result_syslog_server;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"syslog_server_responses",
"result",
"=",
"(",
"syslog_server_responses",
")",
"service",
".",
"get_payload_fo... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/syslog_server.java#L554-L571 |
wcm-io/wcm-io-wcm | commons/src/main/java/io/wcm/wcm/commons/util/Template.java | Template.forTemplatePath | public static TemplatePathInfo forTemplatePath(@NotNull String templatePath, @NotNull TemplatePathInfo @NotNull... templates) {
if (templatePath == null || templates == null || templates.length == 0) {
return null;
}
for (TemplatePathInfo template : templates) {
if (StringUtils.equals(template.getTemplatePath(), templatePath)) {
return template;
}
}
return null;
} | java | public static TemplatePathInfo forTemplatePath(@NotNull String templatePath, @NotNull TemplatePathInfo @NotNull... templates) {
if (templatePath == null || templates == null || templates.length == 0) {
return null;
}
for (TemplatePathInfo template : templates) {
if (StringUtils.equals(template.getTemplatePath(), templatePath)) {
return template;
}
}
return null;
} | [
"public",
"static",
"TemplatePathInfo",
"forTemplatePath",
"(",
"@",
"NotNull",
"String",
"templatePath",
",",
"@",
"NotNull",
"TemplatePathInfo",
"@",
"NotNull",
".",
".",
".",
"templates",
")",
"{",
"if",
"(",
"templatePath",
"==",
"null",
"||",
"templates",
... | Lookup a template by the given template path.
@param templatePath Path of template
@param templates Templates
@return The {@link TemplatePathInfo} instance or null for unknown template paths | [
"Lookup",
"a",
"template",
"by",
"the",
"given",
"template",
"path",
"."
] | train | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/util/Template.java#L117-L127 |
linkedin/dexmaker | dexmaker/src/main/java/com/android/dx/Code.java | Code.instanceOfType | public void instanceOfType(Local<?> target, Local<?> source, TypeId<?> type) {
addInstruction(new ThrowingCstInsn(Rops.INSTANCE_OF, sourcePosition,
RegisterSpecList.make(source.spec()), catches, type.constant));
moveResult(target, true);
} | java | public void instanceOfType(Local<?> target, Local<?> source, TypeId<?> type) {
addInstruction(new ThrowingCstInsn(Rops.INSTANCE_OF, sourcePosition,
RegisterSpecList.make(source.spec()), catches, type.constant));
moveResult(target, true);
} | [
"public",
"void",
"instanceOfType",
"(",
"Local",
"<",
"?",
">",
"target",
",",
"Local",
"<",
"?",
">",
"source",
",",
"TypeId",
"<",
"?",
">",
"type",
")",
"{",
"addInstruction",
"(",
"new",
"ThrowingCstInsn",
"(",
"Rops",
".",
"INSTANCE_OF",
",",
"so... | Tests if the value in {@code source} is assignable to {@code type}. If it
is, {@code target} is assigned to 1; otherwise {@code target} is assigned
to 0. | [
"Tests",
"if",
"the",
"value",
"in",
"{"
] | train | https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L718-L722 |
raydac/netbeans-mmd-plugin | mind-map/scia-reto/src/main/java/com/igormaznitsa/sciareto/ui/FileListPanel.java | FileListPanel.initComponents | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane2 = new javax.swing.JScrollPane();
tableFiles = new javax.swing.JTable();
jPanel1 = new javax.swing.JPanel();
jHtmlLabel1 = new com.igormaznitsa.sciareto.ui.misc.JHtmlLabel();
setLayout(new java.awt.BorderLayout(0, 8));
tableFiles.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
tableFiles.setFillsViewportHeight(true);
tableFiles.setShowHorizontalLines(false);
tableFiles.setShowVerticalLines(false);
jScrollPane2.setViewportView(tableFiles);
add(jScrollPane2, java.awt.BorderLayout.CENTER);
jPanel1.setLayout(new java.awt.GridBagLayout());
add(jPanel1, java.awt.BorderLayout.NORTH);
jHtmlLabel1.setText("<html>The Files contain links affected by the operation. You can uncheck them to prevent changes.</html>"); // NOI18N
add(jHtmlLabel1, java.awt.BorderLayout.NORTH);
} | java | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane2 = new javax.swing.JScrollPane();
tableFiles = new javax.swing.JTable();
jPanel1 = new javax.swing.JPanel();
jHtmlLabel1 = new com.igormaznitsa.sciareto.ui.misc.JHtmlLabel();
setLayout(new java.awt.BorderLayout(0, 8));
tableFiles.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
tableFiles.setFillsViewportHeight(true);
tableFiles.setShowHorizontalLines(false);
tableFiles.setShowVerticalLines(false);
jScrollPane2.setViewportView(tableFiles);
add(jScrollPane2, java.awt.BorderLayout.CENTER);
jPanel1.setLayout(new java.awt.GridBagLayout());
add(jPanel1, java.awt.BorderLayout.NORTH);
jHtmlLabel1.setText("<html>The Files contain links affected by the operation. You can uncheck them to prevent changes.</html>"); // NOI18N
add(jHtmlLabel1, java.awt.BorderLayout.NORTH);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents",
"private",
"void",
"initComponents",
"(",
")",
"{",
"jScrollPane2",
"=",
"new",
"javax",
".",
"swing",
".",
"JScrollPane",
"(",... | This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form
Editor. | [
"This",
"method",
"is",
"called",
"from",
"within",
"the",
"constructor",
"to",
"initialize",
"the",
"form",
".",
"WARNING",
":",
"Do",
"NOT",
"modify",
"this",
"code",
".",
"The",
"content",
"of",
"this",
"method",
"is",
"always",
"regenerated",
"by",
"th... | train | https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/scia-reto/src/main/java/com/igormaznitsa/sciareto/ui/FileListPanel.java#L156-L190 |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/EntityIdValueImpl.java | EntityIdValueImpl.fromId | static EntityIdValue fromId(String id, String siteIri) {
switch (guessEntityTypeFromId(id)) {
case EntityIdValueImpl.JSON_ENTITY_TYPE_ITEM:
return new ItemIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_PROPERTY:
return new PropertyIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_LEXEME:
return new LexemeIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_FORM:
return new FormIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_SENSE:
return new SenseIdValueImpl(id, siteIri);
default:
throw new IllegalArgumentException("Entity id \"" + id + "\" is not supported.");
}
} | java | static EntityIdValue fromId(String id, String siteIri) {
switch (guessEntityTypeFromId(id)) {
case EntityIdValueImpl.JSON_ENTITY_TYPE_ITEM:
return new ItemIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_PROPERTY:
return new PropertyIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_LEXEME:
return new LexemeIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_FORM:
return new FormIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_SENSE:
return new SenseIdValueImpl(id, siteIri);
default:
throw new IllegalArgumentException("Entity id \"" + id + "\" is not supported.");
}
} | [
"static",
"EntityIdValue",
"fromId",
"(",
"String",
"id",
",",
"String",
"siteIri",
")",
"{",
"switch",
"(",
"guessEntityTypeFromId",
"(",
"id",
")",
")",
"{",
"case",
"EntityIdValueImpl",
".",
"JSON_ENTITY_TYPE_ITEM",
":",
"return",
"new",
"ItemIdValueImpl",
"(... | Parses an item id
@param id
the identifier of the entity, such as "Q42"
@param siteIri
the siteIRI that this value refers to
@throws IllegalArgumentException
if the id is invalid | [
"Parses",
"an",
"item",
"id"
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/EntityIdValueImpl.java#L117-L132 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getStoryInfo | public void getStoryInfo(int[] ids, Callback<List<Story>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getStoryInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getStoryInfo(int[] ids, Callback<List<Story>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getStoryInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getStoryInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Story",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
"... | For more info on stories API go <a href="https://wiki.guildwars2.com/wiki/API:2/stories">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of story id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Story story info | [
"For",
"more",
"info",
"on",
"stories",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"stories",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2437-L2440 |
Stratio/deep-spark | deep-jdbc/src/main/java/com/stratio/deep/jdbc/utils/UtilJdbc.java | UtilJdbc.getObjectFromRow | public static <T, S extends DeepJobConfig> T getObjectFromRow(Class<T> classEntity, Map<String, Object> row, DeepJobConfig<T, S> config) throws IllegalAccessException, InstantiationException, InvocationTargetException {
T t = classEntity.newInstance();
Field[] fields = AnnotationUtils.filterDeepFields(classEntity);
for (Field field : fields) {
Object currentRow = null;
Method method = null;
Class<?> classField = field.getType();
try {
method = Utils.findSetter(field.getName(), classEntity, field.getType());
currentRow = row.get(AnnotationUtils.deepFieldName(field));
if (currentRow != null) {
method.invoke(t, currentRow);
}
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) {
LOG.error("impossible to create a java object from column:" + field.getName() + " and type:"
+ field.getType() + " and value:" + t + "; recordReceived:" + currentRow);
method.invoke(t, Utils.castNumberType(currentRow, classField));
}
}
return t;
} | java | public static <T, S extends DeepJobConfig> T getObjectFromRow(Class<T> classEntity, Map<String, Object> row, DeepJobConfig<T, S> config) throws IllegalAccessException, InstantiationException, InvocationTargetException {
T t = classEntity.newInstance();
Field[] fields = AnnotationUtils.filterDeepFields(classEntity);
for (Field field : fields) {
Object currentRow = null;
Method method = null;
Class<?> classField = field.getType();
try {
method = Utils.findSetter(field.getName(), classEntity, field.getType());
currentRow = row.get(AnnotationUtils.deepFieldName(field));
if (currentRow != null) {
method.invoke(t, currentRow);
}
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) {
LOG.error("impossible to create a java object from column:" + field.getName() + " and type:"
+ field.getType() + " and value:" + t + "; recordReceived:" + currentRow);
method.invoke(t, Utils.castNumberType(currentRow, classField));
}
}
return t;
} | [
"public",
"static",
"<",
"T",
",",
"S",
"extends",
"DeepJobConfig",
">",
"T",
"getObjectFromRow",
"(",
"Class",
"<",
"T",
">",
"classEntity",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"row",
",",
"DeepJobConfig",
"<",
"T",
",",
"S",
">",
"config",... | Returns a Stratio Entity from a Jdbc row represented as a map.
@param classEntity Stratio Entity.
@param row Jdbc row represented as a Map.
@param config JDBC Deep Job configuration.
@param <T> Stratio Entity class.
@return Stratio Entity from a Jdbc row represented as a map.
@throws IllegalAccessException
@throws InstantiationException
@throws InvocationTargetException | [
"Returns",
"a",
"Stratio",
"Entity",
"from",
"a",
"Jdbc",
"row",
"represented",
"as",
"a",
"map",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-jdbc/src/main/java/com/stratio/deep/jdbc/utils/UtilJdbc.java#L53-L76 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java | OrderItemUrl.createOrderItemUrl | public static MozuUrl createOrderItemUrl(String orderId, String responseFields, Boolean skipInventoryCheck, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items?updatemode={updateMode}&version={version}&skipInventoryCheck={skipInventoryCheck}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("skipInventoryCheck", skipInventoryCheck);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl createOrderItemUrl(String orderId, String responseFields, Boolean skipInventoryCheck, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items?updatemode={updateMode}&version={version}&skipInventoryCheck={skipInventoryCheck}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("skipInventoryCheck", skipInventoryCheck);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"createOrderItemUrl",
"(",
"String",
"orderId",
",",
"String",
"responseFields",
",",
"Boolean",
"skipInventoryCheck",
",",
"String",
"updateMode",
",",
"String",
"version",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormat... | Get Resource Url for CreateOrderItem
@param orderId Unique identifier of the order.
@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.
@param skipInventoryCheck If true, skip the process to validate inventory when creating this product reservation.
@param updateMode Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."
@param version Determines whether or not to check versioning of items for concurrency purposes.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"CreateOrderItem"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java#L77-L86 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.updateTags | public NetworkInterfaceInner updateTags(String resourceGroupName, String networkInterfaceName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().last().body();
} | java | public NetworkInterfaceInner updateTags(String resourceGroupName, String networkInterfaceName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().last().body();
} | [
"public",
"NetworkInterfaceInner",
"updateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkInterfaceName",
")",
".",
"toBlocking",
"(",
")",
"... | Updates a network interface tags.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@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 NetworkInterfaceInner object if successful. | [
"Updates",
"a",
"network",
"interface",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L660-L662 |
tango-controls/JTango | common/src/main/java/org/tango/utils/ArrayUtils.java | ArrayUtils.toObjectArray | public final static Object toObjectArray(final Object array) {
if (!array.getClass().isArray()) {
return array;
}
final Class<?> clazz = PRIMITIVE_TO_OBJ.get(array.getClass().getComponentType());
return setArray(clazz, array);
} | java | public final static Object toObjectArray(final Object array) {
if (!array.getClass().isArray()) {
return array;
}
final Class<?> clazz = PRIMITIVE_TO_OBJ.get(array.getClass().getComponentType());
return setArray(clazz, array);
} | [
"public",
"final",
"static",
"Object",
"toObjectArray",
"(",
"final",
"Object",
"array",
")",
"{",
"if",
"(",
"!",
"array",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"array",
";",
"}",
"final",
"Class",
"<",
"?",
">",
... | Convert an array of primitives to Objects if possible. Return input otherwise
@param array
the array to convert
@return The array of Objects | [
"Convert",
"an",
"array",
"of",
"primitives",
"to",
"Objects",
"if",
"possible",
".",
"Return",
"input",
"otherwise"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L60-L66 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadReuseExact | public static ReuseResult loadReuseExact(Uri uri, Context context, Bitmap dest) throws ImageLoadException {
return loadBitmapReuseExact(new UriSource(uri, context), dest);
} | java | public static ReuseResult loadReuseExact(Uri uri, Context context, Bitmap dest) throws ImageLoadException {
return loadBitmapReuseExact(new UriSource(uri, context), dest);
} | [
"public",
"static",
"ReuseResult",
"loadReuseExact",
"(",
"Uri",
"uri",
",",
"Context",
"context",
",",
"Bitmap",
"dest",
")",
"throws",
"ImageLoadException",
"{",
"return",
"loadBitmapReuseExact",
"(",
"new",
"UriSource",
"(",
"uri",
",",
"context",
")",
",",
... | Loading bitmap with using reuse bitmap with the same size of source image.
If it is unable to load with reuse method tries to load without it.
Reuse works only in 3.0+
@param uri content uri for bitmap
@param context Application Context
@param dest reuse bitmap
@return result of loading
@throws ImageLoadException if it is unable to load file | [
"Loading",
"bitmap",
"with",
"using",
"reuse",
"bitmap",
"with",
"the",
"same",
"size",
"of",
"source",
"image",
".",
"If",
"it",
"is",
"unable",
"to",
"load",
"with",
"reuse",
"method",
"tries",
"to",
"load",
"without",
"it",
".",
"Reuse",
"works",
"onl... | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L188-L190 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java | ExcelReader.aliasHeader | private String aliasHeader(Object headerObj, int index) {
if(null == headerObj) {
return ExcelUtil.indexToColName(index);
}
final String header = headerObj.toString();
return ObjectUtil.defaultIfNull(this.headerAlias.get(header), header);
} | java | private String aliasHeader(Object headerObj, int index) {
if(null == headerObj) {
return ExcelUtil.indexToColName(index);
}
final String header = headerObj.toString();
return ObjectUtil.defaultIfNull(this.headerAlias.get(header), header);
} | [
"private",
"String",
"aliasHeader",
"(",
"Object",
"headerObj",
",",
"int",
"index",
")",
"{",
"if",
"(",
"null",
"==",
"headerObj",
")",
"{",
"return",
"ExcelUtil",
".",
"indexToColName",
"(",
"index",
")",
";",
"}",
"final",
"String",
"header",
"=",
"h... | 转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header
@param headerObj 原标题
@param index 标题所在列号,当标题为空时,列号对应的字母便是header
@return 转换别名列表
@since 4.3.2 | [
"转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java#L466-L473 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceRequestMap.java | InstanceRequestMap.setMinimumNumberOfInstances | public void setMinimumNumberOfInstances(final InstanceType instanceType, final int number) {
this.minimumMap.put(instanceType, Integer.valueOf(number));
} | java | public void setMinimumNumberOfInstances(final InstanceType instanceType, final int number) {
this.minimumMap.put(instanceType, Integer.valueOf(number));
} | [
"public",
"void",
"setMinimumNumberOfInstances",
"(",
"final",
"InstanceType",
"instanceType",
",",
"final",
"int",
"number",
")",
"{",
"this",
".",
"minimumMap",
".",
"put",
"(",
"instanceType",
",",
"Integer",
".",
"valueOf",
"(",
"number",
")",
")",
";",
... | Sets the minimum number of instances to be requested from the given instance type.
@param instanceType
the type of instance to request
@param number
the minimum number of instances to request | [
"Sets",
"the",
"minimum",
"number",
"of",
"instances",
"to",
"be",
"requested",
"from",
"the",
"given",
"instance",
"type",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceRequestMap.java#L53-L56 |
Harium/keel | src/main/java/com/harium/keel/catalano/core/FloatPoint.java | FloatPoint.Add | public FloatPoint Add(FloatPoint point1, FloatPoint point2) {
FloatPoint result = new FloatPoint(point1);
result.Add(point2);
return result;
} | java | public FloatPoint Add(FloatPoint point1, FloatPoint point2) {
FloatPoint result = new FloatPoint(point1);
result.Add(point2);
return result;
} | [
"public",
"FloatPoint",
"Add",
"(",
"FloatPoint",
"point1",
",",
"FloatPoint",
"point2",
")",
"{",
"FloatPoint",
"result",
"=",
"new",
"FloatPoint",
"(",
"point1",
")",
";",
"result",
".",
"Add",
"(",
"point2",
")",
";",
"return",
"result",
";",
"}"
] | Adds values of two points.
@param point1 FloatPoint.
@param point2 FloatPoint.
@return A new FloatPoint with the add operation. | [
"Adds",
"values",
"of",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/FloatPoint.java#L137-L141 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.