repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/interceptor/Interceptor.java | Interceptor.doInvoke | protected Object doInvoke(Object proxy, Method methodToBeInvoked, Object[] args)
throws Throwable
{
Method m =
getRealSubject().getClass().getMethod(
methodToBeInvoked.getName(),
methodToBeInvoked.getParameterTypes());
return m.invoke(getRealSubject(), args);
} | java | protected Object doInvoke(Object proxy, Method methodToBeInvoked, Object[] args)
throws Throwable
{
Method m =
getRealSubject().getClass().getMethod(
methodToBeInvoked.getName(),
methodToBeInvoked.getParameterTypes());
return m.invoke(getRealSubject(), args);
} | [
"protected",
"Object",
"doInvoke",
"(",
"Object",
"proxy",
",",
"Method",
"methodToBeInvoked",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"Method",
"m",
"=",
"getRealSubject",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(... | this method will be invoked after methodToBeInvoked is invoked | [
"this",
"method",
"will",
"be",
"invoked",
"after",
"methodToBeInvoked",
"is",
"invoked"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/interceptor/Interceptor.java#L62-L70 |
dita-ot/dita-ot | src/main/java/org/ditang/relaxng/defaults/OxygenRelaxNGSchemaReader.java | OxygenRelaxNGSchemaReader.wrapPattern2 | private static SchemaWrapper wrapPattern2(Pattern start, SchemaPatternBuilder spb, PropertyMap properties)
throws SAXException, IncorrectSchemaException {
if (properties.contains(RngProperty.FEASIBLE)) {
//Use a feasible transform
start = FeasibleTransform.transform(spb, start);
}
//Get properties for supported IDs
properties = AbstractSchema.filterProperties(properties, supportedPropertyIds);
Schema schema = new PatternSchema(spb, start, properties);
IdTypeMap idTypeMap = null;
if (spb.hasIdTypes() && properties.contains(RngProperty.CHECK_ID_IDREF)) {
//Check ID/IDREF
ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
idTypeMap = new IdTypeMapBuilder(eh, start).getIdTypeMap();
if (idTypeMap == null) {
throw new IncorrectSchemaException();
}
Schema idSchema;
if (properties.contains(RngProperty.FEASIBLE)) {
idSchema = new FeasibleIdTypeMapSchema(idTypeMap, properties);
} else {
idSchema = new IdTypeMapSchema(idTypeMap, properties);
}
schema = new CombineSchema(schema, idSchema, properties);
}
//Wrap the schema
SchemaWrapper sw = new SchemaWrapper(schema);
sw.setStart(start);
sw.setIdTypeMap(idTypeMap);
return sw;
} | java | private static SchemaWrapper wrapPattern2(Pattern start, SchemaPatternBuilder spb, PropertyMap properties)
throws SAXException, IncorrectSchemaException {
if (properties.contains(RngProperty.FEASIBLE)) {
//Use a feasible transform
start = FeasibleTransform.transform(spb, start);
}
//Get properties for supported IDs
properties = AbstractSchema.filterProperties(properties, supportedPropertyIds);
Schema schema = new PatternSchema(spb, start, properties);
IdTypeMap idTypeMap = null;
if (spb.hasIdTypes() && properties.contains(RngProperty.CHECK_ID_IDREF)) {
//Check ID/IDREF
ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
idTypeMap = new IdTypeMapBuilder(eh, start).getIdTypeMap();
if (idTypeMap == null) {
throw new IncorrectSchemaException();
}
Schema idSchema;
if (properties.contains(RngProperty.FEASIBLE)) {
idSchema = new FeasibleIdTypeMapSchema(idTypeMap, properties);
} else {
idSchema = new IdTypeMapSchema(idTypeMap, properties);
}
schema = new CombineSchema(schema, idSchema, properties);
}
//Wrap the schema
SchemaWrapper sw = new SchemaWrapper(schema);
sw.setStart(start);
sw.setIdTypeMap(idTypeMap);
return sw;
} | [
"private",
"static",
"SchemaWrapper",
"wrapPattern2",
"(",
"Pattern",
"start",
",",
"SchemaPatternBuilder",
"spb",
",",
"PropertyMap",
"properties",
")",
"throws",
"SAXException",
",",
"IncorrectSchemaException",
"{",
"if",
"(",
"properties",
".",
"contains",
"(",
"... | Make a schema wrapper.
@param start Start pattern.
@param spb The schema pattern builder.
@param properties The properties map.
@return The schema wrapper. | [
"Make",
"a",
"schema",
"wrapper",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/ditang/relaxng/defaults/OxygenRelaxNGSchemaReader.java#L174-L205 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutGatewayResponseRequest.java | PutGatewayResponseRequest.withResponseTemplates | public PutGatewayResponseRequest withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | java | public PutGatewayResponseRequest withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | [
"public",
"PutGatewayResponseRequest",
"withResponseTemplates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseTemplates",
")",
"{",
"setResponseTemplates",
"(",
"responseTemplates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
<p>
Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs.
</p>
</p>
@param responseTemplates
Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"<p",
">",
"Response",
"templates",
"of",
"the",
"<a",
">",
"GatewayResponse<",
"/",
"a",
">",
"as",
"a",
"string",
"-",
"to",
"-",
"string",
"map",
"of",
"key",
"-",
"value",
"pairs",
".",
"<",
"/",
"p",
">",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutGatewayResponseRequest.java#L597-L600 |
samskivert/samskivert | src/main/java/com/samskivert/util/DebugChords.java | DebugChords.registerHook | public static void registerHook (int modifierMask, int keyCode, Hook hook)
{
// store the hooks mapped by key code
ArrayList<Tuple<Integer,Hook>> list = _bindings.get(keyCode);
if (list == null) {
list = new ArrayList<Tuple<Integer,Hook>>();
_bindings.put(keyCode, list);
}
// append the hook and modifier mask to the list
list.add(new Tuple<Integer,Hook>(modifierMask, hook));
} | java | public static void registerHook (int modifierMask, int keyCode, Hook hook)
{
// store the hooks mapped by key code
ArrayList<Tuple<Integer,Hook>> list = _bindings.get(keyCode);
if (list == null) {
list = new ArrayList<Tuple<Integer,Hook>>();
_bindings.put(keyCode, list);
}
// append the hook and modifier mask to the list
list.add(new Tuple<Integer,Hook>(modifierMask, hook));
} | [
"public",
"static",
"void",
"registerHook",
"(",
"int",
"modifierMask",
",",
"int",
"keyCode",
",",
"Hook",
"hook",
")",
"{",
"// store the hooks mapped by key code",
"ArrayList",
"<",
"Tuple",
"<",
"Integer",
",",
"Hook",
">",
">",
"list",
"=",
"_bindings",
"... | Registers the supplied debug hook to be invoked when the specified
key combination is depressed.
@param modifierMask a mask with bits on for all modifiers that must
be present when the specified key code is received (e.g. {@link
KeyEvent#CTRL_DOWN_MASK}|{@link KeyEvent#ALT_DOWN_MASK}).
@param keyCode the code that identifies the normal key that must be
pressed to activate the hook (e.g. {@link KeyEvent#VK_E}).
@param hook the hook to be invoked when the specified key
combination is received. | [
"Registers",
"the",
"supplied",
"debug",
"hook",
"to",
"be",
"invoked",
"when",
"the",
"specified",
"key",
"combination",
"is",
"depressed",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/DebugChords.java#L72-L83 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java | ConcurrentCommonCache.doWithReadLock | private <R> R doWithReadLock(Action<K, V, R> action) {
readLock.lock();
try {
return action.doWith(commonCache);
} finally {
readLock.unlock();
}
} | java | private <R> R doWithReadLock(Action<K, V, R> action) {
readLock.lock();
try {
return action.doWith(commonCache);
} finally {
readLock.unlock();
}
} | [
"private",
"<",
"R",
">",
"R",
"doWithReadLock",
"(",
"Action",
"<",
"K",
",",
"V",
",",
"R",
">",
"action",
")",
"{",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"action",
".",
"doWith",
"(",
"commonCache",
")",
";",
"}",
"fina... | deal with the backed cache guarded by read lock
@param action the content to complete | [
"deal",
"with",
"the",
"backed",
"cache",
"guarded",
"by",
"read",
"lock"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java#L260-L267 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Session.java | Session.openActiveSessionWithAccessToken | public static Session openActiveSessionWithAccessToken(Context context, AccessToken accessToken,
StatusCallback callback) {
Session session = new Session(context, null, null, false);
setActiveSession(session);
session.open(accessToken, callback);
return session;
} | java | public static Session openActiveSessionWithAccessToken(Context context, AccessToken accessToken,
StatusCallback callback) {
Session session = new Session(context, null, null, false);
setActiveSession(session);
session.open(accessToken, callback);
return session;
} | [
"public",
"static",
"Session",
"openActiveSessionWithAccessToken",
"(",
"Context",
"context",
",",
"AccessToken",
"accessToken",
",",
"StatusCallback",
"callback",
")",
"{",
"Session",
"session",
"=",
"new",
"Session",
"(",
"context",
",",
"null",
",",
"null",
","... | Opens a session based on an existing Facebook access token, and also makes this session
the currently active session. This method should be used
only in instances where an application has previously obtained an access token and wishes
to import it into the Session/TokenCachingStrategy-based session-management system. A primary
example would be an application which previously did not use the Facebook SDK for Android
and implemented its own session-management scheme, but wishes to implement an upgrade path
for existing users so they do not need to log in again when upgrading to a version of
the app that uses the SDK. In general, this method will be called only once, when the app
detects that it has been upgraded -- after that, the usual Session lifecycle methods
should be used to manage the session and its associated token.
<p/>
No validation is done that the token, token source, or permissions are actually valid.
It is the caller's responsibility to ensure that these accurately reflect the state of
the token that has been passed in, or calls to the Facebook API may fail.
@param context the Context to use for creation the session
@param accessToken the access token obtained from Facebook
@param callback a callback that will be called when the session status changes; may be null
@return The new Session or null if one could not be created | [
"Opens",
"a",
"session",
"based",
"on",
"an",
"existing",
"Facebook",
"access",
"token",
"and",
"also",
"makes",
"this",
"session",
"the",
"currently",
"active",
"session",
".",
"This",
"method",
"should",
"be",
"used",
"only",
"in",
"instances",
"where",
"a... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Session.java#L1119-L1127 |
azkaban/azkaban | azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java | MySQLDataSource.getConnection | @Override
public Connection getConnection() throws SQLException {
this.dbMetrics.markDBConnection();
final long startMs = System.currentTimeMillis();
Connection connection = null;
int retryAttempt = 1;
while (retryAttempt < AzDBUtil.MAX_DB_RETRY_COUNT) {
try {
/**
* when DB connection could not be fetched (e.g., network issue), or connection can not be validated,
* {@link BasicDataSource} throws a SQL Exception. {@link BasicDataSource#dataSource} will be reset to null.
* createDataSource() will create a new dataSource.
* Every Attempt generates a thread-hanging-time, about 75 seconds, which is hard coded, and can not be changed.
*/
connection = createDataSource().getConnection();
/**
* If connection is null or connection is read only, retry to find available connection.
* When DB fails over from master to slave, master is set to read-only mode. We must keep
* finding correct data source and sql connection.
*/
if (connection == null || isReadOnly(connection)) {
throw new SQLException("Failed to find DB connection Or connection is read only. ");
} else {
// Evalaute how long it takes to get DB Connection.
this.dbMetrics.setDBConnectionTime(System.currentTimeMillis() - startMs);
return connection;
}
} catch (final SQLException ex) {
/**
* invalidate connection and reconstruct it later. if remote IP address is not reachable,
* it will get hang for a while and throw exception.
*/
this.dbMetrics.markDBFailConnection();
try {
invalidateConnection(connection);
} catch (final Exception e) {
logger.error( "can not invalidate connection.", e);
}
logger.error( "Failed to find write-enabled DB connection. Wait 15 seconds and retry."
+ " No.Attempt = " + retryAttempt, ex);
/**
* When database is completed down, DB connection fails to be fetched immediately. So we need
* to sleep 15 seconds for retry.
*/
sleep(1000L * 15);
retryAttempt++;
}
}
return connection;
} | java | @Override
public Connection getConnection() throws SQLException {
this.dbMetrics.markDBConnection();
final long startMs = System.currentTimeMillis();
Connection connection = null;
int retryAttempt = 1;
while (retryAttempt < AzDBUtil.MAX_DB_RETRY_COUNT) {
try {
/**
* when DB connection could not be fetched (e.g., network issue), or connection can not be validated,
* {@link BasicDataSource} throws a SQL Exception. {@link BasicDataSource#dataSource} will be reset to null.
* createDataSource() will create a new dataSource.
* Every Attempt generates a thread-hanging-time, about 75 seconds, which is hard coded, and can not be changed.
*/
connection = createDataSource().getConnection();
/**
* If connection is null or connection is read only, retry to find available connection.
* When DB fails over from master to slave, master is set to read-only mode. We must keep
* finding correct data source and sql connection.
*/
if (connection == null || isReadOnly(connection)) {
throw new SQLException("Failed to find DB connection Or connection is read only. ");
} else {
// Evalaute how long it takes to get DB Connection.
this.dbMetrics.setDBConnectionTime(System.currentTimeMillis() - startMs);
return connection;
}
} catch (final SQLException ex) {
/**
* invalidate connection and reconstruct it later. if remote IP address is not reachable,
* it will get hang for a while and throw exception.
*/
this.dbMetrics.markDBFailConnection();
try {
invalidateConnection(connection);
} catch (final Exception e) {
logger.error( "can not invalidate connection.", e);
}
logger.error( "Failed to find write-enabled DB connection. Wait 15 seconds and retry."
+ " No.Attempt = " + retryAttempt, ex);
/**
* When database is completed down, DB connection fails to be fetched immediately. So we need
* to sleep 15 seconds for retry.
*/
sleep(1000L * 15);
retryAttempt++;
}
}
return connection;
} | [
"@",
"Override",
"public",
"Connection",
"getConnection",
"(",
")",
"throws",
"SQLException",
"{",
"this",
".",
"dbMetrics",
".",
"markDBConnection",
"(",
")",
";",
"final",
"long",
"startMs",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"Connection... | This method overrides {@link BasicDataSource#getConnection()}, in order to have retry logics.
We don't make the call synchronized in order to guarantee normal cases performance. | [
"This",
"method",
"overrides",
"{"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java#L61-L114 |
LMAX-Exchange/disruptor | src/main/java/com/lmax/disruptor/RingBuffer.java | RingBuffer.createSingleProducer | public static <E> RingBuffer<E> createSingleProducer(EventFactory<E> factory, int bufferSize)
{
return createSingleProducer(factory, bufferSize, new BlockingWaitStrategy());
} | java | public static <E> RingBuffer<E> createSingleProducer(EventFactory<E> factory, int bufferSize)
{
return createSingleProducer(factory, bufferSize, new BlockingWaitStrategy());
} | [
"public",
"static",
"<",
"E",
">",
"RingBuffer",
"<",
"E",
">",
"createSingleProducer",
"(",
"EventFactory",
"<",
"E",
">",
"factory",
",",
"int",
"bufferSize",
")",
"{",
"return",
"createSingleProducer",
"(",
"factory",
",",
"bufferSize",
",",
"new",
"Block... | Create a new single producer RingBuffer using the default wait strategy {@link BlockingWaitStrategy}.
@param <E> Class of the event stored in the ring buffer.
@param factory used to create the events within the ring buffer.
@param bufferSize number of elements to create within the ring buffer.
@return a constructed ring buffer.
@throws IllegalArgumentException if <code>bufferSize</code> is less than 1 or not a power of 2
@see MultiProducerSequencer | [
"Create",
"a",
"new",
"single",
"producer",
"RingBuffer",
"using",
"the",
"default",
"wait",
"strategy",
"{",
"@link",
"BlockingWaitStrategy",
"}",
"."
] | train | https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/RingBuffer.java#L189-L192 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.getLock | public CmsLock getLock(CmsRequestContext context, CmsResource resource) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsLock result = null;
try {
result = m_driverManager.getLock(dbc, resource);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_GET_LOCK_1, context.getSitePath(resource)), e);
} finally {
dbc.clear();
}
return result;
} | java | public CmsLock getLock(CmsRequestContext context, CmsResource resource) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsLock result = null;
try {
result = m_driverManager.getLock(dbc, resource);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_GET_LOCK_1, context.getSitePath(resource)), e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"CmsLock",
"getLock",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"CmsLock",
"result",
"=",
"nul... | Returns the lock state of a resource.<p>
@param context the current request context
@param resource the resource to return the lock state for
@return the lock state of the resource
@throws CmsException if something goes wrong | [
"Returns",
"the",
"lock",
"state",
"of",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L2246-L2258 |
apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java | TaskLockbox.revokeLock | private void revokeLock(String taskId, TaskLock lock)
{
giant.lock();
try {
if (!activeTasks.contains(taskId)) {
throw new ISE("Cannot revoke lock for inactive task[%s]", taskId);
}
final Task task = taskStorage.getTask(taskId).orNull();
if (task == null) {
throw new ISE("Cannot revoke lock for unknown task[%s]", taskId);
}
log.info("Revoking task lock[%s] for task[%s]", lock, taskId);
if (lock.isRevoked()) {
log.warn("TaskLock[%s] is already revoked", lock);
} else {
final TaskLock revokedLock = lock.revokedCopy();
taskStorage.replaceLock(taskId, lock, revokedLock);
final List<TaskLockPosse> possesHolder = running.get(task.getDataSource()).get(lock.getInterval().getStart()).get(lock.getInterval());
final TaskLockPosse foundPosse = possesHolder.stream()
.filter(posse -> posse.getTaskLock().equals(lock))
.findFirst()
.orElseThrow(
() -> new ISE("Failed to find lock posse for lock[%s]", lock)
);
possesHolder.remove(foundPosse);
possesHolder.add(foundPosse.withTaskLock(revokedLock));
log.info("Revoked taskLock[%s]", lock);
}
}
finally {
giant.unlock();
}
} | java | private void revokeLock(String taskId, TaskLock lock)
{
giant.lock();
try {
if (!activeTasks.contains(taskId)) {
throw new ISE("Cannot revoke lock for inactive task[%s]", taskId);
}
final Task task = taskStorage.getTask(taskId).orNull();
if (task == null) {
throw new ISE("Cannot revoke lock for unknown task[%s]", taskId);
}
log.info("Revoking task lock[%s] for task[%s]", lock, taskId);
if (lock.isRevoked()) {
log.warn("TaskLock[%s] is already revoked", lock);
} else {
final TaskLock revokedLock = lock.revokedCopy();
taskStorage.replaceLock(taskId, lock, revokedLock);
final List<TaskLockPosse> possesHolder = running.get(task.getDataSource()).get(lock.getInterval().getStart()).get(lock.getInterval());
final TaskLockPosse foundPosse = possesHolder.stream()
.filter(posse -> posse.getTaskLock().equals(lock))
.findFirst()
.orElseThrow(
() -> new ISE("Failed to find lock posse for lock[%s]", lock)
);
possesHolder.remove(foundPosse);
possesHolder.add(foundPosse.withTaskLock(revokedLock));
log.info("Revoked taskLock[%s]", lock);
}
}
finally {
giant.unlock();
}
} | [
"private",
"void",
"revokeLock",
"(",
"String",
"taskId",
",",
"TaskLock",
"lock",
")",
"{",
"giant",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"activeTasks",
".",
"contains",
"(",
"taskId",
")",
")",
"{",
"throw",
"new",
"ISE",
"(",
... | Mark the lock as revoked. Note that revoked locks are NOT removed. Instead, they are maintained in {@link #running}
and {@link #taskStorage} as the normal locks do. This is to check locks are revoked when they are requested to be
acquired and notify to the callers if revoked. Revoked locks are removed by calling
{@link #unlock(Task, Interval)}.
@param taskId an id of the task holding the lock
@param lock lock to be revoked | [
"Mark",
"the",
"lock",
"as",
"revoked",
".",
"Note",
"that",
"revoked",
"locks",
"are",
"NOT",
"removed",
".",
"Instead",
"they",
"are",
"maintained",
"in",
"{",
"@link",
"#running",
"}",
"and",
"{",
"@link",
"#taskStorage",
"}",
"as",
"the",
"normal",
"... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L672-L709 |
ontop/ontop | mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/RAExpressionAttributes.java | RAExpressionAttributes.crossJoin | public static RAExpressionAttributes crossJoin(RAExpressionAttributes re1, RAExpressionAttributes re2) throws IllegalJoinException {
checkRelationAliasesConsistency(re1, re2);
ImmutableMap<QualifiedAttributeID, Term> attributes = merge(
re1.selectAttributes(id ->
(id.getRelation() != null) || re2.isAbsent(id.getAttribute())),
re2.selectAttributes(id ->
(id.getRelation() != null) || re1.isAbsent(id.getAttribute())));
return new RAExpressionAttributes(attributes,
getAttributeOccurrences(re1, re2, id -> attributeOccurrencesUnion(id, re1, re2)));
} | java | public static RAExpressionAttributes crossJoin(RAExpressionAttributes re1, RAExpressionAttributes re2) throws IllegalJoinException {
checkRelationAliasesConsistency(re1, re2);
ImmutableMap<QualifiedAttributeID, Term> attributes = merge(
re1.selectAttributes(id ->
(id.getRelation() != null) || re2.isAbsent(id.getAttribute())),
re2.selectAttributes(id ->
(id.getRelation() != null) || re1.isAbsent(id.getAttribute())));
return new RAExpressionAttributes(attributes,
getAttributeOccurrences(re1, re2, id -> attributeOccurrencesUnion(id, re1, re2)));
} | [
"public",
"static",
"RAExpressionAttributes",
"crossJoin",
"(",
"RAExpressionAttributes",
"re1",
",",
"RAExpressionAttributes",
"re2",
")",
"throws",
"IllegalJoinException",
"{",
"checkRelationAliasesConsistency",
"(",
"re1",
",",
"re2",
")",
";",
"ImmutableMap",
"<",
"... | CROSS JOIN (also denoted by , in SQL)
@param re1 a {@link RAExpressionAttributes}
@param re2 a {@link RAExpressionAttributes}
@return a {@link RAExpressionAttributes}
@throws IllegalJoinException if the same alias occurs in both arguments | [
"CROSS",
"JOIN",
"(",
"also",
"denoted",
"by",
"in",
"SQL",
")"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/RAExpressionAttributes.java#L72-L85 |
eclipse/xtext-extras | org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/IndexedJvmTypeAccess.java | IndexedJvmTypeAccess.findAccessibleType | protected EObject findAccessibleType(String fragment, ResourceSet resourceSet, Iterator<IEObjectDescription> fromIndex) throws UnknownNestedTypeException {
IEObjectDescription description = fromIndex.next();
return getAccessibleType(description, fragment, resourceSet);
} | java | protected EObject findAccessibleType(String fragment, ResourceSet resourceSet, Iterator<IEObjectDescription> fromIndex) throws UnknownNestedTypeException {
IEObjectDescription description = fromIndex.next();
return getAccessibleType(description, fragment, resourceSet);
} | [
"protected",
"EObject",
"findAccessibleType",
"(",
"String",
"fragment",
",",
"ResourceSet",
"resourceSet",
",",
"Iterator",
"<",
"IEObjectDescription",
">",
"fromIndex",
")",
"throws",
"UnknownNestedTypeException",
"{",
"IEObjectDescription",
"description",
"=",
"fromInd... | Returns the first type that was found in the index. May be overridden to honor visibility semantics.
The given iterator is never empty.
@since 2.8 | [
"Returns",
"the",
"first",
"type",
"that",
"was",
"found",
"in",
"the",
"index",
".",
"May",
"be",
"overridden",
"to",
"honor",
"visibility",
"semantics",
".",
"The",
"given",
"iterator",
"is",
"never",
"empty",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/IndexedJvmTypeAccess.java#L129-L132 |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/SSLEngineImpl.java | SSLEngineImpl.needToSplitPayload | boolean needToSplitPayload(CipherBox cipher, ProtocolVersion protocol) {
return (protocol.v <= ProtocolVersion.TLS10.v) &&
cipher.isCBCMode() && !isFirstAppOutputRecord &&
Record.enableCBCProtection;
} | java | boolean needToSplitPayload(CipherBox cipher, ProtocolVersion protocol) {
return (protocol.v <= ProtocolVersion.TLS10.v) &&
cipher.isCBCMode() && !isFirstAppOutputRecord &&
Record.enableCBCProtection;
} | [
"boolean",
"needToSplitPayload",
"(",
"CipherBox",
"cipher",
",",
"ProtocolVersion",
"protocol",
")",
"{",
"return",
"(",
"protocol",
".",
"v",
"<=",
"ProtocolVersion",
".",
"TLS10",
".",
"v",
")",
"&&",
"cipher",
".",
"isCBCMode",
"(",
")",
"&&",
"!",
"is... | /*
Need to split the payload except the following cases:
1. protocol version is TLS 1.1 or later;
2. bulk cipher does not use CBC mode, including null bulk cipher suites.
3. the payload is the first application record of a freshly
negotiated TLS session.
4. the CBC protection is disabled;
More details, please refer to
EngineOutputRecord.write(EngineArgs, MAC, CipherBox). | [
"/",
"*",
"Need",
"to",
"split",
"the",
"payload",
"except",
"the",
"following",
"cases",
":"
] | train | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/SSLEngineImpl.java#L1337-L1341 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.email_exchange_organizationName_service_exchangeService_account_GET | public ArrayList<String> email_exchange_organizationName_service_exchangeService_account_GET(String organizationName, String exchangeService, OvhOvhLicenceEnum licence, Long number, OvhAccountQuotaEnum storageQuota) throws IOException {
String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/account";
StringBuilder sb = path(qPath, organizationName, exchangeService);
query(sb, "licence", licence);
query(sb, "number", number);
query(sb, "storageQuota", storageQuota);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> email_exchange_organizationName_service_exchangeService_account_GET(String organizationName, String exchangeService, OvhOvhLicenceEnum licence, Long number, OvhAccountQuotaEnum storageQuota) throws IOException {
String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/account";
StringBuilder sb = path(qPath, organizationName, exchangeService);
query(sb, "licence", licence);
query(sb, "number", number);
query(sb, "storageQuota", storageQuota);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"email_exchange_organizationName_service_exchangeService_account_GET",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"OvhOvhLicenceEnum",
"licence",
",",
"Long",
"number",
",",
"OvhAccountQuotaEnum",
"stor... | Get allowed durations for 'account' option
REST: GET /order/email/exchange/{organizationName}/service/{exchangeService}/account
@param storageQuota [required] The storage quota for the account(s) in GB (default = 50)
@param number [required] Number of Accounts to order
@param licence [required] Licence type for the account
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Get",
"allowed",
"durations",
"for",
"account",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3903-L3911 |
lotaris/rox-client-java | rox-client-java/src/main/java/com/lotaris/rox/core/cache/CacheOptimizerStore.java | CacheOptimizerStore.persistCache | private void persistCache(String projectName, String projectVersion, Map<String, String> cache) {
File cacheFile = new File(getCacheDir(), projectName + "/" + projectVersion);
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(cacheFile));
oos.writeObject(cache);
}
catch (IOException ioe) {
LOGGER.warn("Unable to create the cache file {}/{}/{}", getCacheDir().getAbsoluteFile(), projectName, projectVersion);
}
finally { if (oos != null) { try { oos.close(); } catch (IOException ioe) {} } }
} | java | private void persistCache(String projectName, String projectVersion, Map<String, String> cache) {
File cacheFile = new File(getCacheDir(), projectName + "/" + projectVersion);
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(cacheFile));
oos.writeObject(cache);
}
catch (IOException ioe) {
LOGGER.warn("Unable to create the cache file {}/{}/{}", getCacheDir().getAbsoluteFile(), projectName, projectVersion);
}
finally { if (oos != null) { try { oos.close(); } catch (IOException ioe) {} } }
} | [
"private",
"void",
"persistCache",
"(",
"String",
"projectName",
",",
"String",
"projectVersion",
",",
"Map",
"<",
"String",
",",
"String",
">",
"cache",
")",
"{",
"File",
"cacheFile",
"=",
"new",
"File",
"(",
"getCacheDir",
"(",
")",
",",
"projectName",
"... | Persist a specific cache
@param projectName Project name
@param projectVersion Project version
@param cache The cache to persist | [
"Persist",
"a",
"specific",
"cache"
] | train | https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/core/cache/CacheOptimizerStore.java#L179-L190 |
xwiki/xwiki-commons | xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/AbstractXARMojo.java | AbstractXARMojo.getDocFromXML | protected XWikiDocument getDocFromXML(File file) throws MojoExecutionException
{
XWikiDocument doc;
try {
doc = new XWikiDocument();
doc.fromXML(file);
} catch (Exception e) {
throw new MojoExecutionException(String.format("Failed to parse [%s].", file.getAbsolutePath()), e);
}
return doc;
} | java | protected XWikiDocument getDocFromXML(File file) throws MojoExecutionException
{
XWikiDocument doc;
try {
doc = new XWikiDocument();
doc.fromXML(file);
} catch (Exception e) {
throw new MojoExecutionException(String.format("Failed to parse [%s].", file.getAbsolutePath()), e);
}
return doc;
} | [
"protected",
"XWikiDocument",
"getDocFromXML",
"(",
"File",
"file",
")",
"throws",
"MojoExecutionException",
"{",
"XWikiDocument",
"doc",
";",
"try",
"{",
"doc",
"=",
"new",
"XWikiDocument",
"(",
")",
";",
"doc",
".",
"fromXML",
"(",
"file",
")",
";",
"}",
... | Load a XWiki document from its XML representation.
@param file the file to parse.
@return the loaded document object or null if the document cannot be parsed | [
"Load",
"a",
"XWiki",
"document",
"from",
"its",
"XML",
"representation",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/AbstractXARMojo.java#L330-L342 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/FunctionLibraryParser.java | FunctionLibraryParser.parseFunctionDefinitions | private void parseFunctionDefinitions(BeanDefinitionBuilder builder, Element element) {
ManagedMap<String, Object> functions = new ManagedMap<String, Object>();
for (Element function : DomUtils.getChildElementsByTagName(element, "function")) {
if (function.hasAttribute("ref")) {
functions.put(function.getAttribute("name"), new RuntimeBeanReference(function.getAttribute("ref")));
} else {
functions.put(function.getAttribute("name"), BeanDefinitionBuilder.rootBeanDefinition(function.getAttribute("class")).getBeanDefinition());
}
}
if (!functions.isEmpty()) {
builder.addPropertyValue("members", functions);
}
} | java | private void parseFunctionDefinitions(BeanDefinitionBuilder builder, Element element) {
ManagedMap<String, Object> functions = new ManagedMap<String, Object>();
for (Element function : DomUtils.getChildElementsByTagName(element, "function")) {
if (function.hasAttribute("ref")) {
functions.put(function.getAttribute("name"), new RuntimeBeanReference(function.getAttribute("ref")));
} else {
functions.put(function.getAttribute("name"), BeanDefinitionBuilder.rootBeanDefinition(function.getAttribute("class")).getBeanDefinition());
}
}
if (!functions.isEmpty()) {
builder.addPropertyValue("members", functions);
}
} | [
"private",
"void",
"parseFunctionDefinitions",
"(",
"BeanDefinitionBuilder",
"builder",
",",
"Element",
"element",
")",
"{",
"ManagedMap",
"<",
"String",
",",
"Object",
">",
"functions",
"=",
"new",
"ManagedMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";... | Parses all variable definitions and adds those to the bean definition
builder as property value.
@param builder the target bean definition builder.
@param element the source element. | [
"Parses",
"all",
"variable",
"definitions",
"and",
"adds",
"those",
"to",
"the",
"bean",
"definition",
"builder",
"as",
"property",
"value",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/FunctionLibraryParser.java#L54-L67 |
facebookarchive/hadoop-20 | src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatInputStream.java | SimpleSeekableFormatInputStream.createInterleavedInputStream | protected InterleavedInputStream createInterleavedInputStream(InputStream in,
int metaDataBlockLength, int dataBlockLength,
SimpleSeekableFormat.MetaDataConsumer consumer) {
return new InterleavedInputStream(in, metaDataBlockLength, dataBlockLength, consumer);
} | java | protected InterleavedInputStream createInterleavedInputStream(InputStream in,
int metaDataBlockLength, int dataBlockLength,
SimpleSeekableFormat.MetaDataConsumer consumer) {
return new InterleavedInputStream(in, metaDataBlockLength, dataBlockLength, consumer);
} | [
"protected",
"InterleavedInputStream",
"createInterleavedInputStream",
"(",
"InputStream",
"in",
",",
"int",
"metaDataBlockLength",
",",
"int",
"dataBlockLength",
",",
"SimpleSeekableFormat",
".",
"MetaDataConsumer",
"consumer",
")",
"{",
"return",
"new",
"InterleavedInputS... | This factory method can be overwritten by subclass to provide different behavior.
It's only called in the constructor. | [
"This",
"factory",
"method",
"can",
"be",
"overwritten",
"by",
"subclass",
"to",
"provide",
"different",
"behavior",
".",
"It",
"s",
"only",
"called",
"in",
"the",
"constructor",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatInputStream.java#L54-L58 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/V1JsExprTranslator.java | V1JsExprTranslator.getLocalVarTranslation | @Nullable
private static String getLocalVarTranslation(String ident, SoyToJsVariableMappings mappings) {
Expression translation = mappings.maybeGet(ident);
if (translation == null) {
return null;
}
JsExpr asExpr = translation.assertExpr();
return asExpr.getPrecedence() != Integer.MAX_VALUE
? "(" + asExpr.getText() + ")"
: asExpr.getText();
} | java | @Nullable
private static String getLocalVarTranslation(String ident, SoyToJsVariableMappings mappings) {
Expression translation = mappings.maybeGet(ident);
if (translation == null) {
return null;
}
JsExpr asExpr = translation.assertExpr();
return asExpr.getPrecedence() != Integer.MAX_VALUE
? "(" + asExpr.getText() + ")"
: asExpr.getText();
} | [
"@",
"Nullable",
"private",
"static",
"String",
"getLocalVarTranslation",
"(",
"String",
"ident",
",",
"SoyToJsVariableMappings",
"mappings",
")",
"{",
"Expression",
"translation",
"=",
"mappings",
".",
"maybeGet",
"(",
"ident",
")",
";",
"if",
"(",
"translation",... | Gets the translated expression for an in-scope local variable (or special "variable" derived
from a foreach-loop var), or null if not found.
@param ident The Soy local variable to translate.
@param mappings The replacement JS expressions for the local variables (and foreach-loop
special functions) current in scope.
@return The translated string for the given variable, or null if not found. | [
"Gets",
"the",
"translated",
"expression",
"for",
"an",
"in",
"-",
"scope",
"local",
"variable",
"(",
"or",
"special",
"variable",
"derived",
"from",
"a",
"foreach",
"-",
"loop",
"var",
")",
"or",
"null",
"if",
"not",
"found",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/V1JsExprTranslator.java#L171-L181 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/xpath/XPathQueryBuilder.java | XPathQueryBuilder.createQuery | public static QueryRootNode createQuery(String statement,
LocationFactory resolver,
QueryNodeFactory factory)
throws InvalidQueryException {
return new XPathQueryBuilder(statement, resolver, factory).getRootNode();
} | java | public static QueryRootNode createQuery(String statement,
LocationFactory resolver,
QueryNodeFactory factory)
throws InvalidQueryException {
return new XPathQueryBuilder(statement, resolver, factory).getRootNode();
} | [
"public",
"static",
"QueryRootNode",
"createQuery",
"(",
"String",
"statement",
",",
"LocationFactory",
"resolver",
",",
"QueryNodeFactory",
"factory",
")",
"throws",
"InvalidQueryException",
"{",
"return",
"new",
"XPathQueryBuilder",
"(",
"statement",
",",
"resolver",
... | Creates a <code>QueryNode</code> tree from a XPath statement using the
passed query node <code>factory</code>.
@param statement the XPath statement.
@param resolver the name resolver to use.
@param factory the query node factory.
@return the <code>QueryNode</code> tree for the XPath statement.
@throws InvalidQueryException if the XPath statement is malformed. | [
"Creates",
"a",
"<code",
">",
"QueryNode<",
"/",
"code",
">",
"tree",
"from",
"a",
"XPath",
"statement",
"using",
"the",
"passed",
"query",
"node",
"<code",
">",
"factory<",
"/",
"code",
">",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/xpath/XPathQueryBuilder.java#L319-L324 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteQuery.java | SQLiteQuery.fillWindow | int fillWindow(CursorWindow window, int startPos, int requiredPos, boolean countAllRows) {
acquireReference();
try {
window.acquireReference();
try {
int numRows = getSession().executeForCursorWindow(getSql(), getBindArgs(),
window, startPos, requiredPos, countAllRows, getConnectionFlags(),
mCancellationSignal);
return numRows;
} catch (SQLiteDatabaseCorruptException ex) {
onCorruption();
throw ex;
} catch (SQLiteException ex) {
Log.e(TAG, "exception: " + ex.getMessage() + "; query: " + getSql());
throw ex;
} finally {
window.releaseReference();
}
} finally {
releaseReference();
}
} | java | int fillWindow(CursorWindow window, int startPos, int requiredPos, boolean countAllRows) {
acquireReference();
try {
window.acquireReference();
try {
int numRows = getSession().executeForCursorWindow(getSql(), getBindArgs(),
window, startPos, requiredPos, countAllRows, getConnectionFlags(),
mCancellationSignal);
return numRows;
} catch (SQLiteDatabaseCorruptException ex) {
onCorruption();
throw ex;
} catch (SQLiteException ex) {
Log.e(TAG, "exception: " + ex.getMessage() + "; query: " + getSql());
throw ex;
} finally {
window.releaseReference();
}
} finally {
releaseReference();
}
} | [
"int",
"fillWindow",
"(",
"CursorWindow",
"window",
",",
"int",
"startPos",
",",
"int",
"requiredPos",
",",
"boolean",
"countAllRows",
")",
"{",
"acquireReference",
"(",
")",
";",
"try",
"{",
"window",
".",
"acquireReference",
"(",
")",
";",
"try",
"{",
"i... | Reads rows into a buffer.
@param window The window to fill into
@param startPos The start position for filling the window.
@param requiredPos The position of a row that MUST be in the window.
If it won't fit, then the query should discard part of what it filled.
@param countAllRows True to count all rows that the query would
return regardless of whether they fit in the window.
@return Number of rows that were enumerated. Might not be all rows
unless countAllRows is true.
@throws SQLiteException if an error occurs.
@throws OperationCanceledException if the operation was canceled. | [
"Reads",
"rows",
"into",
"a",
"buffer",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteQuery.java#L61-L82 |
hal/core | gui/src/main/java/org/jboss/as/console/mbui/widgets/ComplexAttributeForm.java | ComplexAttributeForm.getSecurityContext | private SecurityContext getSecurityContext() {
return new SecurityContext() {
@Override
public AuthorisationDecision getReadPriviledge() {
return securityContextDelegate.getReadPriviledge();
}
@Override
public AuthorisationDecision getWritePriviledge() {
return securityContextDelegate.getWritePriviledge();
}
@Override
public AuthorisationDecision getAttributeWritePriviledge(String s) {
return securityContextDelegate.getAttributeWritePriviledge(attributeName);
}
@Override
public AuthorisationDecision getAttributeReadPriviledge(String s) {
return securityContextDelegate.getAttributeReadPriviledge(attributeName);
}
@Override
public AuthorisationDecision getAttributeWritePriviledge(String resourceAddress, String attributeName) {
return securityContextDelegate.getAttributeWritePriviledge(attributeName);
}
@Override
public AuthorisationDecision getAttributeReadPriviledge(String resourceAddress, String attributeName) {
return securityContextDelegate.getAttributeReadPriviledge(attributeName);
}
@Override
public AuthorisationDecision getReadPrivilege(String resourceAddress) {
return securityContextDelegate.getAttributeReadPriviledge(attributeName);
}
@Override
public AuthorisationDecision getWritePrivilege(String resourceAddress) {
return securityContextDelegate.getAttributeWritePriviledge(attributeName);
}
@Override
public AuthorisationDecision getOperationPriviledge(String resourceAddress, String operationName) {
return securityContextDelegate.getOperationPriviledge(resourceAddress, operationName);
}
@Override
public boolean hasChildContext(Object s, String resolvedKey) {
return false;
}
@Override
public void activateChildContext(Object resourceAddress, String resolvedKey) {
}
@Override
public void seal() {
securityContextDelegate.seal();
}
};
} | java | private SecurityContext getSecurityContext() {
return new SecurityContext() {
@Override
public AuthorisationDecision getReadPriviledge() {
return securityContextDelegate.getReadPriviledge();
}
@Override
public AuthorisationDecision getWritePriviledge() {
return securityContextDelegate.getWritePriviledge();
}
@Override
public AuthorisationDecision getAttributeWritePriviledge(String s) {
return securityContextDelegate.getAttributeWritePriviledge(attributeName);
}
@Override
public AuthorisationDecision getAttributeReadPriviledge(String s) {
return securityContextDelegate.getAttributeReadPriviledge(attributeName);
}
@Override
public AuthorisationDecision getAttributeWritePriviledge(String resourceAddress, String attributeName) {
return securityContextDelegate.getAttributeWritePriviledge(attributeName);
}
@Override
public AuthorisationDecision getAttributeReadPriviledge(String resourceAddress, String attributeName) {
return securityContextDelegate.getAttributeReadPriviledge(attributeName);
}
@Override
public AuthorisationDecision getReadPrivilege(String resourceAddress) {
return securityContextDelegate.getAttributeReadPriviledge(attributeName);
}
@Override
public AuthorisationDecision getWritePrivilege(String resourceAddress) {
return securityContextDelegate.getAttributeWritePriviledge(attributeName);
}
@Override
public AuthorisationDecision getOperationPriviledge(String resourceAddress, String operationName) {
return securityContextDelegate.getOperationPriviledge(resourceAddress, operationName);
}
@Override
public boolean hasChildContext(Object s, String resolvedKey) {
return false;
}
@Override
public void activateChildContext(Object resourceAddress, String resolvedKey) {
}
@Override
public void seal() {
securityContextDelegate.seal();
}
};
} | [
"private",
"SecurityContext",
"getSecurityContext",
"(",
")",
"{",
"return",
"new",
"SecurityContext",
"(",
")",
"{",
"@",
"Override",
"public",
"AuthorisationDecision",
"getReadPriviledge",
"(",
")",
"{",
"return",
"securityContextDelegate",
".",
"getReadPriviledge",
... | Simply delegates all auth decision to the parent context attribute scope represented by {@link #attributeName}
@return | [
"Simply",
"delegates",
"all",
"auth",
"decision",
"to",
"the",
"parent",
"context",
"attribute",
"scope",
"represented",
"by",
"{"
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/mbui/widgets/ComplexAttributeForm.java#L84-L146 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java | WikipediaInfo.iterateCategoriesGetArticles | private void iterateCategoriesGetArticles(Wikipedia pWiki, CategoryGraph catGraph) throws WikiPageNotFoundException {
Map<Integer,Integer> localDegreeDistribution = new HashMap<Integer,Integer>();
Set<Integer> localCategorizedArticleSet = new HashSet<Integer>();
Set<Integer> categoryNodes = catGraph.getGraph().vertexSet();
// iterate over all categories
int progress = 0;
for (int node : categoryNodes) {
progress++;
ApiUtilities.printProgressInfo(progress, categoryNodes.size(), 100, ApiUtilities.ProgressInfoMode.TEXT, "iterate over categories");
// get the category
Category cat = pWiki.getCategory(node);
if (cat != null) {
Set<Integer> pages = new HashSet<Integer>(cat.__getPages());
// update degree distribution map
int numberOfArticles = pages.size();
if (localDegreeDistribution.containsKey(numberOfArticles)) {
int count = localDegreeDistribution.get(numberOfArticles);
count++;
localDegreeDistribution.put(numberOfArticles, count);
}
else {
localDegreeDistribution.put(numberOfArticles, 1);
}
// add the page to the categorized articles set, if it is to already in it
for (int page : pages) {
if (!localCategorizedArticleSet.contains(page)) {
localCategorizedArticleSet.add(page);
}
}
}
else {
logger.info("{} is not a category.", node);
}
}
this.degreeDistribution = localDegreeDistribution;
this.categorizedArticleSet = localCategorizedArticleSet;
} | java | private void iterateCategoriesGetArticles(Wikipedia pWiki, CategoryGraph catGraph) throws WikiPageNotFoundException {
Map<Integer,Integer> localDegreeDistribution = new HashMap<Integer,Integer>();
Set<Integer> localCategorizedArticleSet = new HashSet<Integer>();
Set<Integer> categoryNodes = catGraph.getGraph().vertexSet();
// iterate over all categories
int progress = 0;
for (int node : categoryNodes) {
progress++;
ApiUtilities.printProgressInfo(progress, categoryNodes.size(), 100, ApiUtilities.ProgressInfoMode.TEXT, "iterate over categories");
// get the category
Category cat = pWiki.getCategory(node);
if (cat != null) {
Set<Integer> pages = new HashSet<Integer>(cat.__getPages());
// update degree distribution map
int numberOfArticles = pages.size();
if (localDegreeDistribution.containsKey(numberOfArticles)) {
int count = localDegreeDistribution.get(numberOfArticles);
count++;
localDegreeDistribution.put(numberOfArticles, count);
}
else {
localDegreeDistribution.put(numberOfArticles, 1);
}
// add the page to the categorized articles set, if it is to already in it
for (int page : pages) {
if (!localCategorizedArticleSet.contains(page)) {
localCategorizedArticleSet.add(page);
}
}
}
else {
logger.info("{} is not a category.", node);
}
}
this.degreeDistribution = localDegreeDistribution;
this.categorizedArticleSet = localCategorizedArticleSet;
} | [
"private",
"void",
"iterateCategoriesGetArticles",
"(",
"Wikipedia",
"pWiki",
",",
"CategoryGraph",
"catGraph",
")",
"throws",
"WikiPageNotFoundException",
"{",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"localDegreeDistribution",
"=",
"new",
"HashMap",
"<",
"Integer... | Methods computing stuff that have to iterate over all categories and access category articles can plug-in here.
Recently plugin-in:
numberOfCategorizedArticles
distributionOfArticlesByCategory
@param pWiki The wikipedia object.
@param catGraph The category graph.
@throws WikiPageNotFoundException | [
"Methods",
"computing",
"stuff",
"that",
"have",
"to",
"iterate",
"over",
"all",
"categories",
"and",
"access",
"category",
"articles",
"can",
"plug",
"-",
"in",
"here",
".",
"Recently",
"plugin",
"-",
"in",
":",
"numberOfCategorizedArticles",
"distributionOfArtic... | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java#L318-L357 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java | ApacheHTTPClient.createStringRequestContent | protected RequestEntity createStringRequestContent(HTTPRequest httpRequest)
{
RequestEntity requestEntity=null;
String contentString=httpRequest.getContentAsString();
if(contentString!=null)
{
try
{
requestEntity=new StringRequestEntity(contentString,"text/plain",null);
}
catch(UnsupportedEncodingException exception)
{
throw new FaxException("Unable to set string request entity.",exception);
}
}
return requestEntity;
} | java | protected RequestEntity createStringRequestContent(HTTPRequest httpRequest)
{
RequestEntity requestEntity=null;
String contentString=httpRequest.getContentAsString();
if(contentString!=null)
{
try
{
requestEntity=new StringRequestEntity(contentString,"text/plain",null);
}
catch(UnsupportedEncodingException exception)
{
throw new FaxException("Unable to set string request entity.",exception);
}
}
return requestEntity;
} | [
"protected",
"RequestEntity",
"createStringRequestContent",
"(",
"HTTPRequest",
"httpRequest",
")",
"{",
"RequestEntity",
"requestEntity",
"=",
"null",
";",
"String",
"contentString",
"=",
"httpRequest",
".",
"getContentAsString",
"(",
")",
";",
"if",
"(",
"contentStr... | This function creates a string type request entity and populates it
with the data from the provided HTTP request.
@param httpRequest
The HTTP request
@return The request entity | [
"This",
"function",
"creates",
"a",
"string",
"type",
"request",
"entity",
"and",
"populates",
"it",
"with",
"the",
"data",
"from",
"the",
"provided",
"HTTP",
"request",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java#L282-L299 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.INPUT | public static HtmlTree INPUT(String type, String id) {
HtmlTree htmltree = new HtmlTree(HtmlTag.INPUT);
htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
htmltree.addAttr(HtmlAttr.VALUE, " ");
htmltree.addAttr(HtmlAttr.DISABLED, "disabled");
return htmltree;
} | java | public static HtmlTree INPUT(String type, String id) {
HtmlTree htmltree = new HtmlTree(HtmlTag.INPUT);
htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
htmltree.addAttr(HtmlAttr.VALUE, " ");
htmltree.addAttr(HtmlAttr.DISABLED, "disabled");
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"INPUT",
"(",
"String",
"type",
",",
"String",
"id",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"INPUT",
")",
";",
"htmltree",
".",
"addAttr",
"(",
"HtmlAttr",
".",
"TYPE",
",",
"nullChe... | Generates a INPUT tag with some id.
@param type the type of input
@param id id for the tag
@return an HtmlTree object for the INPUT tag | [
"Generates",
"a",
"INPUT",
"tag",
"with",
"some",
"id",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L479-L486 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/feature/VisualizeShapes.java | VisualizeShapes.drawPolygon | public static<T extends Point2D_I32> void drawPolygon( List<T> vertexes , boolean loop, Graphics2D g2 ) {
for( int i = 0; i < vertexes.size()-1; i++ ) {
Point2D_I32 p0 = vertexes.get(i);
Point2D_I32 p1 = vertexes.get(i+1);
g2.drawLine(p0.x,p0.y,p1.x,p1.y);
}
if( loop && vertexes.size() > 0) {
Point2D_I32 p0 = vertexes.get(0);
Point2D_I32 p1 = vertexes.get(vertexes.size()-1);
g2.drawLine(p0.x,p0.y,p1.x,p1.y);
}
} | java | public static<T extends Point2D_I32> void drawPolygon( List<T> vertexes , boolean loop, Graphics2D g2 ) {
for( int i = 0; i < vertexes.size()-1; i++ ) {
Point2D_I32 p0 = vertexes.get(i);
Point2D_I32 p1 = vertexes.get(i+1);
g2.drawLine(p0.x,p0.y,p1.x,p1.y);
}
if( loop && vertexes.size() > 0) {
Point2D_I32 p0 = vertexes.get(0);
Point2D_I32 p1 = vertexes.get(vertexes.size()-1);
g2.drawLine(p0.x,p0.y,p1.x,p1.y);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Point2D_I32",
">",
"void",
"drawPolygon",
"(",
"List",
"<",
"T",
">",
"vertexes",
",",
"boolean",
"loop",
",",
"Graphics2D",
"g2",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vertexes",
".",
... | Draws a polygon
@param vertexes List of vertices in the polygon
@param loop true if the end points are connected, forming a loop
@param g2 Graphics object it's drawn to | [
"Draws",
"a",
"polygon"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/feature/VisualizeShapes.java#L166-L177 |
undera/jmeter-plugins | plugins/csvars/src/main/java/kg/apc/jmeter/config/VariableFromCsvFileReader.java | VariableFromCsvFileReader.getDataAsMap | public Map<String, String> getDataAsMap(String prefix, String separator) {
return getDataAsMap(prefix, separator, 0);
} | java | public Map<String, String> getDataAsMap(String prefix, String separator) {
return getDataAsMap(prefix, separator, 0);
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getDataAsMap",
"(",
"String",
"prefix",
",",
"String",
"separator",
")",
"{",
"return",
"getDataAsMap",
"(",
"prefix",
",",
"separator",
",",
"0",
")",
";",
"}"
] | Parses (name, value) pairs from the input and returns the result as a Map. The name is taken from the first column and
value from the second column. If an input line contains only one column its value is defaulted to an empty string.
Any extra columns are ignored.
@param prefix a prefix to apply to the mapped variable names
@param separator the field delimiter
@return a map of (name, value) pairs | [
"Parses",
"(",
"name",
"value",
")",
"pairs",
"from",
"the",
"input",
"and",
"returns",
"the",
"result",
"as",
"a",
"Map",
".",
"The",
"name",
"is",
"taken",
"from",
"the",
"first",
"column",
"and",
"value",
"from",
"the",
"second",
"column",
".",
"If"... | train | https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/plugins/csvars/src/main/java/kg/apc/jmeter/config/VariableFromCsvFileReader.java#L49-L51 |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.parseDuration | public static final long parseDuration(String durationStr, long defaultValue) {
durationStr = durationStr.toLowerCase().trim();
Matcher matcher = DURATION_NUMBER_AND_UNIT_PATTERN.matcher(durationStr);
long millis = 0;
boolean matched = false;
while (matcher.find()) {
long number = Long.valueOf(matcher.group(1)).longValue();
String unit = matcher.group(2);
long multiplier = 0;
for (int j = 0; j < DURATION_UNTIS.length; j++) {
if (unit.equals(DURATION_UNTIS[j])) {
multiplier = DURATION_MULTIPLIERS[j];
break;
}
}
if (multiplier == 0) {
LOG.warn("parseDuration: Unknown unit " + unit);
} else {
matched = true;
}
millis += number * multiplier;
}
if (!matched) {
millis = defaultValue;
}
return millis;
} | java | public static final long parseDuration(String durationStr, long defaultValue) {
durationStr = durationStr.toLowerCase().trim();
Matcher matcher = DURATION_NUMBER_AND_UNIT_PATTERN.matcher(durationStr);
long millis = 0;
boolean matched = false;
while (matcher.find()) {
long number = Long.valueOf(matcher.group(1)).longValue();
String unit = matcher.group(2);
long multiplier = 0;
for (int j = 0; j < DURATION_UNTIS.length; j++) {
if (unit.equals(DURATION_UNTIS[j])) {
multiplier = DURATION_MULTIPLIERS[j];
break;
}
}
if (multiplier == 0) {
LOG.warn("parseDuration: Unknown unit " + unit);
} else {
matched = true;
}
millis += number * multiplier;
}
if (!matched) {
millis = defaultValue;
}
return millis;
} | [
"public",
"static",
"final",
"long",
"parseDuration",
"(",
"String",
"durationStr",
",",
"long",
"defaultValue",
")",
"{",
"durationStr",
"=",
"durationStr",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"Matcher",
"matcher",
"=",
"DURATION_NUMBER_... | Parses a duration and returns the corresponding number of milliseconds.
Durations consist of a space-separated list of components of the form {number}{time unit},
for example 1d 5m. The available units are d (days), h (hours), m (months), s (seconds), ms (milliseconds).<p>
@param durationStr the duration string
@param defaultValue the default value to return in case the pattern does not match
@return the corresponding number of milliseconds | [
"Parses",
"a",
"duration",
"and",
"returns",
"the",
"corresponding",
"number",
"of",
"milliseconds",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1366-L1393 |
Harium/keel | src/main/java/com/harium/keel/effect/rotate/RotateOperation.java | RotateOperation.fillColor | public RotateOperation fillColor(int red, int green, int blue) {
this.fillRed = red;
this.fillGreen = green;
this.fillBlue = blue;
return this;
} | java | public RotateOperation fillColor(int red, int green, int blue) {
this.fillRed = red;
this.fillGreen = green;
this.fillBlue = blue;
return this;
} | [
"public",
"RotateOperation",
"fillColor",
"(",
"int",
"red",
",",
"int",
"green",
",",
"int",
"blue",
")",
"{",
"this",
".",
"fillRed",
"=",
"red",
";",
"this",
".",
"fillGreen",
"=",
"green",
";",
"this",
".",
"fillBlue",
"=",
"blue",
";",
"return",
... | Set Fill color.
@param red Red channel's value.
@param green Green channel's value.
@param blue Blue channel's value. | [
"Set",
"Fill",
"color",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/rotate/RotateOperation.java#L70-L75 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPUtils.java | RTMPUtils.writeReverseInt | public static void writeReverseInt(IoBuffer out, int value) {
out.put((byte) (0xFF & value));
out.put((byte) (0xFF & (value >> 8)));
out.put((byte) (0xFF & (value >> 16)));
out.put((byte) (0xFF & (value >> 24)));
} | java | public static void writeReverseInt(IoBuffer out, int value) {
out.put((byte) (0xFF & value));
out.put((byte) (0xFF & (value >> 8)));
out.put((byte) (0xFF & (value >> 16)));
out.put((byte) (0xFF & (value >> 24)));
} | [
"public",
"static",
"void",
"writeReverseInt",
"(",
"IoBuffer",
"out",
",",
"int",
"value",
")",
"{",
"out",
".",
"put",
"(",
"(",
"byte",
")",
"(",
"0xFF",
"&",
"value",
")",
")",
";",
"out",
".",
"put",
"(",
"(",
"byte",
")",
"(",
"0xFF",
"&",
... | Writes reversed integer to buffer.
@param out
Buffer
@param value
Integer to write | [
"Writes",
"reversed",
"integer",
"to",
"buffer",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPUtils.java#L41-L46 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java | StyleUtils.createMarkerOptions | public static MarkerOptions createMarkerOptions(IconRow icon, float density, IconCache iconCache) {
MarkerOptions markerOptions = new MarkerOptions();
setIcon(markerOptions, icon, density, iconCache);
return markerOptions;
} | java | public static MarkerOptions createMarkerOptions(IconRow icon, float density, IconCache iconCache) {
MarkerOptions markerOptions = new MarkerOptions();
setIcon(markerOptions, icon, density, iconCache);
return markerOptions;
} | [
"public",
"static",
"MarkerOptions",
"createMarkerOptions",
"(",
"IconRow",
"icon",
",",
"float",
"density",
",",
"IconCache",
"iconCache",
")",
"{",
"MarkerOptions",
"markerOptions",
"=",
"new",
"MarkerOptions",
"(",
")",
";",
"setIcon",
"(",
"markerOptions",
","... | Create new marker options populated with the icon
@param icon icon row
@param density display density: {@link android.util.DisplayMetrics#density}
@param iconCache icon cache
@return marker options populated with the icon | [
"Create",
"new",
"marker",
"options",
"populated",
"with",
"the",
"icon"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L235-L241 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/message/HttpCarbonMessage.java | HttpCarbonMessage.setHeader | public void setHeader(String key, Object value) {
this.httpMessage.headers().set(key, value);
} | java | public void setHeader(String key, Object value) {
this.httpMessage.headers().set(key, value);
} | [
"public",
"void",
"setHeader",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"this",
".",
"httpMessage",
".",
"headers",
"(",
")",
".",
"set",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Set the header value for the given name.
@param key header name.
@param value header value as object. | [
"Set",
"the",
"header",
"value",
"for",
"the",
"given",
"name",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/message/HttpCarbonMessage.java#L228-L230 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/RemoveUserAction.java | RemoveUserAction.ensureLastAdminIsNotRemoved | private void ensureLastAdminIsNotRemoved(DbSession dbSession, GroupDto group, UserDto user) {
int remainingAdmins = dbClient.authorizationDao().countUsersWithGlobalPermissionExcludingGroupMember(dbSession,
group.getOrganizationUuid(), OrganizationPermission.ADMINISTER.getKey(), group.getId(), user.getId());
checkRequest(remainingAdmins > 0, "The last administrator user cannot be removed");
} | java | private void ensureLastAdminIsNotRemoved(DbSession dbSession, GroupDto group, UserDto user) {
int remainingAdmins = dbClient.authorizationDao().countUsersWithGlobalPermissionExcludingGroupMember(dbSession,
group.getOrganizationUuid(), OrganizationPermission.ADMINISTER.getKey(), group.getId(), user.getId());
checkRequest(remainingAdmins > 0, "The last administrator user cannot be removed");
} | [
"private",
"void",
"ensureLastAdminIsNotRemoved",
"(",
"DbSession",
"dbSession",
",",
"GroupDto",
"group",
",",
"UserDto",
"user",
")",
"{",
"int",
"remainingAdmins",
"=",
"dbClient",
".",
"authorizationDao",
"(",
")",
".",
"countUsersWithGlobalPermissionExcludingGroupM... | Ensure that there are still users with admin global permission if user is removed from the group. | [
"Ensure",
"that",
"there",
"are",
"still",
"users",
"with",
"admin",
"global",
"permission",
"if",
"user",
"is",
"removed",
"from",
"the",
"group",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/RemoveUserAction.java#L93-L97 |
couchbase/java-dcp-client | src/main/java/com/couchbase/client/dcp/transport/netty/DcpConnectHandler.java | DcpConnectHandler.channelRead0 | @Override
protected void channelRead0(final ChannelHandlerContext ctx, final ByteBuf msg) throws Exception {
ResponseStatus status = MessageUtil.getResponseStatus(msg);
if (status.isSuccess()) {
step++;
switch (step) {
case HELLO:
hello(ctx, msg);
break;
case SELECT:
select(ctx);
break;
case OPEN:
open(ctx);
break;
case REMOVE:
remove(ctx);
break;
default:
originalPromise().setFailure(new IllegalStateException("Unidentified DcpConnection step " + step));
break;
}
} else {
originalPromise().setFailure(new IllegalStateException("Could not open DCP Connection: Failed in the "
+ toString(step) + " step, response status is " + status));
}
} | java | @Override
protected void channelRead0(final ChannelHandlerContext ctx, final ByteBuf msg) throws Exception {
ResponseStatus status = MessageUtil.getResponseStatus(msg);
if (status.isSuccess()) {
step++;
switch (step) {
case HELLO:
hello(ctx, msg);
break;
case SELECT:
select(ctx);
break;
case OPEN:
open(ctx);
break;
case REMOVE:
remove(ctx);
break;
default:
originalPromise().setFailure(new IllegalStateException("Unidentified DcpConnection step " + step));
break;
}
} else {
originalPromise().setFailure(new IllegalStateException("Could not open DCP Connection: Failed in the "
+ toString(step) + " step, response status is " + status));
}
} | [
"@",
"Override",
"protected",
"void",
"channelRead0",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"final",
"ByteBuf",
"msg",
")",
"throws",
"Exception",
"{",
"ResponseStatus",
"status",
"=",
"MessageUtil",
".",
"getResponseStatus",
"(",
"msg",
")",
";",
"... | Once we get a response from the connect request, check if it is successful and complete/fail the connect
phase accordingly. | [
"Once",
"we",
"get",
"a",
"response",
"from",
"the",
"connect",
"request",
"check",
"if",
"it",
"is",
"successful",
"and",
"complete",
"/",
"fail",
"the",
"connect",
"phase",
"accordingly",
"."
] | train | https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/transport/netty/DcpConnectHandler.java#L132-L158 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/NotificationsApi.java | NotificationsApi.notificationsHandshakeWithHttpInfo | public ApiResponse<Void> notificationsHandshakeWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = notificationsHandshakeValidateBeforeCall(null, null);
return apiClient.execute(call);
} | java | public ApiResponse<Void> notificationsHandshakeWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = notificationsHandshakeValidateBeforeCall(null, null);
return apiClient.execute(call);
} | [
"public",
"ApiResponse",
"<",
"Void",
">",
"notificationsHandshakeWithHttpInfo",
"(",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"notificationsHandshakeValidateBeforeCall",
"(",
"null",
",",
"null",
")",
";... | CometD handshake
See the [CometD documentation](https://docs.cometd.org/current/reference/#_bayeux_meta_handshake) for details.
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"CometD",
"handshake",
"See",
"the",
"[",
"CometD",
"documentation",
"]",
"(",
"https",
":",
"//",
"docs",
".",
"cometd",
".",
"org",
"/",
"current",
"/",
"reference",
"/",
"#_bayeux_meta_handshake",
")",
"for",
"details",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/NotificationsApi.java#L455-L458 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassComboBoxUI.java | SeaGlassComboBoxUI.getDefaultSize | @Override
protected Dimension getDefaultSize() {
SynthComboBoxRenderer r = new SynthComboBoxRenderer();
Dimension d = getSizeForComponent(r.getListCellRendererComponent(listBox, " ", -1, false, false));
return new Dimension(d.width, d.height);
} | java | @Override
protected Dimension getDefaultSize() {
SynthComboBoxRenderer r = new SynthComboBoxRenderer();
Dimension d = getSizeForComponent(r.getListCellRendererComponent(listBox, " ", -1, false, false));
return new Dimension(d.width, d.height);
} | [
"@",
"Override",
"protected",
"Dimension",
"getDefaultSize",
"(",
")",
"{",
"SynthComboBoxRenderer",
"r",
"=",
"new",
"SynthComboBoxRenderer",
"(",
")",
";",
"Dimension",
"d",
"=",
"getSizeForComponent",
"(",
"r",
".",
"getListCellRendererComponent",
"(",
"listBox",... | Return the default size of an empty display area of the combo box using
the current renderer and font.
This method was overridden to use SynthComboBoxRenderer instead of
DefaultListCellRenderer as the default renderer when calculating the size
of the combo box. This is used in the case of the combo not having any
data.
@return the size of an empty display area
@see #getDisplaySize | [
"Return",
"the",
"default",
"size",
"of",
"an",
"empty",
"display",
"area",
"of",
"the",
"combo",
"box",
"using",
"the",
"current",
"renderer",
"and",
"font",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassComboBoxUI.java#L408-L413 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/svm/SBP.java | SBP.setNu | public void setNu(double nu)
{
if(Double.isNaN(nu) || nu <= 0 || nu >= 1)
throw new IllegalArgumentException("nu must be in the range (0, 1)");
this.nu = nu;
} | java | public void setNu(double nu)
{
if(Double.isNaN(nu) || nu <= 0 || nu >= 1)
throw new IllegalArgumentException("nu must be in the range (0, 1)");
this.nu = nu;
} | [
"public",
"void",
"setNu",
"(",
"double",
"nu",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"nu",
")",
"||",
"nu",
"<=",
"0",
"||",
"nu",
">=",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"nu must be in the range (0, 1)\"",
")",
";... | The nu parameter for this SVM is not the same as the standard nu-SVM
formulation, though it plays a similar role. It must be in the range
(0, 1), where small values indicate a linearly separable problem (in the
kernel space), and large values mean the problem is less separable. If
the value is too small for the problem, the SVM may fail to converge or
produce good results.
@param nu the value between (0, 1) | [
"The",
"nu",
"parameter",
"for",
"this",
"SVM",
"is",
"not",
"the",
"same",
"as",
"the",
"standard",
"nu",
"-",
"SVM",
"formulation",
"though",
"it",
"plays",
"a",
"similar",
"role",
".",
"It",
"must",
"be",
"in",
"the",
"range",
"(",
"0",
"1",
")",
... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/SBP.java#L106-L111 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/keyboard/ExtensionKeyboard.java | ExtensionKeyboard.hasSameDefaultAccelerator | private static boolean hasSameDefaultAccelerator(KeyboardMapping km, KeyStroke ks) {
KeyStroke kmKs = km.getDefaultKeyStroke();
if (kmKs == null) {
return false;
}
return kmKs.getKeyCode() == ks.getKeyCode() && kmKs.getModifiers() == ks.getModifiers();
} | java | private static boolean hasSameDefaultAccelerator(KeyboardMapping km, KeyStroke ks) {
KeyStroke kmKs = km.getDefaultKeyStroke();
if (kmKs == null) {
return false;
}
return kmKs.getKeyCode() == ks.getKeyCode() && kmKs.getModifiers() == ks.getModifiers();
} | [
"private",
"static",
"boolean",
"hasSameDefaultAccelerator",
"(",
"KeyboardMapping",
"km",
",",
"KeyStroke",
"ks",
")",
"{",
"KeyStroke",
"kmKs",
"=",
"km",
".",
"getDefaultKeyStroke",
"(",
")",
";",
"if",
"(",
"kmKs",
"==",
"null",
")",
"{",
"return",
"fals... | Tells whether or not the given keyboard mapping has the given default accelerator.
@param km the keyboard mapping to check.
@param ks the accelerator.
@return {@code true} if the keyboard mapping has the given default accelerator, {@code false} otherwise. | [
"Tells",
"whether",
"or",
"not",
"the",
"given",
"keyboard",
"mapping",
"has",
"the",
"given",
"default",
"accelerator",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/keyboard/ExtensionKeyboard.java#L163-L169 |
pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java | EntityUtilities.findLocaleFromString | public static LocaleWrapper findLocaleFromString(final CollectionWrapper<LocaleWrapper> locales, final String localeString) {
if (localeString == null) return null;
for (final LocaleWrapper locale : locales.getItems()) {
if (localeString.equals(locale.getValue())) {
return locale;
}
}
return null;
} | java | public static LocaleWrapper findLocaleFromString(final CollectionWrapper<LocaleWrapper> locales, final String localeString) {
if (localeString == null) return null;
for (final LocaleWrapper locale : locales.getItems()) {
if (localeString.equals(locale.getValue())) {
return locale;
}
}
return null;
} | [
"public",
"static",
"LocaleWrapper",
"findLocaleFromString",
"(",
"final",
"CollectionWrapper",
"<",
"LocaleWrapper",
">",
"locales",
",",
"final",
"String",
"localeString",
")",
"{",
"if",
"(",
"localeString",
"==",
"null",
")",
"return",
"null",
";",
"for",
"(... | Finds the matching locale entity from a locale string.
@param localeProvider
@param localeString
@return | [
"Finds",
"the",
"matching",
"locale",
"entity",
"from",
"a",
"locale",
"string",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L452-L462 |
brettwooldridge/HikariCP | src/main/java/com/zaxxer/hikari/pool/PoolBase.java | PoolBase.executeSql | private void executeSql(final Connection connection, final String sql, final boolean isCommit) throws SQLException
{
if (sql != null) {
try (Statement statement = connection.createStatement()) {
// connection was created a few milliseconds before, so set query timeout is omitted (we assume it will succeed)
statement.execute(sql);
}
if (isIsolateInternalQueries && !isAutoCommit) {
if (isCommit) {
connection.commit();
}
else {
connection.rollback();
}
}
}
} | java | private void executeSql(final Connection connection, final String sql, final boolean isCommit) throws SQLException
{
if (sql != null) {
try (Statement statement = connection.createStatement()) {
// connection was created a few milliseconds before, so set query timeout is omitted (we assume it will succeed)
statement.execute(sql);
}
if (isIsolateInternalQueries && !isAutoCommit) {
if (isCommit) {
connection.commit();
}
else {
connection.rollback();
}
}
}
} | [
"private",
"void",
"executeSql",
"(",
"final",
"Connection",
"connection",
",",
"final",
"String",
"sql",
",",
"final",
"boolean",
"isCommit",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"sql",
"!=",
"null",
")",
"{",
"try",
"(",
"Statement",
"statement",... | Execute the user-specified init SQL.
@param connection the connection to initialize
@param sql the SQL to execute
@param isCommit whether to commit the SQL after execution or not
@throws SQLException throws if the init SQL execution fails | [
"Execute",
"the",
"user",
"-",
"specified",
"init",
"SQL",
"."
] | train | https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L564-L581 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java | EqualsBuilder.isRegistered | @GwtIncompatible("incompatible method")
static boolean isRegistered(final Object lhs, final Object rhs) {
final Set<Pair<IDKey, IDKey>> registry = getRegistry();
final Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
final Pair<IDKey, IDKey> swappedPair = Pair.of(pair.getRight(), pair.getLeft());
return registry != null
&& (registry.contains(pair) || registry.contains(swappedPair));
} | java | @GwtIncompatible("incompatible method")
static boolean isRegistered(final Object lhs, final Object rhs) {
final Set<Pair<IDKey, IDKey>> registry = getRegistry();
final Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
final Pair<IDKey, IDKey> swappedPair = Pair.of(pair.getRight(), pair.getLeft());
return registry != null
&& (registry.contains(pair) || registry.contains(swappedPair));
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"static",
"boolean",
"isRegistered",
"(",
"final",
"Object",
"lhs",
",",
"final",
"Object",
"rhs",
")",
"{",
"final",
"Set",
"<",
"Pair",
"<",
"IDKey",
",",
"IDKey",
">",
">",
"registry",
"=",
"g... | <p>
Returns <code>true</code> if the registry contains the given object pair.
Used by the reflection methods to avoid infinite loops.
Objects might be swapped therefore a check is needed if the object pair
is registered in given or swapped order.
</p>
@param lhs <code>this</code> object to lookup in registry
@param rhs the other object to lookup on registry
@return boolean <code>true</code> if the registry contains the given object.
@since 3.0 | [
"<p",
">",
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"registry",
"contains",
"the",
"given",
"object",
"pair",
".",
"Used",
"by",
"the",
"reflection",
"methods",
"to",
"avoid",
"infinite",
"loops",
".",
"Objects",
"might",
"be",
"s... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java#L161-L169 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/CircuitsConfig.java | CircuitsConfig.exports | public static void exports(Media media, Map<Circuit, Collection<TileRef>> circuits)
{
Check.notNull(media);
Check.notNull(circuits);
final Xml nodeCircuits = new Xml(NODE_CIRCUITS);
for (final Map.Entry<Circuit, Collection<TileRef>> entry : circuits.entrySet())
{
final Circuit circuit = entry.getKey();
final Xml nodeCircuit = nodeCircuits.createChild(NODE_CIRCUIT);
nodeCircuit.writeString(ATT_CIRCUIT_TYPE, circuit.getType().name());
nodeCircuit.writeString(ATT_GROUP_IN, circuit.getIn());
nodeCircuit.writeString(ATT_GROUP_OUT, circuit.getOut());
exportTiles(nodeCircuit, entry.getValue());
}
nodeCircuits.save(media);
} | java | public static void exports(Media media, Map<Circuit, Collection<TileRef>> circuits)
{
Check.notNull(media);
Check.notNull(circuits);
final Xml nodeCircuits = new Xml(NODE_CIRCUITS);
for (final Map.Entry<Circuit, Collection<TileRef>> entry : circuits.entrySet())
{
final Circuit circuit = entry.getKey();
final Xml nodeCircuit = nodeCircuits.createChild(NODE_CIRCUIT);
nodeCircuit.writeString(ATT_CIRCUIT_TYPE, circuit.getType().name());
nodeCircuit.writeString(ATT_GROUP_IN, circuit.getIn());
nodeCircuit.writeString(ATT_GROUP_OUT, circuit.getOut());
exportTiles(nodeCircuit, entry.getValue());
}
nodeCircuits.save(media);
} | [
"public",
"static",
"void",
"exports",
"(",
"Media",
"media",
",",
"Map",
"<",
"Circuit",
",",
"Collection",
"<",
"TileRef",
">",
">",
"circuits",
")",
"{",
"Check",
".",
"notNull",
"(",
"media",
")",
";",
"Check",
".",
"notNull",
"(",
"circuits",
")",... | Export all circuits to an XML file.
@param media The export output (must not be <code>null</code>).
@param circuits The circuits reference (must not be <code>null</code>).
@throws LionEngineException If error on export. | [
"Export",
"all",
"circuits",
"to",
"an",
"XML",
"file",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/CircuitsConfig.java#L119-L138 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.expectIpv6 | public void expectIpv6(String name, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
if (!InetAddressValidator.getInstance().isValidInet6Address(value)) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.IPV6_KEY.name(), name)));
}
} | java | public void expectIpv6(String name, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
if (!InetAddressValidator.getInstance().isValidInet6Address(value)) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.IPV6_KEY.name(), name)));
}
} | [
"public",
"void",
"expectIpv6",
"(",
"String",
"name",
",",
"String",
"message",
")",
"{",
"String",
"value",
"=",
"Optional",
".",
"ofNullable",
"(",
"get",
"(",
"name",
")",
")",
".",
"orElse",
"(",
"\"\"",
")",
";",
"if",
"(",
"!",
"InetAddressValid... | Validates a field to be a valid IPv6 address
@param name The field to check
@param message A custom error message instead of the default one | [
"Validates",
"a",
"field",
"to",
"be",
"a",
"valid",
"IPv6",
"address"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L326-L332 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/ViewpointsAndPerspectivesDocumentationTemplate.java | ViewpointsAndPerspectivesDocumentationTemplate.addArchitecturalForcesSection | public Section addArchitecturalForcesSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "Architectural Forces", files);
} | java | public Section addArchitecturalForcesSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "Architectural Forces", files);
} | [
"public",
"Section",
"addArchitecturalForcesSection",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"return",
"addSection",
"(",
"softwareSystem",
",",
"\"Architectural Forces\"",
",",
"files",
")",
";",
"}"
] | Adds an "Architectural Forces" section relating to a {@link SoftwareSystem} from one or more files.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files | [
"Adds",
"an",
"Architectural",
"Forces",
"section",
"relating",
"to",
"a",
"{",
"@link",
"SoftwareSystem",
"}",
"from",
"one",
"or",
"more",
"files",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/ViewpointsAndPerspectivesDocumentationTemplate.java#L116-L118 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNamedNodeMap.java | DTMNamedNodeMap.getNamedItemNS | public Node getNamedItemNS(String namespaceURI, String localName)
{
Node retNode = null;
for (int n = dtm.getFirstAttribute(element); n != DTM.NULL;
n = dtm.getNextAttribute(n))
{
if (localName.equals(dtm.getLocalName(n)))
{
String nsURI = dtm.getNamespaceURI(n);
if ((namespaceURI == null && nsURI == null)
|| (namespaceURI != null && namespaceURI.equals(nsURI)))
{
retNode = dtm.getNode(n);
break;
}
}
}
return retNode;
} | java | public Node getNamedItemNS(String namespaceURI, String localName)
{
Node retNode = null;
for (int n = dtm.getFirstAttribute(element); n != DTM.NULL;
n = dtm.getNextAttribute(n))
{
if (localName.equals(dtm.getLocalName(n)))
{
String nsURI = dtm.getNamespaceURI(n);
if ((namespaceURI == null && nsURI == null)
|| (namespaceURI != null && namespaceURI.equals(nsURI)))
{
retNode = dtm.getNode(n);
break;
}
}
}
return retNode;
} | [
"public",
"Node",
"getNamedItemNS",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
")",
"{",
"Node",
"retNode",
"=",
"null",
";",
"for",
"(",
"int",
"n",
"=",
"dtm",
".",
"getFirstAttribute",
"(",
"element",
")",
";",
"n",
"!=",
"DTM",
".",
... | Retrieves a node specified by local name and namespace URI. HTML-only
DOM implementations do not need to implement this method.
@param namespaceURI The namespace URI of the node to retrieve.
@param localName The local name of the node to retrieve.
@return A <code>Node</code> (of any type) with the specified local
name and namespace URI, or <code>null</code> if they do not
identify any node in this map.
@since DOM Level 2 | [
"Retrieves",
"a",
"node",
"specified",
"by",
"local",
"name",
"and",
"namespace",
"URI",
".",
"HTML",
"-",
"only",
"DOM",
"implementations",
"do",
"not",
"need",
"to",
"implement",
"this",
"method",
".",
"@param",
"namespaceURI",
"The",
"namespace",
"URI",
"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNamedNodeMap.java#L197-L215 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CardUrl.java | CardUrl.deleteAccountCardUrl | public static MozuUrl deleteAccountCardUrl(Integer accountId, String cardId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/cards/{cardId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("cardId", cardId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteAccountCardUrl(Integer accountId, String cardId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/cards/{cardId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("cardId", cardId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteAccountCardUrl",
"(",
"Integer",
"accountId",
",",
"String",
"cardId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/accounts/{accountId}/cards/{cardId}\"",
")",
";",
"formatter",
".... | Get Resource Url for DeleteAccountCard
@param accountId Unique identifier of the customer account.
@param cardId Unique identifier of the card associated with the customer account billing contact.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteAccountCard"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CardUrl.java#L82-L88 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java | BoxApiFolder.getCopyRequest | public BoxRequestsFolder.CopyFolder getCopyRequest(String id, String parentId) {
BoxRequestsFolder.CopyFolder request = new BoxRequestsFolder.CopyFolder(id, parentId, getFolderCopyUrl(id), mSession);
return request;
} | java | public BoxRequestsFolder.CopyFolder getCopyRequest(String id, String parentId) {
BoxRequestsFolder.CopyFolder request = new BoxRequestsFolder.CopyFolder(id, parentId, getFolderCopyUrl(id), mSession);
return request;
} | [
"public",
"BoxRequestsFolder",
".",
"CopyFolder",
"getCopyRequest",
"(",
"String",
"id",
",",
"String",
"parentId",
")",
"{",
"BoxRequestsFolder",
".",
"CopyFolder",
"request",
"=",
"new",
"BoxRequestsFolder",
".",
"CopyFolder",
"(",
"id",
",",
"parentId",
",",
... | Gets a request that copies a folder
@param id id of folder to copy
@param parentId id of parent folder to copy folder into
@return request to copy a folder | [
"Gets",
"a",
"request",
"that",
"copies",
"a",
"folder"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java#L170-L173 |
apache/flink | flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java | QueryableStateClient.getKvState | @PublicEvolving
public <K, S extends State, V> CompletableFuture<S> getKvState(
final JobID jobId,
final String queryableStateName,
final K key,
final TypeHint<K> keyTypeHint,
final StateDescriptor<S, V> stateDescriptor) {
Preconditions.checkNotNull(keyTypeHint);
TypeInformation<K> keyTypeInfo = keyTypeHint.getTypeInfo();
return getKvState(jobId, queryableStateName, key, keyTypeInfo, stateDescriptor);
} | java | @PublicEvolving
public <K, S extends State, V> CompletableFuture<S> getKvState(
final JobID jobId,
final String queryableStateName,
final K key,
final TypeHint<K> keyTypeHint,
final StateDescriptor<S, V> stateDescriptor) {
Preconditions.checkNotNull(keyTypeHint);
TypeInformation<K> keyTypeInfo = keyTypeHint.getTypeInfo();
return getKvState(jobId, queryableStateName, key, keyTypeInfo, stateDescriptor);
} | [
"@",
"PublicEvolving",
"public",
"<",
"K",
",",
"S",
"extends",
"State",
",",
"V",
">",
"CompletableFuture",
"<",
"S",
">",
"getKvState",
"(",
"final",
"JobID",
"jobId",
",",
"final",
"String",
"queryableStateName",
",",
"final",
"K",
"key",
",",
"final",
... | Returns a future holding the request result.
@param jobId JobID of the job the queryable state belongs to.
@param queryableStateName Name under which the state is queryable.
@param key The key we are interested in.
@param keyTypeHint A {@link TypeHint} used to extract the type of the key.
@param stateDescriptor The {@link StateDescriptor} of the state we want to query.
@return Future holding the immutable {@link State} object containing the result. | [
"Returns",
"a",
"future",
"holding",
"the",
"request",
"result",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java#L196-L208 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java | Hierarchy.resolveMethodCallTargets | public static Set<JavaClassAndMethod> resolveMethodCallTargets(ReferenceType receiverType,
InvokeInstruction invokeInstruction, ConstantPoolGen cpg) throws ClassNotFoundException {
return resolveMethodCallTargets(receiverType, invokeInstruction, cpg, false);
} | java | public static Set<JavaClassAndMethod> resolveMethodCallTargets(ReferenceType receiverType,
InvokeInstruction invokeInstruction, ConstantPoolGen cpg) throws ClassNotFoundException {
return resolveMethodCallTargets(receiverType, invokeInstruction, cpg, false);
} | [
"public",
"static",
"Set",
"<",
"JavaClassAndMethod",
">",
"resolveMethodCallTargets",
"(",
"ReferenceType",
"receiverType",
",",
"InvokeInstruction",
"invokeInstruction",
",",
"ConstantPoolGen",
"cpg",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"resolveMethodC... | Resolve possible instance method call targets. Assumes that invokevirtual
and invokeinterface methods may call any subtype of the receiver class.
@param receiverType
type of the receiver object
@param invokeInstruction
the InvokeInstruction
@param cpg
the ConstantPoolGen
@return Set of methods which might be called
@throws ClassNotFoundException | [
"Resolve",
"possible",
"instance",
"method",
"call",
"targets",
".",
"Assumes",
"that",
"invokevirtual",
"and",
"invokeinterface",
"methods",
"may",
"call",
"any",
"subtype",
"of",
"the",
"receiver",
"class",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L774-L777 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.checkArgument | public static void checkArgument(boolean b, String errorMessageTemplate, double p) {
if (!b) {
throw new IllegalArgumentException(format(errorMessageTemplate, p));
}
} | java | public static void checkArgument(boolean b, String errorMessageTemplate, double p) {
if (!b) {
throw new IllegalArgumentException(format(errorMessageTemplate, p));
}
} | [
"public",
"static",
"void",
"checkArgument",
"(",
"boolean",
"b",
",",
"String",
"errorMessageTemplate",
",",
"double",
"p",
")",
"{",
"if",
"(",
"!",
"b",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"errorMessageTemplate",
",",
... | Ensures the truth of an expression involving one or more parameters to the calling method.
<p>See {@link #checkArgument(boolean, String, Object...)} for details. | [
"Ensures",
"the",
"truth",
"of",
"an",
"expression",
"involving",
"one",
"or",
"more",
"parameters",
"to",
"the",
"calling",
"method",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L5471-L5475 |
VoltDB/voltdb | src/frontend/org/voltdb/planner/parseinfo/JoinNode.java | JoinNode.reconstructJoinTreeFromTableNodes | public static JoinNode reconstructJoinTreeFromTableNodes(List<JoinNode> tableNodes, JoinType joinType) {
JoinNode root = null;
for (JoinNode leafNode : tableNodes) {
JoinNode node = leafNode.cloneWithoutFilters();
if (root == null) {
root = node;
} else {
// We only care about the root node id to be able to reconnect the sub-trees
// The intermediate node id can be anything. For the final root node its id
// will be set later to the original tree's root id
root = new BranchNode(-node.m_id, joinType, root, node);
}
}
return root;
} | java | public static JoinNode reconstructJoinTreeFromTableNodes(List<JoinNode> tableNodes, JoinType joinType) {
JoinNode root = null;
for (JoinNode leafNode : tableNodes) {
JoinNode node = leafNode.cloneWithoutFilters();
if (root == null) {
root = node;
} else {
// We only care about the root node id to be able to reconnect the sub-trees
// The intermediate node id can be anything. For the final root node its id
// will be set later to the original tree's root id
root = new BranchNode(-node.m_id, joinType, root, node);
}
}
return root;
} | [
"public",
"static",
"JoinNode",
"reconstructJoinTreeFromTableNodes",
"(",
"List",
"<",
"JoinNode",
">",
"tableNodes",
",",
"JoinType",
"joinType",
")",
"{",
"JoinNode",
"root",
"=",
"null",
";",
"for",
"(",
"JoinNode",
"leafNode",
":",
"tableNodes",
")",
"{",
... | Reconstruct a join tree from the list of tables always appending the next node to the right.
@param tableNodes the list of tables to build the tree from.
@param JoinType the join type for all the joins
@return The reconstructed tree | [
"Reconstruct",
"a",
"join",
"tree",
"from",
"the",
"list",
"of",
"tables",
"always",
"appending",
"the",
"next",
"node",
"to",
"the",
"right",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/parseinfo/JoinNode.java#L335-L349 |
alkacon/opencms-core | src/org/opencms/gwt/CmsBrokenLinkRenderer.java | CmsBrokenLinkRenderer.addPageInfo | protected void addPageInfo(CmsBrokenLinkBean bean, String extraTitle, String extraPath) {
if (extraTitle != null) {
bean.addInfo(messagePageTitle(), "" + extraTitle);
}
if (extraPath != null) {
bean.addInfo(messagePagePath(), "" + extraPath);
}
} | java | protected void addPageInfo(CmsBrokenLinkBean bean, String extraTitle, String extraPath) {
if (extraTitle != null) {
bean.addInfo(messagePageTitle(), "" + extraTitle);
}
if (extraPath != null) {
bean.addInfo(messagePagePath(), "" + extraPath);
}
} | [
"protected",
"void",
"addPageInfo",
"(",
"CmsBrokenLinkBean",
"bean",
",",
"String",
"extraTitle",
",",
"String",
"extraPath",
")",
"{",
"if",
"(",
"extraTitle",
"!=",
"null",
")",
"{",
"bean",
".",
"addInfo",
"(",
"messagePageTitle",
"(",
")",
",",
"\"\"",
... | Adds optional page information to the broken link bean.<p>
@param bean the broken link bean
@param extraTitle the optional page title
@param extraPath the optional page path | [
"Adds",
"optional",
"page",
"information",
"to",
"the",
"broken",
"link",
"bean",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsBrokenLinkRenderer.java#L227-L235 |
prolificinteractive/material-calendarview | library/src/main/java/com/prolificinteractive/materialcalendarview/CalendarPagerAdapter.java | CalendarPagerAdapter.setDateSelected | public void setDateSelected(CalendarDay day, boolean selected) {
if (selected) {
if (!selectedDates.contains(day)) {
selectedDates.add(day);
invalidateSelectedDates();
}
} else {
if (selectedDates.contains(day)) {
selectedDates.remove(day);
invalidateSelectedDates();
}
}
} | java | public void setDateSelected(CalendarDay day, boolean selected) {
if (selected) {
if (!selectedDates.contains(day)) {
selectedDates.add(day);
invalidateSelectedDates();
}
} else {
if (selectedDates.contains(day)) {
selectedDates.remove(day);
invalidateSelectedDates();
}
}
} | [
"public",
"void",
"setDateSelected",
"(",
"CalendarDay",
"day",
",",
"boolean",
"selected",
")",
"{",
"if",
"(",
"selected",
")",
"{",
"if",
"(",
"!",
"selectedDates",
".",
"contains",
"(",
"day",
")",
")",
"{",
"selectedDates",
".",
"add",
"(",
"day",
... | Select or un-select a day.
@param day Day to select or un-select
@param selected Whether to select or un-select the day from the list.
@see CalendarPagerAdapter#selectRange(CalendarDay, CalendarDay) | [
"Select",
"or",
"un",
"-",
"select",
"a",
"day",
"."
] | train | https://github.com/prolificinteractive/material-calendarview/blob/04fae8175fd034d0a7131f8cb253cae883a88aa2/library/src/main/java/com/prolificinteractive/materialcalendarview/CalendarPagerAdapter.java#L303-L315 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toNodeList | public static NodeList toNodeList(Object o, NodeList defaultValue) {
// print.ln("nodeList:"+o);
if (o instanceof NodeList) {
return (NodeList) o;
}
else if (o instanceof ObjectWrap) {
return toNodeList(((ObjectWrap) o).getEmbededObject(defaultValue), defaultValue);
}
return defaultValue;
} | java | public static NodeList toNodeList(Object o, NodeList defaultValue) {
// print.ln("nodeList:"+o);
if (o instanceof NodeList) {
return (NodeList) o;
}
else if (o instanceof ObjectWrap) {
return toNodeList(((ObjectWrap) o).getEmbededObject(defaultValue), defaultValue);
}
return defaultValue;
} | [
"public",
"static",
"NodeList",
"toNodeList",
"(",
"Object",
"o",
",",
"NodeList",
"defaultValue",
")",
"{",
"// print.ln(\"nodeList:\"+o);",
"if",
"(",
"o",
"instanceof",
"NodeList",
")",
"{",
"return",
"(",
"NodeList",
")",
"o",
";",
"}",
"else",
"if",
"("... | casts a Object to a Node List
@param o Object to Cast
@param defaultValue
@return NodeList from Object | [
"casts",
"a",
"Object",
"to",
"a",
"Node",
"List"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L4289-L4298 |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.setSocketAddr | public void setSocketAddr(String name, InetSocketAddress addr) {
set(name, NetUtils.getHostPortString(addr));
} | java | public void setSocketAddr(String name, InetSocketAddress addr) {
set(name, NetUtils.getHostPortString(addr));
} | [
"public",
"void",
"setSocketAddr",
"(",
"String",
"name",
",",
"InetSocketAddress",
"addr",
")",
"{",
"set",
"(",
"name",
",",
"NetUtils",
".",
"getHostPortString",
"(",
"addr",
")",
")",
";",
"}"
] | Set the socket address for the <code>name</code> property as
a <code>host:port</code>. | [
"Set",
"the",
"socket",
"address",
"for",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"a",
"<code",
">",
"host",
":",
"port<",
"/",
"code",
">",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2312-L2314 |
ltearno/hexa.tools | hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/Properties.java | Properties.getObjectDynamicProperty | public static <T> T getObjectDynamicProperty( Object object, String propertyName )
{
return propertyValues.getObjectDynamicProperty(object, propertyName);
} | java | public static <T> T getObjectDynamicProperty( Object object, String propertyName )
{
return propertyValues.getObjectDynamicProperty(object, propertyName);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getObjectDynamicProperty",
"(",
"Object",
"object",
",",
"String",
"propertyName",
")",
"{",
"return",
"propertyValues",
".",
"getObjectDynamicProperty",
"(",
"object",
",",
"propertyName",
")",
";",
"}"
] | Gets a dynamic property value on an object
@param object the object from which one wants to get the property value
@param propertyName the property name | [
"Gets",
"a",
"dynamic",
"property",
"value",
"on",
"an",
"object"
] | train | https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/Properties.java#L152-L155 |
HubSpot/Singularity | SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java | SingularityClient.isUserAuthorized | public boolean isUserAuthorized(String requestId, String userId, SingularityAuthorizationScope scope) {
final Function<String, String> requestUri = (host) -> String.format(AUTH_CHECK_USER_FORMAT, getApiBase(host), requestId, userId);
Map<String, Object> params = Collections.singletonMap("scope", scope.name());
HttpResponse response = executeGetSingleWithParams(requestUri, "auth check", "", Optional.of(params));
return response.isSuccess();
} | java | public boolean isUserAuthorized(String requestId, String userId, SingularityAuthorizationScope scope) {
final Function<String, String> requestUri = (host) -> String.format(AUTH_CHECK_USER_FORMAT, getApiBase(host), requestId, userId);
Map<String, Object> params = Collections.singletonMap("scope", scope.name());
HttpResponse response = executeGetSingleWithParams(requestUri, "auth check", "", Optional.of(params));
return response.isSuccess();
} | [
"public",
"boolean",
"isUserAuthorized",
"(",
"String",
"requestId",
",",
"String",
"userId",
",",
"SingularityAuthorizationScope",
"scope",
")",
"{",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"requestUri",
"=",
"(",
"host",
")",
"-",
">",
"Strin... | Check if a user is authorized for the specified scope on the specified request
@param requestId
The request to check authorization on
@param userId
The user whose authorization will be checked
@param scope
The scope to check that `user` has
@return
true if the user is authorized for scope, false otherwise | [
"Check",
"if",
"a",
"user",
"is",
"authorized",
"for",
"the",
"specified",
"scope",
"on",
"the",
"specified",
"request"
] | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L1521-L1526 |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.setRow | public void setRow(int i, Vector row) {
if (columns != row.length()) {
fail("Wrong vector length: " + row.length() + ". Should be: " + columns + ".");
}
for (int j = 0; j < row.length(); j++) {
set(i, j, row.get(j));
}
} | java | public void setRow(int i, Vector row) {
if (columns != row.length()) {
fail("Wrong vector length: " + row.length() + ". Should be: " + columns + ".");
}
for (int j = 0; j < row.length(); j++) {
set(i, j, row.get(j));
}
} | [
"public",
"void",
"setRow",
"(",
"int",
"i",
",",
"Vector",
"row",
")",
"{",
"if",
"(",
"columns",
"!=",
"row",
".",
"length",
"(",
")",
")",
"{",
"fail",
"(",
"\"Wrong vector length: \"",
"+",
"row",
".",
"length",
"(",
")",
"+",
"\". Should be: \"",
... | Copies given {@code row} into the specified row of this matrix.
@param i the row index
@param row the row represented as vector | [
"Copies",
"given",
"{",
"@code",
"row",
"}",
"into",
"the",
"specified",
"row",
"of",
"this",
"matrix",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1014-L1022 |
aws/aws-sdk-java | aws-java-sdk-elasticsearch/src/main/java/com/amazonaws/services/elasticsearch/model/ElasticsearchDomainStatus.java | ElasticsearchDomainStatus.withEndpoints | public ElasticsearchDomainStatus withEndpoints(java.util.Map<String, String> endpoints) {
setEndpoints(endpoints);
return this;
} | java | public ElasticsearchDomainStatus withEndpoints(java.util.Map<String, String> endpoints) {
setEndpoints(endpoints);
return this;
} | [
"public",
"ElasticsearchDomainStatus",
"withEndpoints",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"endpoints",
")",
"{",
"setEndpoints",
"(",
"endpoints",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Map containing the Elasticsearch domain endpoints used to submit index and search requests. Example
<code>key, value</code>:
<code>'vpc','vpc-endpoint-h2dsd34efgyghrtguk5gt6j2foh4.us-east-1.es.amazonaws.com'</code>.
</p>
@param endpoints
Map containing the Elasticsearch domain endpoints used to submit index and search requests. Example
<code>key, value</code>:
<code>'vpc','vpc-endpoint-h2dsd34efgyghrtguk5gt6j2foh4.us-east-1.es.amazonaws.com'</code>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Map",
"containing",
"the",
"Elasticsearch",
"domain",
"endpoints",
"used",
"to",
"submit",
"index",
"and",
"search",
"requests",
".",
"Example",
"<code",
">",
"key",
"value<",
"/",
"code",
">",
":",
"<code",
">",
"vpc",
"vpc",
"-",
"endpoint",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-elasticsearch/src/main/java/com/amazonaws/services/elasticsearch/model/ElasticsearchDomainStatus.java#L534-L537 |
apache/groovy | src/main/java/org/codehaus/groovy/vmplugin/v7/TypeHelper.java | TypeHelper.argumentClassIsParameterClass | protected static boolean argumentClassIsParameterClass(Class argumentClass, Class parameterClass) {
if (argumentClass == parameterClass) return true;
if (getWrapperClass(parameterClass) == argumentClass) return true;
return false;
} | java | protected static boolean argumentClassIsParameterClass(Class argumentClass, Class parameterClass) {
if (argumentClass == parameterClass) return true;
if (getWrapperClass(parameterClass) == argumentClass) return true;
return false;
} | [
"protected",
"static",
"boolean",
"argumentClassIsParameterClass",
"(",
"Class",
"argumentClass",
",",
"Class",
"parameterClass",
")",
"{",
"if",
"(",
"argumentClass",
"==",
"parameterClass",
")",
"return",
"true",
";",
"if",
"(",
"getWrapperClass",
"(",
"parameterC... | Realizes an unsharp equal for the class.
In general we return true if the provided arguments are the same. But
we will also return true if our argument class is a wrapper for
the parameter class. For example the parameter is an int and the
argument class is a wrapper. | [
"Realizes",
"an",
"unsharp",
"equal",
"for",
"the",
"class",
".",
"In",
"general",
"we",
"return",
"true",
"if",
"the",
"provided",
"arguments",
"are",
"the",
"same",
".",
"But",
"we",
"will",
"also",
"return",
"true",
"if",
"our",
"argument",
"class",
"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v7/TypeHelper.java#L66-L70 |
jenetics/jenetics | jenetics/src/main/java/io/jenetics/engine/Codecs.java | Codecs.ofVector | public static <A> Codec<ISeq<A>, AnyGene<A>> ofVector(
final Supplier<? extends A> supplier,
final int length
) {
return ofVector(supplier, Predicates.TRUE, length);
} | java | public static <A> Codec<ISeq<A>, AnyGene<A>> ofVector(
final Supplier<? extends A> supplier,
final int length
) {
return ofVector(supplier, Predicates.TRUE, length);
} | [
"public",
"static",
"<",
"A",
">",
"Codec",
"<",
"ISeq",
"<",
"A",
">",
",",
"AnyGene",
"<",
"A",
">",
">",
"ofVector",
"(",
"final",
"Supplier",
"<",
"?",
"extends",
"A",
">",
"supplier",
",",
"final",
"int",
"length",
")",
"{",
"return",
"ofVecto... | Return a scala {@code Codec} with the given allele {@link Supplier} and
{@code Chromosome} length. The {@code supplier} is responsible for
creating new random alleles.
@param <A> the allele type
@param supplier the allele-supplier which is used for creating new,
random alleles
@param length the vector length
@return a new {@code Codec} with the given parameters
@throws NullPointerException if one of the parameters is {@code null}
@throws IllegalArgumentException if the length of the vector is smaller
than one. | [
"Return",
"a",
"scala",
"{",
"@code",
"Codec",
"}",
"with",
"the",
"given",
"allele",
"{",
"@link",
"Supplier",
"}",
"and",
"{",
"@code",
"Chromosome",
"}",
"length",
".",
"The",
"{",
"@code",
"supplier",
"}",
"is",
"responsible",
"for",
"creating",
"new... | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Codecs.java#L458-L463 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataAllValuesFromImpl_CustomFieldSerializer.java | OWLDataAllValuesFromImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLDataAllValuesFromImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLDataAllValuesFromImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLDataAllValuesFromImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataAllValuesFromImpl_CustomFieldSerializer.java#L94-L97 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java | CollectionLiteralsTypeComputer.isSubtypeButNotSynonym | protected boolean isSubtypeButNotSynonym(LightweightTypeReference expectation, Class<?> clazz) {
if (expectation.isType(clazz)) {
return true;
}
ITypeReferenceOwner owner = expectation.getOwner();
JvmType declaredType = owner.getServices().getTypeReferences().findDeclaredType(clazz, owner.getContextResourceSet());
if (declaredType == null) {
return false;
}
LightweightTypeReference superType = owner.newParameterizedTypeReference(declaredType);
// don't allow synonyms, e.g. Iterable is not considered to be a supertype of Functions.Function0
boolean result = superType.isAssignableFrom(expectation.getRawTypeReference(),
new TypeConformanceComputationArgument(false, false, true, true, false, false));
return result;
} | java | protected boolean isSubtypeButNotSynonym(LightweightTypeReference expectation, Class<?> clazz) {
if (expectation.isType(clazz)) {
return true;
}
ITypeReferenceOwner owner = expectation.getOwner();
JvmType declaredType = owner.getServices().getTypeReferences().findDeclaredType(clazz, owner.getContextResourceSet());
if (declaredType == null) {
return false;
}
LightweightTypeReference superType = owner.newParameterizedTypeReference(declaredType);
// don't allow synonyms, e.g. Iterable is not considered to be a supertype of Functions.Function0
boolean result = superType.isAssignableFrom(expectation.getRawTypeReference(),
new TypeConformanceComputationArgument(false, false, true, true, false, false));
return result;
} | [
"protected",
"boolean",
"isSubtypeButNotSynonym",
"(",
"LightweightTypeReference",
"expectation",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"expectation",
".",
"isType",
"(",
"clazz",
")",
")",
"{",
"return",
"true",
";",
"}",
"ITypeReferenceO... | Same as {@link LightweightTypeReference#isSubtypeOf(Class)} but does not accept synonym types as subtypes. | [
"Same",
"as",
"{"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java#L352-L366 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Transformation2D.java | Transformation2D.setRotate | void setRotate(double angle_in_Radians, Point2D rotationCenter) {
setRotate(Math.cos(angle_in_Radians), Math.sin(angle_in_Radians),
rotationCenter);
} | java | void setRotate(double angle_in_Radians, Point2D rotationCenter) {
setRotate(Math.cos(angle_in_Radians), Math.sin(angle_in_Radians),
rotationCenter);
} | [
"void",
"setRotate",
"(",
"double",
"angle_in_Radians",
",",
"Point2D",
"rotationCenter",
")",
"{",
"setRotate",
"(",
"Math",
".",
"cos",
"(",
"angle_in_Radians",
")",
",",
"Math",
".",
"sin",
"(",
"angle_in_Radians",
")",
",",
"rotationCenter",
")",
";",
"}... | Sets this transformation to be a rotation around point rotationCenter.
When the axis Y is directed up and X is directed to the right, the
positive angle corresponds to the anti-clockwise rotation. When the axis
Y is directed down and X is directed to the right, the positive angle
corresponds to the clockwise rotation.
@param angle_in_Radians
The rotation angle in radian.
@param rotationCenter
The center point of the rotation. | [
"Sets",
"this",
"transformation",
"to",
"be",
"a",
"rotation",
"around",
"point",
"rotationCenter",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L709-L712 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/TreeMenuExample.java | TreeMenuExample.buildTreeMenuWithDecoratedLabel | private WMenu buildTreeMenuWithDecoratedLabel() {
WMenu menu = new WMenu(WMenu.MenuType.TREE);
WDecoratedLabel dLabel = new WDecoratedLabel(null, new WText("Settings Menu"), new WImage(
"/image/settings.png", "settings"));
WSubMenu settings = new WSubMenu(dLabel);
settings.setMode(WSubMenu.MenuMode.LAZY);
settings.setAccessKey('S');
menu.add(settings);
settings.add(new WMenuItem(new WDecoratedLabel(null, new WText("Account Settings"),
new WImage("/image/user-properties.png", "user properties"))));
settings.add(new WMenuItem(new WDecoratedLabel(null, new WText("Personal Details"),
new WImage("/image/user.png", "user"))));
WSubMenu addressSub = new WSubMenu(new WDecoratedLabel(null, new WText("Address Details"),
new WImage("/image/address-book-open.png", "address book")));
addressSub.setMode(WSubMenu.MenuMode.LAZY);
settings.add(addressSub);
addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Home Address"),
new WImage("/image/home.png", "home"))));
addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Work Address"),
new WImage("/image/wrench.png", "work"))));
addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Postal Address"),
new WImage("/image/mail-post.png", "postal"))));
WMenuItem itemWithIcon = new WMenuItem("Help");
itemWithIcon.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
// do something
}
});
itemWithIcon.setHtmlClass(HtmlClassProperties.ICON_HELP_BEFORE);
menu.add(itemWithIcon);
return menu;
} | java | private WMenu buildTreeMenuWithDecoratedLabel() {
WMenu menu = new WMenu(WMenu.MenuType.TREE);
WDecoratedLabel dLabel = new WDecoratedLabel(null, new WText("Settings Menu"), new WImage(
"/image/settings.png", "settings"));
WSubMenu settings = new WSubMenu(dLabel);
settings.setMode(WSubMenu.MenuMode.LAZY);
settings.setAccessKey('S');
menu.add(settings);
settings.add(new WMenuItem(new WDecoratedLabel(null, new WText("Account Settings"),
new WImage("/image/user-properties.png", "user properties"))));
settings.add(new WMenuItem(new WDecoratedLabel(null, new WText("Personal Details"),
new WImage("/image/user.png", "user"))));
WSubMenu addressSub = new WSubMenu(new WDecoratedLabel(null, new WText("Address Details"),
new WImage("/image/address-book-open.png", "address book")));
addressSub.setMode(WSubMenu.MenuMode.LAZY);
settings.add(addressSub);
addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Home Address"),
new WImage("/image/home.png", "home"))));
addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Work Address"),
new WImage("/image/wrench.png", "work"))));
addressSub.add(new WMenuItem(new WDecoratedLabel(null, new WText("Postal Address"),
new WImage("/image/mail-post.png", "postal"))));
WMenuItem itemWithIcon = new WMenuItem("Help");
itemWithIcon.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
// do something
}
});
itemWithIcon.setHtmlClass(HtmlClassProperties.ICON_HELP_BEFORE);
menu.add(itemWithIcon);
return menu;
} | [
"private",
"WMenu",
"buildTreeMenuWithDecoratedLabel",
"(",
")",
"{",
"WMenu",
"menu",
"=",
"new",
"WMenu",
"(",
"WMenu",
".",
"MenuType",
".",
"TREE",
")",
";",
"WDecoratedLabel",
"dLabel",
"=",
"new",
"WDecoratedLabel",
"(",
"null",
",",
"new",
"WText",
"(... | Tree menu containing image in the items. This example demonstrates creating {@link WSubMenu} and
{@link WMenuItem} components with {@link WDecoratedLabel}.
@return menu with a decorated label | [
"Tree",
"menu",
"containing",
"image",
"in",
"the",
"items",
".",
"This",
"example",
"demonstrates",
"creating",
"{",
"@link",
"WSubMenu",
"}",
"and",
"{",
"@link",
"WMenuItem",
"}",
"components",
"with",
"{",
"@link",
"WDecoratedLabel",
"}",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/TreeMenuExample.java#L152-L187 |
jhalterman/failsafe | src/main/java/net/jodah/failsafe/FailsafeExecutor.java | FailsafeExecutor.get | public <T extends R> T get(CheckedSupplier<T> supplier) {
return call(execution -> Assert.notNull(supplier, "supplier"));
} | java | public <T extends R> T get(CheckedSupplier<T> supplier) {
return call(execution -> Assert.notNull(supplier, "supplier"));
} | [
"public",
"<",
"T",
"extends",
"R",
">",
"T",
"get",
"(",
"CheckedSupplier",
"<",
"T",
">",
"supplier",
")",
"{",
"return",
"call",
"(",
"execution",
"->",
"Assert",
".",
"notNull",
"(",
"supplier",
",",
"\"supplier\"",
")",
")",
";",
"}"
] | Executes the {@code supplier} until a successful result is returned or the configured policies are exceeded.
@throws NullPointerException if the {@code supplier} is null
@throws FailsafeException if the {@code supplier} fails with a checked Exception or if interrupted while
waiting to perform a retry.
@throws CircuitBreakerOpenException if a configured circuit is open. | [
"Executes",
"the",
"{",
"@code",
"supplier",
"}",
"until",
"a",
"successful",
"result",
"is",
"returned",
"or",
"the",
"configured",
"policies",
"are",
"exceeded",
"."
] | train | https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/FailsafeExecutor.java#L68-L70 |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jadex/common/MockAgentPlan.java | MockAgentPlan.sendRequestToDF | protected String sendRequestToDF(String df_service, Object msgContent) {
IDFComponentDescription[] receivers = getReceivers(df_service);
if (receivers.length > 0) {
IMessageEvent mevent = createMessageEvent("send_request");
mevent.getParameter(SFipa.CONTENT).setValue(msgContent);
for (int i = 0; i < receivers.length; i++) {
mevent.getParameterSet(SFipa.RECEIVERS).addValue(
receivers[i].getName());
logger.info("The receiver is " + receivers[i].getName());
}
sendMessage(mevent);
}
logger.info("Message sended to " + df_service + " to "
+ receivers.length + " receivers");
return ("Message sended to " + df_service);
} | java | protected String sendRequestToDF(String df_service, Object msgContent) {
IDFComponentDescription[] receivers = getReceivers(df_service);
if (receivers.length > 0) {
IMessageEvent mevent = createMessageEvent("send_request");
mevent.getParameter(SFipa.CONTENT).setValue(msgContent);
for (int i = 0; i < receivers.length; i++) {
mevent.getParameterSet(SFipa.RECEIVERS).addValue(
receivers[i].getName());
logger.info("The receiver is " + receivers[i].getName());
}
sendMessage(mevent);
}
logger.info("Message sended to " + df_service + " to "
+ receivers.length + " receivers");
return ("Message sended to " + df_service);
} | [
"protected",
"String",
"sendRequestToDF",
"(",
"String",
"df_service",
",",
"Object",
"msgContent",
")",
"{",
"IDFComponentDescription",
"[",
"]",
"receivers",
"=",
"getReceivers",
"(",
"df_service",
")",
";",
"if",
"(",
"receivers",
".",
"length",
">",
"0",
"... | Method to send Request messages to a specific df_service
@param df_service
The name of the df_service
@param msgContent
The content of the message to be sent
@return Message sent to + the name of the df_service | [
"Method",
"to",
"send",
"Request",
"messages",
"to",
"a",
"specific",
"df_service"
] | train | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jadex/common/MockAgentPlan.java#L51-L67 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java | PossibleIncompleteSerialization.visitClassContext | @Override
public void visitClassContext(ClassContext classContext) {
try {
JavaClass cls = classContext.getJavaClass();
if (isSerializable(cls)) {
JavaClass superCls = cls.getSuperClass();
if (!isSerializable(superCls) && hasSerializableFields(superCls) && !hasSerializingMethods(cls)) {
bugReporter.reportBug(new BugInstance(this, BugType.PIS_POSSIBLE_INCOMPLETE_SERIALIZATION.name(), NORMAL_PRIORITY).addClass(cls));
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
} | java | @Override
public void visitClassContext(ClassContext classContext) {
try {
JavaClass cls = classContext.getJavaClass();
if (isSerializable(cls)) {
JavaClass superCls = cls.getSuperClass();
if (!isSerializable(superCls) && hasSerializableFields(superCls) && !hasSerializingMethods(cls)) {
bugReporter.reportBug(new BugInstance(this, BugType.PIS_POSSIBLE_INCOMPLETE_SERIALIZATION.name(), NORMAL_PRIORITY).addClass(cls));
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
} | [
"@",
"Override",
"public",
"void",
"visitClassContext",
"(",
"ClassContext",
"classContext",
")",
"{",
"try",
"{",
"JavaClass",
"cls",
"=",
"classContext",
".",
"getJavaClass",
"(",
")",
";",
"if",
"(",
"isSerializable",
"(",
"cls",
")",
")",
"{",
"JavaClass... | implements the visitor to look for classes that are serializable, and are derived from non serializable classes and don't either implement methods in
Externalizable or Serializable to save parent class fields.
@param classContext
the context object of the currently parsed class | [
"implements",
"the",
"visitor",
"to",
"look",
"for",
"classes",
"that",
"are",
"serializable",
"and",
"are",
"derived",
"from",
"non",
"serializable",
"classes",
"and",
"don",
"t",
"either",
"implement",
"methods",
"in",
"Externalizable",
"or",
"Serializable",
"... | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java#L62-L75 |
lightblue-platform/lightblue-migrator | facade/src/main/java/com/redhat/lightblue/migrator/facade/ServiceFacade.java | ServiceFacade.getWithTimeout | private <T> T getWithTimeout(ListenableFuture<T> listenableFuture, String methodName, FacadeOperation facadeOperation, int destinationCallTimeout) throws InterruptedException, ExecutionException, TimeoutException {
// not reading from source/legacy means this is either proxy or kinda proxy phase
// in that case, ignore timeout settings for Lightblue call
if (!shouldSource(FacadeOperation.READ) || timeoutConfiguration.getTimeoutMS(methodName, facadeOperation) <= 0) {
return listenableFuture.get();
} else {
return listenableFuture.get(destinationCallTimeout, TimeUnit.MILLISECONDS);
}
} | java | private <T> T getWithTimeout(ListenableFuture<T> listenableFuture, String methodName, FacadeOperation facadeOperation, int destinationCallTimeout) throws InterruptedException, ExecutionException, TimeoutException {
// not reading from source/legacy means this is either proxy or kinda proxy phase
// in that case, ignore timeout settings for Lightblue call
if (!shouldSource(FacadeOperation.READ) || timeoutConfiguration.getTimeoutMS(methodName, facadeOperation) <= 0) {
return listenableFuture.get();
} else {
return listenableFuture.get(destinationCallTimeout, TimeUnit.MILLISECONDS);
}
} | [
"private",
"<",
"T",
">",
"T",
"getWithTimeout",
"(",
"ListenableFuture",
"<",
"T",
">",
"listenableFuture",
",",
"String",
"methodName",
",",
"FacadeOperation",
"facadeOperation",
",",
"int",
"destinationCallTimeout",
")",
"throws",
"InterruptedException",
",",
"Ex... | Call destination (lightblue) using a timeout in dual read/write phases.
Do not use facade timeout during lightblue proxy and kinda proxy phases (when
reading from source is disabled).
@param listenableFuture
@param methodName method name is used to read method specific timeout
configuration
@param destinationCallTimeout Set future timeout to this amount
@return
@throws InterruptedException
@throws ExecutionException
@throws TimeoutException | [
"Call",
"destination",
"(",
"lightblue",
")",
"using",
"a",
"timeout",
"in",
"dual",
"read",
"/",
"write",
"phases",
".",
"Do",
"not",
"use",
"facade",
"timeout",
"during",
"lightblue",
"proxy",
"and",
"kinda",
"proxy",
"phases",
"(",
"when",
"reading",
"f... | train | https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/facade/src/main/java/com/redhat/lightblue/migrator/facade/ServiceFacade.java#L198-L206 |
jenkinsci/jenkins | core/src/main/java/hudson/util/Futures.java | Futures.precomputed | public static <T> Future<T> precomputed(final T value) {
return new Future<T>() {
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
public boolean isCancelled() {
return false;
}
public boolean isDone() {
return true;
}
public T get() {
return value;
}
public T get(long timeout, TimeUnit unit) {
return value;
}
};
} | java | public static <T> Future<T> precomputed(final T value) {
return new Future<T>() {
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
public boolean isCancelled() {
return false;
}
public boolean isDone() {
return true;
}
public T get() {
return value;
}
public T get(long timeout, TimeUnit unit) {
return value;
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"precomputed",
"(",
"final",
"T",
"value",
")",
"{",
"return",
"new",
"Future",
"<",
"T",
">",
"(",
")",
"{",
"public",
"boolean",
"cancel",
"(",
"boolean",
"mayInterruptIfRunning",
")",
"{",
... | Creates a {@link Future} instance that already has its value pre-computed. | [
"Creates",
"a",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/Futures.java#L39-L61 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java | BitcoinSerializer.makeBlock | @Override
public Block makeBlock(final byte[] payloadBytes, final int offset, final int length) throws ProtocolException {
return new Block(params, payloadBytes, offset, this, length);
} | java | @Override
public Block makeBlock(final byte[] payloadBytes, final int offset, final int length) throws ProtocolException {
return new Block(params, payloadBytes, offset, this, length);
} | [
"@",
"Override",
"public",
"Block",
"makeBlock",
"(",
"final",
"byte",
"[",
"]",
"payloadBytes",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"length",
")",
"throws",
"ProtocolException",
"{",
"return",
"new",
"Block",
"(",
"params",
",",
"payloadByte... | Make a block from the payload. Extension point for alternative
serialization format support. | [
"Make",
"a",
"block",
"from",
"the",
"payload",
".",
"Extension",
"point",
"for",
"alternative",
"serialization",
"format",
"support",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java#L272-L275 |
EdwardRaff/JSAT | JSAT/src/jsat/utils/IndexTable.java | IndexTable.apply | public void apply(List target, List tmp)
{
if (target.size() != length())
throw new RuntimeException("target array does not have the same length as the index table");
//fill tmp with the original ordering or target, adding when needed
for (int i = 0; i < target.size(); i++)
if (i >= tmp.size())
tmp.add(target.get(i));
else
tmp.set(i, target.get(i));
//place back into target from tmp to get sorted order
for(int i = 0; i < target.size(); i++)
target.set(i, tmp.get(index(i)));
} | java | public void apply(List target, List tmp)
{
if (target.size() != length())
throw new RuntimeException("target array does not have the same length as the index table");
//fill tmp with the original ordering or target, adding when needed
for (int i = 0; i < target.size(); i++)
if (i >= tmp.size())
tmp.add(target.get(i));
else
tmp.set(i, target.get(i));
//place back into target from tmp to get sorted order
for(int i = 0; i < target.size(); i++)
target.set(i, tmp.get(index(i)));
} | [
"public",
"void",
"apply",
"(",
"List",
"target",
",",
"List",
"tmp",
")",
"{",
"if",
"(",
"target",
".",
"size",
"(",
")",
"!=",
"length",
"(",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"target array does not have the same length as the index table\"... | Applies this index table to the specified target, putting {@code target}
into the same ordering as this IndexTable. It will use the provided
{@code tmp} space to store the original values in target in the same
ordering. It will be modified, and may be expanded using the {@link
List#add(java.lang.Object) add} method if it does not contain sufficient
space. Extra size in the tmp list will be ignored. After this method is
called, {@code tmp} will contain the same ordering that was in
{@code target} <br>
<br>
This method is provided as a means to reducing memory use when multiple
lists need to be sorted.
@param target the list to sort, that should be the same size as the
previously sorted list.
@param tmp the temp list that may be of any size | [
"Applies",
"this",
"index",
"table",
"to",
"the",
"specified",
"target",
"putting",
"{",
"@code",
"target",
"}",
"into",
"the",
"same",
"ordering",
"as",
"this",
"IndexTable",
".",
"It",
"will",
"use",
"the",
"provided",
"{",
"@code",
"tmp",
"}",
"space",
... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IndexTable.java#L316-L329 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java | HttpPostMultipartRequestDecoder.readLineStandard | private static String readLineStandard(ByteBuf undecodedChunk, Charset charset) {
int readerIndex = undecodedChunk.readerIndex();
try {
ByteBuf line = buffer(64);
while (undecodedChunk.isReadable()) {
byte nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.CR) {
// check but do not changed readerIndex
nextByte = undecodedChunk.getByte(undecodedChunk.readerIndex());
if (nextByte == HttpConstants.LF) {
// force read
undecodedChunk.readByte();
return line.toString(charset);
} else {
// Write CR (not followed by LF)
line.writeByte(HttpConstants.CR);
}
} else if (nextByte == HttpConstants.LF) {
return line.toString(charset);
} else {
line.writeByte(nextByte);
}
}
} catch (IndexOutOfBoundsException e) {
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException(e);
}
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
} | java | private static String readLineStandard(ByteBuf undecodedChunk, Charset charset) {
int readerIndex = undecodedChunk.readerIndex();
try {
ByteBuf line = buffer(64);
while (undecodedChunk.isReadable()) {
byte nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.CR) {
// check but do not changed readerIndex
nextByte = undecodedChunk.getByte(undecodedChunk.readerIndex());
if (nextByte == HttpConstants.LF) {
// force read
undecodedChunk.readByte();
return line.toString(charset);
} else {
// Write CR (not followed by LF)
line.writeByte(HttpConstants.CR);
}
} else if (nextByte == HttpConstants.LF) {
return line.toString(charset);
} else {
line.writeByte(nextByte);
}
}
} catch (IndexOutOfBoundsException e) {
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException(e);
}
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
} | [
"private",
"static",
"String",
"readLineStandard",
"(",
"ByteBuf",
"undecodedChunk",
",",
"Charset",
"charset",
")",
"{",
"int",
"readerIndex",
"=",
"undecodedChunk",
".",
"readerIndex",
"(",
")",
";",
"try",
"{",
"ByteBuf",
"line",
"=",
"buffer",
"(",
"64",
... | Read one line up to the CRLF or LF
@return the String from one line
@throws NotEnoughDataDecoderException
Need more chunks and reset the {@code readerIndex} to the previous
value | [
"Read",
"one",
"line",
"up",
"to",
"the",
"CRLF",
"or",
"LF"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L991-L1021 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java | JdbcTypesHelper.getObjectFromColumn | public static Object getObjectFromColumn(ResultSet rs, Integer jdbcType, int columnId)
throws SQLException
{
return getObjectFromColumn(rs, null, jdbcType, null, columnId);
} | java | public static Object getObjectFromColumn(ResultSet rs, Integer jdbcType, int columnId)
throws SQLException
{
return getObjectFromColumn(rs, null, jdbcType, null, columnId);
} | [
"public",
"static",
"Object",
"getObjectFromColumn",
"(",
"ResultSet",
"rs",
",",
"Integer",
"jdbcType",
",",
"int",
"columnId",
")",
"throws",
"SQLException",
"{",
"return",
"getObjectFromColumn",
"(",
"rs",
",",
"null",
",",
"jdbcType",
",",
"null",
",",
"co... | Returns an java object read from the specified ResultSet column. | [
"Returns",
"an",
"java",
"object",
"read",
"from",
"the",
"specified",
"ResultSet",
"column",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java#L213-L217 |
facebook/fresco | animated-gif-lite/src/main/java/com/facebook/animated/giflite/drawable/GifAnimationBackend.java | GifAnimationBackend.scale | private void scale(int viewPortWidth, int viewPortHeight, int sourceWidth, int sourceHeight) {
float inputRatio = ((float) sourceWidth) / sourceHeight;
float outputRatio = ((float) viewPortWidth) / viewPortHeight;
int scaledWidth = viewPortWidth;
int scaledHeight = viewPortHeight;
if (outputRatio > inputRatio) {
// Not enough width to fill the output. (Black bars on left and right.)
scaledWidth = (int) (viewPortHeight * inputRatio);
scaledHeight = viewPortHeight;
} else if (outputRatio < inputRatio) {
// Not enough height to fill the output. (Black bars on top and bottom.)
scaledHeight = (int) (viewPortWidth / inputRatio);
scaledWidth = viewPortWidth;
}
float scale = scaledWidth / (float) sourceWidth;
mMidX = ((viewPortWidth - scaledWidth) / 2f) / scale;
mMidY = ((viewPortHeight - scaledHeight) / 2f) / scale;
} | java | private void scale(int viewPortWidth, int viewPortHeight, int sourceWidth, int sourceHeight) {
float inputRatio = ((float) sourceWidth) / sourceHeight;
float outputRatio = ((float) viewPortWidth) / viewPortHeight;
int scaledWidth = viewPortWidth;
int scaledHeight = viewPortHeight;
if (outputRatio > inputRatio) {
// Not enough width to fill the output. (Black bars on left and right.)
scaledWidth = (int) (viewPortHeight * inputRatio);
scaledHeight = viewPortHeight;
} else if (outputRatio < inputRatio) {
// Not enough height to fill the output. (Black bars on top and bottom.)
scaledHeight = (int) (viewPortWidth / inputRatio);
scaledWidth = viewPortWidth;
}
float scale = scaledWidth / (float) sourceWidth;
mMidX = ((viewPortWidth - scaledWidth) / 2f) / scale;
mMidY = ((viewPortHeight - scaledHeight) / 2f) / scale;
} | [
"private",
"void",
"scale",
"(",
"int",
"viewPortWidth",
",",
"int",
"viewPortHeight",
",",
"int",
"sourceWidth",
",",
"int",
"sourceHeight",
")",
"{",
"float",
"inputRatio",
"=",
"(",
"(",
"float",
")",
"sourceWidth",
")",
"/",
"sourceHeight",
";",
"float",... | Measures the source, and sets the size based on them. Maintains aspect ratio of source, and
ensures that screen is filled in at least one dimension.
<p>Adapted from com.facebook.cameracore.common.RenderUtil#calculateFitRect
@param viewPortWidth the width of the display
@param viewPortHeight the height of the display
@param sourceWidth the width of the video
@param sourceHeight the height of the video | [
"Measures",
"the",
"source",
"and",
"sets",
"the",
"size",
"based",
"on",
"them",
".",
"Maintains",
"aspect",
"ratio",
"of",
"source",
"and",
"ensures",
"that",
"screen",
"is",
"filled",
"in",
"at",
"least",
"one",
"dimension",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/animated-gif-lite/src/main/java/com/facebook/animated/giflite/drawable/GifAnimationBackend.java#L141-L161 |
hypercube1024/firefly | firefly/src/main/java/com/firefly/codec/http2/model/MultiPartWriter.java | MultiPartWriter.startPart | public void startPart(String contentType, String[] headers) throws IOException {
if (inPart)
out.write(__CRLF);
out.write(__DASHDASH);
out.write(boundary);
out.write(__CRLF);
out.write("Content-Type: ");
out.write(contentType);
out.write(__CRLF);
for (int i = 0; headers != null && i < headers.length; i++) {
out.write(headers[i]);
out.write(__CRLF);
}
out.write(__CRLF);
inPart = true;
} | java | public void startPart(String contentType, String[] headers) throws IOException {
if (inPart)
out.write(__CRLF);
out.write(__DASHDASH);
out.write(boundary);
out.write(__CRLF);
out.write("Content-Type: ");
out.write(contentType);
out.write(__CRLF);
for (int i = 0; headers != null && i < headers.length; i++) {
out.write(headers[i]);
out.write(__CRLF);
}
out.write(__CRLF);
inPart = true;
} | [
"public",
"void",
"startPart",
"(",
"String",
"contentType",
",",
"String",
"[",
"]",
"headers",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inPart",
")",
"out",
".",
"write",
"(",
"__CRLF",
")",
";",
"out",
".",
"write",
"(",
"__DASHDASH",
")",
";"... | Start creation of the next Content.
@param contentType the content type of the part
@param headers the part headers
@throws IOException if unable to write the part | [
"Start",
"creation",
"of",
"the",
"next",
"Content",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MultiPartWriter.java#L87-L102 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createParameters | private Node createParameters(boolean lastVarArgs, JSType... parameterTypes) {
FunctionParamBuilder builder = new FunctionParamBuilder(this);
int max = parameterTypes.length - 1;
for (int i = 0; i <= max; i++) {
if (lastVarArgs && i == max) {
builder.addVarArgs(parameterTypes[i]);
} else {
builder.addRequiredParams(parameterTypes[i]);
}
}
return builder.build();
} | java | private Node createParameters(boolean lastVarArgs, JSType... parameterTypes) {
FunctionParamBuilder builder = new FunctionParamBuilder(this);
int max = parameterTypes.length - 1;
for (int i = 0; i <= max; i++) {
if (lastVarArgs && i == max) {
builder.addVarArgs(parameterTypes[i]);
} else {
builder.addRequiredParams(parameterTypes[i]);
}
}
return builder.build();
} | [
"private",
"Node",
"createParameters",
"(",
"boolean",
"lastVarArgs",
",",
"JSType",
"...",
"parameterTypes",
")",
"{",
"FunctionParamBuilder",
"builder",
"=",
"new",
"FunctionParamBuilder",
"(",
"this",
")",
";",
"int",
"max",
"=",
"parameterTypes",
".",
"length"... | Creates a tree hierarchy representing a typed argument list.
@param lastVarArgs whether the last type should considered as a variable length argument.
@param parameterTypes the parameter types. The last element of this array is considered a
variable length argument is {@code lastVarArgs} is {@code true}.
@return a tree hierarchy representing a typed argument list | [
"Creates",
"a",
"tree",
"hierarchy",
"representing",
"a",
"typed",
"argument",
"list",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1665-L1676 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.parseToTimeMillis | private static long parseToTimeMillis(String dateStr, TimeZone tz) {
String format;
if (dateStr.length() <= 10) {
format = DATE_FORMAT_STRING;
} else {
format = TIMESTAMP_FORMAT_STRING;
}
return parseToTimeMillis(dateStr, format, tz) + getMillis(dateStr);
} | java | private static long parseToTimeMillis(String dateStr, TimeZone tz) {
String format;
if (dateStr.length() <= 10) {
format = DATE_FORMAT_STRING;
} else {
format = TIMESTAMP_FORMAT_STRING;
}
return parseToTimeMillis(dateStr, format, tz) + getMillis(dateStr);
} | [
"private",
"static",
"long",
"parseToTimeMillis",
"(",
"String",
"dateStr",
",",
"TimeZone",
"tz",
")",
"{",
"String",
"format",
";",
"if",
"(",
"dateStr",
".",
"length",
"(",
")",
"<=",
"10",
")",
"{",
"format",
"=",
"DATE_FORMAT_STRING",
";",
"}",
"els... | Parses a given datetime string to milli seconds since 1970-01-01 00:00:00 UTC
using the default format "yyyy-MM-dd" or "yyyy-MM-dd HH:mm:ss" depends on the string length. | [
"Parses",
"a",
"given",
"datetime",
"string",
"to",
"milli",
"seconds",
"since",
"1970",
"-",
"01",
"-",
"01",
"00",
":",
"00",
":",
"00",
"UTC",
"using",
"the",
"default",
"format",
"yyyy",
"-",
"MM",
"-",
"dd",
"or",
"yyyy",
"-",
"MM",
"-",
"dd",... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L449-L457 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listCustomPrebuiltIntentsAsync | public Observable<List<IntentClassifier>> listCustomPrebuiltIntentsAsync(UUID appId, String versionId) {
return listCustomPrebuiltIntentsWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<IntentClassifier>>, List<IntentClassifier>>() {
@Override
public List<IntentClassifier> call(ServiceResponse<List<IntentClassifier>> response) {
return response.body();
}
});
} | java | public Observable<List<IntentClassifier>> listCustomPrebuiltIntentsAsync(UUID appId, String versionId) {
return listCustomPrebuiltIntentsWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<IntentClassifier>>, List<IntentClassifier>>() {
@Override
public List<IntentClassifier> call(ServiceResponse<List<IntentClassifier>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"IntentClassifier",
">",
">",
"listCustomPrebuiltIntentsAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
")",
"{",
"return",
"listCustomPrebuiltIntentsWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
")",
".... | Gets custom prebuilt intents information of this application.
@param appId The application ID.
@param versionId The version ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<IntentClassifier> object | [
"Gets",
"custom",
"prebuilt",
"intents",
"information",
"of",
"this",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L5829-L5836 |
windup/windup | reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java | ClassificationService.attachClassification | public ClassificationModel attachClassification(GraphRewrite event, EvaluationContext context, FileModel fileModel, String classificationText, String description)
{
return attachClassification(event, context, fileModel, IssueCategoryRegistry.DEFAULT, classificationText, description);
} | java | public ClassificationModel attachClassification(GraphRewrite event, EvaluationContext context, FileModel fileModel, String classificationText, String description)
{
return attachClassification(event, context, fileModel, IssueCategoryRegistry.DEFAULT, classificationText, description);
} | [
"public",
"ClassificationModel",
"attachClassification",
"(",
"GraphRewrite",
"event",
",",
"EvaluationContext",
"context",
",",
"FileModel",
"fileModel",
",",
"String",
"classificationText",
",",
"String",
"description",
")",
"{",
"return",
"attachClassification",
"(",
... | Attach a {@link ClassificationModel} with the given classificationText and description to the provided {@link FileModel}.
If an existing Model exists with the provided classificationText, that one will be used instead. | [
"Attach",
"a",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java#L276-L279 |
xcesco/kripton | kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java | PrimitiveUtils.readDouble | public static Double readDouble(String value, Double defaultValue) {
if (!StringUtils.hasText(value)) return defaultValue;
return Double.valueOf(value);
} | java | public static Double readDouble(String value, Double defaultValue) {
if (!StringUtils.hasText(value)) return defaultValue;
return Double.valueOf(value);
} | [
"public",
"static",
"Double",
"readDouble",
"(",
"String",
"value",
",",
"Double",
"defaultValue",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"value",
")",
")",
"return",
"defaultValue",
";",
"return",
"Double",
".",
"valueOf",
"(",
"val... | Read double.
@param value the value
@param defaultValue the default value
@return the double | [
"Read",
"double",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java#L200-L204 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Multimap.java | Multimap.computeIfAbsent | public <X extends Exception> V computeIfAbsent(K key, Try.Function<? super K, ? extends V, X> mappingFunction) throws X {
N.checkArgNotNull(mappingFunction);
final V oldValue = get(key);
if (N.notNullOrEmpty(oldValue)) {
return oldValue;
}
final V newValue = mappingFunction.apply(key);
if (N.notNullOrEmpty(newValue)) {
valueMap.put(key, newValue);
}
return newValue;
} | java | public <X extends Exception> V computeIfAbsent(K key, Try.Function<? super K, ? extends V, X> mappingFunction) throws X {
N.checkArgNotNull(mappingFunction);
final V oldValue = get(key);
if (N.notNullOrEmpty(oldValue)) {
return oldValue;
}
final V newValue = mappingFunction.apply(key);
if (N.notNullOrEmpty(newValue)) {
valueMap.put(key, newValue);
}
return newValue;
} | [
"public",
"<",
"X",
"extends",
"Exception",
">",
"V",
"computeIfAbsent",
"(",
"K",
"key",
",",
"Try",
".",
"Function",
"<",
"?",
"super",
"K",
",",
"?",
"extends",
"V",
",",
"X",
">",
"mappingFunction",
")",
"throws",
"X",
"{",
"N",
".",
"checkArgNot... | The implementation is equivalent to performing the following steps for this Multimap:
<pre>
final V oldValue = get(key);
if (N.notNullOrEmpty(oldValue)) {
return oldValue;
}
final V newValue = mappingFunction.apply(key);
if (N.notNullOrEmpty(newValue)) {
valueMap.put(key, newValue);
}
return newValue;
</pre>
@param key
@param mappingFunction
@return | [
"The",
"implementation",
"is",
"equivalent",
"to",
"performing",
"the",
"following",
"steps",
"for",
"this",
"Multimap",
":"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multimap.java#L1092-L1108 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java | Signature.setParameter | @Deprecated
public final void setParameter(String param, Object value)
throws InvalidParameterException {
engineSetParameter(param, value);
} | java | @Deprecated
public final void setParameter(String param, Object value)
throws InvalidParameterException {
engineSetParameter(param, value);
} | [
"@",
"Deprecated",
"public",
"final",
"void",
"setParameter",
"(",
"String",
"param",
",",
"Object",
"value",
")",
"throws",
"InvalidParameterException",
"{",
"engineSetParameter",
"(",
"param",
",",
"value",
")",
";",
"}"
] | Sets the specified algorithm parameter to the specified value.
This method supplies a general-purpose mechanism through
which it is possible to set the various parameters of this object.
A parameter may be any settable parameter for the algorithm, such as
a parameter size, or a source of random bits for signature generation
(if appropriate), or an indication of whether or not to perform
a specific but optional computation. A uniform algorithm-specific
naming scheme for each parameter is desirable but left unspecified
at this time.
@param param the string identifier of the parameter.
@param value the parameter value.
@exception InvalidParameterException if {@code param} is an
invalid parameter for this signature algorithm engine,
the parameter is already set
and cannot be set again, a security exception occurs, and so on.
@see #getParameter
@deprecated Use
{@link #setParameter(java.security.spec.AlgorithmParameterSpec)
setParameter}. | [
"Sets",
"the",
"specified",
"algorithm",
"parameter",
"to",
"the",
"specified",
"value",
".",
"This",
"method",
"supplies",
"a",
"general",
"-",
"purpose",
"mechanism",
"through",
"which",
"it",
"is",
"possible",
"to",
"set",
"the",
"various",
"parameters",
"o... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L1004-L1008 |
deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/EqualizeHistTransform.java | EqualizeHistTransform.doTransform | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
Mat mat = (Mat) converter.convert(image.getFrame());
Mat result = new Mat();
try {
if (mat.channels() == 1) {
equalizeHist(mat, result);
} else {
split(mat, splitChannels);
equalizeHist(splitChannels.get(0), splitChannels.get(0)); //equalize histogram on the 1st channel (Y)
merge(splitChannels, result);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return new ImageWritable(converter.convert(result));
} | java | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
Mat mat = (Mat) converter.convert(image.getFrame());
Mat result = new Mat();
try {
if (mat.channels() == 1) {
equalizeHist(mat, result);
} else {
split(mat, splitChannels);
equalizeHist(splitChannels.get(0), splitChannels.get(0)); //equalize histogram on the 1st channel (Y)
merge(splitChannels, result);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return new ImageWritable(converter.convert(result));
} | [
"@",
"Override",
"protected",
"ImageWritable",
"doTransform",
"(",
"ImageWritable",
"image",
",",
"Random",
"random",
")",
"{",
"if",
"(",
"image",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Mat",
"mat",
"=",
"(",
"Mat",
")",
"converter",
".",
... | Takes an image and returns a transformed image.
Uses the random object in the case of random transformations.
@param image to transform, null == end of stream
@param random object to use (or null for deterministic)
@return transformed image | [
"Takes",
"an",
"image",
"and",
"returns",
"a",
"transformed",
"image",
".",
"Uses",
"the",
"random",
"object",
"in",
"the",
"case",
"of",
"random",
"transformations",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/EqualizeHistTransform.java#L87-L107 |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java | LongPollingMessagingDelegate.listChannels | public List<ChannelInformation> listChannels() {
LinkedList<ChannelInformation> entries = new LinkedList<ChannelInformation>();
Collection<Broadcaster> broadcasters = BroadcasterFactory.getDefault().lookupAll();
String name;
for (Broadcaster broadcaster : broadcasters) {
if (broadcaster instanceof BounceProxyBroadcaster) {
name = ((BounceProxyBroadcaster) broadcaster).getName();
} else {
name = broadcaster.getClass().getSimpleName();
}
Integer cachedSize = null;
entries.add(new ChannelInformation(name, broadcaster.getAtmosphereResources().size(), cachedSize));
}
return entries;
} | java | public List<ChannelInformation> listChannels() {
LinkedList<ChannelInformation> entries = new LinkedList<ChannelInformation>();
Collection<Broadcaster> broadcasters = BroadcasterFactory.getDefault().lookupAll();
String name;
for (Broadcaster broadcaster : broadcasters) {
if (broadcaster instanceof BounceProxyBroadcaster) {
name = ((BounceProxyBroadcaster) broadcaster).getName();
} else {
name = broadcaster.getClass().getSimpleName();
}
Integer cachedSize = null;
entries.add(new ChannelInformation(name, broadcaster.getAtmosphereResources().size(), cachedSize));
}
return entries;
} | [
"public",
"List",
"<",
"ChannelInformation",
">",
"listChannels",
"(",
")",
"{",
"LinkedList",
"<",
"ChannelInformation",
">",
"entries",
"=",
"new",
"LinkedList",
"<",
"ChannelInformation",
">",
"(",
")",
";",
"Collection",
"<",
"Broadcaster",
">",
"broadcaster... | Gets a list of all channel information.
@return list of all channel informations | [
"Gets",
"a",
"list",
"of",
"all",
"channel",
"information",
"."
] | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java#L66-L82 |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.separate | public Stream<T> separate(final T value) {
return filter(new Func1<T, Boolean>() {
@Override
public Boolean call(T it) {
return ((it == null) ? (value != null) : !it.equals(value));
}
});
} | java | public Stream<T> separate(final T value) {
return filter(new Func1<T, Boolean>() {
@Override
public Boolean call(T it) {
return ((it == null) ? (value != null) : !it.equals(value));
}
});
} | [
"public",
"Stream",
"<",
"T",
">",
"separate",
"(",
"final",
"T",
"value",
")",
"{",
"return",
"filter",
"(",
"new",
"Func1",
"<",
"T",
",",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"call",
"(",
"T",
"it",
")",
"{",
"r... | Returns a new stream that contains all items of the current stream except of a given item.
@param value a value to filter out.
@return a new stream that contains all items of the current stream except of a given item. | [
"Returns",
"a",
"new",
"stream",
"that",
"contains",
"all",
"items",
"of",
"the",
"current",
"stream",
"except",
"of",
"a",
"given",
"item",
"."
] | train | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L337-L344 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java | CmsAttributeHandler.clearMoveAnimationStyles | void clearMoveAnimationStyles(Element placeHolder, CmsAttributeValueView reference) {
placeHolder.removeFromParent();
reference.getElement().getParentElement().getStyle().clearPosition();
reference.getElement().getStyle().clearPosition();
reference.getElement().getStyle().clearWidth();
reference.getElement().getStyle().clearZIndex();
reference.showButtons();
} | java | void clearMoveAnimationStyles(Element placeHolder, CmsAttributeValueView reference) {
placeHolder.removeFromParent();
reference.getElement().getParentElement().getStyle().clearPosition();
reference.getElement().getStyle().clearPosition();
reference.getElement().getStyle().clearWidth();
reference.getElement().getStyle().clearZIndex();
reference.showButtons();
} | [
"void",
"clearMoveAnimationStyles",
"(",
"Element",
"placeHolder",
",",
"CmsAttributeValueView",
"reference",
")",
"{",
"placeHolder",
".",
"removeFromParent",
"(",
")",
";",
"reference",
".",
"getElement",
"(",
")",
".",
"getParentElement",
"(",
")",
".",
"getSty... | Clears the inline styles used during move animation.<p>
@param placeHolder the animation place holder
@param reference the moved attribute widget | [
"Clears",
"the",
"inline",
"styles",
"used",
"during",
"move",
"animation",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L1112-L1120 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java | DiscreteDistributions.uniformCdf | public static double uniformCdf(int k, int n) {
if(k<0 || n<1) {
throw new IllegalArgumentException("All the parameters must be positive and n larger than 1.");
}
k = Math.min(k, n);
double probabilitySum = k*uniform(n);
return probabilitySum;
} | java | public static double uniformCdf(int k, int n) {
if(k<0 || n<1) {
throw new IllegalArgumentException("All the parameters must be positive and n larger than 1.");
}
k = Math.min(k, n);
double probabilitySum = k*uniform(n);
return probabilitySum;
} | [
"public",
"static",
"double",
"uniformCdf",
"(",
"int",
"k",
",",
"int",
"n",
")",
"{",
"if",
"(",
"k",
"<",
"0",
"||",
"n",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"All the parameters must be positive and n larger than 1.\"",
")... | Returns the cumulative probability of uniform
@param k
@param n
@return | [
"Returns",
"the",
"cumulative",
"probability",
"of",
"uniform"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java#L248-L257 |
alkacon/opencms-core | src/org/opencms/xml/CmsXmlUtils.java | CmsXmlUtils.removeLastComplexXpathElement | public static String removeLastComplexXpathElement(String path) {
int pos = path.lastIndexOf('/');
if (pos < 0) {
return path;
}
// count ' chars
int p = pos;
int count = -1;
while (p > 0) {
count++;
p = path.indexOf("\'", p + 1);
}
String parentPath = path.substring(0, pos);
if ((count % 2) == 0) {
// if substring is complete
return parentPath;
}
// if not complete
p = parentPath.lastIndexOf("'");
if (p >= 0) {
// complete it if possible
return removeLastComplexXpathElement(parentPath.substring(0, p));
}
return parentPath;
} | java | public static String removeLastComplexXpathElement(String path) {
int pos = path.lastIndexOf('/');
if (pos < 0) {
return path;
}
// count ' chars
int p = pos;
int count = -1;
while (p > 0) {
count++;
p = path.indexOf("\'", p + 1);
}
String parentPath = path.substring(0, pos);
if ((count % 2) == 0) {
// if substring is complete
return parentPath;
}
// if not complete
p = parentPath.lastIndexOf("'");
if (p >= 0) {
// complete it if possible
return removeLastComplexXpathElement(parentPath.substring(0, p));
}
return parentPath;
} | [
"public",
"static",
"String",
"removeLastComplexXpathElement",
"(",
"String",
"path",
")",
"{",
"int",
"pos",
"=",
"path",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"{",
"return",
"path",
";",
"}",
"// count ' chars",
... | Removes the last complex Xpath element from the path.<p>
The same as {@link #removeLastXpathElement(String)} both it works with more complex xpaths.
<p>Example:<br>
<code>system/backup[@date='23/10/2003']/resource[path='/a/b/c']</code> becomes <code>system/backup[@date='23/10/2003']</code><p>
@param path the Xpath to remove the last element from
@return the path with the last element removed | [
"Removes",
"the",
"last",
"complex",
"Xpath",
"element",
"from",
"the",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlUtils.java#L534-L559 |
aws/aws-sdk-java | aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/CreateFunctionRequest.java | CreateFunctionRequest.getLayers | public java.util.List<String> getLayers() {
if (layers == null) {
layers = new com.amazonaws.internal.SdkInternalList<String>();
}
return layers;
} | java | public java.util.List<String> getLayers() {
if (layers == null) {
layers = new com.amazonaws.internal.SdkInternalList<String>();
}
return layers;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
"getLayers",
"(",
")",
"{",
"if",
"(",
"layers",
"==",
"null",
")",
"{",
"layers",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
"SdkInternalList",
"<",
"String",
">",
"(",
... | <p>
A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">function layers</a> to
add to the function's execution environment. Specify each layer by its ARN, including the version.
</p>
@return A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">function
layers</a> to add to the function's execution environment. Specify each layer by its ARN, including the
version. | [
"<p",
">",
"A",
"list",
"of",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"lambda",
"/",
"latest",
"/",
"dg",
"/",
"configuration",
"-",
"layers",
".",
"html",
">",
"function",
"layers<",
"/",
"a",
"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/CreateFunctionRequest.java#L1057-L1062 |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java | ErrorUtils.printErrorMessage | public static String printErrorMessage(String format, String errorMessage, int startIndex, int endIndex,
InputBuffer inputBuffer) {
checkArgNotNull(inputBuffer, "inputBuffer");
checkArgument(startIndex <= endIndex);
Position pos = inputBuffer.getPosition(startIndex);
StringBuilder sb = new StringBuilder(String.format(format, errorMessage, pos.line, pos.column));
sb.append('\n');
String line = inputBuffer.extractLine(pos.line);
sb.append(line);
sb.append('\n');
int charCount = Math.max(Math.min(endIndex - startIndex, StringUtils.length(line) - pos.column + 2), 1);
for (int i = 0; i < pos.column - 1; i++) sb.append(' ');
for (int i = 0; i < charCount; i++) sb.append('^');
sb.append("\n");
return sb.toString();
} | java | public static String printErrorMessage(String format, String errorMessage, int startIndex, int endIndex,
InputBuffer inputBuffer) {
checkArgNotNull(inputBuffer, "inputBuffer");
checkArgument(startIndex <= endIndex);
Position pos = inputBuffer.getPosition(startIndex);
StringBuilder sb = new StringBuilder(String.format(format, errorMessage, pos.line, pos.column));
sb.append('\n');
String line = inputBuffer.extractLine(pos.line);
sb.append(line);
sb.append('\n');
int charCount = Math.max(Math.min(endIndex - startIndex, StringUtils.length(line) - pos.column + 2), 1);
for (int i = 0; i < pos.column - 1; i++) sb.append(' ');
for (int i = 0; i < charCount; i++) sb.append('^');
sb.append("\n");
return sb.toString();
} | [
"public",
"static",
"String",
"printErrorMessage",
"(",
"String",
"format",
",",
"String",
"errorMessage",
",",
"int",
"startIndex",
",",
"int",
"endIndex",
",",
"InputBuffer",
"inputBuffer",
")",
"{",
"checkArgNotNull",
"(",
"inputBuffer",
",",
"\"inputBuffer\"",
... | Prints an error message showing a location in the given InputBuffer.
@param format the format string, must include three placeholders for a string
(the error message) and two integers (the error line / column respectively)
@param errorMessage the error message
@param startIndex the start location of the error as an index into the inputBuffer
@param endIndex the end location of the error as an index into the inputBuffer
@param inputBuffer the underlying InputBuffer
@return the error message including the relevant line from the underlying input plus location indicators | [
"Prints",
"an",
"error",
"message",
"showing",
"a",
"location",
"in",
"the",
"given",
"InputBuffer",
"."
] | train | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java#L149-L167 |
rolfl/MicroBench | src/main/java/net/tuis/ubench/UBench.java | UBench.addTask | public UBench addTask(String name, Runnable task) {
return putTask(name, () -> {
long start = System.nanoTime();
task.run();
return System.nanoTime() - start;
});
} | java | public UBench addTask(String name, Runnable task) {
return putTask(name, () -> {
long start = System.nanoTime();
task.run();
return System.nanoTime() - start;
});
} | [
"public",
"UBench",
"addTask",
"(",
"String",
"name",
",",
"Runnable",
"task",
")",
"{",
"return",
"putTask",
"(",
"name",
",",
"(",
")",
"->",
"{",
"long",
"start",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"task",
".",
"run",
"(",
")",
";",
... | Include a named task that has no output value in to the benchmark.
@param name
The name of the task. Only one task with any one name is
allowed.
@param task
The task to perform
@return The same object, for chaining calls. | [
"Include",
"a",
"named",
"task",
"that",
"has",
"no",
"output",
"value",
"in",
"to",
"the",
"benchmark",
"."
] | train | https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UBench.java#L285-L291 |
Grasia/phatsim | phat-core/src/main/java/phat/util/SpatialFactory.java | SpatialFactory.createCube | public static Geometry createCube(Vector3f dimensions, ColorRGBA color) {
checkInit();
Box b = new Box(dimensions.getX(), dimensions.getY(), dimensions.getZ()); // create cube shape at the origin
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", color); // set color of material to blue
geom.setMaterial(mat); // set the cube's material
return geom;
} | java | public static Geometry createCube(Vector3f dimensions, ColorRGBA color) {
checkInit();
Box b = new Box(dimensions.getX(), dimensions.getY(), dimensions.getZ()); // create cube shape at the origin
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", color); // set color of material to blue
geom.setMaterial(mat); // set the cube's material
return geom;
} | [
"public",
"static",
"Geometry",
"createCube",
"(",
"Vector3f",
"dimensions",
",",
"ColorRGBA",
"color",
")",
"{",
"checkInit",
"(",
")",
";",
"Box",
"b",
"=",
"new",
"Box",
"(",
"dimensions",
".",
"getX",
"(",
")",
",",
"dimensions",
".",
"getY",
"(",
... | Creates a cube given its dimensions and its color
@param dimensions
@param color
@return a cube Geometry | [
"Creates",
"a",
"cube",
"given",
"its",
"dimensions",
"and",
"its",
"color"
] | train | https://github.com/Grasia/phatsim/blob/2d4fc8189be9730b34c8e3e1a08fb4800e01c5df/phat-core/src/main/java/phat/util/SpatialFactory.java#L75-L85 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/contentcensor/AipContentCensor.java | AipContentCensor.imageCensorComb | public JSONObject imageCensorComb(String imgPath, EImgType type,
List<String> scenes, HashMap<String, String> options) {
if (type == EImgType.FILE) {
try {
byte[] imgData = Util.readFileByBytes(imgPath);
return imageCensorComb(imgData, scenes, options);
} catch (IOException e) {
return AipError.IMAGE_READ_ERROR.toJsonResult();
}
}
// url
AipRequest request = new AipRequest();
request.addBody("imgUrl", imgPath);
return imageCensorCombHelper(request, scenes, options);
} | java | public JSONObject imageCensorComb(String imgPath, EImgType type,
List<String> scenes, HashMap<String, String> options) {
if (type == EImgType.FILE) {
try {
byte[] imgData = Util.readFileByBytes(imgPath);
return imageCensorComb(imgData, scenes, options);
} catch (IOException e) {
return AipError.IMAGE_READ_ERROR.toJsonResult();
}
}
// url
AipRequest request = new AipRequest();
request.addBody("imgUrl", imgPath);
return imageCensorCombHelper(request, scenes, options);
} | [
"public",
"JSONObject",
"imageCensorComb",
"(",
"String",
"imgPath",
",",
"EImgType",
"type",
",",
"List",
"<",
"String",
">",
"scenes",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"if",
"(",
"type",
"==",
"EImgType",
".",
"FI... | 组合审核接口
@param imgPath 本地图片路径或url
@param type imgPath类型:FILE或URL
@param scenes 需要审核的服务类型
@param options 可选参数
@return JSONObject | [
"组合审核接口"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/contentcensor/AipContentCensor.java#L157-L174 |
FINRAOS/DataGenerator | dg-common/src/main/java/org/finra/datagenerator/common/SocialNetwork_Example_Java/UserStub.java | UserStub.getStubWithRandomParams | public static UserStub getStubWithRandomParams(UserTypeVal userType) {
// Java coerces the return type as a Tuple2 of Objects -- but it's declared as a Tuple2 of Doubles!
// Oh the joys of type erasure.
Tuple2<Double, Double> tuple = SocialNetworkUtilities.getRandomGeographicalLocation();
return new UserStub(userType, new Tuple2<>((Double) tuple._1(), (Double) tuple._2()),
SocialNetworkUtilities.getRandomIsSecret());
} | java | public static UserStub getStubWithRandomParams(UserTypeVal userType) {
// Java coerces the return type as a Tuple2 of Objects -- but it's declared as a Tuple2 of Doubles!
// Oh the joys of type erasure.
Tuple2<Double, Double> tuple = SocialNetworkUtilities.getRandomGeographicalLocation();
return new UserStub(userType, new Tuple2<>((Double) tuple._1(), (Double) tuple._2()),
SocialNetworkUtilities.getRandomIsSecret());
} | [
"public",
"static",
"UserStub",
"getStubWithRandomParams",
"(",
"UserTypeVal",
"userType",
")",
"{",
"// Java coerces the return type as a Tuple2 of Objects -- but it's declared as a Tuple2 of Doubles!\r",
"// Oh the joys of type erasure.\r",
"Tuple2",
"<",
"Double",
",",
"Double",
"... | Get random stub matching this user type
@param userType User type
@return Random stub | [
"Get",
"random",
"stub",
"matching",
"this",
"user",
"type"
] | train | https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-common/src/main/java/org/finra/datagenerator/common/SocialNetwork_Example_Java/UserStub.java#L116-L122 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/Treebank.java | Treebank.loadPath | public void loadPath(File path, String suffix, boolean recursively) {
loadPath(path, new ExtensionFileFilter(suffix, recursively));
} | java | public void loadPath(File path, String suffix, boolean recursively) {
loadPath(path, new ExtensionFileFilter(suffix, recursively));
} | [
"public",
"void",
"loadPath",
"(",
"File",
"path",
",",
"String",
"suffix",
",",
"boolean",
"recursively",
")",
"{",
"loadPath",
"(",
"path",
",",
"new",
"ExtensionFileFilter",
"(",
"suffix",
",",
"recursively",
")",
")",
";",
"}"
] | Load trees from given directory.
@param path file or directory to load from
@param suffix suffix of files to load
@param recursively descend into subdirectories as well | [
"Load",
"trees",
"from",
"given",
"directory",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/Treebank.java#L178-L180 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TextComponentPainter.java | TextComponentPainter.paintBorder | private void paintBorder(Graphics2D g, JComponent c, int x, int y, int width, int height) {
boolean useToolBarColors = isInToolBar(c);
Shape s;
if (focused) {
s = shapeGenerator.createRoundRectangle(x - 2, y - 2, width + 3, height + 3, CornerSize.OUTER_FOCUS);
g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, useToolBarColors));
g.draw(s);
s = shapeGenerator.createRoundRectangle(x - 1, y - 1, width + 1, height + 1, CornerSize.INNER_FOCUS);
g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, useToolBarColors));
g.draw(s);
}
if (type != CommonControlState.DISABLED) {
s = shapeGenerator.createRoundRectangle(x + 1, x + 1, width - 2, height - 2, CornerSize.BORDER);
internalShadow.fill(g, s, false, true);
}
s = shapeGenerator.createRoundRectangle(x, y, width - 1, height - 1, CornerSize.BORDER);
g.setPaint(getTextBorderPaint(type, !focused && useToolBarColors));
g.draw(s);
} | java | private void paintBorder(Graphics2D g, JComponent c, int x, int y, int width, int height) {
boolean useToolBarColors = isInToolBar(c);
Shape s;
if (focused) {
s = shapeGenerator.createRoundRectangle(x - 2, y - 2, width + 3, height + 3, CornerSize.OUTER_FOCUS);
g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, useToolBarColors));
g.draw(s);
s = shapeGenerator.createRoundRectangle(x - 1, y - 1, width + 1, height + 1, CornerSize.INNER_FOCUS);
g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, useToolBarColors));
g.draw(s);
}
if (type != CommonControlState.DISABLED) {
s = shapeGenerator.createRoundRectangle(x + 1, x + 1, width - 2, height - 2, CornerSize.BORDER);
internalShadow.fill(g, s, false, true);
}
s = shapeGenerator.createRoundRectangle(x, y, width - 1, height - 1, CornerSize.BORDER);
g.setPaint(getTextBorderPaint(type, !focused && useToolBarColors));
g.draw(s);
} | [
"private",
"void",
"paintBorder",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"boolean",
"useToolBarColors",
"=",
"isInToolBar",
"(",
"c",
")",
";",
"Shape",
"s"... | Paint the border.
@param g DOCUMENT ME!
@param c DOCUMENT ME!
@param x DOCUMENT ME!
@param y DOCUMENT ME!
@param width DOCUMENT ME!
@param height DOCUMENT ME! | [
"Paint",
"the",
"border",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TextComponentPainter.java#L232-L253 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/RegularExpressionValidator.java | RegularExpressionValidator.isValid | @Override
public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) {
if (StringUtils.isEmpty(pvalue)) {
return true;
}
try {
// execute regular expression, result doesn't matter
"x".matches(pvalue);
return true;
} catch (final Exception pexception) {
// regular expression is invalid
return false;
}
} | java | @Override
public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) {
if (StringUtils.isEmpty(pvalue)) {
return true;
}
try {
// execute regular expression, result doesn't matter
"x".matches(pvalue);
return true;
} catch (final Exception pexception) {
// regular expression is invalid
return false;
}
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"String",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"pvalue",
")",
")",
"{",
"return",
"true",
";",
"}",
... | {@inheritDoc} check if given string is a valid regular expression.
@see javax.validation.ConstraintValidator#isValid(java.lang.Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"string",
"is",
"a",
"valid",
"regular",
"expression",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/RegularExpressionValidator.java#L49-L62 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/utils/MemoryCacheUtils.java | MemoryCacheUtils.removeFromCache | public static void removeFromCache(String imageUri, MemoryCache memoryCache) {
List<String> keysToRemove = new ArrayList<String>();
for (String key : memoryCache.keys()) {
if (key.startsWith(imageUri)) {
keysToRemove.add(key);
}
}
for (String keyToRemove : keysToRemove) {
memoryCache.remove(keyToRemove);
}
} | java | public static void removeFromCache(String imageUri, MemoryCache memoryCache) {
List<String> keysToRemove = new ArrayList<String>();
for (String key : memoryCache.keys()) {
if (key.startsWith(imageUri)) {
keysToRemove.add(key);
}
}
for (String keyToRemove : keysToRemove) {
memoryCache.remove(keyToRemove);
}
} | [
"public",
"static",
"void",
"removeFromCache",
"(",
"String",
"imageUri",
",",
"MemoryCache",
"memoryCache",
")",
"{",
"List",
"<",
"String",
">",
"keysToRemove",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",... | Removes from memory cache all images for incoming URI.<br />
<b>Note:</b> Memory cache can contain multiple sizes of the same image if only you didn't set
{@link ImageLoaderConfiguration.Builder#denyCacheImageMultipleSizesInMemory()
denyCacheImageMultipleSizesInMemory()} option in {@linkplain ImageLoaderConfiguration configuration} | [
"Removes",
"from",
"memory",
"cache",
"all",
"images",
"for",
"incoming",
"URI",
".",
"<br",
"/",
">",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"Memory",
"cache",
"can",
"contain",
"multiple",
"sizes",
"of",
"the",
"same",
"image",
"if",
"only",
"... | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/utils/MemoryCacheUtils.java#L99-L109 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_retraction_POST | public void order_orderId_retraction_POST(Long orderId, String comment, OvhRetractionReasonEnum reason) throws IOException {
String qPath = "/me/order/{orderId}/retraction";
StringBuilder sb = path(qPath, orderId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "comment", comment);
addBody(o, "reason", reason);
exec(qPath, "POST", sb.toString(), o);
} | java | public void order_orderId_retraction_POST(Long orderId, String comment, OvhRetractionReasonEnum reason) throws IOException {
String qPath = "/me/order/{orderId}/retraction";
StringBuilder sb = path(qPath, orderId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "comment", comment);
addBody(o, "reason", reason);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"order_orderId_retraction_POST",
"(",
"Long",
"orderId",
",",
"String",
"comment",
",",
"OvhRetractionReasonEnum",
"reason",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/retraction\"",
";",
"StringBuilder",
"sb",
"=... | Request retraction of order
REST: POST /me/order/{orderId}/retraction
@param reason [required] The reason why you want to retract
@param comment [required] An optional comment of why you want to retract
@param orderId [required] | [
"Request",
"retraction",
"of",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2096-L2103 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.