repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/AbstractPersistenceManager.java
AbstractPersistenceManager.verifyStatusTransitionIsValid
protected void verifyStatusTransitionIsValid(JobInstanceEntity instance, BatchStatus toStatus) throws BatchIllegalJobStatusTransitionException { switch (instance.getBatchStatus()) { case COMPLETED: //COMPLETED to ABANDONED is allowed since it's already allowed in released TCK tests. if (toStatus == BatchStatus.ABANDONED) { break; } case ABANDONED: throw new BatchIllegalJobStatusTransitionException("Job instance: " + instance.getInstanceId() + " cannot be transitioned from Batch Status: " + instance.getBatchStatus().name() + " to " + toStatus.name()); case STARTING: case STARTED: case STOPPING: case FAILED: default: } }
java
protected void verifyStatusTransitionIsValid(JobInstanceEntity instance, BatchStatus toStatus) throws BatchIllegalJobStatusTransitionException { switch (instance.getBatchStatus()) { case COMPLETED: //COMPLETED to ABANDONED is allowed since it's already allowed in released TCK tests. if (toStatus == BatchStatus.ABANDONED) { break; } case ABANDONED: throw new BatchIllegalJobStatusTransitionException("Job instance: " + instance.getInstanceId() + " cannot be transitioned from Batch Status: " + instance.getBatchStatus().name() + " to " + toStatus.name()); case STARTING: case STARTED: case STOPPING: case FAILED: default: } }
[ "protected", "void", "verifyStatusTransitionIsValid", "(", "JobInstanceEntity", "instance", ",", "BatchStatus", "toStatus", ")", "throws", "BatchIllegalJobStatusTransitionException", "{", "switch", "(", "instance", ".", "getBatchStatus", "(", ")", ")", "{", "case", "COM...
See description of: {@link AbstractPersistenceManager#verifyStatusTransitionIsValid(JobExecutionEntity, BatchStatus) @param instance @param toStatus @throws BatchIllegalJobStatusTransitionException
[ "See", "description", "of", ":", "{", "@link", "AbstractPersistenceManager#verifyStatusTransitionIsValid", "(", "JobExecutionEntity", "BatchStatus", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/AbstractPersistenceManager.java#L412-L432
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/InstanceId.java
InstanceId.of
public static InstanceId of(String project, String zone, String instance) { return new InstanceId(project, zone, instance); }
java
public static InstanceId of(String project, String zone, String instance) { return new InstanceId(project, zone, instance); }
[ "public", "static", "InstanceId", "of", "(", "String", "project", ",", "String", "zone", ",", "String", "instance", ")", "{", "return", "new", "InstanceId", "(", "project", ",", "zone", ",", "instance", ")", ";", "}" ]
Returns an instance identity given project, zone and instance names. The instance name must be 1-63 characters long and comply with RFC1035. Specifically, the name must match the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. @see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a>
[ "Returns", "an", "instance", "identity", "given", "project", "zone", "and", "instance", "names", ".", "The", "instance", "name", "must", "be", "1", "-", "63", "characters", "long", "and", "comply", "with", "RFC1035", ".", "Specifically", "the", "name", "must...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/InstanceId.java#L153-L155
prestodb/presto
presto-parser/src/main/java/com/facebook/presto/sql/tree/QualifiedName.java
QualifiedName.getPrefix
public Optional<QualifiedName> getPrefix() { if (parts.size() == 1) { return Optional.empty(); } List<String> subList = parts.subList(0, parts.size() - 1); return Optional.of(new QualifiedName(subList, subList)); }
java
public Optional<QualifiedName> getPrefix() { if (parts.size() == 1) { return Optional.empty(); } List<String> subList = parts.subList(0, parts.size() - 1); return Optional.of(new QualifiedName(subList, subList)); }
[ "public", "Optional", "<", "QualifiedName", ">", "getPrefix", "(", ")", "{", "if", "(", "parts", ".", "size", "(", ")", "==", "1", ")", "{", "return", "Optional", ".", "empty", "(", ")", ";", "}", "List", "<", "String", ">", "subList", "=", "parts"...
For an identifier of the form "a.b.c.d", returns "a.b.c" For an identifier of the form "a", returns absent
[ "For", "an", "identifier", "of", "the", "form", "a", ".", "b", ".", "c", ".", "d", "returns", "a", ".", "b", ".", "c", "For", "an", "identifier", "of", "the", "form", "a", "returns", "absent" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parser/src/main/java/com/facebook/presto/sql/tree/QualifiedName.java#L82-L90
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/api/HttpApiUtil.java
HttpApiUtil.newResponse
public static HttpResponse newResponse(RequestContext ctx, HttpStatus status, String format, Object... args) { requireNonNull(ctx, "ctx"); requireNonNull(status, "status"); requireNonNull(format, "format"); requireNonNull(args, "args"); return newResponse(ctx, status, String.format(Locale.ENGLISH, format, args)); }
java
public static HttpResponse newResponse(RequestContext ctx, HttpStatus status, String format, Object... args) { requireNonNull(ctx, "ctx"); requireNonNull(status, "status"); requireNonNull(format, "format"); requireNonNull(args, "args"); return newResponse(ctx, status, String.format(Locale.ENGLISH, format, args)); }
[ "public", "static", "HttpResponse", "newResponse", "(", "RequestContext", "ctx", ",", "HttpStatus", "status", ",", "String", "format", ",", "Object", "...", "args", ")", "{", "requireNonNull", "(", "ctx", ",", "\"ctx\"", ")", ";", "requireNonNull", "(", "statu...
Returns a newly created {@link HttpResponse} with the specified {@link HttpStatus} and the formatted message.
[ "Returns", "a", "newly", "created", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/HttpApiUtil.java#L103-L110
sarl/sarl
docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java
SarlLinkFactory.updateLinkLabel
protected void updateLinkLabel(LinkInfo linkInfo) { if (linkInfo.type != null && linkInfo instanceof LinkInfoImpl) { final LinkInfoImpl impl = (LinkInfoImpl) linkInfo; final ClassDoc classdoc = linkInfo.type.asClassDoc(); if (classdoc != null) { final SARLFeatureAccess kw = Utils.getKeywords(); final String name = classdoc.qualifiedName(); if (isPrefix(name, kw.getProceduresName())) { linkInfo.label = createProcedureLambdaLabel(impl); } else if (isPrefix(name, kw.getFunctionsName())) { linkInfo.label = createFunctionLambdaLabel(impl); } } } }
java
protected void updateLinkLabel(LinkInfo linkInfo) { if (linkInfo.type != null && linkInfo instanceof LinkInfoImpl) { final LinkInfoImpl impl = (LinkInfoImpl) linkInfo; final ClassDoc classdoc = linkInfo.type.asClassDoc(); if (classdoc != null) { final SARLFeatureAccess kw = Utils.getKeywords(); final String name = classdoc.qualifiedName(); if (isPrefix(name, kw.getProceduresName())) { linkInfo.label = createProcedureLambdaLabel(impl); } else if (isPrefix(name, kw.getFunctionsName())) { linkInfo.label = createFunctionLambdaLabel(impl); } } } }
[ "protected", "void", "updateLinkLabel", "(", "LinkInfo", "linkInfo", ")", "{", "if", "(", "linkInfo", ".", "type", "!=", "null", "&&", "linkInfo", "instanceof", "LinkInfoImpl", ")", "{", "final", "LinkInfoImpl", "impl", "=", "(", "LinkInfoImpl", ")", "linkInfo...
Update the label of the given link with the SARL notation for lambdas. @param linkInfo the link information to update.
[ "Update", "the", "label", "of", "the", "given", "link", "with", "the", "SARL", "notation", "for", "lambdas", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L243-L257
kkopacz/agiso-core
bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/DateUtils.java
DateUtils.getRandomDate
public static Date getRandomDate(Date begin, Date end, Random random) { long delay = end.getTime() - begin.getTime(); return new Date(begin.getTime() + (Math.abs(random.nextLong() % delay))); }
java
public static Date getRandomDate(Date begin, Date end, Random random) { long delay = end.getTime() - begin.getTime(); return new Date(begin.getTime() + (Math.abs(random.nextLong() % delay))); }
[ "public", "static", "Date", "getRandomDate", "(", "Date", "begin", ",", "Date", "end", ",", "Random", "random", ")", "{", "long", "delay", "=", "end", ".", "getTime", "(", ")", "-", "begin", ".", "getTime", "(", ")", ";", "return", "new", "Date", "("...
Pobiera pseudolosową datę z okreslonego przedziału czasowego do generacji której wykorzystany zostanie przekazany generator. Data generowana jest z dokładnością (ziarnem) wynoszącym 1ms (tj. 1 w reprezentacji daty w formie liczyby typu <code>long</code>). @param begin Data początkowa przedziału (włączona do zbioru wynikowego). @param end Data końcowa przedziału (wyłączona ze zbioru wynikowego). @param random Generator pseudolosowy wykorzystywany do pozyskania daty. @return Losowo wygenerowana data z przedziału [begin; end).
[ "Pobiera", "pseudolosową", "datę", "z", "okreslonego", "przedziału", "czasowego", "do", "generacji", "której", "wykorzystany", "zostanie", "przekazany", "generator", ".", "Data", "generowana", "jest", "z", "dokładnością", "(", "ziarnem", ")", "wynoszącym", "1ms", "(...
train
https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/DateUtils.java#L209-L212
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.initUserSettings
public static CmsWorkplaceSettings initUserSettings(CmsObject cms, CmsWorkplaceSettings settings, boolean update) { if (settings == null) { settings = new CmsWorkplaceSettings(); } // save current workplace user & user settings object CmsUser user; if (update) { try { // read the user from db to get the latest user information if required user = cms.readUser(cms.getRequestContext().getCurrentUser().getId()); } catch (CmsException e) { // can usually be ignored if (LOG.isInfoEnabled()) { LOG.info(e.getLocalizedMessage()); } user = cms.getRequestContext().getCurrentUser(); } } else { user = cms.getRequestContext().getCurrentUser(); } // store the user and it's settings in the Workplace settings settings.setUser(user); settings.setUserSettings(new CmsUserSettings(user)); // return the result settings return settings; }
java
public static CmsWorkplaceSettings initUserSettings(CmsObject cms, CmsWorkplaceSettings settings, boolean update) { if (settings == null) { settings = new CmsWorkplaceSettings(); } // save current workplace user & user settings object CmsUser user; if (update) { try { // read the user from db to get the latest user information if required user = cms.readUser(cms.getRequestContext().getCurrentUser().getId()); } catch (CmsException e) { // can usually be ignored if (LOG.isInfoEnabled()) { LOG.info(e.getLocalizedMessage()); } user = cms.getRequestContext().getCurrentUser(); } } else { user = cms.getRequestContext().getCurrentUser(); } // store the user and it's settings in the Workplace settings settings.setUser(user); settings.setUserSettings(new CmsUserSettings(user)); // return the result settings return settings; }
[ "public", "static", "CmsWorkplaceSettings", "initUserSettings", "(", "CmsObject", "cms", ",", "CmsWorkplaceSettings", "settings", ",", "boolean", "update", ")", "{", "if", "(", "settings", "==", "null", ")", "{", "settings", "=", "new", "CmsWorkplaceSettings", "("...
Updates the user settings in the given workplace settings for the current user, reading the user settings from the database if required.<p> @param cms the cms object for the current user @param settings the workplace settings to update (if <code>null</code> a new instance is created) @param update flag indicating if settings are only updated (user preferences) @return the current users workplace settings @see #initWorkplaceSettings(CmsObject, CmsWorkplaceSettings, boolean)
[ "Updates", "the", "user", "settings", "in", "the", "given", "workplace", "settings", "for", "the", "current", "user", "reading", "the", "user", "settings", "from", "the", "database", "if", "required", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L854-L882
bbottema/simple-java-mail
modules/simple-java-mail/src/main/java/org/simplejavamail/mailer/internal/MailerImpl.java
MailerImpl.createMailSession
@SuppressWarnings("WeakerAccess") public static Session createMailSession(@Nonnull final ServerConfig serverConfig, @Nonnull final TransportStrategy transportStrategy) { final Properties props = transportStrategy.generateProperties(); props.put(transportStrategy.propertyNameHost(), serverConfig.getHost()); props.put(transportStrategy.propertyNamePort(), String.valueOf(serverConfig.getPort())); if (serverConfig.getUsername() != null) { props.put(transportStrategy.propertyNameUsername(), serverConfig.getUsername()); } if (serverConfig.getPassword() != null) { props.put(transportStrategy.propertyNameAuthenticate(), "true"); return Session.getInstance(props, new SmtpAuthenticator(serverConfig)); } else { return Session.getInstance(props); } }
java
@SuppressWarnings("WeakerAccess") public static Session createMailSession(@Nonnull final ServerConfig serverConfig, @Nonnull final TransportStrategy transportStrategy) { final Properties props = transportStrategy.generateProperties(); props.put(transportStrategy.propertyNameHost(), serverConfig.getHost()); props.put(transportStrategy.propertyNamePort(), String.valueOf(serverConfig.getPort())); if (serverConfig.getUsername() != null) { props.put(transportStrategy.propertyNameUsername(), serverConfig.getUsername()); } if (serverConfig.getPassword() != null) { props.put(transportStrategy.propertyNameAuthenticate(), "true"); return Session.getInstance(props, new SmtpAuthenticator(serverConfig)); } else { return Session.getInstance(props); } }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "static", "Session", "createMailSession", "(", "@", "Nonnull", "final", "ServerConfig", "serverConfig", ",", "@", "Nonnull", "final", "TransportStrategy", "transportStrategy", ")", "{", "final", "Propert...
Instantiates and configures the {@link Session} instance. Delegates resolving transport protocol specific properties to the given {@link TransportStrategy} in two ways: <ol> <li>request an initial property list which the strategy may pre-populate</li> <li>by requesting the property names according to the respective transport protocol it handles (for the host property for example it would be <em>"mail.smtp.host"</em> for SMTP and <em>"mail.smtps.host"</em> for SMTPS)</li> </ol> <p> Furthermore adds proxy SOCKS properties if a proxy configuration was provided, overwriting any SOCKS properties already present. @param serverConfig Remote SMTP server details. @param transportStrategy The transport protocol strategy enum that actually handles the session configuration. Session configuration meaning setting the right properties for the appropriate transport type (ie. <em>"mail.smtp.host"</em> for SMTP, <em>"mail.smtps.host"</em> for SMTPS). @return A fully configured <code>Session</code> instance complete with transport protocol settings. @see TransportStrategy#generateProperties() @see TransportStrategy#propertyNameHost() @see TransportStrategy#propertyNamePort() @see TransportStrategy#propertyNameUsername() @see TransportStrategy#propertyNameAuthenticate()
[ "Instantiates", "and", "configures", "the", "{", "@link", "Session", "}", "instance", ".", "Delegates", "resolving", "transport", "protocol", "specific", "properties", "to", "the", "given", "{", "@link", "TransportStrategy", "}", "in", "two", "ways", ":", "<ol",...
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/mailer/internal/MailerImpl.java#L113-L129
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.getTagValue
String getTagValue(Collection<Tag> tags, String key) { for (Tag tag : tags) { if (tag.getKey().toLowerCase(Locale.ENGLISH).equals(key.toLowerCase(Locale.ENGLISH))) { return tag.getValue(); } } return null; }
java
String getTagValue(Collection<Tag> tags, String key) { for (Tag tag : tags) { if (tag.getKey().toLowerCase(Locale.ENGLISH).equals(key.toLowerCase(Locale.ENGLISH))) { return tag.getValue(); } } return null; }
[ "String", "getTagValue", "(", "Collection", "<", "Tag", ">", "tags", ",", "String", "key", ")", "{", "for", "(", "Tag", "tag", ":", "tags", ")", "{", "if", "(", "tag", ".", "getKey", "(", ")", ".", "toLowerCase", "(", "Locale", ".", "ENGLISH", ")",...
Returns value of given tag in a set of tags. @param tags collection of tags @param key tag key @return Tag value or null if not exists
[ "Returns", "value", "of", "given", "tag", "in", "a", "set", "of", "tags", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L295-L302
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/states/Http2StateUtil.java
Http2StateUtil.releaseDataFrame
public static void releaseDataFrame(Http2SourceHandler http2SourceHandler, Http2DataFrame dataFrame) { int streamId = dataFrame.getStreamId(); HttpCarbonMessage sourceReqCMsg = http2SourceHandler.getStreamIdRequestMap().get(streamId); if (sourceReqCMsg != null) { sourceReqCMsg.addHttpContent(new DefaultLastHttpContent()); http2SourceHandler.getStreamIdRequestMap().remove(streamId); } dataFrame.getData().release(); }
java
public static void releaseDataFrame(Http2SourceHandler http2SourceHandler, Http2DataFrame dataFrame) { int streamId = dataFrame.getStreamId(); HttpCarbonMessage sourceReqCMsg = http2SourceHandler.getStreamIdRequestMap().get(streamId); if (sourceReqCMsg != null) { sourceReqCMsg.addHttpContent(new DefaultLastHttpContent()); http2SourceHandler.getStreamIdRequestMap().remove(streamId); } dataFrame.getData().release(); }
[ "public", "static", "void", "releaseDataFrame", "(", "Http2SourceHandler", "http2SourceHandler", ",", "Http2DataFrame", "dataFrame", ")", "{", "int", "streamId", "=", "dataFrame", ".", "getStreamId", "(", ")", ";", "HttpCarbonMessage", "sourceReqCMsg", "=", "http2Sour...
Releases the {@link io.netty.buffer.ByteBuf} content. @param http2SourceHandler the HTTP2 source handler @param dataFrame the HTTP2 data frame to be released
[ "Releases", "the", "{", "@link", "io", ".", "netty", ".", "buffer", ".", "ByteBuf", "}", "content", "." ]
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/states/Http2StateUtil.java#L229-L237
tango-controls/JTango
server/src/main/java/org/tango/server/servant/ORBUtils.java
ORBUtils.exportDeviceWithDatabase
private static void exportDeviceWithDatabase(final DeviceImpl dev, final String hostName, final String pid) throws DevFailed { XLOGGER.entry(dev.getName()); final ORB orb = ORBManager.getOrb(); // Activate the CORBA object incarnated by the Java object final Device_5 d = dev._this(orb); // Get the object id and store it final POA poa = ORBManager.getPoa(); try { dev.setObjId(poa.reference_to_id(d)); } catch (final WrongAdapter e) { throw DevFailedUtils.newDevFailed(e); } catch (final WrongPolicy e) { throw DevFailedUtils.newDevFailed(e); } final DeviceExportInfo info = new DeviceExportInfo(dev.getName(), orb.object_to_string(d), hostName, Integer.toString(DeviceImpl.SERVER_VERSION), pid, dev.getClassName()); DatabaseFactory.getDatabase().exportDevice(info); XLOGGER.exit(); }
java
private static void exportDeviceWithDatabase(final DeviceImpl dev, final String hostName, final String pid) throws DevFailed { XLOGGER.entry(dev.getName()); final ORB orb = ORBManager.getOrb(); // Activate the CORBA object incarnated by the Java object final Device_5 d = dev._this(orb); // Get the object id and store it final POA poa = ORBManager.getPoa(); try { dev.setObjId(poa.reference_to_id(d)); } catch (final WrongAdapter e) { throw DevFailedUtils.newDevFailed(e); } catch (final WrongPolicy e) { throw DevFailedUtils.newDevFailed(e); } final DeviceExportInfo info = new DeviceExportInfo(dev.getName(), orb.object_to_string(d), hostName, Integer.toString(DeviceImpl.SERVER_VERSION), pid, dev.getClassName()); DatabaseFactory.getDatabase().exportDevice(info); XLOGGER.exit(); }
[ "private", "static", "void", "exportDeviceWithDatabase", "(", "final", "DeviceImpl", "dev", ",", "final", "String", "hostName", ",", "final", "String", "pid", ")", "throws", "DevFailed", "{", "XLOGGER", ".", "entry", "(", "dev", ".", "getName", "(", ")", ")"...
description : This method exports a device to the outside world. This is done by sending its CORBA network parameter (mainly the IOR) to the Tango database @param dev @throws DevFailed
[ "description", ":", "This", "method", "exports", "a", "device", "to", "the", "outside", "world", ".", "This", "is", "done", "by", "sending", "its", "CORBA", "network", "parameter", "(", "mainly", "the", "IOR", ")", "to", "the", "Tango", "database" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/servant/ORBUtils.java#L73-L98
wisdom-framework/wisdom
framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java
EhCacheService.set
@Override public void set(String key, Object value, int expiration) { Element element = new Element(key, value); if (expiration == 0) { element.setEternal(true); } element.setTimeToLive(expiration); cache.put(element); }
java
@Override public void set(String key, Object value, int expiration) { Element element = new Element(key, value); if (expiration == 0) { element.setEternal(true); } element.setTimeToLive(expiration); cache.put(element); }
[ "@", "Override", "public", "void", "set", "(", "String", "key", ",", "Object", "value", ",", "int", "expiration", ")", "{", "Element", "element", "=", "new", "Element", "(", "key", ",", "value", ")", ";", "if", "(", "expiration", "==", "0", ")", "{",...
Adds an entry in the cache. @param key Item key. @param value Item value. @param expiration Expiration time in seconds (0 second means eternity).
[ "Adds", "an", "entry", "in", "the", "cache", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java#L125-L133
twilio/twilio-java
src/main/java/com/twilio/Twilio.java
Twilio.validateSslCertificate
public static void validateSslCertificate() { final NetworkHttpClient client = new NetworkHttpClient(); final Request request = new Request(HttpMethod.GET, "https://api.twilio.com:8443"); try { final Response response = client.makeRequest(request); if (!TwilioRestClient.SUCCESS.apply(response.getStatusCode())) { throw new CertificateValidationException( "Unexpected response from certificate endpoint", request, response ); } } catch (final ApiException e) { throw new CertificateValidationException("Could not get response from certificate endpoint", request); } }
java
public static void validateSslCertificate() { final NetworkHttpClient client = new NetworkHttpClient(); final Request request = new Request(HttpMethod.GET, "https://api.twilio.com:8443"); try { final Response response = client.makeRequest(request); if (!TwilioRestClient.SUCCESS.apply(response.getStatusCode())) { throw new CertificateValidationException( "Unexpected response from certificate endpoint", request, response ); } } catch (final ApiException e) { throw new CertificateValidationException("Could not get response from certificate endpoint", request); } }
[ "public", "static", "void", "validateSslCertificate", "(", ")", "{", "final", "NetworkHttpClient", "client", "=", "new", "NetworkHttpClient", "(", ")", ";", "final", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", "\"https://api....
Validate that we can connect to the new SSL certificate posted on api.twilio.com. @throws com.twilio.exception.CertificateValidationException if the connection fails
[ "Validate", "that", "we", "can", "connect", "to", "the", "new", "SSL", "certificate", "posted", "on", "api", ".", "twilio", ".", "com", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/Twilio.java#L170-L185
JavaMoney/jsr354-api
src/main/java/javax/money/convert/ConversionQueryBuilder.java
ConversionQueryBuilder.setRateTypes
public ConversionQueryBuilder setRateTypes(RateType... rateTypes) { return set(ConversionQuery.KEY_RATE_TYPES, new HashSet<>(Arrays.asList(rateTypes))); }
java
public ConversionQueryBuilder setRateTypes(RateType... rateTypes) { return set(ConversionQuery.KEY_RATE_TYPES, new HashSet<>(Arrays.asList(rateTypes))); }
[ "public", "ConversionQueryBuilder", "setRateTypes", "(", "RateType", "...", "rateTypes", ")", "{", "return", "set", "(", "ConversionQuery", ".", "KEY_RATE_TYPES", ",", "new", "HashSet", "<>", "(", "Arrays", ".", "asList", "(", "rateTypes", ")", ")", ")", ";", ...
Set the providers to be considered. If not set explicitly the <i>default</i> ISO currencies as returned by {@link java.util.Currency} is used. @param rateTypes the rate types to use, not null. @return the query for chaining.
[ "Set", "the", "providers", "to", "be", "considered", ".", "If", "not", "set", "explicitly", "the", "<i", ">", "default<", "/", "i", ">", "ISO", "currencies", "as", "returned", "by", "{", "@link", "java", ".", "util", ".", "Currency", "}", "is", "used",...
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/ConversionQueryBuilder.java#L46-L48
drinkjava2/jDialects
core/src/main/java/com/github/drinkjava2/jdialects/StrUtils.java
StrUtils.replaceIgnoreCase
public static String replaceIgnoreCase(String text, String findtxt, String replacetxt) { if (text == null) return null; String str = text; if (findtxt == null || findtxt.length() == 0) { return str; } if (findtxt.length() > str.length()) { return str; } int counter = 0; String thesubstr; while ((counter < str.length()) && (str.substring(counter).length() >= findtxt.length())) { thesubstr = str.substring(counter, counter + findtxt.length()); if (thesubstr.equalsIgnoreCase(findtxt)) { str = str.substring(0, counter) + replacetxt + str.substring(counter + findtxt.length()); counter += replacetxt.length(); } else { counter++; } } return str; }
java
public static String replaceIgnoreCase(String text, String findtxt, String replacetxt) { if (text == null) return null; String str = text; if (findtxt == null || findtxt.length() == 0) { return str; } if (findtxt.length() > str.length()) { return str; } int counter = 0; String thesubstr; while ((counter < str.length()) && (str.substring(counter).length() >= findtxt.length())) { thesubstr = str.substring(counter, counter + findtxt.length()); if (thesubstr.equalsIgnoreCase(findtxt)) { str = str.substring(0, counter) + replacetxt + str.substring(counter + findtxt.length()); counter += replacetxt.length(); } else { counter++; } } return str; }
[ "public", "static", "String", "replaceIgnoreCase", "(", "String", "text", ",", "String", "findtxt", ",", "String", "replacetxt", ")", "{", "if", "(", "text", "==", "null", ")", "return", "null", ";", "String", "str", "=", "text", ";", "if", "(", "findtxt...
Replace all sub strings ignore case <br/> replaceIgnoreCase("AbcDECd", "Cd", "FF") = "AbFFEFF"
[ "Replace", "all", "sub", "strings", "ignore", "case", "<br", "/", ">", "replaceIgnoreCase", "(", "AbcDECd", "Cd", "FF", ")", "=", "AbFFEFF" ]
train
https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/StrUtils.java#L338-L360
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java
MarshallUtil.unmarshallUUID
public static UUID unmarshallUUID(ObjectInput in, boolean checkNull) throws IOException { if (checkNull && in.readBoolean()) { return null; } return new UUID(in.readLong(), in.readLong()); }
java
public static UUID unmarshallUUID(ObjectInput in, boolean checkNull) throws IOException { if (checkNull && in.readBoolean()) { return null; } return new UUID(in.readLong(), in.readLong()); }
[ "public", "static", "UUID", "unmarshallUUID", "(", "ObjectInput", "in", ",", "boolean", "checkNull", ")", "throws", "IOException", "{", "if", "(", "checkNull", "&&", "in", ".", "readBoolean", "(", ")", ")", "{", "return", "null", ";", "}", "return", "new",...
Unmarshall {@link UUID}. @param in {@link ObjectInput} to read. @param checkNull If {@code true}, it checks if the {@link UUID} marshalled was {@code null}. @return {@link UUID} marshalled. @throws IOException If any of the usual Input/Output related exceptions occur. @see #marshallUUID(UUID, ObjectOutput, boolean).
[ "Unmarshall", "{", "@link", "UUID", "}", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java#L167-L172
soi-toolkit/soi-toolkit-mule
commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/rest/RestClient.java
RestClient.doHttpReceiveRequest
public MuleMessage doHttpReceiveRequest(String url, String method, String acceptConentType, String acceptCharSet) { Map<String, String> properties = new HashMap<String, String>(); properties.put("http.method", method); properties.put("Accept", acceptConentType); properties.put("Accept-Charset", acceptCharSet); MuleMessage response = send(url, null, properties); return response; }
java
public MuleMessage doHttpReceiveRequest(String url, String method, String acceptConentType, String acceptCharSet) { Map<String, String> properties = new HashMap<String, String>(); properties.put("http.method", method); properties.put("Accept", acceptConentType); properties.put("Accept-Charset", acceptCharSet); MuleMessage response = send(url, null, properties); return response; }
[ "public", "MuleMessage", "doHttpReceiveRequest", "(", "String", "url", ",", "String", "method", ",", "String", "acceptConentType", ",", "String", "acceptCharSet", ")", "{", "Map", "<", "String", ",", "String", ">", "properties", "=", "new", "HashMap", "<", "St...
Perform a HTTP call receiving information from the server using GET or DELETE @param url @param method, e.g. "GET" or "DELETE" @param acceptConentType @param acceptCharSet @return @throws MuleException
[ "Perform", "a", "HTTP", "call", "receiving", "information", "from", "the", "server", "using", "GET", "or", "DELETE" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/rest/RestClient.java#L180-L190
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java
JRDF.samePredicate
public static boolean samePredicate(PredicateNode p1, PredicateNode p2) { return sameResource((URIReference) p1, (URIReference) p2); }
java
public static boolean samePredicate(PredicateNode p1, PredicateNode p2) { return sameResource((URIReference) p1, (URIReference) p2); }
[ "public", "static", "boolean", "samePredicate", "(", "PredicateNode", "p1", ",", "PredicateNode", "p2", ")", "{", "return", "sameResource", "(", "(", "URIReference", ")", "p1", ",", "(", "URIReference", ")", "p2", ")", ";", "}" ]
Tells whether the given predicates are equivalent. <p> Two predicates are equivalent if they match according to the rules for resources. @param p1 first predicate. @param p2 second predicate. @return true if equivalent, false otherwise.
[ "Tells", "whether", "the", "given", "predicates", "are", "equivalent", ".", "<p", ">", "Two", "predicates", "are", "equivalent", "if", "they", "match", "according", "to", "the", "rules", "for", "resources", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java#L171-L173
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.createGraphicsShapes
public java.awt.Graphics2D createGraphicsShapes(float width, float height) { return new PdfGraphics2D(this, width, height, null, true, false, 0); }
java
public java.awt.Graphics2D createGraphicsShapes(float width, float height) { return new PdfGraphics2D(this, width, height, null, true, false, 0); }
[ "public", "java", ".", "awt", ".", "Graphics2D", "createGraphicsShapes", "(", "float", "width", ",", "float", "height", ")", "{", "return", "new", "PdfGraphics2D", "(", "this", ",", "width", ",", "height", ",", "null", ",", "true", ",", "false", ",", "0"...
Gets a <CODE>Graphics2D</CODE> to write on. The graphics are translated to PDF commands as shapes. No PDF fonts will appear. @param width the width of the panel @param height the height of the panel @return a <CODE>Graphics2D</CODE>
[ "Gets", "a", "<CODE", ">", "Graphics2D<", "/", "CODE", ">", "to", "write", "on", ".", "The", "graphics", "are", "translated", "to", "PDF", "commands", "as", "shapes", ".", "No", "PDF", "fonts", "will", "appear", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2791-L2793
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/observer/SubjectRegistry.java
SubjectRegistry.register
@SuppressWarnings("unchecked") public <T> void register(String subjectName, SubjectObserver<T> subjectObserver) { Subject<?> subject = (Subject<?>)this.registry.get(subjectName); if(subject == null) subject = new Topic<T>(); register(subjectName, subjectObserver, (Subject<T>)subject); }
java
@SuppressWarnings("unchecked") public <T> void register(String subjectName, SubjectObserver<T> subjectObserver) { Subject<?> subject = (Subject<?>)this.registry.get(subjectName); if(subject == null) subject = new Topic<T>(); register(subjectName, subjectObserver, (Subject<T>)subject); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "void", "register", "(", "String", "subjectName", ",", "SubjectObserver", "<", "T", ">", "subjectObserver", ")", "{", "Subject", "<", "?", ">", "subject", "=", "(", "Subject", "<"...
Add the subject Observer (default Topic implementation may be used) @param <T> the class type @param subjectName the subject name @param subjectObserver the subject observer
[ "Add", "the", "subject", "Observer", "(", "default", "Topic", "implementation", "may", "be", "used", ")" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/observer/SubjectRegistry.java#L49-L59
telly/groundy
library/src/main/java/com/telly/groundy/Groundy.java
Groundy.arg
public Groundy arg(String key, Bundle value) { mArgs.putBundle(key, value); return this; }
java
public Groundy arg(String key, Bundle value) { mArgs.putBundle(key, value); return this; }
[ "public", "Groundy", "arg", "(", "String", "key", ",", "Bundle", "value", ")", "{", "mArgs", ".", "putBundle", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Bundle object, or null @return itself
[ "Inserts", "a", "Bundle", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/Groundy.java#L730-L733
yanzhenjie/AndServer
api/src/main/java/com/yanzhenjie/andserver/framework/view/ViewResolver.java
ViewResolver.resolve
public void resolve(@Nullable View view, @NonNull HttpRequest request, @NonNull HttpResponse response) { if (view == null) return; Object output = view.output(); if (output == null) return; if (view.rest()) { resolveRest(output, request, response); } else { resolvePath(output, request, response); } }
java
public void resolve(@Nullable View view, @NonNull HttpRequest request, @NonNull HttpResponse response) { if (view == null) return; Object output = view.output(); if (output == null) return; if (view.rest()) { resolveRest(output, request, response); } else { resolvePath(output, request, response); } }
[ "public", "void", "resolve", "(", "@", "Nullable", "View", "view", ",", "@", "NonNull", "HttpRequest", "request", ",", "@", "NonNull", "HttpResponse", "response", ")", "{", "if", "(", "view", "==", "null", ")", "return", ";", "Object", "output", "=", "vi...
Solve the view and convert the view to http package content. @param view current view. @param request current request. @param response current response.
[ "Solve", "the", "view", "and", "convert", "the", "view", "to", "http", "package", "content", "." ]
train
https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/framework/view/ViewResolver.java#L57-L68
PinaeOS/timon
src/main/java/org/pinae/timon/cache/CacheFactory.java
CacheFactory.createCache
public Cache createCache(String name, CacheConfiguration config, int type) throws CacheException { if (config == null) { throw new CacheException("Cache configuration is null"); } Cache cache = null; switch (type) { case Cache.SYN_CACHE: cache = new SynchronizedCache(name, (SynchronizedCacheConfiguration) config); break; case Cache.EHCACHE_CACHE: cache = new EhCache(name, (EhCacheConfiguration) config); break; case Cache.MEMCACHED_CACHE: cache = new MemcachedCache(name, (MemcachedCacheConfiguration)config); break; } if (name != null && cache != null) { this.cachePool.put(name, cache); } return cache; }
java
public Cache createCache(String name, CacheConfiguration config, int type) throws CacheException { if (config == null) { throw new CacheException("Cache configuration is null"); } Cache cache = null; switch (type) { case Cache.SYN_CACHE: cache = new SynchronizedCache(name, (SynchronizedCacheConfiguration) config); break; case Cache.EHCACHE_CACHE: cache = new EhCache(name, (EhCacheConfiguration) config); break; case Cache.MEMCACHED_CACHE: cache = new MemcachedCache(name, (MemcachedCacheConfiguration)config); break; } if (name != null && cache != null) { this.cachePool.put(name, cache); } return cache; }
[ "public", "Cache", "createCache", "(", "String", "name", ",", "CacheConfiguration", "config", ",", "int", "type", ")", "throws", "CacheException", "{", "if", "(", "config", "==", "null", ")", "{", "throw", "new", "CacheException", "(", "\"Cache configuration is ...
生成缓存 @param name 缓存名称 @param config 缓存配置 @param type 缓存类别 @return 生成的缓存对象 @throws CacheException 缓存异常
[ "生成缓存" ]
train
https://github.com/PinaeOS/timon/blob/b8c66868624e3eb1b36f6ecda3c556c456a30cd3/src/main/java/org/pinae/timon/cache/CacheFactory.java#L52-L75
io7m/jcanephora
com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLTextureUpdates.java
JCGLTextureUpdates.newUpdateReplacingAll2D
public static JCGLTexture2DUpdateType newUpdateReplacingAll2D( final JCGLTexture2DUsableType t) { NullCheck.notNull(t, "Texture"); return newUpdateReplacingArea2D(t, AreaSizesL.area(t.size())); }
java
public static JCGLTexture2DUpdateType newUpdateReplacingAll2D( final JCGLTexture2DUsableType t) { NullCheck.notNull(t, "Texture"); return newUpdateReplacingArea2D(t, AreaSizesL.area(t.size())); }
[ "public", "static", "JCGLTexture2DUpdateType", "newUpdateReplacingAll2D", "(", "final", "JCGLTexture2DUsableType", "t", ")", "{", "NullCheck", ".", "notNull", "(", "t", ",", "\"Texture\"", ")", ";", "return", "newUpdateReplacingArea2D", "(", "t", ",", "AreaSizesL", ...
Create a new update that will replace the entirety of {@code t}. @param t The texture @return A new update
[ "Create", "a", "new", "update", "that", "will", "replace", "the", "entirety", "of", "{", "@code", "t", "}", "." ]
train
https://github.com/io7m/jcanephora/blob/0004c1744b7f0969841d04cd4fa693f402b10980/com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLTextureUpdates.java#L109-L114
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java
NodeSet.removeNode
public void removeNode(Node n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); this.removeElement(n); }
java
public void removeNode(Node n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); this.removeElement(n); }
[ "public", "void", "removeNode", "(", "Node", "n", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESET_NOT_MUTABLE", ",", "null", ")", ")", "...
Remove a node. @param n Node to be added @throws RuntimeException thrown if this NodeSet is not of a mutable type.
[ "Remove", "a", "node", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L413-L420
esigate/esigate
esigate-core/src/main/java/org/esigate/Driver.java
Driver.logAction
private void logAction(String action, String onUrl, Renderer[] renderers) { if (LOG.isInfoEnabled()) { List<String> rendererNames = new ArrayList<>(renderers.length); for (Renderer renderer : renderers) { rendererNames.add(renderer.getClass().getName()); } LOG.info("{} provider={} page= {} renderers={}", action, this.config.getInstanceName(), onUrl, rendererNames); } }
java
private void logAction(String action, String onUrl, Renderer[] renderers) { if (LOG.isInfoEnabled()) { List<String> rendererNames = new ArrayList<>(renderers.length); for (Renderer renderer : renderers) { rendererNames.add(renderer.getClass().getName()); } LOG.info("{} provider={} page= {} renderers={}", action, this.config.getInstanceName(), onUrl, rendererNames); } }
[ "private", "void", "logAction", "(", "String", "action", ",", "String", "onUrl", ",", "Renderer", "[", "]", "renderers", ")", "{", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "List", "<", "String", ">", "rendererNames", "=", "new", "Arr...
Log current provider, page and renderers that will be applied. <p> This methods log at the INFO level. <p> You should only call this method if INFO level is enabled. <pre> if (LOG.isInfoEnabled()) { logAction(pageUrl, renderers); } </pre> @param action Action name (eg. "proxy" or "render") @param onUrl current page url. @param renderers array of renderers
[ "Log", "current", "provider", "page", "and", "renderers", "that", "will", "be", "applied", ".", "<p", ">", "This", "methods", "log", "at", "the", "INFO", "level", ".", "<p", ">", "You", "should", "only", "call", "this", "method", "if", "INFO", "level", ...
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/Driver.java#L243-L252
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/ClusterDistributionChannelWriter.java
ClusterDistributionChannelWriter.getIntent
static Intent getIntent(Collection<? extends RedisCommand<?, ?, ?>> commands) { boolean w = false; boolean r = false; Intent singleIntent = Intent.WRITE; for (RedisCommand<?, ?, ?> command : commands) { if (command instanceof ClusterCommand) { continue; } singleIntent = getIntent(command.getType()); if (singleIntent == Intent.READ) { r = true; } if (singleIntent == Intent.WRITE) { w = true; } if (r && w) { return Intent.WRITE; } } return singleIntent; }
java
static Intent getIntent(Collection<? extends RedisCommand<?, ?, ?>> commands) { boolean w = false; boolean r = false; Intent singleIntent = Intent.WRITE; for (RedisCommand<?, ?, ?> command : commands) { if (command instanceof ClusterCommand) { continue; } singleIntent = getIntent(command.getType()); if (singleIntent == Intent.READ) { r = true; } if (singleIntent == Intent.WRITE) { w = true; } if (r && w) { return Intent.WRITE; } } return singleIntent; }
[ "static", "Intent", "getIntent", "(", "Collection", "<", "?", "extends", "RedisCommand", "<", "?", ",", "?", ",", "?", ">", ">", "commands", ")", "{", "boolean", "w", "=", "false", ";", "boolean", "r", "=", "false", ";", "Intent", "singleIntent", "=", ...
Optimization: Determine command intents and optimize for bulk execution preferring one node. <p> If there is only one intent, then we take the intent derived from the commands. If there is more than one intent, then use {@link Intent#WRITE}. @param commands {@link Collection} of {@link RedisCommand commands}. @return the intent.
[ "Optimization", ":", "Determine", "command", "intents", "and", "optimize", "for", "bulk", "execution", "preferring", "one", "node", ".", "<p", ">", "If", "there", "is", "only", "one", "intent", "then", "we", "take", "the", "intent", "derived", "from", "the",...
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/ClusterDistributionChannelWriter.java#L269-L296
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java
NamedResolverMap.getGroupName
public GroupName getGroupName(@NonNull SimpleGroupPath prefixPath, @NonNull Map<String, MetricValue> extraTags) { return getGroupName(prefixPath.getPath(), extraTags); }
java
public GroupName getGroupName(@NonNull SimpleGroupPath prefixPath, @NonNull Map<String, MetricValue> extraTags) { return getGroupName(prefixPath.getPath(), extraTags); }
[ "public", "GroupName", "getGroupName", "(", "@", "NonNull", "SimpleGroupPath", "prefixPath", ",", "@", "NonNull", "Map", "<", "String", ",", "MetricValue", ">", "extraTags", ")", "{", "return", "getGroupName", "(", "prefixPath", ".", "getPath", "(", ")", ",", ...
Create a GroupName from this NamedResolverMap. @param prefixPath Additional path elements to put in front of the returned path. @param extraTags Additional tags to put in the tag set. The extraTags argument will override any values present in the NamedResolverMap. @return A group name derived from this NamedResolverMap and the supplied arguments.
[ "Create", "a", "GroupName", "from", "this", "NamedResolverMap", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L265-L267
bmelnychuk/AndroidTreeView
library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java
TwoDScrollView.fullScroll
public boolean fullScroll(int direction, boolean horizontal) { if (!horizontal) { boolean down = direction == View.FOCUS_DOWN; int height = getHeight(); mTempRect.top = 0; mTempRect.bottom = height; if (down) { int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); mTempRect.bottom = view.getBottom(); mTempRect.top = mTempRect.bottom - height; } } return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom, 0, 0, 0); } else { boolean right = direction == View.FOCUS_DOWN; int width = getWidth(); mTempRect.left = 0; mTempRect.right = width; if (right) { int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); mTempRect.right = view.getBottom(); mTempRect.left = mTempRect.right - width; } } return scrollAndFocus(0, 0, 0, direction, mTempRect.top, mTempRect.bottom); } }
java
public boolean fullScroll(int direction, boolean horizontal) { if (!horizontal) { boolean down = direction == View.FOCUS_DOWN; int height = getHeight(); mTempRect.top = 0; mTempRect.bottom = height; if (down) { int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); mTempRect.bottom = view.getBottom(); mTempRect.top = mTempRect.bottom - height; } } return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom, 0, 0, 0); } else { boolean right = direction == View.FOCUS_DOWN; int width = getWidth(); mTempRect.left = 0; mTempRect.right = width; if (right) { int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); mTempRect.right = view.getBottom(); mTempRect.left = mTempRect.right - width; } } return scrollAndFocus(0, 0, 0, direction, mTempRect.top, mTempRect.bottom); } }
[ "public", "boolean", "fullScroll", "(", "int", "direction", ",", "boolean", "horizontal", ")", "{", "if", "(", "!", "horizontal", ")", "{", "boolean", "down", "=", "direction", "==", "View", ".", "FOCUS_DOWN", ";", "int", "height", "=", "getHeight", "(", ...
<p>Handles scrolling in response to a "home/end" shortcut press. This method will scroll the view to the top or bottom and give the focus to the topmost/bottommost component in the new visible area. If no component is a good candidate for focus, this scrollview reclaims the focus.</p> @param direction the scroll direction: {@link android.view.View#FOCUS_UP} to go the top of the view or {@link android.view.View#FOCUS_DOWN} to go the bottom @return true if the key event is consumed by this method, false otherwise
[ "<p", ">", "Handles", "scrolling", "in", "response", "to", "a", "home", "/", "end", "shortcut", "press", ".", "This", "method", "will", "scroll", "the", "view", "to", "the", "top", "or", "bottom", "and", "give", "the", "focus", "to", "the", "topmost", ...
train
https://github.com/bmelnychuk/AndroidTreeView/blob/d051ce75f5c9bd5206481808f6133b51f581c8f1/library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java#L575-L605
looly/hutool
hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java
Arrangement.count
public static long count(int n, int m) { if(n == m) { return NumberUtil.factorial(n); } return (n > m) ? NumberUtil.factorial(n, n - m) : 0; }
java
public static long count(int n, int m) { if(n == m) { return NumberUtil.factorial(n); } return (n > m) ? NumberUtil.factorial(n, n - m) : 0; }
[ "public", "static", "long", "count", "(", "int", "n", ",", "int", "m", ")", "{", "if", "(", "n", "==", "m", ")", "{", "return", "NumberUtil", ".", "factorial", "(", "n", ")", ";", "}", "return", "(", "n", ">", "m", ")", "?", "NumberUtil", ".", ...
计算排列数,即A(n, m) = n!/(n-m)! @param n 总数 @param m 选择的个数 @return 排列数
[ "计算排列数,即A", "(", "n", "m", ")", "=", "n!", "/", "(", "n", "-", "m", ")", "!" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java#L46-L51
LearnLib/automatalib
util/src/main/java/net/automatalib/util/automata/minimizer/hopcroft/HopcroftMinimization.java
HopcroftMinimization.minimizeDFA
public static <S, I, A extends DFA<S, I> & InputAlphabetHolder<I>> CompactDFA<I> minimizeDFA(A dfa) { return minimizeDFA(dfa, PruningMode.PRUNE_AFTER); }
java
public static <S, I, A extends DFA<S, I> & InputAlphabetHolder<I>> CompactDFA<I> minimizeDFA(A dfa) { return minimizeDFA(dfa, PruningMode.PRUNE_AFTER); }
[ "public", "static", "<", "S", ",", "I", ",", "A", "extends", "DFA", "<", "S", ",", "I", ">", "&", "InputAlphabetHolder", "<", "I", ">", ">", "CompactDFA", "<", "I", ">", "minimizeDFA", "(", "A", "dfa", ")", "{", "return", "minimizeDFA", "(", "dfa",...
Minimizes the given DFA. The result is returned in the form of a {@link CompactDFA}, using the input alphabet obtained via <code>dfa.{@link InputAlphabetHolder#getInputAlphabet() getInputAlphabet()}</code>. Pruning (see above) is performed after computing state equivalences. @param dfa the DFA to minimize @return a minimized version of the specified DFA
[ "Minimizes", "the", "given", "DFA", ".", "The", "result", "is", "returned", "in", "the", "form", "of", "a", "{", "@link", "CompactDFA", "}", "using", "the", "input", "alphabet", "obtained", "via", "<code", ">", "dfa", ".", "{", "@link", "InputAlphabetHolde...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/minimizer/hopcroft/HopcroftMinimization.java#L190-L192
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/Sketches.java
Sketches.getLowerBound
public static double getLowerBound(final int numStdDev, final Memory srcMem) { return Sketch.lowerBound(getRetainedEntries(srcMem), getThetaLong(srcMem), numStdDev, getEmpty(srcMem)); }
java
public static double getLowerBound(final int numStdDev, final Memory srcMem) { return Sketch.lowerBound(getRetainedEntries(srcMem), getThetaLong(srcMem), numStdDev, getEmpty(srcMem)); }
[ "public", "static", "double", "getLowerBound", "(", "final", "int", "numStdDev", ",", "final", "Memory", "srcMem", ")", "{", "return", "Sketch", ".", "lowerBound", "(", "getRetainedEntries", "(", "srcMem", ")", ",", "getThetaLong", "(", "srcMem", ")", ",", "...
Gets the approximate lower error bound from a valid memory image of a Sketch given the specified number of Standard Deviations. This will return getEstimate() if isEmpty() is true. @param numStdDev <a href="{@docRoot}/resources/dictionary.html#numStdDev">See Number of Standard Deviations</a> @param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @return the lower bound.
[ "Gets", "the", "approximate", "lower", "error", "bound", "from", "a", "valid", "memory", "image", "of", "a", "Sketch", "given", "the", "specified", "number", "of", "Standard", "Deviations", ".", "This", "will", "return", "getEstimate", "()", "if", "isEmpty", ...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Sketches.java#L310-L312
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric_ca/sdk/HFCAClient.java
HFCAClient.getHFCACertificates
public HFCACertificateResponse getHFCACertificates(User registrar, HFCACertificateRequest req) throws HFCACertificateException { try { logger.debug(format("certificate url: %s, registrar: %s", HFCA_CERTIFICATE, registrar.getName())); JsonObject result = httpGet(HFCA_CERTIFICATE, registrar, req.getQueryParameters()); int statusCode = result.getInt("statusCode"); Collection<HFCACredential> certs = new ArrayList<>(); if (statusCode < 400) { JsonArray certificates = result.getJsonArray("certs"); if (certificates != null && !certificates.isEmpty()) { for (int i = 0; i < certificates.size(); i++) { String certPEM = certificates.getJsonObject(i).getString("PEM"); certs.add(new HFCAX509Certificate(certPEM)); } } logger.debug(format("certificate url: %s, registrar: %s done.", HFCA_CERTIFICATE, registrar)); } return new HFCACertificateResponse(statusCode, certs); } catch (HTTPException e) { String msg = format("[Code: %d] - Error while getting certificates from url '%s': %s", e.getStatusCode(), HFCA_CERTIFICATE, e.getMessage()); HFCACertificateException certificateException = new HFCACertificateException(msg, e); logger.error(msg); throw certificateException; } catch (Exception e) { String msg = format("Error while getting certificates from url '%s': %s", HFCA_CERTIFICATE, e.getMessage()); HFCACertificateException certificateException = new HFCACertificateException(msg, e); logger.error(msg); throw certificateException; } }
java
public HFCACertificateResponse getHFCACertificates(User registrar, HFCACertificateRequest req) throws HFCACertificateException { try { logger.debug(format("certificate url: %s, registrar: %s", HFCA_CERTIFICATE, registrar.getName())); JsonObject result = httpGet(HFCA_CERTIFICATE, registrar, req.getQueryParameters()); int statusCode = result.getInt("statusCode"); Collection<HFCACredential> certs = new ArrayList<>(); if (statusCode < 400) { JsonArray certificates = result.getJsonArray("certs"); if (certificates != null && !certificates.isEmpty()) { for (int i = 0; i < certificates.size(); i++) { String certPEM = certificates.getJsonObject(i).getString("PEM"); certs.add(new HFCAX509Certificate(certPEM)); } } logger.debug(format("certificate url: %s, registrar: %s done.", HFCA_CERTIFICATE, registrar)); } return new HFCACertificateResponse(statusCode, certs); } catch (HTTPException e) { String msg = format("[Code: %d] - Error while getting certificates from url '%s': %s", e.getStatusCode(), HFCA_CERTIFICATE, e.getMessage()); HFCACertificateException certificateException = new HFCACertificateException(msg, e); logger.error(msg); throw certificateException; } catch (Exception e) { String msg = format("Error while getting certificates from url '%s': %s", HFCA_CERTIFICATE, e.getMessage()); HFCACertificateException certificateException = new HFCACertificateException(msg, e); logger.error(msg); throw certificateException; } }
[ "public", "HFCACertificateResponse", "getHFCACertificates", "(", "User", "registrar", ",", "HFCACertificateRequest", "req", ")", "throws", "HFCACertificateException", "{", "try", "{", "logger", ".", "debug", "(", "format", "(", "\"certificate url: %s, registrar: %s\"", ",...
Gets all certificates that the registrar is allowed to see and based on filter parameters that are part of the certificate request. @param registrar The identity of the registrar (i.e. who is performing the registration). @param req The certificate request that contains filter parameters @return HFCACertificateResponse object @throws HFCACertificateException Failed to process get certificate request
[ "Gets", "all", "certificates", "that", "the", "registrar", "is", "allowed", "to", "see", "and", "based", "on", "filter", "parameters", "that", "are", "part", "of", "the", "certificate", "request", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAClient.java#L1224-L1254
lastaflute/lastaflute
src/main/java/org/lastaflute/web/servlet/request/scoped/ScopedMessageHandler.java
ScopedMessageHandler.saveGlobal
public void saveGlobal(String messageKey, Object... args) { assertObjectNotNull("messageKey", messageKey); doSaveInfo(prepareUserMessages(globalPropertyKey, messageKey, args)); }
java
public void saveGlobal(String messageKey, Object... args) { assertObjectNotNull("messageKey", messageKey); doSaveInfo(prepareUserMessages(globalPropertyKey, messageKey, args)); }
[ "public", "void", "saveGlobal", "(", "String", "messageKey", ",", "Object", "...", "args", ")", "{", "assertObjectNotNull", "(", "\"messageKey\"", ",", "messageKey", ")", ";", "doSaveInfo", "(", "prepareUserMessages", "(", "globalPropertyKey", ",", "messageKey", "...
Save message as global user messages. (overriding existing messages) <br> This message will be deleted immediately after display if you use e.g. la:errors. @param messageKey The message key to be saved. (NotNull) @param args The varying array of arguments for the message. (NullAllowed, EmptyAllowed)
[ "Save", "message", "as", "global", "user", "messages", ".", "(", "overriding", "existing", "messages", ")", "<br", ">", "This", "message", "will", "be", "deleted", "immediately", "after", "display", "if", "you", "use", "e", ".", "g", ".", "la", ":", "err...
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/servlet/request/scoped/ScopedMessageHandler.java#L64-L67
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java
CacheManager.isTileToBeDownloaded
public boolean isTileToBeDownloaded(final ITileSource pTileSource, final long pMapTileIndex) { final Long expiration = mTileWriter.getExpirationTimestamp(pTileSource, pMapTileIndex); if (expiration == null) { return true; } final long now = System.currentTimeMillis(); return now > expiration; }
java
public boolean isTileToBeDownloaded(final ITileSource pTileSource, final long pMapTileIndex) { final Long expiration = mTileWriter.getExpirationTimestamp(pTileSource, pMapTileIndex); if (expiration == null) { return true; } final long now = System.currentTimeMillis(); return now > expiration; }
[ "public", "boolean", "isTileToBeDownloaded", "(", "final", "ITileSource", "pTileSource", ",", "final", "long", "pMapTileIndex", ")", "{", "final", "Long", "expiration", "=", "mTileWriter", ".", "getExpirationTimestamp", "(", "pTileSource", ",", "pMapTileIndex", ")", ...
"Should we download this tile?", either because it's not cached yet or because it's expired @since 5.6.5
[ "Should", "we", "download", "this", "tile?", "either", "because", "it", "s", "not", "cached", "yet", "or", "because", "it", "s", "expired" ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java#L188-L195
casbin/jcasbin
src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java
DefaultRoleManager.hasLink
@Override public boolean hasLink(String name1, String name2, String... domain) { if (domain.length == 1) { name1 = domain[0] + "::" + name1; name2 = domain[0] + "::" + name2; } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } if (name1.equals(name2)) { return true; } if (!hasRole(name1) || !hasRole(name2)) { return false; } Role role1 = createRole(name1); return role1.hasRole(name2, maxHierarchyLevel); }
java
@Override public boolean hasLink(String name1, String name2, String... domain) { if (domain.length == 1) { name1 = domain[0] + "::" + name1; name2 = domain[0] + "::" + name2; } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } if (name1.equals(name2)) { return true; } if (!hasRole(name1) || !hasRole(name2)) { return false; } Role role1 = createRole(name1); return role1.hasRole(name2, maxHierarchyLevel); }
[ "@", "Override", "public", "boolean", "hasLink", "(", "String", "name1", ",", "String", "name2", ",", "String", "...", "domain", ")", "{", "if", "(", "domain", ".", "length", "==", "1", ")", "{", "name1", "=", "domain", "[", "0", "]", "+", "\"::\"", ...
hasLink determines whether role: name1 inherits role: name2. domain is a prefix to the roles.
[ "hasLink", "determines", "whether", "role", ":", "name1", "inherits", "role", ":", "name2", ".", "domain", "is", "a", "prefix", "to", "the", "roles", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java#L107-L126
JoeKerouac/utils
src/main/java/com/joe/utils/poi/WorkBookAccesser.java
WorkBookAccesser.mergedRegion
public void mergedRegion(int firstRow, int lastRow, int firstCol, int lastCol) { mergedRegion(workbook.getSheetAt(sheetIndex), firstRow, lastRow, firstCol, lastCol); }
java
public void mergedRegion(int firstRow, int lastRow, int firstCol, int lastCol) { mergedRegion(workbook.getSheetAt(sheetIndex), firstRow, lastRow, firstCol, lastCol); }
[ "public", "void", "mergedRegion", "(", "int", "firstRow", ",", "int", "lastRow", ",", "int", "firstCol", ",", "int", "lastCol", ")", "{", "mergedRegion", "(", "workbook", ".", "getSheetAt", "(", "sheetIndex", ")", ",", "firstRow", ",", "lastRow", ",", "fir...
合并指定sheet指定区域的单元格 @param firstRow 要合并的第一行 @param lastRow 要合并的最后一行 @param firstCol 要合并的第一列 @param lastCol 要合并的最后一列
[ "合并指定sheet指定区域的单元格" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/poi/WorkBookAccesser.java#L89-L91
jamesagnew/hapi-fhir
hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/validation/InstanceValidator.java
InstanceValidator.validateAnswerCode
private void validateAnswerCode(List<ValidationMessage> errors, Element value, NodeStack stack, Questionnaire qSrc, Reference ref, boolean theOpenChoice) { ValueSet vs = resolveBindingReference(qSrc, ref); if (warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), vs != null, "ValueSet " + describeReference(ref) + " not found")) { try { Coding c = readAsCoding(value); if (isBlank(c.getCode()) && isBlank(c.getSystem()) && isNotBlank(c.getDisplay())) { if (theOpenChoice) { return; } } long t = System.nanoTime(); ValidationResult res = context.validateCode(c, vs); txTime = txTime + (System.nanoTime() - t); if (!res.isOk()) rule(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "The value provided ("+c.getSystem()+"::"+c.getCode()+") is not in the options value set in the questionnaire"); } catch (Exception e) { warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "Error " + e.getMessage() + " validating Coding against Questionnaire Options"); } } }
java
private void validateAnswerCode(List<ValidationMessage> errors, Element value, NodeStack stack, Questionnaire qSrc, Reference ref, boolean theOpenChoice) { ValueSet vs = resolveBindingReference(qSrc, ref); if (warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), vs != null, "ValueSet " + describeReference(ref) + " not found")) { try { Coding c = readAsCoding(value); if (isBlank(c.getCode()) && isBlank(c.getSystem()) && isNotBlank(c.getDisplay())) { if (theOpenChoice) { return; } } long t = System.nanoTime(); ValidationResult res = context.validateCode(c, vs); txTime = txTime + (System.nanoTime() - t); if (!res.isOk()) rule(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "The value provided ("+c.getSystem()+"::"+c.getCode()+") is not in the options value set in the questionnaire"); } catch (Exception e) { warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "Error " + e.getMessage() + " validating Coding against Questionnaire Options"); } } }
[ "private", "void", "validateAnswerCode", "(", "List", "<", "ValidationMessage", ">", "errors", ",", "Element", "value", ",", "NodeStack", "stack", ",", "Questionnaire", "qSrc", ",", "Reference", "ref", ",", "boolean", "theOpenChoice", ")", "{", "ValueSet", "vs",...
/* private void validateAnswerCode(List<ValidationMessage> errors, Element value, NodeStack stack, List<Coding> optionList) { String system = value.getNamedChildValue("system"); String code = value.getNamedChildValue("code"); boolean found = false; for (Coding c : optionList) { if (ObjectUtil.equals(c.getSystem(), system) && ObjectUtil.equals(c.getCode(), code)) { found = true; break; } } rule(errors, IssueType.STRUCTURE, value.line(), value.col(), stack.getLiteralPath(), found, "The code "+system+"::"+code+" is not a valid option"); }
[ "/", "*", "private", "void", "validateAnswerCode", "(", "List<ValidationMessage", ">", "errors", "Element", "value", "NodeStack", "stack", "List<Coding", ">", "optionList", ")", "{", "String", "system", "=", "value", ".", "getNamedChildValue", "(", "system", ")", ...
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/validation/InstanceValidator.java#L1745-L1765
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/Data.java
Data.resolveWildcardTypeOrTypeVariable
public static Type resolveWildcardTypeOrTypeVariable(List<Type> context, Type type) { // first deal with a wildcard, e.g. ? extends Number if (type instanceof WildcardType) { type = Types.getBound((WildcardType) type); } // next deal with a type variable T while (type instanceof TypeVariable<?>) { // resolve the type variable Type resolved = Types.resolveTypeVariable(context, (TypeVariable<?>) type); if (resolved != null) { type = resolved; } // if unable to fully resolve the type variable, use its bounds, e.g. T extends Number if (type instanceof TypeVariable<?>) { type = ((TypeVariable<?>) type).getBounds()[0]; } // loop in case T extends U and U is also a type variable } return type; }
java
public static Type resolveWildcardTypeOrTypeVariable(List<Type> context, Type type) { // first deal with a wildcard, e.g. ? extends Number if (type instanceof WildcardType) { type = Types.getBound((WildcardType) type); } // next deal with a type variable T while (type instanceof TypeVariable<?>) { // resolve the type variable Type resolved = Types.resolveTypeVariable(context, (TypeVariable<?>) type); if (resolved != null) { type = resolved; } // if unable to fully resolve the type variable, use its bounds, e.g. T extends Number if (type instanceof TypeVariable<?>) { type = ((TypeVariable<?>) type).getBounds()[0]; } // loop in case T extends U and U is also a type variable } return type; }
[ "public", "static", "Type", "resolveWildcardTypeOrTypeVariable", "(", "List", "<", "Type", ">", "context", ",", "Type", "type", ")", "{", "// first deal with a wildcard, e.g. ? extends Number", "if", "(", "type", "instanceof", "WildcardType", ")", "{", "type", "=", ...
Aggressively resolves the given type in such a way that the resolved type is not a wildcard type or a type variable, returning {@code Object.class} if the type variable cannot be resolved. @param context context list, ordering from least specific to most specific type context, for example container class and then its field @param type type or {@code null} for {@code null} result @return resolved type (which may be class, parameterized type, or generic array type, but not wildcard type or type variable) or {@code null} for {@code null} input
[ "Aggressively", "resolves", "the", "given", "type", "in", "such", "a", "way", "that", "the", "resolved", "type", "is", "not", "a", "wildcard", "type", "or", "a", "type", "variable", "returning", "{", "@code", "Object", ".", "class", "}", "if", "the", "ty...
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/Data.java#L543-L562
Azure/azure-sdk-for-java
locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java
ManagementLocksInner.getByScopeAsync
public Observable<ManagementLockObjectInner> getByScopeAsync(String scope, String lockName) { return getByScopeWithServiceResponseAsync(scope, lockName).map(new Func1<ServiceResponse<ManagementLockObjectInner>, ManagementLockObjectInner>() { @Override public ManagementLockObjectInner call(ServiceResponse<ManagementLockObjectInner> response) { return response.body(); } }); }
java
public Observable<ManagementLockObjectInner> getByScopeAsync(String scope, String lockName) { return getByScopeWithServiceResponseAsync(scope, lockName).map(new Func1<ServiceResponse<ManagementLockObjectInner>, ManagementLockObjectInner>() { @Override public ManagementLockObjectInner call(ServiceResponse<ManagementLockObjectInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagementLockObjectInner", ">", "getByScopeAsync", "(", "String", "scope", ",", "String", "lockName", ")", "{", "return", "getByScopeWithServiceResponseAsync", "(", "scope", ",", "lockName", ")", ".", "map", "(", "new", "Func1", "<",...
Get a management lock by scope. @param scope The scope for the lock. @param lockName The name of lock. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagementLockObjectInner object
[ "Get", "a", "management", "lock", "by", "scope", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L625-L632
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java
DeploymentResourceSupport.getDeploymentSubModel
public ModelNode getDeploymentSubModel(final String subsystemName, final PathAddress address) { assert subsystemName != null : "The subsystemName cannot be null"; assert address != null : "The address cannot be null"; return getDeploymentSubModel(subsystemName, address, null, deploymentUnit); }
java
public ModelNode getDeploymentSubModel(final String subsystemName, final PathAddress address) { assert subsystemName != null : "The subsystemName cannot be null"; assert address != null : "The address cannot be null"; return getDeploymentSubModel(subsystemName, address, null, deploymentUnit); }
[ "public", "ModelNode", "getDeploymentSubModel", "(", "final", "String", "subsystemName", ",", "final", "PathAddress", "address", ")", "{", "assert", "subsystemName", "!=", "null", ":", "\"The subsystemName cannot be null\"", ";", "assert", "address", "!=", "null", ":"...
Gets the sub-model for a components from the deployment itself. Operations, metrics and descriptions have to be registered as part of the subsystem registration {@link org.jboss.as.controller.ExtensionContext} and {@link org.jboss.as.controller.SubsystemRegistration#registerDeploymentModel(org.jboss.as.controller.ResourceDefinition)}. <p> The subsystem resource as well as each {@link org.jboss.as.controller.PathAddress#getParent()} parent element} from the address will be created if it does not already exist. </p> @param subsystemName the name of the subsystem @param address the path address this sub-model should return the model for @return the model for the resource
[ "Gets", "the", "sub", "-", "model", "for", "a", "components", "from", "the", "deployment", "itself", ".", "Operations", "metrics", "and", "descriptions", "have", "to", "be", "registered", "as", "part", "of", "the", "subsystem", "registration", "{", "@link", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java#L176-L180
osglworks/java-tool
src/main/java/org/osgl/util/E.java
E.invalidStateIf
public static void invalidStateIf(boolean tester, String msg, Object... args) { if (tester) { invalidState(msg, args); } }
java
public static void invalidStateIf(boolean tester, String msg, Object... args) { if (tester) { invalidState(msg, args); } }
[ "public", "static", "void", "invalidStateIf", "(", "boolean", "tester", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "tester", ")", "{", "invalidState", "(", "msg", ",", "args", ")", ";", "}", "}" ]
Throws out an {@link InvalidStateException} when `tester` evaluated to `true`. @param tester when `true` then an {@link InvalidStateException} will be thrown out. @param msg the message format template @param args the message format arguments
[ "Throws", "out", "an", "{", "@link", "InvalidStateException", "}", "when", "tester", "evaluated", "to", "true", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L92-L96
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java
InvalidationAuditDaemon.filterEntryList
public ArrayList filterEntryList(String cacheName, ArrayList incomingList) { InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName); try { invalidationTableList.readWriteLock.readLock().lock(); Iterator it = incomingList.iterator(); while (it.hasNext()) { Object obj = it.next(); if (obj instanceof CacheEntry) {// ignore any "push-pull" String id's in DRS case CacheEntry cacheEntry = (CacheEntry) obj; if (internalFilterEntry(cacheName, invalidationTableList, cacheEntry) == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "filterEntryList(): Filtered OUT cacheName=" + cacheName + " id=" + cacheEntry.id); } it.remove(); } } } return incomingList; } finally { invalidationTableList.readWriteLock.readLock().unlock(); } }
java
public ArrayList filterEntryList(String cacheName, ArrayList incomingList) { InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName); try { invalidationTableList.readWriteLock.readLock().lock(); Iterator it = incomingList.iterator(); while (it.hasNext()) { Object obj = it.next(); if (obj instanceof CacheEntry) {// ignore any "push-pull" String id's in DRS case CacheEntry cacheEntry = (CacheEntry) obj; if (internalFilterEntry(cacheName, invalidationTableList, cacheEntry) == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "filterEntryList(): Filtered OUT cacheName=" + cacheName + " id=" + cacheEntry.id); } it.remove(); } } } return incomingList; } finally { invalidationTableList.readWriteLock.readLock().unlock(); } }
[ "public", "ArrayList", "filterEntryList", "(", "String", "cacheName", ",", "ArrayList", "incomingList", ")", "{", "InvalidationTableList", "invalidationTableList", "=", "getInvalidationTableList", "(", "cacheName", ")", ";", "try", "{", "invalidationTableList", ".", "re...
This ensures all incoming CacheEntrys have not been invalidated. @param incomingList The unfiltered list of CacheEntrys. @return The filtered list of CacheEntrys.
[ "This", "ensures", "all", "incoming", "CacheEntrys", "have", "not", "been", "invalidated", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/InvalidationAuditDaemon.java#L170-L192
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java
WCheckBoxSelectExample.addDisabledExamples
private void addDisabledExamples() { add(new WHeading(HeadingLevel.H2, "Disabled WCheckBoxSelect examples")); WFieldLayout layout = new WFieldLayout(); add(layout); WCheckBoxSelect select = new WCheckBoxSelect("australian_state"); select.setDisabled(true); layout.addField("Disabled with no default selection", select); add(new WHeading(HeadingLevel.H3, "Disabled with no selection and no frame")); select = new WCheckBoxSelect("australian_state"); select.setDisabled(true); select.setFrameless(true); layout.addField("Disabled with no selection and no frame", select); select = new SelectWithSingleSelected("australian_state"); select.setDisabled(true); layout.addField("Disabled with one selection", select); select = new SelectWithManySelected("australian_state"); select.setDisabled(true); select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS); select.setButtonColumns(3); layout.addField("Disabled with many selections and COLUMN layout", select); }
java
private void addDisabledExamples() { add(new WHeading(HeadingLevel.H2, "Disabled WCheckBoxSelect examples")); WFieldLayout layout = new WFieldLayout(); add(layout); WCheckBoxSelect select = new WCheckBoxSelect("australian_state"); select.setDisabled(true); layout.addField("Disabled with no default selection", select); add(new WHeading(HeadingLevel.H3, "Disabled with no selection and no frame")); select = new WCheckBoxSelect("australian_state"); select.setDisabled(true); select.setFrameless(true); layout.addField("Disabled with no selection and no frame", select); select = new SelectWithSingleSelected("australian_state"); select.setDisabled(true); layout.addField("Disabled with one selection", select); select = new SelectWithManySelected("australian_state"); select.setDisabled(true); select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS); select.setButtonColumns(3); layout.addField("Disabled with many selections and COLUMN layout", select); }
[ "private", "void", "addDisabledExamples", "(", ")", "{", "add", "(", "new", "WHeading", "(", "HeadingLevel", ".", "H2", ",", "\"Disabled WCheckBoxSelect examples\"", ")", ")", ";", "WFieldLayout", "layout", "=", "new", "WFieldLayout", "(", ")", ";", "add", "("...
Examples of disabled state. You should use {@link WSubordinateControl} to set and manage the disabled state unless there is no facility for the user to enable a control.
[ "Examples", "of", "disabled", "state", ".", "You", "should", "use", "{" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java#L377-L400
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/common/utils/NetUtils.java
NetUtils.canTelnet
public static boolean canTelnet(String ip, int port, int timeout) { Socket socket = null; try { socket = new Socket(); socket.connect(new InetSocketAddress(ip, port), timeout); return socket.isConnected() && !socket.isClosed(); } catch (Exception e) { return false; } finally { IOUtils.closeQuietly(socket); } }
java
public static boolean canTelnet(String ip, int port, int timeout) { Socket socket = null; try { socket = new Socket(); socket.connect(new InetSocketAddress(ip, port), timeout); return socket.isConnected() && !socket.isClosed(); } catch (Exception e) { return false; } finally { IOUtils.closeQuietly(socket); } }
[ "public", "static", "boolean", "canTelnet", "(", "String", "ip", ",", "int", "port", ",", "int", "timeout", ")", "{", "Socket", "socket", "=", "null", ";", "try", "{", "socket", "=", "new", "Socket", "(", ")", ";", "socket", ".", "connect", "(", "new...
是否可以telnet @param ip 远程地址 @param port 远程端口 @param timeout 连接超时 @return 是否可连接
[ "是否可以telnet" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/common/utils/NetUtils.java#L486-L497
tropo/tropo-webapi-java
src/main/java/com/voxeo/tropo/Key.java
Key.JOIN_PROMPT
public static Key JOIN_PROMPT(String value, Voice voice) { Map<String, String> map = new HashMap<String, String>(); map.put("value", value); if (voice != null) { map.put("voice", voice.toString()); } return createKey("joinPrompt", map); }
java
public static Key JOIN_PROMPT(String value, Voice voice) { Map<String, String> map = new HashMap<String, String>(); map.put("value", value); if (voice != null) { map.put("voice", voice.toString()); } return createKey("joinPrompt", map); }
[ "public", "static", "Key", "JOIN_PROMPT", "(", "String", "value", ",", "Voice", "voice", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "\"...
Defines a prompt that plays to all participants of a conference when someone joins the conference.It's possible to define either TTS or an audio URL using additional attributes value and voice @param value value is used to play simple TTS and/or an audio URL, and supports SSML @param voice voice is used to define which of the available voices should be used for TTS; if voice is left undefined, the default voice will be used @return
[ "Defines", "a", "prompt", "that", "plays", "to", "all", "participants", "of", "a", "conference", "when", "someone", "joins", "the", "conference", ".", "It", "s", "possible", "to", "define", "either", "TTS", "or", "an", "audio", "URL", "using", "additional", ...
train
https://github.com/tropo/tropo-webapi-java/blob/96af1fa292c1d4b6321d85a559d9718d33eec7e0/src/main/java/com/voxeo/tropo/Key.java#L421-L430
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_task_GET
public ArrayList<Long> serviceName_task_GET(String serviceName, OvhTaskActionEnum action, Date creationDate_from, Date creationDate_to, Date doneDate_from, Date doneDate_to, OvhTaskStatusEnum status) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/task"; StringBuilder sb = path(qPath, serviceName); query(sb, "action", action); query(sb, "creationDate.from", creationDate_from); query(sb, "creationDate.to", creationDate_to); query(sb, "doneDate.from", doneDate_from); query(sb, "doneDate.to", doneDate_to); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> serviceName_task_GET(String serviceName, OvhTaskActionEnum action, Date creationDate_from, Date creationDate_to, Date doneDate_from, Date doneDate_to, OvhTaskStatusEnum status) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/task"; StringBuilder sb = path(qPath, serviceName); query(sb, "action", action); query(sb, "creationDate.from", creationDate_from); query(sb, "creationDate.to", creationDate_to); query(sb, "doneDate.from", doneDate_from); query(sb, "doneDate.to", doneDate_to); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_task_GET", "(", "String", "serviceName", ",", "OvhTaskActionEnum", "action", ",", "Date", "creationDate_from", ",", "Date", "creationDate_to", ",", "Date", "doneDate_from", ",", "Date", "doneDate_to", ",", "OvhTa...
Task for this iplb REST: GET /ipLoadbalancing/{serviceName}/task @param doneDate_to [required] Filter the value of doneDate property (<=) @param doneDate_from [required] Filter the value of doneDate property (>=) @param action [required] Filter the value of action property (=) @param creationDate_to [required] Filter the value of creationDate property (<=) @param creationDate_from [required] Filter the value of creationDate property (>=) @param status [required] Filter the value of status property (=) @param serviceName [required] The internal name of your IP load balancing
[ "Task", "for", "this", "iplb" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1068-L1079
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/color/ColorYuv.java
ColorYuv.rgbToYCbCr
public static void rgbToYCbCr( int r , int g , int b , byte yuv[] ) { // multiply coefficients in book by 1024, which is 2^10 yuv[0] = (byte)((( 187*r + 629*g + 63*b ) >> 10) + 16); yuv[1] = (byte)(((-103*r - 346*g + 450*b) >> 10) + 128); yuv[2] = (byte)((( 450*r - 409*g - 41*b ) >> 10) + 128); }
java
public static void rgbToYCbCr( int r , int g , int b , byte yuv[] ) { // multiply coefficients in book by 1024, which is 2^10 yuv[0] = (byte)((( 187*r + 629*g + 63*b ) >> 10) + 16); yuv[1] = (byte)(((-103*r - 346*g + 450*b) >> 10) + 128); yuv[2] = (byte)((( 450*r - 409*g - 41*b ) >> 10) + 128); }
[ "public", "static", "void", "rgbToYCbCr", "(", "int", "r", ",", "int", "g", ",", "int", "b", ",", "byte", "yuv", "[", "]", ")", "{", "// multiply coefficients in book by 1024, which is 2^10", "yuv", "[", "0", "]", "=", "(", "byte", ")", "(", "(", "(", ...
Conversion from RGB to YCbCr. See [Jack07]. @param r Red [0 to 255] @param g Green [0 to 255] @param b Blue [0 to 255]
[ "Conversion", "from", "RGB", "to", "YCbCr", ".", "See", "[", "Jack07", "]", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/color/ColorYuv.java#L104-L109
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.setAction
public void setAction(PdfAction action, float llx, float lly, float urx, float ury) { pdf.setAction(action, llx, lly, urx, ury); }
java
public void setAction(PdfAction action, float llx, float lly, float urx, float ury) { pdf.setAction(action, llx, lly, urx, ury); }
[ "public", "void", "setAction", "(", "PdfAction", "action", ",", "float", "llx", ",", "float", "lly", ",", "float", "urx", ",", "float", "ury", ")", "{", "pdf", ".", "setAction", "(", "action", ",", "llx", ",", "lly", ",", "urx", ",", "ury", ")", ";...
Implements an action in an area. @param action the <CODE>PdfAction</CODE> @param llx the lower left x corner of the activation area @param lly the lower left y corner of the activation area @param urx the upper right x corner of the activation area @param ury the upper right y corner of the activation area
[ "Implements", "an", "action", "in", "an", "area", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2616-L2618
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/OverlapResolver.java
OverlapResolver.getBondOverlapScore
public double getBondOverlapScore(IAtomContainer ac, Vector overlappingBonds) { overlappingBonds.removeAllElements(); double overlapScore = 0; IBond bond1 = null; IBond bond2 = null; double bondLength = GeometryUtil.getBondLengthAverage(ac);; double overlapCutoff = bondLength / 2; for (int f = 0; f < ac.getBondCount(); f++) { bond1 = ac.getBond(f); for (int g = f; g < ac.getBondCount(); g++) { bond2 = ac.getBond(g); /* bonds must not be connected */ if (!bond1.isConnectedTo(bond2)) { if (areIntersected(bond1, bond2)) { overlapScore += overlapCutoff; overlappingBonds.addElement(new OverlapPair(bond1, bond2)); } } } } return overlapScore; }
java
public double getBondOverlapScore(IAtomContainer ac, Vector overlappingBonds) { overlappingBonds.removeAllElements(); double overlapScore = 0; IBond bond1 = null; IBond bond2 = null; double bondLength = GeometryUtil.getBondLengthAverage(ac);; double overlapCutoff = bondLength / 2; for (int f = 0; f < ac.getBondCount(); f++) { bond1 = ac.getBond(f); for (int g = f; g < ac.getBondCount(); g++) { bond2 = ac.getBond(g); /* bonds must not be connected */ if (!bond1.isConnectedTo(bond2)) { if (areIntersected(bond1, bond2)) { overlapScore += overlapCutoff; overlappingBonds.addElement(new OverlapPair(bond1, bond2)); } } } } return overlapScore; }
[ "public", "double", "getBondOverlapScore", "(", "IAtomContainer", "ac", ",", "Vector", "overlappingBonds", ")", "{", "overlappingBonds", ".", "removeAllElements", "(", ")", ";", "double", "overlapScore", "=", "0", ";", "IBond", "bond1", "=", "null", ";", "IBond"...
Calculates a score based on the intersection of bonds. @param ac The Atomcontainer to work on @param overlappingBonds Description of the Parameter @return The overlapScore value
[ "Calculates", "a", "score", "based", "on", "the", "intersection", "of", "bonds", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/OverlapResolver.java#L215-L236
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.createSibling
public CmsResource createSibling(String source, String destination, List<CmsProperty> properties) throws CmsException { CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION); return getResourceType(resource).createSibling(this, m_securityManager, resource, destination, properties); }
java
public CmsResource createSibling(String source, String destination, List<CmsProperty> properties) throws CmsException { CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION); return getResourceType(resource).createSibling(this, m_securityManager, resource, destination, properties); }
[ "public", "CmsResource", "createSibling", "(", "String", "source", ",", "String", "destination", ",", "List", "<", "CmsProperty", ">", "properties", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "readResource", "(", "source", ",", "CmsResourc...
Creates a new sibling of the source resource.<p> @param source the name of the resource to create a sibling for with complete path @param destination the name of the sibling to create with complete path @param properties the individual properties for the new sibling @return the new created sibling @throws CmsException if something goes wrong
[ "Creates", "a", "new", "sibling", "of", "the", "source", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L865-L870
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java
ResourceUtils.getRawResourceFrom
public static AbstractResource getRawResourceFrom(final String location) throws IOException { if (StringUtils.isBlank(location)) { throw new IllegalArgumentException("Provided location does not exist and is empty"); } if (location.toLowerCase().startsWith(HTTP_URL_PREFIX)) { return new UrlResource(location); } if (location.toLowerCase().startsWith(CLASSPATH_URL_PREFIX)) { return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length())); } return new FileSystemResource(StringUtils.remove(location, FILE_URL_PREFIX)); }
java
public static AbstractResource getRawResourceFrom(final String location) throws IOException { if (StringUtils.isBlank(location)) { throw new IllegalArgumentException("Provided location does not exist and is empty"); } if (location.toLowerCase().startsWith(HTTP_URL_PREFIX)) { return new UrlResource(location); } if (location.toLowerCase().startsWith(CLASSPATH_URL_PREFIX)) { return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length())); } return new FileSystemResource(StringUtils.remove(location, FILE_URL_PREFIX)); }
[ "public", "static", "AbstractResource", "getRawResourceFrom", "(", "final", "String", "location", ")", "throws", "IOException", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "location", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Provi...
Gets resource from a String location. @param location the metadata location @return the resource from @throws IOException the exception
[ "Gets", "resource", "from", "a", "String", "location", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java#L48-L59
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
WicketUrlExtensions.getPageUrl
public static Url getPageUrl(final Page page, final PageParameters parameters) { return getPageUrl(page.getPageClass(), parameters); }
java
public static Url getPageUrl(final Page page, final PageParameters parameters) { return getPageUrl(page.getPageClass(), parameters); }
[ "public", "static", "Url", "getPageUrl", "(", "final", "Page", "page", ",", "final", "PageParameters", "parameters", ")", "{", "return", "getPageUrl", "(", "page", ".", "getPageClass", "(", ")", ",", "parameters", ")", ";", "}" ]
Gets the page url. @param page the page @param parameters the parameters @return the page url
[ "Gets", "the", "page", "url", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L308-L311
ralscha/extclassgenerator
src/main/java/ch/rasc/extclassgenerator/ModelGenerator.java
ModelGenerator.generateJavascript
public static String generateJavascript(Class<?> clazz, OutputFormat format, boolean debug) { OutputConfig outputConfig = new OutputConfig(); outputConfig.setIncludeValidation(IncludeValidation.NONE); outputConfig.setOutputFormat(format); outputConfig.setDebug(debug); ModelBean model = createModel(clazz, outputConfig); return generateJavascript(model, outputConfig); }
java
public static String generateJavascript(Class<?> clazz, OutputFormat format, boolean debug) { OutputConfig outputConfig = new OutputConfig(); outputConfig.setIncludeValidation(IncludeValidation.NONE); outputConfig.setOutputFormat(format); outputConfig.setDebug(debug); ModelBean model = createModel(clazz, outputConfig); return generateJavascript(model, outputConfig); }
[ "public", "static", "String", "generateJavascript", "(", "Class", "<", "?", ">", "clazz", ",", "OutputFormat", "format", ",", "boolean", "debug", ")", "{", "OutputConfig", "outputConfig", "=", "new", "OutputConfig", "(", ")", ";", "outputConfig", ".", "setIncl...
Instrospects the provided class, creates a model object (JS code) and returns it. This method does not add any validation configuration. @param clazz class that the generator should introspect @param format specifies which code (ExtJS or Touch) the generator should create @param debug if true the generator creates the output in pretty format, false the output is compressed @return the generated model object (JS code)
[ "Instrospects", "the", "provided", "class", "creates", "a", "model", "object", "(", "JS", "code", ")", "and", "returns", "it", ".", "This", "method", "does", "not", "add", "any", "validation", "configuration", "." ]
train
https://github.com/ralscha/extclassgenerator/blob/6f106cf5ca83ef004225a3512e2291dfd028cf07/src/main/java/ch/rasc/extclassgenerator/ModelGenerator.java#L229-L238
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java
CacheOnDisk.readTemplatesByRange
public ValueSet readTemplatesByRange(int index, int length) { Result result = htod.readTemplatesByRange(index, length); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); this.htod.returnToResultPool(result); return HTODDynacache.EMPTY_VS; } ValueSet valueSet = (ValueSet) result.data; if (valueSet == null) { valueSet = HTODDynacache.EMPTY_VS; } this.htod.returnToResultPool(result); return valueSet; }
java
public ValueSet readTemplatesByRange(int index, int length) { Result result = htod.readTemplatesByRange(index, length); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); this.htod.returnToResultPool(result); return HTODDynacache.EMPTY_VS; } ValueSet valueSet = (ValueSet) result.data; if (valueSet == null) { valueSet = HTODDynacache.EMPTY_VS; } this.htod.returnToResultPool(result); return valueSet; }
[ "public", "ValueSet", "readTemplatesByRange", "(", "int", "index", ",", "int", "length", ")", "{", "Result", "result", "=", "htod", ".", "readTemplatesByRange", "(", "index", ",", "length", ")", ";", "if", "(", "result", ".", "returnCode", "==", "HTODDynacac...
Call this method to get the template ids based on the index and the length from the disk. @param index If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous". @param length The max number of templates to be read. If length = -1, it reads all templates until the end. @return valueSet - the collection of templates.
[ "Call", "this", "method", "to", "get", "the", "template", "ids", "based", "on", "the", "index", "and", "the", "length", "from", "the", "disk", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1409-L1422
code4everything/util
src/main/java/com/zhazhapan/util/BeanUtils.java
BeanUtils.bean2Another
public static <T> T bean2Another(Object object, Class<T> clazz) throws IllegalAccessException, InstantiationException, InvocationTargetException { return bean2Another(object, clazz, clazz.newInstance()); }
java
public static <T> T bean2Another(Object object, Class<T> clazz) throws IllegalAccessException, InstantiationException, InvocationTargetException { return bean2Another(object, clazz, clazz.newInstance()); }
[ "public", "static", "<", "T", ">", "T", "bean2Another", "(", "Object", "object", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "IllegalAccessException", ",", "InstantiationException", ",", "InvocationTargetException", "{", "return", "bean2Another", "(", "...
将一个Bean的数据装换到另外一个(需实现setter和getter,以及一个默认无参构造函数) @param object 一个Bean @param clazz 另外一个Bean @param <T> 另外Bean类型 @return {@link T} @throws InstantiationException 异常 @throws IllegalAccessException 异常 @throws InvocationTargetException 异常 @since 1.1.1
[ "将一个Bean的数据装换到另外一个(需实现setter和getter,以及一个默认无参构造函数)" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/BeanUtils.java#L63-L66
code4everything/util
src/main/java/com/zhazhapan/util/FileExecutor.java
FileExecutor.copyDirectories
public static void copyDirectories(File[] directories, String storageFolder) throws IOException { storageFolder = checkFolder(storageFolder) + ValueConsts.SEPARATOR; for (File directory : directories) { copyDirectory(directory, new File(storageFolder + directory.getName())); } }
java
public static void copyDirectories(File[] directories, String storageFolder) throws IOException { storageFolder = checkFolder(storageFolder) + ValueConsts.SEPARATOR; for (File directory : directories) { copyDirectory(directory, new File(storageFolder + directory.getName())); } }
[ "public", "static", "void", "copyDirectories", "(", "File", "[", "]", "directories", ",", "String", "storageFolder", ")", "throws", "IOException", "{", "storageFolder", "=", "checkFolder", "(", "storageFolder", ")", "+", "ValueConsts", ".", "SEPARATOR", ";", "fo...
批量复制文件夹 @param directories 文件夹数组 @param storageFolder 存储目录 @throws IOException 异常
[ "批量复制文件夹" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L394-L399
telly/groundy
library/src/main/java/com/telly/groundy/GroundyTaskFactory.java
GroundyTaskFactory.get
static GroundyTask get(Class<? extends GroundyTask> taskClass, Context context) { if (CACHE.containsKey(taskClass)) { return CACHE.get(taskClass); } GroundyTask groundyTask = null; try { L.d(TAG, "Instantiating " + taskClass); Constructor ctc = taskClass.getConstructor(); groundyTask = (GroundyTask) ctc.newInstance(); if (groundyTask.canBeCached()) { CACHE.put(taskClass, groundyTask); } else if (CACHE.containsKey(taskClass)) { CACHE.remove(taskClass); } groundyTask.setContext(context); groundyTask.onCreate(); return groundyTask; } catch (Exception e) { L.e(TAG, "Unable to create value for call " + taskClass, e); } return groundyTask; }
java
static GroundyTask get(Class<? extends GroundyTask> taskClass, Context context) { if (CACHE.containsKey(taskClass)) { return CACHE.get(taskClass); } GroundyTask groundyTask = null; try { L.d(TAG, "Instantiating " + taskClass); Constructor ctc = taskClass.getConstructor(); groundyTask = (GroundyTask) ctc.newInstance(); if (groundyTask.canBeCached()) { CACHE.put(taskClass, groundyTask); } else if (CACHE.containsKey(taskClass)) { CACHE.remove(taskClass); } groundyTask.setContext(context); groundyTask.onCreate(); return groundyTask; } catch (Exception e) { L.e(TAG, "Unable to create value for call " + taskClass, e); } return groundyTask; }
[ "static", "GroundyTask", "get", "(", "Class", "<", "?", "extends", "GroundyTask", ">", "taskClass", ",", "Context", "context", ")", "{", "if", "(", "CACHE", ".", "containsKey", "(", "taskClass", ")", ")", "{", "return", "CACHE", ".", "get", "(", "taskCla...
Builds a GroundyTask based on call. @param taskClass groundy value implementation class @param context used to instantiate the value @return An instance of a GroundyTask if a given call is valid null otherwise
[ "Builds", "a", "GroundyTask", "based", "on", "call", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/GroundyTaskFactory.java#L47-L68
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.registerApplePushKit
@ObjectiveCName("registerApplePushKitWithApnsId:withToken:") public void registerApplePushKit(int apnsId, String token) { modules.getPushesModule().registerApplePushKit(apnsId, token); }
java
@ObjectiveCName("registerApplePushKitWithApnsId:withToken:") public void registerApplePushKit(int apnsId, String token) { modules.getPushesModule().registerApplePushKit(apnsId, token); }
[ "@", "ObjectiveCName", "(", "\"registerApplePushKitWithApnsId:withToken:\"", ")", "public", "void", "registerApplePushKit", "(", "int", "apnsId", ",", "String", "token", ")", "{", "modules", ".", "getPushesModule", "(", ")", ".", "registerApplePushKit", "(", "apnsId",...
Register apple push kit tokens @param apnsId internal APNS cert key @param token APNS token
[ "Register", "apple", "push", "kit", "tokens" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L2699-L2702
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java
AbstractProfileProfileAligner.setQuery
public void setQuery(Profile<S, C> query) { this.query = query; queryFuture = null; reset(); }
java
public void setQuery(Profile<S, C> query) { this.query = query; queryFuture = null; reset(); }
[ "public", "void", "setQuery", "(", "Profile", "<", "S", ",", "C", ">", "query", ")", "{", "this", ".", "query", "=", "query", ";", "queryFuture", "=", "null", ";", "reset", "(", ")", ";", "}" ]
Sets the query {@link Profile}. @param query the first {@link Profile} of the pair to align
[ "Sets", "the", "query", "{", "@link", "Profile", "}", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java#L143-L147
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/parser/JSONParser.java
JSONParser.parse
public <T> T parse(InputStream in, JsonReaderI<T> mapper) throws ParseException, UnsupportedEncodingException { return getPBinStream().parse(in, mapper); }
java
public <T> T parse(InputStream in, JsonReaderI<T> mapper) throws ParseException, UnsupportedEncodingException { return getPBinStream().parse(in, mapper); }
[ "public", "<", "T", ">", "T", "parse", "(", "InputStream", "in", ",", "JsonReaderI", "<", "T", ">", "mapper", ")", "throws", "ParseException", ",", "UnsupportedEncodingException", "{", "return", "getPBinStream", "(", ")", ".", "parse", "(", "in", ",", "map...
use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory
[ "use", "to", "return", "Primitive", "Type", "or", "String", "Or", "JsonObject", "or", "JsonArray", "generated", "by", "a", "ContainerFactory" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParser.java#L222-L224
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.beginRedeployAsync
public Observable<OperationStatusResponseInner> beginRedeployAsync(String resourceGroupName, String vmName) { return beginRedeployWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> beginRedeployAsync(String resourceGroupName, String vmName) { return beginRedeployWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "beginRedeployAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ")", "{", "return", "beginRedeployWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ")", ".", "map", "(...
The operation to redeploy a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object
[ "The", "operation", "to", "redeploy", "a", "virtual", "machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L2407-L2414
flow/commons
src/main/java/com/flowpowered/commons/LogicUtil.java
LogicUtil.equalsAny
public static <A, B> boolean equalsAny(A object, B... objects) { for (B o : objects) { if (bothNullOrEqual(o, object)) { return true; } } return false; }
java
public static <A, B> boolean equalsAny(A object, B... objects) { for (B o : objects) { if (bothNullOrEqual(o, object)) { return true; } } return false; }
[ "public", "static", "<", "A", ",", "B", ">", "boolean", "equalsAny", "(", "A", "object", ",", "B", "...", "objects", ")", "{", "for", "(", "B", "o", ":", "objects", ")", "{", "if", "(", "bothNullOrEqual", "(", "o", ",", "object", ")", ")", "{", ...
Checks if the object equals one of the other objects given @param object to check @param objects to use equals against @return True if one of the objects equal the object
[ "Checks", "if", "the", "object", "equals", "one", "of", "the", "other", "objects", "given" ]
train
https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/LogicUtil.java#L58-L65
vkostyukov/la4j
src/main/java/org/la4j/Vectors.java
Vectors.asMulFunction
public static VectorFunction asMulFunction(final double arg) { return new VectorFunction() { @Override public double evaluate(int i, double value) { return value * arg; } }; }
java
public static VectorFunction asMulFunction(final double arg) { return new VectorFunction() { @Override public double evaluate(int i, double value) { return value * arg; } }; }
[ "public", "static", "VectorFunction", "asMulFunction", "(", "final", "double", "arg", ")", "{", "return", "new", "VectorFunction", "(", ")", "{", "@", "Override", "public", "double", "evaluate", "(", "int", "i", ",", "double", "value", ")", "{", "return", ...
Creates a mul function that multiplies given {@code value} by it's argument. @param arg a value to be multiplied by function's argument @return a closure that does {@code _ * _}
[ "Creates", "a", "mul", "function", "that", "multiplies", "given", "{", "@code", "value", "}", "by", "it", "s", "argument", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L186-L193
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java
base_resource.add_resource
protected base_resource[] add_resource(nitro_service service, options option) throws Exception { if (!service.isLogin() && !get_object_type().equals("login")) service.login(); String request = resource_to_string(service, option); return post_data(service, request); }
java
protected base_resource[] add_resource(nitro_service service, options option) throws Exception { if (!service.isLogin() && !get_object_type().equals("login")) service.login(); String request = resource_to_string(service, option); return post_data(service, request); }
[ "protected", "base_resource", "[", "]", "add_resource", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "if", "(", "!", "service", ".", "isLogin", "(", ")", "&&", "!", "get_object_type", "(", ")", ".", "equals", ...
Use this method to perform a add operation on MPS resource. @param service nitro_service object. @param option options class object. @return status of the operation performed. @throws Exception
[ "Use", "this", "method", "to", "perform", "a", "add", "operation", "on", "MPS", "resource", "." ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L216-L223
Azure/azure-sdk-for-java
common/azure-common-auth/src/main/java/com/azure/common/auth/credentials/DelegatedTokenCredentials.java
DelegatedTokenCredentials.fromFile
public static DelegatedTokenCredentials fromFile(File authFile, String redirectUrl) throws IOException { return new DelegatedTokenCredentials(ApplicationTokenCredentials.fromFile(authFile), redirectUrl); }
java
public static DelegatedTokenCredentials fromFile(File authFile, String redirectUrl) throws IOException { return new DelegatedTokenCredentials(ApplicationTokenCredentials.fromFile(authFile), redirectUrl); }
[ "public", "static", "DelegatedTokenCredentials", "fromFile", "(", "File", "authFile", ",", "String", "redirectUrl", ")", "throws", "IOException", "{", "return", "new", "DelegatedTokenCredentials", "(", "ApplicationTokenCredentials", ".", "fromFile", "(", "authFile", ")"...
Creates a new instance of the DelegatedTokenCredentials from an auth file. @param authFile The credentials based on the file @param redirectUrl the URL to redirect to after authentication in Active Directory @return a new delegated token credentials @throws IOException exception thrown from file access errors.
[ "Creates", "a", "new", "instance", "of", "the", "DelegatedTokenCredentials", "from", "an", "auth", "file", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common-auth/src/main/java/com/azure/common/auth/credentials/DelegatedTokenCredentials.java#L73-L75
elki-project/elki
elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java
GeneratorXMLDatabaseConnection.processElementGamma
private void processElementGamma(GeneratorSingleCluster cluster, Node cur) { double k = 1.0; double theta = 1.0; String kstr = ((Element) cur).getAttribute(ATTR_K); if(kstr != null && kstr.length() > 0) { k = ParseUtil.parseDouble(kstr); } String thetastr = ((Element) cur).getAttribute(ATTR_THETA); if(thetastr != null && thetastr.length() > 0) { theta = ParseUtil.parseDouble(thetastr); } // *** New normal distribution generator Random random = cluster.getNewRandomGenerator(); Distribution generator = new GammaDistribution(k, theta, random); cluster.addGenerator(generator); // TODO: check for unknown attributes. XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild()); while(iter.hasNext()) { Node child = iter.next(); if(child.getNodeType() == Node.ELEMENT_NODE) { LOG.warning("Unknown element in XML specification file: " + child.getNodeName()); } } }
java
private void processElementGamma(GeneratorSingleCluster cluster, Node cur) { double k = 1.0; double theta = 1.0; String kstr = ((Element) cur).getAttribute(ATTR_K); if(kstr != null && kstr.length() > 0) { k = ParseUtil.parseDouble(kstr); } String thetastr = ((Element) cur).getAttribute(ATTR_THETA); if(thetastr != null && thetastr.length() > 0) { theta = ParseUtil.parseDouble(thetastr); } // *** New normal distribution generator Random random = cluster.getNewRandomGenerator(); Distribution generator = new GammaDistribution(k, theta, random); cluster.addGenerator(generator); // TODO: check for unknown attributes. XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild()); while(iter.hasNext()) { Node child = iter.next(); if(child.getNodeType() == Node.ELEMENT_NODE) { LOG.warning("Unknown element in XML specification file: " + child.getNodeName()); } } }
[ "private", "void", "processElementGamma", "(", "GeneratorSingleCluster", "cluster", ",", "Node", "cur", ")", "{", "double", "k", "=", "1.0", ";", "double", "theta", "=", "1.0", ";", "String", "kstr", "=", "(", "(", "Element", ")", "cur", ")", ".", "getAt...
Process a 'gamma' Element in the XML stream. @param cluster @param cur Current document nod
[ "Process", "a", "gamma", "Element", "in", "the", "XML", "stream", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java#L459-L484
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.checksAttributesExistence
private XML checksAttributesExistence(Class<?> aClass,String[] attributes){ if(!classExists(aClass)) Error.xmlClassInexistent(this.xmlPath,aClass); for (String attributeName : attributes) try{ aClass.getDeclaredField(attributeName); } catch (Exception e){ Error.attributeInexistent(attributeName, aClass);} return this; }
java
private XML checksAttributesExistence(Class<?> aClass,String[] attributes){ if(!classExists(aClass)) Error.xmlClassInexistent(this.xmlPath,aClass); for (String attributeName : attributes) try{ aClass.getDeclaredField(attributeName); } catch (Exception e){ Error.attributeInexistent(attributeName, aClass);} return this; }
[ "private", "XML", "checksAttributesExistence", "(", "Class", "<", "?", ">", "aClass", ",", "String", "[", "]", "attributes", ")", "{", "if", "(", "!", "classExists", "(", "aClass", ")", ")", "Error", ".", "xmlClassInexistent", "(", "this", ".", "xmlPath", ...
Verifies that the attributes exist in aClass. @param aClass Class to check @param attributes list of the names attributes to check. @return this instance of XML
[ "Verifies", "that", "the", "attributes", "exist", "in", "aClass", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L421-L427
twitter/finagle
finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ZooKeeperClient.java
ZooKeeperClient.digestCredentials
public static Credentials digestCredentials(String username, String password) { MorePreconditions.checkNotBlank(username); Objects.requireNonNull(password); // TODO(John Sirois): DigestAuthenticationProvider is broken - uses platform default charset // (on server) and so we just have to hope here that clients are deployed in compatible jvms. // Consider writing and installing a version of DigestAuthenticationProvider that controls its // Charset explicitly. return credentials("digest", (username + ":" + password).getBytes()); }
java
public static Credentials digestCredentials(String username, String password) { MorePreconditions.checkNotBlank(username); Objects.requireNonNull(password); // TODO(John Sirois): DigestAuthenticationProvider is broken - uses platform default charset // (on server) and so we just have to hope here that clients are deployed in compatible jvms. // Consider writing and installing a version of DigestAuthenticationProvider that controls its // Charset explicitly. return credentials("digest", (username + ":" + password).getBytes()); }
[ "public", "static", "Credentials", "digestCredentials", "(", "String", "username", ",", "String", "password", ")", "{", "MorePreconditions", ".", "checkNotBlank", "(", "username", ")", ";", "Objects", ".", "requireNonNull", "(", "password", ")", ";", "// TODO(John...
Creates a set of credentials for the zoo keeper digest authentication mechanism. @param username the username to authenticate with @param password the password to authenticate with @return a set of credentials that can be used to authenticate the zoo keeper client
[ "Creates", "a", "set", "of", "credentials", "for", "the", "zoo", "keeper", "digest", "authentication", "mechanism", "." ]
train
https://github.com/twitter/finagle/blob/872be5f2b147fa50351bdbf08b003a26745e1df8/finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ZooKeeperClient.java#L121-L130
datacleaner/AnalyzerBeans
core/src/main/java/org/eobjects/analyzer/util/convert/ResourceConverter.java
ResourceConverter.parseStructure
public ResourceStructure parseStructure(String str) { Matcher matcher = RESOURCE_PATTERN.matcher(str); if (!matcher.find()) { logger.info("Did not find any scheme definition in resource path: {}. Using default scheme: {}.", str, _defaultScheme); return new ResourceStructure(_defaultScheme, str); } String scheme = matcher.group(1); String path = matcher.group(2); return new ResourceStructure(scheme, path); }
java
public ResourceStructure parseStructure(String str) { Matcher matcher = RESOURCE_PATTERN.matcher(str); if (!matcher.find()) { logger.info("Did not find any scheme definition in resource path: {}. Using default scheme: {}.", str, _defaultScheme); return new ResourceStructure(_defaultScheme, str); } String scheme = matcher.group(1); String path = matcher.group(2); return new ResourceStructure(scheme, path); }
[ "public", "ResourceStructure", "parseStructure", "(", "String", "str", ")", "{", "Matcher", "matcher", "=", "RESOURCE_PATTERN", ".", "matcher", "(", "str", ")", ";", "if", "(", "!", "matcher", ".", "find", "(", ")", ")", "{", "logger", ".", "info", "(", ...
Parses a string in order to produce a {@link ResourceStructure} object @param str @return
[ "Parses", "a", "string", "in", "order", "to", "produce", "a", "{", "@link", "ResourceStructure", "}", "object" ]
train
https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/util/convert/ResourceConverter.java#L161-L171
paymill/paymill-java
src/main/java/com/paymill/services/TransactionService.java
TransactionService.createWithPayment
public Transaction createWithPayment( Payment payment, Integer amount, String currency ) { return this.createWithPayment( payment, amount, currency, null ); }
java
public Transaction createWithPayment( Payment payment, Integer amount, String currency ) { return this.createWithPayment( payment, amount, currency, null ); }
[ "public", "Transaction", "createWithPayment", "(", "Payment", "payment", ",", "Integer", "amount", ",", "String", "currency", ")", "{", "return", "this", ".", "createWithPayment", "(", "payment", ",", "amount", ",", "currency", ",", "null", ")", ";", "}" ]
Executes a {@link Transaction} with {@link Payment} for the given amount in the given currency. @param payment A PAYMILL {@link Payment} representing credit card or direct debit. @param amount Amount (in cents) which will be charged. @param currency ISO 4217 formatted currency code. @return {@link Transaction} object indicating whether a the call was successful or not.
[ "Executes", "a", "{" ]
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L193-L195
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.isCase
public static boolean isCase(Pattern caseValue, Object switchValue) { if (switchValue == null) { return caseValue == null; } final Matcher matcher = caseValue.matcher(switchValue.toString()); if (matcher.matches()) { RegexSupport.setLastMatcher(matcher); return true; } else { return false; } }
java
public static boolean isCase(Pattern caseValue, Object switchValue) { if (switchValue == null) { return caseValue == null; } final Matcher matcher = caseValue.matcher(switchValue.toString()); if (matcher.matches()) { RegexSupport.setLastMatcher(matcher); return true; } else { return false; } }
[ "public", "static", "boolean", "isCase", "(", "Pattern", "caseValue", ",", "Object", "switchValue", ")", "{", "if", "(", "switchValue", "==", "null", ")", "{", "return", "caseValue", "==", "null", ";", "}", "final", "Matcher", "matcher", "=", "caseValue", ...
'Case' implementation for the {@link java.util.regex.Pattern} class, which allows testing a String against a number of regular expressions. For example: <pre>switch( str ) { case ~/one/ : // the regex 'one' matches the value of str } </pre> Note that this returns true for the case where both the pattern and the 'switch' values are <code>null</code>. @param caseValue the case value @param switchValue the switch value @return true if the switchValue is deemed to match the caseValue @since 1.0
[ "Case", "implementation", "for", "the", "{", "@link", "java", ".", "util", ".", "regex", ".", "Pattern", "}", "class", "which", "allows", "testing", "a", "String", "against", "a", "number", "of", "regular", "expressions", ".", "For", "example", ":", "<pre"...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1700-L1711
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByCompanyName
public Iterable<DContact> queryByCompanyName(Object parent, java.lang.String companyName) { return queryByField(parent, DContactMapper.Field.COMPANYNAME.getFieldName(), companyName); }
java
public Iterable<DContact> queryByCompanyName(Object parent, java.lang.String companyName) { return queryByField(parent, DContactMapper.Field.COMPANYNAME.getFieldName(), companyName); }
[ "public", "Iterable", "<", "DContact", ">", "queryByCompanyName", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "companyName", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "COMPANYNAME", ".", ...
query-by method for field companyName @param companyName the specified attribute @return an Iterable of DContacts for the specified companyName
[ "query", "-", "by", "method", "for", "field", "companyName" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L115-L117
sargue/mailgun
src/main/java/net/sargue/mailgun/MailBuilder.java
MailBuilder.from
public MailBuilder from(String name, String email) { return param("from", email(name, email)); }
java
public MailBuilder from(String name, String email) { return param("from", email(name, email)); }
[ "public", "MailBuilder", "from", "(", "String", "name", ",", "String", "email", ")", "{", "return", "param", "(", "\"from\"", ",", "email", "(", "name", ",", "email", ")", ")", ";", "}" ]
Sets the address of the sender. @param name the name of the sender @param email the address of the sender @return this builder
[ "Sets", "the", "address", "of", "the", "sender", "." ]
train
https://github.com/sargue/mailgun/blob/2ffb0a156f3f3666eb1bb2db661451b9377c3d11/src/main/java/net/sargue/mailgun/MailBuilder.java#L82-L84
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java
CmsPositionBean.avoidCollision
public static void avoidCollision(CmsPositionBean posA, CmsPositionBean posB, int margin) { Direction dir = null; int diff = 0; int diffTemp = (posB.getLeft() + posB.getWidth()) - posA.getLeft(); if (diffTemp > -margin) { dir = Direction.left; diff = diffTemp; } diffTemp = (posA.getLeft() + posA.getWidth()) - posB.getLeft(); if ((diffTemp > -margin) && (diffTemp < diff)) { dir = Direction.right; diff = diffTemp; } diffTemp = (posB.getTop() + posB.getHeight()) - posA.getTop(); if ((diffTemp > -margin) && (diffTemp < diff)) { dir = Direction.top; diff = diffTemp; } diffTemp = (posA.getTop() + posA.getHeight()) - posB.getTop(); if ((diffTemp > -margin) && (diffTemp < diff)) { dir = Direction.bottom; diff = diffTemp; } diff = (int)Math.ceil((1.0 * (diff + margin)) / 2); if (dir != null) { switch (dir) { case left: // move the left border of a posA.setLeft(posA.getLeft() + diff); posA.setWidth(posA.getWidth() - diff); // move the right border of b posB.setWidth(posB.getWidth() - diff); break; case right: // move the left border of b posB.setLeft(posB.getLeft() + diff); posB.setWidth(posB.getWidth() - diff); // move the right border of a posA.setWidth(posA.getWidth() - diff); break; case top: posA.setTop(posA.getTop() + diff); posA.setHeight(posA.getHeight() - diff); posB.setHeight(posB.getHeight() - diff); break; case bottom: posB.setTop(posB.getTop() + diff); posB.setHeight(posB.getHeight() - diff); posA.setHeight(posA.getHeight() - diff); break; default: // nothing to do } } }
java
public static void avoidCollision(CmsPositionBean posA, CmsPositionBean posB, int margin) { Direction dir = null; int diff = 0; int diffTemp = (posB.getLeft() + posB.getWidth()) - posA.getLeft(); if (diffTemp > -margin) { dir = Direction.left; diff = diffTemp; } diffTemp = (posA.getLeft() + posA.getWidth()) - posB.getLeft(); if ((diffTemp > -margin) && (diffTemp < diff)) { dir = Direction.right; diff = diffTemp; } diffTemp = (posB.getTop() + posB.getHeight()) - posA.getTop(); if ((diffTemp > -margin) && (diffTemp < diff)) { dir = Direction.top; diff = diffTemp; } diffTemp = (posA.getTop() + posA.getHeight()) - posB.getTop(); if ((diffTemp > -margin) && (diffTemp < diff)) { dir = Direction.bottom; diff = diffTemp; } diff = (int)Math.ceil((1.0 * (diff + margin)) / 2); if (dir != null) { switch (dir) { case left: // move the left border of a posA.setLeft(posA.getLeft() + diff); posA.setWidth(posA.getWidth() - diff); // move the right border of b posB.setWidth(posB.getWidth() - diff); break; case right: // move the left border of b posB.setLeft(posB.getLeft() + diff); posB.setWidth(posB.getWidth() - diff); // move the right border of a posA.setWidth(posA.getWidth() - diff); break; case top: posA.setTop(posA.getTop() + diff); posA.setHeight(posA.getHeight() - diff); posB.setHeight(posB.getHeight() - diff); break; case bottom: posB.setTop(posB.getTop() + diff); posB.setHeight(posB.getHeight() - diff); posA.setHeight(posA.getHeight() - diff); break; default: // nothing to do } } }
[ "public", "static", "void", "avoidCollision", "(", "CmsPositionBean", "posA", ",", "CmsPositionBean", "posB", ",", "int", "margin", ")", "{", "Direction", "dir", "=", "null", ";", "int", "diff", "=", "0", ";", "int", "diffTemp", "=", "(", "posB", ".", "g...
Manipulates the position infos to ensure a minimum margin between the rectangles.<p> @param posA the first position to check @param posB the second position to check @param margin the required margin
[ "Manipulates", "the", "position", "infos", "to", "ensure", "a", "minimum", "margin", "between", "the", "rectangles", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java#L132-L195
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java
DateControl.setEntryFactory
public final void setEntryFactory(Callback<CreateEntryParameter, Entry<?>> factory) { Objects.requireNonNull(factory); entryFactoryProperty().set(factory); }
java
public final void setEntryFactory(Callback<CreateEntryParameter, Entry<?>> factory) { Objects.requireNonNull(factory); entryFactoryProperty().set(factory); }
[ "public", "final", "void", "setEntryFactory", "(", "Callback", "<", "CreateEntryParameter", ",", "Entry", "<", "?", ">", ">", "factory", ")", "{", "Objects", ".", "requireNonNull", "(", "factory", ")", ";", "entryFactoryProperty", "(", ")", ".", "set", "(", ...
Sets the value of {@link #entryFactoryProperty()}. @param factory the factory used for creating a new entry
[ "Sets", "the", "value", "of", "{", "@link", "#entryFactoryProperty", "()", "}", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java#L879-L882
Azure/azure-sdk-for-java
resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceGroupsInner.java
ResourceGroupsInner.exportTemplate
public ResourceGroupExportResultInner exportTemplate(String resourceGroupName, ExportTemplateRequest parameters) { return exportTemplateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); }
java
public ResourceGroupExportResultInner exportTemplate(String resourceGroupName, ExportTemplateRequest parameters) { return exportTemplateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); }
[ "public", "ResourceGroupExportResultInner", "exportTemplate", "(", "String", "resourceGroupName", ",", "ExportTemplateRequest", "parameters", ")", "{", "return", "exportTemplateWithServiceResponseAsync", "(", "resourceGroupName", ",", "parameters", ")", ".", "toBlocking", "("...
Captures the specified resource group as a template. @param resourceGroupName The name of the resource group to export as a template. @param parameters Parameters for exporting the template. @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 ResourceGroupExportResultInner object if successful.
[ "Captures", "the", "specified", "resource", "group", "as", "a", "template", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceGroupsInner.java#L851-L853
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java
Grid.getCellBounds
@Pure public Rectangle2d getCellBounds(int row, int column) { final double cellWidth = getCellWidth(); final double cellHeight = getCellHeight(); final double x = this.bounds.getMinX() + cellWidth * column; final double y = this.bounds.getMinY() + cellHeight * row; return new Rectangle2d(x, y, cellWidth, cellHeight); }
java
@Pure public Rectangle2d getCellBounds(int row, int column) { final double cellWidth = getCellWidth(); final double cellHeight = getCellHeight(); final double x = this.bounds.getMinX() + cellWidth * column; final double y = this.bounds.getMinY() + cellHeight * row; return new Rectangle2d(x, y, cellWidth, cellHeight); }
[ "@", "Pure", "public", "Rectangle2d", "getCellBounds", "(", "int", "row", ",", "int", "column", ")", "{", "final", "double", "cellWidth", "=", "getCellWidth", "(", ")", ";", "final", "double", "cellHeight", "=", "getCellHeight", "(", ")", ";", "final", "do...
Replies the bounds covered by a cell at the specified location. @param row the row index. @param column the column index. @return the bounds.
[ "Replies", "the", "bounds", "covered", "by", "a", "cell", "at", "the", "specified", "location", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java#L152-L159
google/closure-templates
java/src/com/google/template/soy/data/SoyListData.java
SoyListData.putSingle
@Override public void putSingle(String key, SoyData value) { set(Integer.parseInt(key), value); }
java
@Override public void putSingle(String key, SoyData value) { set(Integer.parseInt(key), value); }
[ "@", "Override", "public", "void", "putSingle", "(", "String", "key", ",", "SoyData", "value", ")", "{", "set", "(", "Integer", ".", "parseInt", "(", "key", ")", ",", "value", ")", ";", "}" ]
Important: Do not use outside of Soy code (treat as superpackage-private). <p>Puts data into this data object at the specified key. @param key An individual key. @param value The data to put at the specified key.
[ "Important", ":", "Do", "not", "use", "outside", "of", "Soy", "code", "(", "treat", "as", "superpackage", "-", "private", ")", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SoyListData.java#L399-L402
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/beans/PropertyChangeSupport.java
PropertyChangeSupport.firePropertyChange
public void firePropertyChange(String propertyName, int oldValue, int newValue) { if (oldValue != newValue) { firePropertyChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue)); } }
java
public void firePropertyChange(String propertyName, int oldValue, int newValue) { if (oldValue != newValue) { firePropertyChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue)); } }
[ "public", "void", "firePropertyChange", "(", "String", "propertyName", ",", "int", "oldValue", ",", "int", "newValue", ")", "{", "if", "(", "oldValue", "!=", "newValue", ")", "{", "firePropertyChange", "(", "propertyName", ",", "Integer", ".", "valueOf", "(", ...
Reports an integer bound property update to listeners that have been registered to track updates of all properties or a property with the specified name. <p> No event is fired if old and new values are equal. <p> This is merely a convenience wrapper around the more general {@link #firePropertyChange(String, Object, Object)} method. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property @param newValue the new value of the property
[ "Reports", "an", "integer", "bound", "property", "update", "to", "listeners", "that", "have", "been", "registered", "to", "track", "updates", "of", "all", "properties", "or", "a", "property", "with", "the", "specified", "name", ".", "<p", ">", "No", "event",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/beans/PropertyChangeSupport.java#L281-L285
jtrfp/javamod
src/main/java/de/quippy/javamod/main/gui/MainForm.java
MainForm.createFileFilter
private void createFileFilter() { HashMap<String, String[]> extensionMap = MultimediaContainerManager.getSupportedFileExtensionsPerContainer(); ArrayList<FileFilter> chooserFilterArray = new ArrayList<FileFilter>(extensionMap.size() + 1); // add all single file extensions grouped by container Set<String> containerNameSet = extensionMap.keySet(); Iterator<String> containerNameIterator = containerNameSet.iterator(); while (containerNameIterator.hasNext()) { String containerName = containerNameIterator.next(); String [] extensions = extensionMap.get(containerName); StringBuilder fileText = new StringBuilder(containerName); fileText.append(" ("); int ende = extensions.length-1; for (int i=0; i<=ende; i++) { fileText.append("*.").append(extensions[i]); if (i<ende) fileText.append(", "); } fileText.append(')'); chooserFilterArray.add(new FileChooserFilter(extensions, fileText.toString())); } // now add playlist as group of files chooserFilterArray.add(PlayList.PLAYLIST_FILE_FILTER); // now add all playable files at the last step (container extensions and playlist files) String [] containerExtensions = MultimediaContainerManager.getSupportedFileExtensions(); String [] fullSupportedExtensions = new String[containerExtensions.length + PlayList.SUPPORTEDPLAYLISTS.length]; System.arraycopy(PlayList.SUPPORTEDPLAYLISTS, 0, fullSupportedExtensions, 0, PlayList.SUPPORTEDPLAYLISTS.length); System.arraycopy(containerExtensions, 0, fullSupportedExtensions, PlayList.SUPPORTEDPLAYLISTS.length, containerExtensions.length); chooserFilterArray.add(new FileChooserFilter(fullSupportedExtensions, "All playable files")); // add default "all files" - WE DO NOT DO THAT ANYMORE ;) // chooserFilterArray.add(new FileChooserFilter("*", "All files")); fileFilterLoad = new FileFilter[chooserFilterArray.size()]; chooserFilterArray.toArray(fileFilterLoad); fileFilterExport = new FileFilter[1]; fileFilterExport[0] = new FileChooserFilter(javax.sound.sampled.AudioFileFormat.Type.WAVE.getExtension(), javax.sound.sampled.AudioFileFormat.Type.WAVE.toString()); }
java
private void createFileFilter() { HashMap<String, String[]> extensionMap = MultimediaContainerManager.getSupportedFileExtensionsPerContainer(); ArrayList<FileFilter> chooserFilterArray = new ArrayList<FileFilter>(extensionMap.size() + 1); // add all single file extensions grouped by container Set<String> containerNameSet = extensionMap.keySet(); Iterator<String> containerNameIterator = containerNameSet.iterator(); while (containerNameIterator.hasNext()) { String containerName = containerNameIterator.next(); String [] extensions = extensionMap.get(containerName); StringBuilder fileText = new StringBuilder(containerName); fileText.append(" ("); int ende = extensions.length-1; for (int i=0; i<=ende; i++) { fileText.append("*.").append(extensions[i]); if (i<ende) fileText.append(", "); } fileText.append(')'); chooserFilterArray.add(new FileChooserFilter(extensions, fileText.toString())); } // now add playlist as group of files chooserFilterArray.add(PlayList.PLAYLIST_FILE_FILTER); // now add all playable files at the last step (container extensions and playlist files) String [] containerExtensions = MultimediaContainerManager.getSupportedFileExtensions(); String [] fullSupportedExtensions = new String[containerExtensions.length + PlayList.SUPPORTEDPLAYLISTS.length]; System.arraycopy(PlayList.SUPPORTEDPLAYLISTS, 0, fullSupportedExtensions, 0, PlayList.SUPPORTEDPLAYLISTS.length); System.arraycopy(containerExtensions, 0, fullSupportedExtensions, PlayList.SUPPORTEDPLAYLISTS.length, containerExtensions.length); chooserFilterArray.add(new FileChooserFilter(fullSupportedExtensions, "All playable files")); // add default "all files" - WE DO NOT DO THAT ANYMORE ;) // chooserFilterArray.add(new FileChooserFilter("*", "All files")); fileFilterLoad = new FileFilter[chooserFilterArray.size()]; chooserFilterArray.toArray(fileFilterLoad); fileFilterExport = new FileFilter[1]; fileFilterExport[0] = new FileChooserFilter(javax.sound.sampled.AudioFileFormat.Type.WAVE.getExtension(), javax.sound.sampled.AudioFileFormat.Type.WAVE.toString()); }
[ "private", "void", "createFileFilter", "(", ")", "{", "HashMap", "<", "String", ",", "String", "[", "]", ">", "extensionMap", "=", "MultimediaContainerManager", ".", "getSupportedFileExtensionsPerContainer", "(", ")", ";", "ArrayList", "<", "FileFilter", ">", "cho...
Create the file filters so that we do have them for the dialogs @since 05.01.2008
[ "Create", "the", "file", "filters", "so", "that", "we", "do", "have", "them", "for", "the", "dialogs" ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L548-L589
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java
FieldListener.syncClonedListener
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) listener.init(null); listener.setRespondsToMode(DBConstants.INIT_MOVE, m_bInitMove); listener.setRespondsToMode(DBConstants.READ_MOVE, m_bReadMove); listener.setRespondsToMode(DBConstants.SCREEN_MOVE, m_bScreenMove); return true; }
java
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) listener.init(null); listener.setRespondsToMode(DBConstants.INIT_MOVE, m_bInitMove); listener.setRespondsToMode(DBConstants.READ_MOVE, m_bReadMove); listener.setRespondsToMode(DBConstants.SCREEN_MOVE, m_bScreenMove); return true; }
[ "public", "boolean", "syncClonedListener", "(", "BaseField", "field", ",", "FieldListener", "listener", ",", "boolean", "bInitCalled", ")", "{", "if", "(", "!", "bInitCalled", ")", "listener", ".", "init", "(", "null", ")", ";", "listener", ".", "setRespondsTo...
Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init.
[ "Set", "this", "cloned", "listener", "to", "the", "same", "state", "at", "this", "listener", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java#L117-L125
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_request_POST
public OvhTask serviceName_request_POST(String serviceName, OvhRequestActionEnum action) throws IOException { String qPath = "/hosting/web/{serviceName}/request"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_request_POST(String serviceName, OvhRequestActionEnum action) throws IOException { String qPath = "/hosting/web/{serviceName}/request"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_request_POST", "(", "String", "serviceName", ",", "OvhRequestActionEnum", "action", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/request\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPat...
Request specific operation for your hosting REST: POST /hosting/web/{serviceName}/request @param action [required] Action you want to request @param serviceName [required] The internal name of your hosting
[ "Request", "specific", "operation", "for", "your", "hosting" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L737-L744
alkacon/opencms-core
src/org/opencms/ade/galleries/CmsPreviewService.java
CmsPreviewService.readResourceFromCurrentOrRootSite
private CmsResource readResourceFromCurrentOrRootSite(CmsObject cms, String name) throws CmsException { CmsResource resource = null; try { resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION); } catch (CmsVfsResourceNotFoundException e) { String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION); } finally { cms.getRequestContext().setSiteRoot(originalSiteRoot); } } return resource; }
java
private CmsResource readResourceFromCurrentOrRootSite(CmsObject cms, String name) throws CmsException { CmsResource resource = null; try { resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION); } catch (CmsVfsResourceNotFoundException e) { String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION); } finally { cms.getRequestContext().setSiteRoot(originalSiteRoot); } } return resource; }
[ "private", "CmsResource", "readResourceFromCurrentOrRootSite", "(", "CmsObject", "cms", ",", "String", "name", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "null", ";", "try", "{", "resource", "=", "cms", ".", "readResource", "(", "name", ...
Tries to read a resource either from the current site or from the root site.<p> @param cms the CMS context to use @param name the resource path @return the resource which was read @throws CmsException if something goes wrong
[ "Tries", "to", "read", "a", "resource", "either", "from", "the", "current", "site", "or", "from", "the", "root", "site", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsPreviewService.java#L382-L398
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java
URLMatchingUtils.performUrlMatch
static String performUrlMatch(String uri, Collection<String> urlPatterns) { String match = null; String longestUrlPattern = null; for (String urlPattern : urlPatterns) { if (URLMatchingUtils.isExactMatch(uri, urlPattern)) { return urlPattern; } else if (URLMatchingUtils.isPathNameMatch(uri, urlPattern)) { longestUrlPattern = URLMatchingUtils.getLongestUrlPattern(longestUrlPattern, urlPattern); } else if (URLMatchingUtils.isExtensionMatch(uri, urlPattern)) { match = urlPattern; } } if (longestUrlPattern != null) { match = longestUrlPattern; } return match; }
java
static String performUrlMatch(String uri, Collection<String> urlPatterns) { String match = null; String longestUrlPattern = null; for (String urlPattern : urlPatterns) { if (URLMatchingUtils.isExactMatch(uri, urlPattern)) { return urlPattern; } else if (URLMatchingUtils.isPathNameMatch(uri, urlPattern)) { longestUrlPattern = URLMatchingUtils.getLongestUrlPattern(longestUrlPattern, urlPattern); } else if (URLMatchingUtils.isExtensionMatch(uri, urlPattern)) { match = urlPattern; } } if (longestUrlPattern != null) { match = longestUrlPattern; } return match; }
[ "static", "String", "performUrlMatch", "(", "String", "uri", ",", "Collection", "<", "String", ">", "urlPatterns", ")", "{", "String", "match", "=", "null", ";", "String", "longestUrlPattern", "=", "null", ";", "for", "(", "String", "urlPattern", ":", "urlPa...
Gets the match for the resource name. <pre> To perform a URL match, 1. For each URL pattern determine if the resource matches it 2. Construct the match object Exact match has first priority. The longest path match has second priority. The extension match has last priority. </pre> @param uriName @return
[ "Gets", "the", "match", "for", "the", "resource", "name", ".", "<pre", ">", "To", "perform", "a", "URL", "match", "1", ".", "For", "each", "URL", "pattern", "determine", "if", "the", "resource", "matches", "it", "2", ".", "Construct", "the", "match", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java#L49-L65
facebookarchive/hadoop-20
src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatOutputStream.java
SimpleSeekableFormatOutputStream.flush
@Override public void flush() throws IOException { // Do not do anything if no data has been written if (currentDataSegmentBuffer.size() == 0) { return; } // Create the current DataSegment DataSegmentWriter currentDataSegment = new DataSegmentWriter(currentDataSegmentBuffer, codec, codecCompressor); // Update the metadata updateMetadata(currentDataSegmentBuffer.size(), currentDataSegment.size()); // Write out the DataSegment currentDataSegment.writeTo(dataSegmentDataOut); // Clear out the current buffer. Note that this has to be done after // currentDataSegment.writeTo(...), because currentDataSegment can // keep a reference to the currentDataSegmentBuffer. currentDataSegmentBuffer.reset(); // Flush out the underlying stream dataSegmentDataOut.flush(); }
java
@Override public void flush() throws IOException { // Do not do anything if no data has been written if (currentDataSegmentBuffer.size() == 0) { return; } // Create the current DataSegment DataSegmentWriter currentDataSegment = new DataSegmentWriter(currentDataSegmentBuffer, codec, codecCompressor); // Update the metadata updateMetadata(currentDataSegmentBuffer.size(), currentDataSegment.size()); // Write out the DataSegment currentDataSegment.writeTo(dataSegmentDataOut); // Clear out the current buffer. Note that this has to be done after // currentDataSegment.writeTo(...), because currentDataSegment can // keep a reference to the currentDataSegmentBuffer. currentDataSegmentBuffer.reset(); // Flush out the underlying stream dataSegmentDataOut.flush(); }
[ "@", "Override", "public", "void", "flush", "(", ")", "throws", "IOException", "{", "// Do not do anything if no data has been written", "if", "(", "currentDataSegmentBuffer", ".", "size", "(", ")", "==", "0", ")", "{", "return", ";", "}", "// Create the current Dat...
Take the current data segment, optionally compress it, calculate the crc32, and then write it out. The method sets the lastOffsets to the end of the file before it starts writing. That means the offsets in the MetaDataBlock will be after the end of the current data block.
[ "Take", "the", "current", "data", "segment", "optionally", "compress", "it", "calculate", "the", "crc32", "and", "then", "write", "it", "out", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatOutputStream.java#L151-L176
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/GenericCollectionTypeResolver.java
GenericCollectionTypeResolver.getGenericParameterType
private static Class getGenericParameterType(MethodParameter methodParam, int typeIndex) { return toClass(extractType(methodParam, getTargetType(methodParam), typeIndex, methodParam.getNestingLevel())); }
java
private static Class getGenericParameterType(MethodParameter methodParam, int typeIndex) { return toClass(extractType(methodParam, getTargetType(methodParam), typeIndex, methodParam.getNestingLevel())); }
[ "private", "static", "Class", "getGenericParameterType", "(", "MethodParameter", "methodParam", ",", "int", "typeIndex", ")", "{", "return", "toClass", "(", "extractType", "(", "methodParam", ",", "getTargetType", "(", "methodParam", ")", ",", "typeIndex", ",", "m...
Extract the generic parameter type from the given method or constructor. @param methodParam the method parameter specification @param typeIndex the index of the type (e.g. 0 for Collections, 0 for Map keys, 1 for Map values) @return the generic type, or <code>null</code> if none
[ "Extract", "the", "generic", "parameter", "type", "from", "the", "given", "method", "or", "constructor", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/GenericCollectionTypeResolver.java#L261-L263
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java
SparkStorageUtils.saveMapFileSequences
public static void saveMapFileSequences(String path, JavaRDD<List<List<Writable>>> rdd) { saveMapFileSequences(path, rdd, DEFAULT_MAP_FILE_INTERVAL, null); }
java
public static void saveMapFileSequences(String path, JavaRDD<List<List<Writable>>> rdd) { saveMapFileSequences(path, rdd, DEFAULT_MAP_FILE_INTERVAL, null); }
[ "public", "static", "void", "saveMapFileSequences", "(", "String", "path", ",", "JavaRDD", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "rdd", ")", "{", "saveMapFileSequences", "(", "path", ",", "rdd", ",", "DEFAULT_MAP_FILE_INTERVAL", ",", "nul...
Save a {@code JavaRDD<List<List<Writable>>>} to a Hadoop {@link org.apache.hadoop.io.MapFile}. Each record is given a <i>unique and contiguous</i> {@link LongWritable} key, and values are stored as {@link SequenceRecordWritable} instances.<br> <b>Note 1</b>: If contiguous keys are not required, using a sequence file instead is preferable from a performance point of view. Contiguous keys are often only required for non-Spark use cases, such as with {@link org.datavec.hadoop.records.reader.mapfile.MapFileSequenceRecordReader}<br> <b>Note 2</b>: This use a MapFile interval of {@link #DEFAULT_MAP_FILE_INTERVAL}, which is usually suitable for use cases such as {@link org.datavec.hadoop.records.reader.mapfile.MapFileSequenceRecordReader}. Use {@link #saveMapFileSequences(String, JavaRDD, int, Integer)} or {@link #saveMapFileSequences(String, JavaRDD, Configuration, Integer)} to customize this. <br> <p> Use {@link #restoreMapFileSequences(String, JavaSparkContext)} to restore values saved with this method. @param path Path to save the MapFile @param rdd RDD to save @see #saveMapFileSequences(String, JavaRDD) @see #saveSequenceFile(String, JavaRDD)
[ "Save", "a", "{", "@code", "JavaRDD<List<List<Writable", ">>>", "}", "to", "a", "Hadoop", "{", "@link", "org", ".", "apache", ".", "hadoop", ".", "io", ".", "MapFile", "}", ".", "Each", "record", "is", "given", "a", "<i", ">", "unique", "and", "contigu...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java#L288-L290
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java
CollationElementIterator.setText
public void setText(String source) { string_ = source; // TODO: do we need to remember the source string in a field? CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new UTF16CollationIterator(rbc_.data, numeric, string_, 0); } else { newIter = new FCDUTF16CollationIterator(rbc_.data, numeric, string_, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
java
public void setText(String source) { string_ = source; // TODO: do we need to remember the source string in a field? CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new UTF16CollationIterator(rbc_.data, numeric, string_, 0); } else { newIter = new FCDUTF16CollationIterator(rbc_.data, numeric, string_, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
[ "public", "void", "setText", "(", "String", "source", ")", "{", "string_", "=", "source", ";", "// TODO: do we need to remember the source string in a field?", "CollationIterator", "newIter", ";", "boolean", "numeric", "=", "rbc_", ".", "settings", ".", "readOnly", "(...
Set a new source string for iteration, and reset the offset to the beginning of the text. @param source the new source string for iteration.
[ "Set", "a", "new", "source", "string", "for", "iteration", "and", "reset", "the", "offset", "to", "the", "beginning", "of", "the", "text", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java#L492-L504
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/LibraryLoader.java
LibraryLoader.loadPlatformDependentLibrary
public static void loadPlatformDependentLibrary(String path, String libname) throws IOException { loadPlatformDependentLibrary(libname, null, path); }
java
public static void loadPlatformDependentLibrary(String path, String libname) throws IOException { loadPlatformDependentLibrary(libname, null, path); }
[ "public", "static", "void", "loadPlatformDependentLibrary", "(", "String", "path", ",", "String", "libname", ")", "throws", "IOException", "{", "loadPlatformDependentLibrary", "(", "libname", ",", "null", ",", "path", ")", ";", "}" ]
Search and load the dynamic library which is fitting the current operating system (32 or 64bits operating system...). A 64 bits library is assumed to be named <code>libname64.dll</code> on Windows&reg; and <code>liblibname64.so</code> on Unix. A 32 bits library is assumed to be named <code>libname32.dll</code> on Windows&reg; and <code>liblibname32.so</code> on Unix. A library which could be ran either on 32 and 64 platforms is assumed to be named <code>libname.dll</code> on Windows&reg; and <code>liblibname.so</code> on Unix. @param path is the resource's path where the library was located. @param libname is the name of the library. @throws IOException when reading error occurs. @throws SecurityException if a security manager exists and its <code>checkLink</code> method doesn't allow loading of the specified dynamic library @throws UnsatisfiedLinkError if the file does not exist. @throws NullPointerException if <code>filename</code> is <code>null</code> @see java.lang.System#load(java.lang.String)
[ "Search", "and", "load", "the", "dynamic", "library", "which", "is", "fitting", "the", "current", "operating", "system", "(", "32", "or", "64bits", "operating", "system", "...", ")", ".", "A", "64", "bits", "library", "is", "assumed", "to", "be", "named", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/LibraryLoader.java#L388-L390
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.putLogoutRequests
public static void putLogoutRequests(final RequestContext context, final List<SingleLogoutRequest> requests) { context.getFlowScope().put(PARAMETER_LOGOUT_REQUESTS, requests); }
java
public static void putLogoutRequests(final RequestContext context, final List<SingleLogoutRequest> requests) { context.getFlowScope().put(PARAMETER_LOGOUT_REQUESTS, requests); }
[ "public", "static", "void", "putLogoutRequests", "(", "final", "RequestContext", "context", ",", "final", "List", "<", "SingleLogoutRequest", ">", "requests", ")", "{", "context", ".", "getFlowScope", "(", ")", ".", "put", "(", "PARAMETER_LOGOUT_REQUESTS", ",", ...
Put logout requests into flow scope. @param context the context @param requests the requests
[ "Put", "logout", "requests", "into", "flow", "scope", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L269-L271
deephacks/confit
api-model/src/main/java/org/deephacks/confit/model/Bean.java
Bean.setProperty
public void setProperty(final String propertyName, final List<String> values) { Preconditions.checkNotNull(propertyName); if (values == null) { properties.put(propertyName, null); return; } properties.put(propertyName, values); }
java
public void setProperty(final String propertyName, final List<String> values) { Preconditions.checkNotNull(propertyName); if (values == null) { properties.put(propertyName, null); return; } properties.put(propertyName, values); }
[ "public", "void", "setProperty", "(", "final", "String", "propertyName", ",", "final", "List", "<", "String", ">", "values", ")", "{", "Preconditions", ".", "checkNotNull", "(", "propertyName", ")", ";", "if", "(", "values", "==", "null", ")", "{", "proper...
Overwrite/replace the current values with the provided values. @param propertyName name of the property as defined by the bean's schema. @param values final String representations of the property that conforms to its type as defined by the bean's schema.
[ "Overwrite", "/", "replace", "the", "current", "values", "with", "the", "provided", "values", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/model/Bean.java#L201-L208
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java
StructureIO.getBiologicalAssembly
public static Structure getBiologicalAssembly(String pdbId, boolean multiModel) throws IOException, StructureException{ checkInitAtomCache(); pdbId = pdbId.toLowerCase(); Structure s = cache.getBiologicalAssembly(pdbId, multiModel); return s; }
java
public static Structure getBiologicalAssembly(String pdbId, boolean multiModel) throws IOException, StructureException{ checkInitAtomCache(); pdbId = pdbId.toLowerCase(); Structure s = cache.getBiologicalAssembly(pdbId, multiModel); return s; }
[ "public", "static", "Structure", "getBiologicalAssembly", "(", "String", "pdbId", ",", "boolean", "multiModel", ")", "throws", "IOException", ",", "StructureException", "{", "checkInitAtomCache", "(", ")", ";", "pdbId", "=", "pdbId", ".", "toLowerCase", "(", ")", ...
Returns the first biological assembly that is available for the given PDB id. <p> The output Structure will be different depending on the multiModel parameter: <li> the symmetry-expanded chains are added as new models, one per transformId. All original models but the first one are discarded. </li> <li> as original with symmetry-expanded chains added with renamed chain ids and names (in the form originalAsymId_transformId and originalAuthId_transformId) </li> <p> For more documentation on quaternary structures see: {@link http://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/biological-assemblies} @param pdbId @param multiModel if true the output Structure will be a multi-model one with one transformId per model, if false the outputStructure will be as the original with added chains with renamed asymIds (in the form originalAsymId_transformId and originalAuthId_transformId). @return a Structure object or null if that assembly is not available @throws StructureException @throws IOException
[ "Returns", "the", "first", "biological", "assembly", "that", "is", "available", "for", "the", "given", "PDB", "id", ".", "<p", ">", "The", "output", "Structure", "will", "be", "different", "depending", "on", "the", "multiModel", "parameter", ":", "<li", ">",...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java#L148-L157
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java
Mapping.getIdValue
public <V> V getIdValue(T instance, Class<V> valueClass) { return getColumnValue(instance, idFieldName, valueClass); }
java
public <V> V getIdValue(T instance, Class<V> valueClass) { return getColumnValue(instance, idFieldName, valueClass); }
[ "public", "<", "V", ">", "V", "getIdValue", "(", "T", "instance", ",", "Class", "<", "V", ">", "valueClass", ")", "{", "return", "getColumnValue", "(", "instance", ",", "idFieldName", ",", "valueClass", ")", ";", "}" ]
Return the value for the ID/Key column from the given instance @param instance the instance @param valueClass type of the value (must match the actual native type in the instance's class) @return value
[ "Return", "the", "value", "for", "the", "ID", "/", "Key", "column", "from", "the", "given", "instance" ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java#L163-L165
michaelliao/jsonstream
src/main/java/com/itranswarp/jsonstream/BeanObjectMapper.java
BeanObjectMapper.toSimpleValue
Object toSimpleValue(Class<?> genericType, Object element, TypeAdapters typeAdapters) { if (element == null) { return null; } log.info("Convert from " + element.getClass().getName() + " to " + genericType.getName()); if (genericType.isEnum() && (element instanceof String)) { @SuppressWarnings({ "unchecked", "rawtypes" }) Enum<?> enumValue = Enum.valueOf((Class<? extends Enum>) genericType, (String) element); return enumValue; } Converter converter = SIMPLE_VALUE_CONVERTERS.get(genericType.getName()); if (converter != null) { return converter.convert(element); } if ((element instanceof String) && (typeAdapters != null)) { TypeAdapter<?> adapter = typeAdapters.getTypeAdapter(genericType); if (adapter != null) { return adapter.deserialize((String) element); } } return element; }
java
Object toSimpleValue(Class<?> genericType, Object element, TypeAdapters typeAdapters) { if (element == null) { return null; } log.info("Convert from " + element.getClass().getName() + " to " + genericType.getName()); if (genericType.isEnum() && (element instanceof String)) { @SuppressWarnings({ "unchecked", "rawtypes" }) Enum<?> enumValue = Enum.valueOf((Class<? extends Enum>) genericType, (String) element); return enumValue; } Converter converter = SIMPLE_VALUE_CONVERTERS.get(genericType.getName()); if (converter != null) { return converter.convert(element); } if ((element instanceof String) && (typeAdapters != null)) { TypeAdapter<?> adapter = typeAdapters.getTypeAdapter(genericType); if (adapter != null) { return adapter.deserialize((String) element); } } return element; }
[ "Object", "toSimpleValue", "(", "Class", "<", "?", ">", "genericType", ",", "Object", "element", ",", "TypeAdapters", "typeAdapters", ")", "{", "if", "(", "element", "==", "null", ")", "{", "return", "null", ";", "}", "log", ".", "info", "(", "\"Convert ...
Convert a simple value object to specific type. e.g. Long to int, String to LocalDate. @param genericType Object type: int.class, String.class, Float.class, etc. @param element Value object. @return Converted object.
[ "Convert", "a", "simple", "value", "object", "to", "specific", "type", ".", "e", ".", "g", ".", "Long", "to", "int", "String", "to", "LocalDate", "." ]
train
https://github.com/michaelliao/jsonstream/blob/50adcff2e1293e655462eef5fc5f1b59277de514/src/main/java/com/itranswarp/jsonstream/BeanObjectMapper.java#L154-L175
JakeWharton/NineOldAndroids
library/src/com/nineoldandroids/view/ViewPropertyAnimatorPreHC.java
ViewPropertyAnimatorPreHC.animatePropertyBy
private void animatePropertyBy(int constantName, float byValue) { float fromValue = getValue(constantName); animatePropertyBy(constantName, fromValue, byValue); }
java
private void animatePropertyBy(int constantName, float byValue) { float fromValue = getValue(constantName); animatePropertyBy(constantName, fromValue, byValue); }
[ "private", "void", "animatePropertyBy", "(", "int", "constantName", ",", "float", "byValue", ")", "{", "float", "fromValue", "=", "getValue", "(", "constantName", ")", ";", "animatePropertyBy", "(", "constantName", ",", "fromValue", ",", "byValue", ")", ";", "...
Utility function, called by the various xBy(), yBy(), etc. methods. This method is just like animateProperty(), except the value is an offset from the property's current value, instead of an absolute "to" value. @param constantName The specifier for the property being animated @param byValue The amount by which the property will change
[ "Utility", "function", "called", "by", "the", "various", "xBy", "()", "yBy", "()", "etc", ".", "methods", ".", "This", "method", "is", "just", "like", "animateProperty", "()", "except", "the", "value", "is", "an", "offset", "from", "the", "property", "s", ...
train
https://github.com/JakeWharton/NineOldAndroids/blob/d582f0ec8e79013e9fa96c07986160b52e662e63/library/src/com/nineoldandroids/view/ViewPropertyAnimatorPreHC.java#L487-L490
wildfly/wildfly-core
elytron/src/main/java/org/wildfly/extension/elytron/ModifiableRealmDecorator.java
ModifiableRealmDecorator.getRealmIdentity
static ModifiableRealmIdentity getRealmIdentity(OperationContext context, String principalName) throws OperationFailedException { ModifiableSecurityRealm modifiableRealm = getModifiableSecurityRealm(context); ModifiableRealmIdentity realmIdentity = null; try { realmIdentity = modifiableRealm.getRealmIdentityForUpdate(new NamePrincipal(principalName)); if (!realmIdentity.exists()) { throw new OperationFailedException(ROOT_LOGGER.identityNotFound(principalName)); } return realmIdentity; } catch (RealmUnavailableException e) { throw ROOT_LOGGER.couldNotReadIdentity(principalName, e); } finally { if (realmIdentity != null) { realmIdentity.dispose(); } } }
java
static ModifiableRealmIdentity getRealmIdentity(OperationContext context, String principalName) throws OperationFailedException { ModifiableSecurityRealm modifiableRealm = getModifiableSecurityRealm(context); ModifiableRealmIdentity realmIdentity = null; try { realmIdentity = modifiableRealm.getRealmIdentityForUpdate(new NamePrincipal(principalName)); if (!realmIdentity.exists()) { throw new OperationFailedException(ROOT_LOGGER.identityNotFound(principalName)); } return realmIdentity; } catch (RealmUnavailableException e) { throw ROOT_LOGGER.couldNotReadIdentity(principalName, e); } finally { if (realmIdentity != null) { realmIdentity.dispose(); } } }
[ "static", "ModifiableRealmIdentity", "getRealmIdentity", "(", "OperationContext", "context", ",", "String", "principalName", ")", "throws", "OperationFailedException", "{", "ModifiableSecurityRealm", "modifiableRealm", "=", "getModifiableSecurityRealm", "(", "context", ")", "...
Try to obtain a {@link ModifiableRealmIdentity} based on the identity and {@link ModifiableSecurityRealm} associated with given {@link OperationContext}. @param context the current context @return the current identity @throws OperationFailedException if the identity does not exists or if any error occurs while obtaining it.
[ "Try", "to", "obtain", "a", "{", "@link", "ModifiableRealmIdentity", "}", "based", "on", "the", "identity", "and", "{", "@link", "ModifiableSecurityRealm", "}", "associated", "with", "given", "{", "@link", "OperationContext", "}", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/elytron/src/main/java/org/wildfly/extension/elytron/ModifiableRealmDecorator.java#L628-L646
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/CheckBoxMenuItemPainter.java
CheckBoxMenuItemPainter.paintCheckIconEnabledAndMouseOver
private void paintCheckIconEnabledAndMouseOver(Graphics2D g, int width, int height) { g.setPaint(iconSelectedMouseOver); g.drawRoundRect(0, 1, width-1, height-2, 4, 4); }
java
private void paintCheckIconEnabledAndMouseOver(Graphics2D g, int width, int height) { g.setPaint(iconSelectedMouseOver); g.drawRoundRect(0, 1, width-1, height-2, 4, 4); }
[ "private", "void", "paintCheckIconEnabledAndMouseOver", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "g", ".", "setPaint", "(", "iconSelectedMouseOver", ")", ";", "g", ".", "drawRoundRect", "(", "0", ",", "1", ",", "width", ...
Paint the check mark in mouse over state. @param g the Graphics2D context to paint with. @param width the width. @param height the height.
[ "Paint", "the", "check", "mark", "in", "mouse", "over", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/CheckBoxMenuItemPainter.java#L187-L190
PureSolTechnologies/graphs
graph/src/main/java/com/puresoltechnologies/graphs/graph/CycleAnalyzer.java
CycleAnalyzer.hasCycles
public static <V extends Vertex<V, E>, E extends Edge<V, E>> boolean hasCycles( Graph<V, E> graph, V startVertex, boolean directed) throws IllegalArgumentException { requireNonNull(graph, "The given start vertex is null"); requireNonNull(startVertex, "The given start vertex is null"); if (!graph.getVertices().contains(startVertex)) { throw new IllegalArgumentException("The given start vertex '" + startVertex + "' is not part of the given graph '" + graph + "'."); } return hasCycle(startVertex, new Stack<>(), new Stack<>(), new HashSet<V>(graph.getVertices()), directed); }
java
public static <V extends Vertex<V, E>, E extends Edge<V, E>> boolean hasCycles( Graph<V, E> graph, V startVertex, boolean directed) throws IllegalArgumentException { requireNonNull(graph, "The given start vertex is null"); requireNonNull(startVertex, "The given start vertex is null"); if (!graph.getVertices().contains(startVertex)) { throw new IllegalArgumentException("The given start vertex '" + startVertex + "' is not part of the given graph '" + graph + "'."); } return hasCycle(startVertex, new Stack<>(), new Stack<>(), new HashSet<V>(graph.getVertices()), directed); }
[ "public", "static", "<", "V", "extends", "Vertex", "<", "V", ",", "E", ">", ",", "E", "extends", "Edge", "<", "V", ",", "E", ">", ">", "boolean", "hasCycles", "(", "Graph", "<", "V", ",", "E", ">", "graph", ",", "V", "startVertex", ",", "boolean"...
This method searches a given {@link Graph} for cycles. This method is different to {@link #hasCycles(Graph, boolean)}, because here it is started at a dedicated vertex and only vertices are checked for cycles which are connected to this start vertex. If disconnected subgraphs exist, these are not checked. @param <V> is the actual vertex implementation. @param <E> is the actual edge implementation. @param graph is the {@link Graph} to be searched for cycles. @param startVertex is the {@link Vertex} to start from. This vertex has to be part of the given graph. @param directed is to be set to <code>true</code> is the graph is to be handled as an directed graph (The {@link Pair} result in {@link Edge#getVertices() is interpreted as startVertex and targetVertex}.). <code>false</code> is to be set otherwise. @return <code>true</code> is returned if a cycle was found. <code>false</code> is returned otherwise. @throws IllegalArgumentException is thrown in case the startVertex is not part of the graph or the graph of vertex are <code>null</code>.
[ "This", "method", "searches", "a", "given", "{", "@link", "Graph", "}", "for", "cycles", ".", "This", "method", "is", "different", "to", "{", "@link", "#hasCycles", "(", "Graph", "boolean", ")", "}", "because", "here", "it", "is", "started", "at", "a", ...
train
https://github.com/PureSolTechnologies/graphs/blob/35dbbd11ccaacbbc6321dcdcd4d31e9a1090d6f1/graph/src/main/java/com/puresoltechnologies/graphs/graph/CycleAnalyzer.java#L104-L116
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtp/sdp/SdpFactory.java
SdpFactory.buildSdp
public static SessionDescription buildSdp(boolean offer, String localAddress, String externalAddress, MediaChannel... channels) { // Session-level fields SessionDescription sd = new SessionDescription(); sd.setVersion(new VersionField((short) 0)); String originAddress = (externalAddress == null || externalAddress.isEmpty()) ? localAddress : externalAddress; sd.setOrigin(new OriginField("-", String.valueOf(System.currentTimeMillis()), "1", "IN", "IP4", originAddress)); sd.setSessionName(new SessionNameField("Mobicents Media Server")); sd.setConnection(new ConnectionField("IN", "IP4", originAddress)); sd.setTiming(new TimingField(0, 0)); // Media Descriptions boolean ice = false; for (MediaChannel channel : channels) { MediaDescriptionField md = buildMediaDescription(channel, offer); md.setSession(sd); sd.addMediaDescription(md); if(md.containsIce()) { // Fix session-level attribute sd.getConnection().setAddress(md.getConnection().getAddress()); ice = true; } } // Session-level ICE if(ice) { sd.setIceLite(new IceLiteAttribute()); } return sd; }
java
public static SessionDescription buildSdp(boolean offer, String localAddress, String externalAddress, MediaChannel... channels) { // Session-level fields SessionDescription sd = new SessionDescription(); sd.setVersion(new VersionField((short) 0)); String originAddress = (externalAddress == null || externalAddress.isEmpty()) ? localAddress : externalAddress; sd.setOrigin(new OriginField("-", String.valueOf(System.currentTimeMillis()), "1", "IN", "IP4", originAddress)); sd.setSessionName(new SessionNameField("Mobicents Media Server")); sd.setConnection(new ConnectionField("IN", "IP4", originAddress)); sd.setTiming(new TimingField(0, 0)); // Media Descriptions boolean ice = false; for (MediaChannel channel : channels) { MediaDescriptionField md = buildMediaDescription(channel, offer); md.setSession(sd); sd.addMediaDescription(md); if(md.containsIce()) { // Fix session-level attribute sd.getConnection().setAddress(md.getConnection().getAddress()); ice = true; } } // Session-level ICE if(ice) { sd.setIceLite(new IceLiteAttribute()); } return sd; }
[ "public", "static", "SessionDescription", "buildSdp", "(", "boolean", "offer", ",", "String", "localAddress", ",", "String", "externalAddress", ",", "MediaChannel", "...", "channels", ")", "{", "// Session-level fields", "SessionDescription", "sd", "=", "new", "Sessio...
Builds a Session Description object to be sent to a remote peer. @param offer if the SDP is for an answer or answer. @param localAddress The local address of the media server. @param externalAddress The public address of the media server. @param channels The media channels to be included in the session description. @return The Session Description object.
[ "Builds", "a", "Session", "Description", "object", "to", "be", "sent", "to", "a", "remote", "peer", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/sdp/SdpFactory.java#L68-L97