repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/gremlin/optimizer/ExpandOrsOptimization.java | ExpandOrsOptimization.expandOrs | private List<GroovyExpression> expandOrs(GroovyExpression expr, OptimizationContext context) {
if (GremlinQueryOptimizer.isOrExpression(expr)) {
return expandOrFunction(expr, context);
}
return processOtherExpression(expr, context);
} | java | private List<GroovyExpression> expandOrs(GroovyExpression expr, OptimizationContext context) {
if (GremlinQueryOptimizer.isOrExpression(expr)) {
return expandOrFunction(expr, context);
}
return processOtherExpression(expr, context);
} | [
"private",
"List",
"<",
"GroovyExpression",
">",
"expandOrs",
"(",
"GroovyExpression",
"expr",
",",
"OptimizationContext",
"context",
")",
"{",
"if",
"(",
"GremlinQueryOptimizer",
".",
"isOrExpression",
"(",
"expr",
")",
")",
"{",
"return",
"expandOrFunction",
"("... | Recursively traverses the given expression, expanding or expressions
wherever they are found.
@param expr
@param context
@return expressions that should be unioned together to get the query result | [
"Recursively",
"traverses",
"the",
"given",
"expression",
"expanding",
"or",
"expressions",
"wherever",
"they",
"are",
"found",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/gremlin/optimizer/ExpandOrsOptimization.java#L350-L356 |
asciidoctor/asciidoclet | src/main/java/org/asciidoctor/Asciidoclet.java | Asciidoclet.validOptions | @SuppressWarnings("UnusedDeclaration")
public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) {
return validOptions(options, errorReporter, new StandardAdapter());
} | java | @SuppressWarnings("UnusedDeclaration")
public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) {
return validOptions(options, errorReporter, new StandardAdapter());
} | [
"@",
"SuppressWarnings",
"(",
"\"UnusedDeclaration\"",
")",
"public",
"static",
"boolean",
"validOptions",
"(",
"String",
"[",
"]",
"[",
"]",
"options",
",",
"DocErrorReporter",
"errorReporter",
")",
"{",
"return",
"validOptions",
"(",
"options",
",",
"errorReport... | Processes the input options by delegating to the standard handler.
_Javadoc spec requirement._
@param options input option array
@param errorReporter error handling
@return success | [
"Processes",
"the",
"input",
"options",
"by",
"delegating",
"to",
"the",
"standard",
"handler",
"."
] | train | https://github.com/asciidoctor/asciidoclet/blob/6c43ce214e48797d2b5e8d59c31b65304279717b/src/main/java/org/asciidoctor/Asciidoclet.java#L254-L257 |
apereo/cas | core/cas-server-core-configuration-api/src/main/java/org/apereo/cas/configuration/loader/ConfigurationPropertiesLoaderFactory.java | ConfigurationPropertiesLoaderFactory.getLoader | public BaseConfigurationPropertiesLoader getLoader(final Resource resource,
final String name) {
val filename = StringUtils.defaultString(resource.getFilename()).toLowerCase();
if (filename.endsWith(".properties")) {
return new SimpleConfigurationPropertiesLoader(this.configurationCipherExecutor, name, resource);
}
if (filename.endsWith(".groovy")) {
return new GroovyConfigurationPropertiesLoader(this.configurationCipherExecutor, name,
getApplicationProfiles(environment), resource);
}
if (filename.endsWith(".yaml") || filename.endsWith(".yml")) {
return new YamlConfigurationPropertiesLoader(this.configurationCipherExecutor, name, resource);
}
throw new IllegalArgumentException("Unable to determine configuration loader for " + resource);
} | java | public BaseConfigurationPropertiesLoader getLoader(final Resource resource,
final String name) {
val filename = StringUtils.defaultString(resource.getFilename()).toLowerCase();
if (filename.endsWith(".properties")) {
return new SimpleConfigurationPropertiesLoader(this.configurationCipherExecutor, name, resource);
}
if (filename.endsWith(".groovy")) {
return new GroovyConfigurationPropertiesLoader(this.configurationCipherExecutor, name,
getApplicationProfiles(environment), resource);
}
if (filename.endsWith(".yaml") || filename.endsWith(".yml")) {
return new YamlConfigurationPropertiesLoader(this.configurationCipherExecutor, name, resource);
}
throw new IllegalArgumentException("Unable to determine configuration loader for " + resource);
} | [
"public",
"BaseConfigurationPropertiesLoader",
"getLoader",
"(",
"final",
"Resource",
"resource",
",",
"final",
"String",
"name",
")",
"{",
"val",
"filename",
"=",
"StringUtils",
".",
"defaultString",
"(",
"resource",
".",
"getFilename",
"(",
")",
")",
".",
"toL... | Gets loader.
@param resource the resource
@param name the name
@return the loader | [
"Gets",
"loader",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-configuration-api/src/main/java/org/apereo/cas/configuration/loader/ConfigurationPropertiesLoaderFactory.java#L37-L52 |
flow/commons | src/main/java/com/flowpowered/commons/hashing/SignedTenBitTripleHashed.java | SignedTenBitTripleHashed.positiveRightShift | public static int positiveRightShift(int key, int shift) {
int single = 0x3FF >> shift;
int shiftMask = (single << 22) | (single << 11) | single;
return shiftMask & (key >> shift);
} | java | public static int positiveRightShift(int key, int shift) {
int single = 0x3FF >> shift;
int shiftMask = (single << 22) | (single << 11) | single;
return shiftMask & (key >> shift);
} | [
"public",
"static",
"int",
"positiveRightShift",
"(",
"int",
"key",
",",
"int",
"shift",
")",
"{",
"int",
"single",
"=",
"0x3FF",
">>",
"shift",
";",
"int",
"shiftMask",
"=",
"(",
"single",
"<<",
"22",
")",
"|",
"(",
"single",
"<<",
"11",
")",
"|",
... | Shifts the given key to the right.<br> <br> This method only works for keys if all 3 sub-keys are positive
@param key the key
@param shift the right shift | [
"Shifts",
"the",
"given",
"key",
"to",
"the",
"right",
".",
"<br",
">",
"<br",
">",
"This",
"method",
"only",
"works",
"for",
"keys",
"if",
"all",
"3",
"sub",
"-",
"keys",
"are",
"positive"
] | train | https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/hashing/SignedTenBitTripleHashed.java#L104-L108 |
Netflix/conductor | redis-persistence/src/main/java/com/netflix/conductor/dao/dynomite/RedisExecutionDAO.java | RedisExecutionDAO.correlateTaskToWorkflowInDS | @VisibleForTesting
void correlateTaskToWorkflowInDS(String taskId, String workflowInstanceId) {
String workflowToTaskKey = nsKey(WORKFLOW_TO_TASKS, workflowInstanceId);
dynoClient.sadd(workflowToTaskKey, taskId);
logger.debug("Task mapped in WORKFLOW_TO_TASKS with workflowToTaskKey: {}, workflowId: {}, taskId: {}",
workflowToTaskKey, workflowInstanceId, taskId);
} | java | @VisibleForTesting
void correlateTaskToWorkflowInDS(String taskId, String workflowInstanceId) {
String workflowToTaskKey = nsKey(WORKFLOW_TO_TASKS, workflowInstanceId);
dynoClient.sadd(workflowToTaskKey, taskId);
logger.debug("Task mapped in WORKFLOW_TO_TASKS with workflowToTaskKey: {}, workflowId: {}, taskId: {}",
workflowToTaskKey, workflowInstanceId, taskId);
} | [
"@",
"VisibleForTesting",
"void",
"correlateTaskToWorkflowInDS",
"(",
"String",
"taskId",
",",
"String",
"workflowInstanceId",
")",
"{",
"String",
"workflowToTaskKey",
"=",
"nsKey",
"(",
"WORKFLOW_TO_TASKS",
",",
"workflowInstanceId",
")",
";",
"dynoClient",
".",
"sad... | Stores the correlation of a task to the workflow instance in the datastore
@param taskId the taskId to be correlated
@param workflowInstanceId the workflowId to which the tasks belongs to | [
"Stores",
"the",
"correlation",
"of",
"a",
"task",
"to",
"the",
"workflow",
"instance",
"in",
"the",
"datastore"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/redis-persistence/src/main/java/com/netflix/conductor/dao/dynomite/RedisExecutionDAO.java#L534-L540 |
instacount/appengine-counter | src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java | ShardedCounterServiceImpl.createCounterData | @VisibleForTesting
protected CounterData createCounterData(final String counterName)
{
this.counterNameValidator.validateCounterName(counterName);
final Key<CounterData> counterKey = CounterData.key(counterName);
// Perform a transactional GET to see if the counter exists. If it does, throw an exception. Otherwise, create
// the counter in the same TX.
return ObjectifyService.ofy().transact(new Work<CounterData>()
{
@Override
public CounterData run()
{
final CounterData loadedCounterData = ObjectifyService.ofy().load().key(counterKey).now();
if (loadedCounterData == null)
{
final CounterData counterData = new CounterData(counterName, config.getNumInitialShards());
ObjectifyService.ofy().save().entity(counterData).now();
return counterData;
}
else
{
throw new CounterExistsException(counterName);
}
}
});
} | java | @VisibleForTesting
protected CounterData createCounterData(final String counterName)
{
this.counterNameValidator.validateCounterName(counterName);
final Key<CounterData> counterKey = CounterData.key(counterName);
// Perform a transactional GET to see if the counter exists. If it does, throw an exception. Otherwise, create
// the counter in the same TX.
return ObjectifyService.ofy().transact(new Work<CounterData>()
{
@Override
public CounterData run()
{
final CounterData loadedCounterData = ObjectifyService.ofy().load().key(counterKey).now();
if (loadedCounterData == null)
{
final CounterData counterData = new CounterData(counterName, config.getNumInitialShards());
ObjectifyService.ofy().save().entity(counterData).now();
return counterData;
}
else
{
throw new CounterExistsException(counterName);
}
}
});
} | [
"@",
"VisibleForTesting",
"protected",
"CounterData",
"createCounterData",
"(",
"final",
"String",
"counterName",
")",
"{",
"this",
".",
"counterNameValidator",
".",
"validateCounterName",
"(",
"counterName",
")",
";",
"final",
"Key",
"<",
"CounterData",
">",
"count... | Helper method to create the {@link CounterData} associated with the supplied counter information.
@param counterName
@return
@throws IllegalArgumentException If the {@code counterName} is invalid.
@throws CounterExistsException If the counter with {@code counterName} already exists in the Datastore. | [
"Helper",
"method",
"to",
"create",
"the",
"{",
"@link",
"CounterData",
"}",
"associated",
"with",
"the",
"supplied",
"counter",
"information",
"."
] | train | https://github.com/instacount/appengine-counter/blob/60aa86ab28f173ec1642539926b69924b8bda238/src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java#L1210-L1237 |
ops4j/org.ops4j.pax.wicket | service/src/main/java/org/ops4j/pax/wicket/util/proxy/LazyInitProxyFactory.java | LazyInitProxyFactory.createProxy | public static Object createProxy(final Class<?> type, final ProxyTargetLocator locator) {
if (type.isPrimitive() || BUILTINS.contains(type) || Enum.class.isAssignableFrom(type)) {
// We special-case primitives as sometimes people use these as
// SpringBeans (WICKET-603, WICKET-906). Go figure.
Object proxy = locator.locateProxyTarget();
Object realTarget = getRealTarget(proxy);
if (proxy instanceof ReleasableProxyTarget) {
// This is not so nice... but with a primitive this should'nt matter at all...
((ReleasableProxyTarget) proxy).releaseTarget();
}
return realTarget;
} else if (type.isInterface()) {
JdkHandler handler = new JdkHandler(type, locator);
try {
return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class[]{ type, Serializable.class, ILazyInitProxy.class,
IWriteReplace.class }, handler);
} catch (IllegalArgumentException e) {
// While in the original Wicket Environment this is a failure of the context-classloader in PAX-WICKET
// this is always an error of missing imports into the classloader. Right now we can do nothing here but
// inform the user about the problem and throw an IllegalStateException instead wrapping up and
// presenting the real problem.
throw new IllegalStateException("The real problem is that the used wrapper classes are not imported " +
"by the bundle using injection", e);
}
} else {
CGLibInterceptor handler = new CGLibInterceptor(type, locator);
Enhancer e = new Enhancer();
e.setInterfaces(new Class[]{ Serializable.class, ILazyInitProxy.class,
IWriteReplace.class });
e.setSuperclass(type);
e.setCallback(handler);
//e.setClassLoader(LazyInitProxyFactory.class.getClassLoader());
e.setNamingPolicy(new DefaultNamingPolicy() {
@Override
public String getClassName(final String prefix, final String source,
final Object key, final Predicate names) {
return super.getClassName("WICKET_" + prefix, source, key, names);
}
});
return e.create();
}
} | java | public static Object createProxy(final Class<?> type, final ProxyTargetLocator locator) {
if (type.isPrimitive() || BUILTINS.contains(type) || Enum.class.isAssignableFrom(type)) {
// We special-case primitives as sometimes people use these as
// SpringBeans (WICKET-603, WICKET-906). Go figure.
Object proxy = locator.locateProxyTarget();
Object realTarget = getRealTarget(proxy);
if (proxy instanceof ReleasableProxyTarget) {
// This is not so nice... but with a primitive this should'nt matter at all...
((ReleasableProxyTarget) proxy).releaseTarget();
}
return realTarget;
} else if (type.isInterface()) {
JdkHandler handler = new JdkHandler(type, locator);
try {
return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class[]{ type, Serializable.class, ILazyInitProxy.class,
IWriteReplace.class }, handler);
} catch (IllegalArgumentException e) {
// While in the original Wicket Environment this is a failure of the context-classloader in PAX-WICKET
// this is always an error of missing imports into the classloader. Right now we can do nothing here but
// inform the user about the problem and throw an IllegalStateException instead wrapping up and
// presenting the real problem.
throw new IllegalStateException("The real problem is that the used wrapper classes are not imported " +
"by the bundle using injection", e);
}
} else {
CGLibInterceptor handler = new CGLibInterceptor(type, locator);
Enhancer e = new Enhancer();
e.setInterfaces(new Class[]{ Serializable.class, ILazyInitProxy.class,
IWriteReplace.class });
e.setSuperclass(type);
e.setCallback(handler);
//e.setClassLoader(LazyInitProxyFactory.class.getClassLoader());
e.setNamingPolicy(new DefaultNamingPolicy() {
@Override
public String getClassName(final String prefix, final String source,
final Object key, final Predicate names) {
return super.getClassName("WICKET_" + prefix, source, key, names);
}
});
return e.create();
}
} | [
"public",
"static",
"Object",
"createProxy",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"ProxyTargetLocator",
"locator",
")",
"{",
"if",
"(",
"type",
".",
"isPrimitive",
"(",
")",
"||",
"BUILTINS",
".",
"contains",
"(",
"type",
")",
"||"... | <p>createProxy.</p>
@param type a {@link java.lang.Class} object.
@param locator a {@link org.ops4j.pax.wicket.spi.ProxyTargetLocator} object.
@return a {@link java.lang.Object} object. | [
"<p",
">",
"createProxy",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/util/proxy/LazyInitProxyFactory.java#L60-L106 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/V1JsExprTranslator.java | V1JsExprTranslator.translateVar | private static String translateVar(SoyToJsVariableMappings variableMappings, Matcher matcher) {
Preconditions.checkArgument(matcher.matches());
String firstPart = matcher.group(1);
StringBuilder exprTextSb = new StringBuilder();
// ------ Translate the first key, which may be a variable or a data key ------
String translation = getLocalVarTranslation(firstPart, variableMappings);
if (translation != null) {
// Case 1: In-scope local var.
exprTextSb.append(translation);
} else {
// Case 2: Data reference.
exprTextSb.append("opt_data.").append(firstPart);
}
return exprTextSb.toString();
} | java | private static String translateVar(SoyToJsVariableMappings variableMappings, Matcher matcher) {
Preconditions.checkArgument(matcher.matches());
String firstPart = matcher.group(1);
StringBuilder exprTextSb = new StringBuilder();
// ------ Translate the first key, which may be a variable or a data key ------
String translation = getLocalVarTranslation(firstPart, variableMappings);
if (translation != null) {
// Case 1: In-scope local var.
exprTextSb.append(translation);
} else {
// Case 2: Data reference.
exprTextSb.append("opt_data.").append(firstPart);
}
return exprTextSb.toString();
} | [
"private",
"static",
"String",
"translateVar",
"(",
"SoyToJsVariableMappings",
"variableMappings",
",",
"Matcher",
"matcher",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
";",
"String",
"firstPart",
"=",
"matcher"... | Helper function to translate a variable or data reference.
<p>Examples:
<pre>
$boo --> opt_data.boo (var ref)
</pre>
@param variableMappings The current replacement JS expressions for the local variables (and
foreach-loop special functions) current in scope.
@param matcher Matcher formed from {@link V1JsExprTranslator#VAR_OR_REF}.
@return Generated translation for the variable or data reference. | [
"Helper",
"function",
"to",
"translate",
"a",
"variable",
"or",
"data",
"reference",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/V1JsExprTranslator.java#L143-L160 |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java | OSchemaHelper.oAbstractClass | public OSchemaHelper oAbstractClass(String className, String... superClasses)
{
return oClass(className, true, superClasses);
} | java | public OSchemaHelper oAbstractClass(String className, String... superClasses)
{
return oClass(className, true, superClasses);
} | [
"public",
"OSchemaHelper",
"oAbstractClass",
"(",
"String",
"className",
",",
"String",
"...",
"superClasses",
")",
"{",
"return",
"oClass",
"(",
"className",
",",
"true",
",",
"superClasses",
")",
";",
"}"
] | Create if required abstract {@link OClass}
@param className name of a class to create
@param superClasses list of superclasses
@return this helper | [
"Create",
"if",
"required",
"abstract",
"{"
] | train | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java#L76-L79 |
threerings/nenya | core/src/main/java/com/threerings/media/util/ArcPath.java | ArcPath.getTranslatedInstance | public Path getTranslatedInstance (int x, int y)
{
int startx = (int)(_center.x + Math.round(Math.cos(_sangle) * _xradius));
int starty = (int)(_center.y + Math.round(Math.sin(_sangle) * _yradius));
return new ArcPath(new Point(startx + x, starty + y),
_xradius, _yradius, _sangle, _delta, _duration, _orient);
} | java | public Path getTranslatedInstance (int x, int y)
{
int startx = (int)(_center.x + Math.round(Math.cos(_sangle) * _xradius));
int starty = (int)(_center.y + Math.round(Math.sin(_sangle) * _yradius));
return new ArcPath(new Point(startx + x, starty + y),
_xradius, _yradius, _sangle, _delta, _duration, _orient);
} | [
"public",
"Path",
"getTranslatedInstance",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"startx",
"=",
"(",
"int",
")",
"(",
"_center",
".",
"x",
"+",
"Math",
".",
"round",
"(",
"Math",
".",
"cos",
"(",
"_sangle",
")",
"*",
"_xradius",
")",
... | Return a copy of the path, translated by the specified amounts. | [
"Return",
"a",
"copy",
"of",
"the",
"path",
"translated",
"by",
"the",
"specified",
"amounts",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/ArcPath.java#L90-L97 |
yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/DispatcherHandler.java | DispatcherHandler.preHandle | private boolean preHandle(HttpRequest request, HttpResponse response, RequestHandler handler) throws Exception {
for (HandlerInterceptor interceptor : mInterceptorList) {
if (interceptor.onIntercept(request, response, handler)) return true;
}
return false;
} | java | private boolean preHandle(HttpRequest request, HttpResponse response, RequestHandler handler) throws Exception {
for (HandlerInterceptor interceptor : mInterceptorList) {
if (interceptor.onIntercept(request, response, handler)) return true;
}
return false;
} | [
"private",
"boolean",
"preHandle",
"(",
"HttpRequest",
"request",
",",
"HttpResponse",
"response",
",",
"RequestHandler",
"handler",
")",
"throws",
"Exception",
"{",
"for",
"(",
"HandlerInterceptor",
"interceptor",
":",
"mInterceptorList",
")",
"{",
"if",
"(",
"in... | Intercept the execution of a handler.
@param request current request.
@param response current response.
@param handler the corresponding handler of the current request.
@return true if the interceptor has processed the request and responded. | [
"Intercept",
"the",
"execution",
"of",
"a",
"handler",
"."
] | train | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/DispatcherHandler.java#L182-L187 |
enioka/jqm | jqm-all/jqm-runner/jqm-runner-shell/src/main/java/com/enioka/jqm/tools/OsHelpers.java | OsHelpers.addAllParametersAsSingleString | private static void addAllParametersAsSingleString(List<String> resultList, String commandLine, Map<String, String> prms)
{
List<String> raw = new ArrayList<>(prms.size() * 2);
// Command itself
raw.add(commandLine);
// Parameters, ordered by key
List<String> keys = new ArrayList<>(prms.keySet());
Collections.sort(keys, prmComparator);
for (String p : keys)
{
if (!prms.get(p).trim().isEmpty())
{
raw.add(prms.get(p).trim());
}
}
if (!raw.isEmpty())
{
resultList.add(StringUtils.join(raw, " "));
}
} | java | private static void addAllParametersAsSingleString(List<String> resultList, String commandLine, Map<String, String> prms)
{
List<String> raw = new ArrayList<>(prms.size() * 2);
// Command itself
raw.add(commandLine);
// Parameters, ordered by key
List<String> keys = new ArrayList<>(prms.keySet());
Collections.sort(keys, prmComparator);
for (String p : keys)
{
if (!prms.get(p).trim().isEmpty())
{
raw.add(prms.get(p).trim());
}
}
if (!raw.isEmpty())
{
resultList.add(StringUtils.join(raw, " "));
}
} | [
"private",
"static",
"void",
"addAllParametersAsSingleString",
"(",
"List",
"<",
"String",
">",
"resultList",
",",
"String",
"commandLine",
",",
"Map",
"<",
"String",
",",
"String",
">",
"prms",
")",
"{",
"List",
"<",
"String",
">",
"raw",
"=",
"new",
"Arr... | When using /bin/sh -c "..." there is a single argument to the process. This method builds it.<br>
Note we encourange users through the GUI to only specify the whole shell command in a single field. Only XML imports may result in
multiple arguments.
@param resultList
@param ji | [
"When",
"using",
"/",
"bin",
"/",
"sh",
"-",
"c",
"...",
"there",
"is",
"a",
"single",
"argument",
"to",
"the",
"process",
".",
"This",
"method",
"builds",
"it",
".",
"<br",
">",
"Note",
"we",
"encourange",
"users",
"through",
"the",
"GUI",
"to",
"on... | train | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-runner/jqm-runner-shell/src/main/java/com/enioka/jqm/tools/OsHelpers.java#L81-L103 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java | CPFriendlyURLEntryPersistenceImpl.fetchByG_C_L_U | @Override
public CPFriendlyURLEntry fetchByG_C_L_U(long groupId, long classNameId,
String languageId, String urlTitle) {
return fetchByG_C_L_U(groupId, classNameId, languageId, urlTitle, true);
} | java | @Override
public CPFriendlyURLEntry fetchByG_C_L_U(long groupId, long classNameId,
String languageId, String urlTitle) {
return fetchByG_C_L_U(groupId, classNameId, languageId, urlTitle, true);
} | [
"@",
"Override",
"public",
"CPFriendlyURLEntry",
"fetchByG_C_L_U",
"(",
"long",
"groupId",
",",
"long",
"classNameId",
",",
"String",
"languageId",
",",
"String",
"urlTitle",
")",
"{",
"return",
"fetchByG_C_L_U",
"(",
"groupId",
",",
"classNameId",
",",
"languageI... | Returns the cp friendly url entry where groupId = ? and classNameId = ? and languageId = ? and urlTitle = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param groupId the group ID
@param classNameId the class name ID
@param languageId the language ID
@param urlTitle the url title
@return the matching cp friendly url entry, or <code>null</code> if a matching cp friendly url entry could not be found | [
"Returns",
"the",
"cp",
"friendly",
"url",
"entry",
"where",
"groupId",
"=",
"?",
";",
"and",
"classNameId",
"=",
"?",
";",
"and",
"languageId",
"=",
"?",
";",
"and",
"urlTitle",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L3970-L3974 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/Database.java | Database.withTransaction | public <T> T withTransaction(@NotNull Propagation propagation,
@NotNull Isolation isolation,
@NotNull TransactionCallback<T> callback) {
TransactionSettings settings = new TransactionSettings();
settings.setPropagation(propagation);
settings.setIsolation(isolation);
return withTransaction(settings, callback);
} | java | public <T> T withTransaction(@NotNull Propagation propagation,
@NotNull Isolation isolation,
@NotNull TransactionCallback<T> callback) {
TransactionSettings settings = new TransactionSettings();
settings.setPropagation(propagation);
settings.setIsolation(isolation);
return withTransaction(settings, callback);
} | [
"public",
"<",
"T",
">",
"T",
"withTransaction",
"(",
"@",
"NotNull",
"Propagation",
"propagation",
",",
"@",
"NotNull",
"Isolation",
"isolation",
",",
"@",
"NotNull",
"TransactionCallback",
"<",
"T",
">",
"callback",
")",
"{",
"TransactionSettings",
"settings",... | Executes a block of code with given propagation and isolation. | [
"Executes",
"a",
"block",
"of",
"code",
"with",
"given",
"propagation",
"and",
"isolation",
"."
] | train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L176-L185 |
jbundle/jcalendarbutton | src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java | JCalendarPopup.createCalendarButton | public static JButton createCalendarButton(String strDateParam, Date dateTarget)
{
JCalendarButton button = new JCalendarButton(strDateParam, dateTarget);
button.setMargin(NO_INSETS);
button.setOpaque(false);
return button;
} | java | public static JButton createCalendarButton(String strDateParam, Date dateTarget)
{
JCalendarButton button = new JCalendarButton(strDateParam, dateTarget);
button.setMargin(NO_INSETS);
button.setOpaque(false);
return button;
} | [
"public",
"static",
"JButton",
"createCalendarButton",
"(",
"String",
"strDateParam",
",",
"Date",
"dateTarget",
")",
"{",
"JCalendarButton",
"button",
"=",
"new",
"JCalendarButton",
"(",
"strDateParam",
",",
"dateTarget",
")",
";",
"button",
".",
"setMargin",
"("... | Create this calendar in a popup menu and synchronize the text field on change.
@param strDateParam The name of the date property (defaults to "date").
@param dateTarget The initial date for this button. | [
"Create",
"this",
"calendar",
"in",
"a",
"popup",
"menu",
"and",
"synchronize",
"the",
"text",
"field",
"on",
"change",
"."
] | train | https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java#L608-L615 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPreferences.java | CmsPreferences.computeEditorPreselection | private String computeEditorPreselection(HttpServletRequest request, String resourceType) {
// first check presence of the setting in request parameter
String preSelection = request.getParameter(PARAM_PREFERREDEDITOR_PREFIX + resourceType);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(preSelection)) {
return CmsEncoder.decode(preSelection);
} else {
// no value found in request, check current user settings (not the member!)
CmsUserSettings userSettings = new CmsUserSettings(getSettings().getUser());
return userSettings.getPreferredEditor(resourceType);
}
} | java | private String computeEditorPreselection(HttpServletRequest request, String resourceType) {
// first check presence of the setting in request parameter
String preSelection = request.getParameter(PARAM_PREFERREDEDITOR_PREFIX + resourceType);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(preSelection)) {
return CmsEncoder.decode(preSelection);
} else {
// no value found in request, check current user settings (not the member!)
CmsUserSettings userSettings = new CmsUserSettings(getSettings().getUser());
return userSettings.getPreferredEditor(resourceType);
}
} | [
"private",
"String",
"computeEditorPreselection",
"(",
"HttpServletRequest",
"request",
",",
"String",
"resourceType",
")",
"{",
"// first check presence of the setting in request parameter",
"String",
"preSelection",
"=",
"request",
".",
"getParameter",
"(",
"PARAM_PREFERREDED... | Returns the preferred editor preselection value either from the request, if not present, from the user settings.<p>
@param request the current http servlet request
@param resourceType the preferred editors resource type
@return the preferred editor preselection value or null, if none found | [
"Returns",
"the",
"preferred",
"editor",
"preselection",
"value",
"either",
"from",
"the",
"request",
"if",
"not",
"present",
"from",
"the",
"user",
"settings",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L2287-L2299 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapClient.java | UrlMapClient.insertUrlMap | @BetaApi
public final Operation insertUrlMap(String project, UrlMap urlMapResource) {
InsertUrlMapHttpRequest request =
InsertUrlMapHttpRequest.newBuilder()
.setProject(project)
.setUrlMapResource(urlMapResource)
.build();
return insertUrlMap(request);
} | java | @BetaApi
public final Operation insertUrlMap(String project, UrlMap urlMapResource) {
InsertUrlMapHttpRequest request =
InsertUrlMapHttpRequest.newBuilder()
.setProject(project)
.setUrlMapResource(urlMapResource)
.build();
return insertUrlMap(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertUrlMap",
"(",
"String",
"project",
",",
"UrlMap",
"urlMapResource",
")",
"{",
"InsertUrlMapHttpRequest",
"request",
"=",
"InsertUrlMapHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setProject",
"(",
"project",... | Creates a UrlMap resource in the specified project using the data included in the request.
<p>Sample code:
<pre><code>
try (UrlMapClient urlMapClient = UrlMapClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
UrlMap urlMapResource = UrlMap.newBuilder().build();
Operation response = urlMapClient.insertUrlMap(project.toString(), urlMapResource);
}
</code></pre>
@param project Project ID for this request.
@param urlMapResource A UrlMap resource. This resource defines the mapping from URL to the
BackendService resource, based on the "longest-match" of the URL's host and path.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"UrlMap",
"resource",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapClient.java#L400-L409 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.getField | public static Field getField(Class<?> clazz, String fieldName)
{
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}
catch(NoSuchFieldException e) {
throw new NoSuchBeingException(e);
}
catch(SecurityException e) {
throw new BugError(e);
}
} | java | public static Field getField(Class<?> clazz, String fieldName)
{
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}
catch(NoSuchFieldException e) {
throw new NoSuchBeingException(e);
}
catch(SecurityException e) {
throw new BugError(e);
}
} | [
"public",
"static",
"Field",
"getField",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
")",
"{",
"try",
"{",
"Field",
"field",
"=",
"clazz",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";",
"field",
".",
"setAccessible",
"(",
"tru... | Get class field with unchecked runtime exception. JRE throws checked {@link NoSuchFieldException} if field is
missing, behavior that is not desirable for this library. This method uses runtime, unchecked
{@link NoSuchBeingException} instead. Returned field has accessibility set to true.
@param clazz Java class to return field from,
@param fieldName field name.
@return class reflective field.
@throws NoSuchBeingException if field not found. | [
"Get",
"class",
"field",
"with",
"unchecked",
"runtime",
"exception",
".",
"JRE",
"throws",
"checked",
"{",
"@link",
"NoSuchFieldException",
"}",
"if",
"field",
"is",
"missing",
"behavior",
"that",
"is",
"not",
"desirable",
"for",
"this",
"library",
".",
"This... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L607-L620 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.addControl | public Widget addControl(String name, int resId, String label, Widget.OnTouchListener listener) {
return addControl(name, resId, label, listener, -1);
} | java | public Widget addControl(String name, int resId, String label, Widget.OnTouchListener listener) {
return addControl(name, resId, label, listener, -1);
} | [
"public",
"Widget",
"addControl",
"(",
"String",
"name",
",",
"int",
"resId",
",",
"String",
"label",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"return",
"addControl",
"(",
"name",
",",
"resId",
",",
"label",
",",
"listener",
",",
"-",
... | Add new control at the end of control bar with specified touch listener, control label and resource.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param resId the control face
@param label the control label
@param listener touch listener | [
"Add",
"new",
"control",
"at",
"the",
"end",
"of",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
"control",
"label",
"and",
"resource",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
".... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L182-L184 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/WsMessageRouterImpl.java | WsMessageRouterImpl.routeTo | protected void routeTo(RoutedMessage routedMessage, String logHandlerId) {
WsLogHandler wsLogHandler = wsLogHandlerServices.get(logHandlerId);
if (wsLogHandler != null) {
wsLogHandler.publish(routedMessage);
}
} | java | protected void routeTo(RoutedMessage routedMessage, String logHandlerId) {
WsLogHandler wsLogHandler = wsLogHandlerServices.get(logHandlerId);
if (wsLogHandler != null) {
wsLogHandler.publish(routedMessage);
}
} | [
"protected",
"void",
"routeTo",
"(",
"RoutedMessage",
"routedMessage",
",",
"String",
"logHandlerId",
")",
"{",
"WsLogHandler",
"wsLogHandler",
"=",
"wsLogHandlerServices",
".",
"get",
"(",
"logHandlerId",
")",
";",
"if",
"(",
"wsLogHandler",
"!=",
"null",
")",
... | Route the message to the LogHandler identified by the given logHandlerId.
@param msg The fully formatted message.
@param logRecord The associated LogRecord, in case the LogHandler needs it.
@param logHandlerId The LogHandler ID in which to route. | [
"Route",
"the",
"message",
"to",
"the",
"LogHandler",
"identified",
"by",
"the",
"given",
"logHandlerId",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/WsMessageRouterImpl.java#L229-L234 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRMorphAnimation.java | GVRMorphAnimation.animate | public void animate(GVRHybridObject object, float animationTime)
{
GVRMeshMorph morph = (GVRMeshMorph) mTarget;
mKeyInterpolator.animate(animationTime * mDuration, mCurrentValues);
morph.setWeights(mCurrentValues);
} | java | public void animate(GVRHybridObject object, float animationTime)
{
GVRMeshMorph morph = (GVRMeshMorph) mTarget;
mKeyInterpolator.animate(animationTime * mDuration, mCurrentValues);
morph.setWeights(mCurrentValues);
} | [
"public",
"void",
"animate",
"(",
"GVRHybridObject",
"object",
",",
"float",
"animationTime",
")",
"{",
"GVRMeshMorph",
"morph",
"=",
"(",
"GVRMeshMorph",
")",
"mTarget",
";",
"mKeyInterpolator",
".",
"animate",
"(",
"animationTime",
"*",
"mDuration",
",",
"mCur... | Computes the blend weights for the given time and
updates them in the target. | [
"Computes",
"the",
"blend",
"weights",
"for",
"the",
"given",
"time",
"and",
"updates",
"them",
"in",
"the",
"target",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRMorphAnimation.java#L55-L62 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/asset/Disposables.java | Disposables.disposeOf | public static void disposeOf(final Map<?, ? extends Disposable> disposables) {
if (disposables != null) {
for (final Disposable disposable : disposables.values()) {
disposeOf(disposable);
}
}
} | java | public static void disposeOf(final Map<?, ? extends Disposable> disposables) {
if (disposables != null) {
for (final Disposable disposable : disposables.values()) {
disposeOf(disposable);
}
}
} | [
"public",
"static",
"void",
"disposeOf",
"(",
"final",
"Map",
"<",
"?",
",",
"?",
"extends",
"Disposable",
">",
"disposables",
")",
"{",
"if",
"(",
"disposables",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"Disposable",
"disposable",
":",
"disposables",
... | Performs null checks and disposes of assets.
@param disposables its values will be disposed of (if they exist). Can be null. | [
"Performs",
"null",
"checks",
"and",
"disposes",
"of",
"assets",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/asset/Disposables.java#L62-L68 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java | UserAttrs.getStringAttribute | public static final String getStringAttribute(Path path, String attribute, LinkOption... options) throws IOException
{
attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute;
byte[] attr = (byte[]) Files.getAttribute(path, attribute, options);
if (attr == null)
{
return null;
}
return new String(attr, UTF_8);
} | java | public static final String getStringAttribute(Path path, String attribute, LinkOption... options) throws IOException
{
attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute;
byte[] attr = (byte[]) Files.getAttribute(path, attribute, options);
if (attr == null)
{
return null;
}
return new String(attr, UTF_8);
} | [
"public",
"static",
"final",
"String",
"getStringAttribute",
"(",
"Path",
"path",
",",
"String",
"attribute",
",",
"LinkOption",
"...",
"options",
")",
"throws",
"IOException",
"{",
"attribute",
"=",
"attribute",
".",
"startsWith",
"(",
"\"user:\"",
")",
"?",
... | Returns user-defined-attribute
@param path
@param attribute user:attribute name. user: can be omitted.
@param options
@return
@throws IOException | [
"Returns",
"user",
"-",
"defined",
"-",
"attribute"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java#L302-L311 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java | RingPlacer.placeRing | public void placeRing(IRing ring, Point2d ringCenter, double bondLength, Map<Integer, Double> startAngles) {
double radius = this.getNativeRingRadius(ring, bondLength);
double addAngle = 2 * Math.PI / ring.getRingSize();
IAtom startAtom = ring.getAtom(0);
Point2d p = new Point2d(ringCenter.x + radius, ringCenter.y);
startAtom.setPoint2d(p);
double startAngle = Math.PI * 0.5;
/*
* Different ring sizes get different start angles to have visually
* correct placement
*/
int ringSize = ring.getRingSize();
if (startAngles.get(ringSize) != null) startAngle = startAngles.get(ringSize);
List<IBond> bonds = ring.getConnectedBondsList(startAtom);
/*
* Store all atoms to draw in consecutive order relative to the chosen
* bond.
*/
Vector<IAtom> atomsToDraw = new Vector<IAtom>();
IAtom currentAtom = startAtom;
IBond currentBond = (IBond) bonds.get(0);
for (int i = 0; i < ring.getBondCount(); i++) {
currentBond = ring.getNextBond(currentBond, currentAtom);
currentAtom = currentBond.getOther(currentAtom);
atomsToDraw.addElement(currentAtom);
}
atomPlacer.populatePolygonCorners(atomsToDraw, ringCenter, startAngle, addAngle, radius);
} | java | public void placeRing(IRing ring, Point2d ringCenter, double bondLength, Map<Integer, Double> startAngles) {
double radius = this.getNativeRingRadius(ring, bondLength);
double addAngle = 2 * Math.PI / ring.getRingSize();
IAtom startAtom = ring.getAtom(0);
Point2d p = new Point2d(ringCenter.x + radius, ringCenter.y);
startAtom.setPoint2d(p);
double startAngle = Math.PI * 0.5;
/*
* Different ring sizes get different start angles to have visually
* correct placement
*/
int ringSize = ring.getRingSize();
if (startAngles.get(ringSize) != null) startAngle = startAngles.get(ringSize);
List<IBond> bonds = ring.getConnectedBondsList(startAtom);
/*
* Store all atoms to draw in consecutive order relative to the chosen
* bond.
*/
Vector<IAtom> atomsToDraw = new Vector<IAtom>();
IAtom currentAtom = startAtom;
IBond currentBond = (IBond) bonds.get(0);
for (int i = 0; i < ring.getBondCount(); i++) {
currentBond = ring.getNextBond(currentBond, currentAtom);
currentAtom = currentBond.getOther(currentAtom);
atomsToDraw.addElement(currentAtom);
}
atomPlacer.populatePolygonCorners(atomsToDraw, ringCenter, startAngle, addAngle, radius);
} | [
"public",
"void",
"placeRing",
"(",
"IRing",
"ring",
",",
"Point2d",
"ringCenter",
",",
"double",
"bondLength",
",",
"Map",
"<",
"Integer",
",",
"Double",
">",
"startAngles",
")",
"{",
"double",
"radius",
"=",
"this",
".",
"getNativeRingRadius",
"(",
"ring",... | Place ring with user provided angles.
@param ring the ring to place.
@param ringCenter center coordinates of the ring.
@param bondLength given bond length.
@param startAngles a map with start angles when drawing the ring. | [
"Place",
"ring",
"with",
"user",
"provided",
"angles",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java#L149-L179 |
motown-io/motown | ocpi/ocpi-identification-authorization-plugin/src/main/java/io/motown/ocpi/service/AuthorizationService.java | AuthorizationService.insertOrUpdateToken | private void insertOrUpdateToken(io.motown.ocpi.dto.Token tokenUpdate, Integer subscriptionId) {
Token token = ocpiRepository.findTokenByUidAndIssuingCompany(tokenUpdate.uid, tokenUpdate.issuer);
if (token == null) {
token = new Token();
token.setUid(tokenUpdate.uid);
token.setSubscriptionId(subscriptionId);
token.setDateCreated(new Date());
}
token.setTokenType(tokenUpdate.type);
token.setAuthId(tokenUpdate.auth_id);
token.setVisualNumber(tokenUpdate.visual_number);
token.setIssuingCompany(tokenUpdate.issuer);
token.setValid(tokenUpdate.valid);
token.setWhitelist(tokenUpdate.whitelist);
token.setLanguageCode(tokenUpdate.languageCode);
try {
token.setLastUpdated(AppConfig.DATE_FORMAT.parse(tokenUpdate.last_updated));
} catch (ParseException e) {
throw new RuntimeException(e);
}
ocpiRepository.insertOrUpdate(token);
} | java | private void insertOrUpdateToken(io.motown.ocpi.dto.Token tokenUpdate, Integer subscriptionId) {
Token token = ocpiRepository.findTokenByUidAndIssuingCompany(tokenUpdate.uid, tokenUpdate.issuer);
if (token == null) {
token = new Token();
token.setUid(tokenUpdate.uid);
token.setSubscriptionId(subscriptionId);
token.setDateCreated(new Date());
}
token.setTokenType(tokenUpdate.type);
token.setAuthId(tokenUpdate.auth_id);
token.setVisualNumber(tokenUpdate.visual_number);
token.setIssuingCompany(tokenUpdate.issuer);
token.setValid(tokenUpdate.valid);
token.setWhitelist(tokenUpdate.whitelist);
token.setLanguageCode(tokenUpdate.languageCode);
try {
token.setLastUpdated(AppConfig.DATE_FORMAT.parse(tokenUpdate.last_updated));
} catch (ParseException e) {
throw new RuntimeException(e);
}
ocpiRepository.insertOrUpdate(token);
} | [
"private",
"void",
"insertOrUpdateToken",
"(",
"io",
".",
"motown",
".",
"ocpi",
".",
"dto",
".",
"Token",
"tokenUpdate",
",",
"Integer",
"subscriptionId",
")",
"{",
"Token",
"token",
"=",
"ocpiRepository",
".",
"findTokenByUidAndIssuingCompany",
"(",
"tokenUpdate... | Inserts a token or updates it if an existing token is found with the same
uid and issuing-company
@param tokenUpdate | [
"Inserts",
"a",
"token",
"or",
"updates",
"it",
"if",
"an",
"existing",
"token",
"is",
"found",
"with",
"the",
"same",
"uid",
"and",
"issuing",
"-",
"company"
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpi/ocpi-identification-authorization-plugin/src/main/java/io/motown/ocpi/service/AuthorizationService.java#L127-L149 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsMessageImpl.java | JmsMessageImpl.newBadConvertException | static MessageFormatException newBadConvertException(Object obj, String propName, String dType, TraceComponent xtc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "newBadConvertException", new Object[] { obj, propName, dType, xtc });
// We expect the object to be something like java.lang.Double
String clsName = null;
if (!(obj instanceof byte[])) {
clsName = obj.getClass().getName();
int index = 0;
// If there is a . in the class name (ie the package name) then remove it to
// give us a concise class name.
if ((index = clsName.lastIndexOf('.')) != 0) {
clsName = clsName.substring(index + 1);
}
} | java | static MessageFormatException newBadConvertException(Object obj, String propName, String dType, TraceComponent xtc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "newBadConvertException", new Object[] { obj, propName, dType, xtc });
// We expect the object to be something like java.lang.Double
String clsName = null;
if (!(obj instanceof byte[])) {
clsName = obj.getClass().getName();
int index = 0;
// If there is a . in the class name (ie the package name) then remove it to
// give us a concise class name.
if ((index = clsName.lastIndexOf('.')) != 0) {
clsName = clsName.substring(index + 1);
}
} | [
"static",
"MessageFormatException",
"newBadConvertException",
"(",
"Object",
"obj",
",",
"String",
"propName",
",",
"String",
"dType",
",",
"TraceComponent",
"xtc",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"is... | This method puts together the message to be returned to the user when they
attempt an invalid property conversion - for example trying to read an Int
property as a Byte.
It attempts to resolve the problem of integrating with the Bhattal Exception Handling Utility (tm)
@param obj The object containing the actual property
@param propName The name of the property that is being retrieved
@param dType The data type that it is being converted into
@param tc the TraceComponent to use for trace. | [
"This",
"method",
"puts",
"together",
"the",
"message",
"to",
"be",
"returned",
"to",
"the",
"user",
"when",
"they",
"attempt",
"an",
"invalid",
"property",
"conversion",
"-",
"for",
"example",
"trying",
"to",
"read",
"an",
"Int",
"property",
"as",
"a",
"B... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsMessageImpl.java#L2104-L2119 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/protocol/SyntaxElement.java | SyntaxElement.extractValues | public void extractValues(HashMap<String, String> values) {
for (MultipleSyntaxElements l : childContainers) {
l.extractValues(values);
}
} | java | public void extractValues(HashMap<String, String> values) {
for (MultipleSyntaxElements l : childContainers) {
l.extractValues(values);
}
} | [
"public",
"void",
"extractValues",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"values",
")",
"{",
"for",
"(",
"MultipleSyntaxElements",
"l",
":",
"childContainers",
")",
"{",
"l",
".",
"extractValues",
"(",
"values",
")",
";",
"}",
"}"
] | fuellt die hashtable 'values' mit den werten der de-syntaxelemente; dazu
wird in allen anderen typen von syntaxelementen die liste der
child-elemente durchlaufen und deren 'fillValues' methode aufgerufen | [
"fuellt",
"die",
"hashtable",
"values",
"mit",
"den",
"werten",
"der",
"de",
"-",
"syntaxelemente",
";",
"dazu",
"wird",
"in",
"allen",
"anderen",
"typen",
"von",
"syntaxelementen",
"die",
"liste",
"der",
"child",
"-",
"elemente",
"durchlaufen",
"und",
"deren"... | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/protocol/SyntaxElement.java#L443-L447 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_vm_vmId_backupJob_enable_POST | public OvhTask serviceName_datacenter_datacenterId_vm_vmId_backupJob_enable_POST(String serviceName, Long datacenterId, Long vmId, OvhBackupDaysEnum[] backupDays) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob/enable";
StringBuilder sb = path(qPath, serviceName, datacenterId, vmId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "backupDays", backupDays);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_datacenter_datacenterId_vm_vmId_backupJob_enable_POST(String serviceName, Long datacenterId, Long vmId, OvhBackupDaysEnum[] backupDays) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob/enable";
StringBuilder sb = path(qPath, serviceName, datacenterId, vmId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "backupDays", backupDays);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_datacenter_datacenterId_vm_vmId_backupJob_enable_POST",
"(",
"String",
"serviceName",
",",
"Long",
"datacenterId",
",",
"Long",
"vmId",
",",
"OvhBackupDaysEnum",
"[",
"]",
"backupDays",
")",
"throws",
"IOException",
"{",
"String",
"qPath"... | Enable backup solution on this virtual Machine
REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob/enable
@param backupDays [required] Backup offer type
@param serviceName [required] Domain of the service
@param datacenterId [required]
@param vmId [required] Id of the virtual machine.
@deprecated | [
"Enable",
"backup",
"solution",
"on",
"this",
"virtual",
"Machine"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2111-L2118 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java | SQLInLoop.visitCode | @Override
public void visitCode(Code obj) {
queryLocations.clear();
loops.clear();
super.visitCode(obj);
for (Integer qLoc : queryLocations) {
for (LoopLocation lLoc : loops) {
if (lLoc.isInLoop(qLoc.intValue())) {
bugReporter.reportBug(new BugInstance(this, BugType.SIL_SQL_IN_LOOP.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this, qLoc.intValue()));
break;
}
}
}
} | java | @Override
public void visitCode(Code obj) {
queryLocations.clear();
loops.clear();
super.visitCode(obj);
for (Integer qLoc : queryLocations) {
for (LoopLocation lLoc : loops) {
if (lLoc.isInLoop(qLoc.intValue())) {
bugReporter.reportBug(new BugInstance(this, BugType.SIL_SQL_IN_LOOP.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this, qLoc.intValue()));
break;
}
}
}
} | [
"@",
"Override",
"public",
"void",
"visitCode",
"(",
"Code",
"obj",
")",
"{",
"queryLocations",
".",
"clear",
"(",
")",
";",
"loops",
".",
"clear",
"(",
")",
";",
"super",
".",
"visitCode",
"(",
"obj",
")",
";",
"for",
"(",
"Integer",
"qLoc",
":",
... | implements the visitor to clear the collections, and report the query locations that are in loops
@param obj
the context object for the currently parsed code block | [
"implements",
"the",
"visitor",
"to",
"clear",
"the",
"collections",
"and",
"report",
"the",
"query",
"locations",
"that",
"are",
"in",
"loops"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java#L85-L99 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/GetTagsResult.java | GetTagsResult.withTags | public GetTagsResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public GetTagsResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"GetTagsResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The requested tags.
</p>
@param tags
The requested tags.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"requested",
"tags",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/GetTagsResult.java#L67-L70 |
facebookarchive/swift | swift-service/src/main/java/com/facebook/swift/service/ThriftClientManager.java | ThriftClientManager.getRequestChannel | public RequestChannel getRequestChannel(Object client)
{
try {
InvocationHandler genericHandler = Proxy.getInvocationHandler(client);
ThriftInvocationHandler thriftHandler = (ThriftInvocationHandler) genericHandler;
return thriftHandler.getChannel();
}
catch (IllegalArgumentException | ClassCastException e) {
throw new IllegalArgumentException("Invalid swift client object", e);
}
} | java | public RequestChannel getRequestChannel(Object client)
{
try {
InvocationHandler genericHandler = Proxy.getInvocationHandler(client);
ThriftInvocationHandler thriftHandler = (ThriftInvocationHandler) genericHandler;
return thriftHandler.getChannel();
}
catch (IllegalArgumentException | ClassCastException e) {
throw new IllegalArgumentException("Invalid swift client object", e);
}
} | [
"public",
"RequestChannel",
"getRequestChannel",
"(",
"Object",
"client",
")",
"{",
"try",
"{",
"InvocationHandler",
"genericHandler",
"=",
"Proxy",
".",
"getInvocationHandler",
"(",
"client",
")",
";",
"ThriftInvocationHandler",
"thriftHandler",
"=",
"(",
"ThriftInvo... | Returns the {@link RequestChannel} backing a Swift client
@throws IllegalArgumentException if the client is not a Swift client | [
"Returns",
"the",
"{",
"@link",
"RequestChannel",
"}",
"backing",
"a",
"Swift",
"client"
] | train | https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-service/src/main/java/com/facebook/swift/service/ThriftClientManager.java#L300-L310 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java | NodeSetDTM.addNodesInDocOrder | public void addNodesInDocOrder(DTMIterator iterator, XPathContext support)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");
int node;
while (DTM.NULL != (node = iterator.nextNode()))
{
addNodeInDocOrder(node, support);
}
} | java | public void addNodesInDocOrder(DTMIterator iterator, XPathContext support)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");
int node;
while (DTM.NULL != (node = iterator.nextNode()))
{
addNodeInDocOrder(node, support);
}
} | [
"public",
"void",
"addNodesInDocOrder",
"(",
"DTMIterator",
"iterator",
",",
"XPathContext",
"support",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
... | Copy NodeList members into this nodelist, adding in
document order. If a node is null, don't add it.
@param iterator DTMIterator which yields the nodes to be added.
@param support The XPath runtime context.
@throws RuntimeException thrown if this NodeSetDTM is not of
a mutable type. | [
"Copy",
"NodeList",
"members",
"into",
"this",
"nodelist",
"adding",
"in",
"document",
"order",
".",
"If",
"a",
"node",
"is",
"null",
"don",
"t",
"add",
"it",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L703-L715 |
kaazing/java.client | amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java | AmqpClient.startOkConnection | AmqpClient startOkConnection(AmqpArguments clientProperties, String mechanism, String response, String locale, Continuation callback, ErrorHandler error) {
Object[] args = {clientProperties, mechanism, response, locale};
AmqpBuffer bodyArg = null;
String methodName = "startOkConnection";
String methodId = "10" + "11";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, 0, args, bodyArg};
asyncClient.enqueueAction(methodName, "write", arguments, callback, error);
return this;
} | java | AmqpClient startOkConnection(AmqpArguments clientProperties, String mechanism, String response, String locale, Continuation callback, ErrorHandler error) {
Object[] args = {clientProperties, mechanism, response, locale};
AmqpBuffer bodyArg = null;
String methodName = "startOkConnection";
String methodId = "10" + "11";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, 0, args, bodyArg};
asyncClient.enqueueAction(methodName, "write", arguments, callback, error);
return this;
} | [
"AmqpClient",
"startOkConnection",
"(",
"AmqpArguments",
"clientProperties",
",",
"String",
"mechanism",
",",
"String",
"response",
",",
"String",
"locale",
",",
"Continuation",
"callback",
",",
"ErrorHandler",
"error",
")",
"{",
"Object",
"[",
"]",
"args",
"=",
... | Sends a StartOkConnection to server.
@param clientProperties
@param mechanism
@param response
@param locale
@param callback
@param error
@return AmqpClient | [
"Sends",
"a",
"StartOkConnection",
"to",
"server",
"."
] | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java#L794-L804 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_cronAvailableLanguage_GET | public ArrayList<OvhLanguageEnum> serviceName_cronAvailableLanguage_GET(String serviceName) throws IOException {
String qPath = "/hosting/web/{serviceName}/cronAvailableLanguage";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | java | public ArrayList<OvhLanguageEnum> serviceName_cronAvailableLanguage_GET(String serviceName) throws IOException {
String qPath = "/hosting/web/{serviceName}/cronAvailableLanguage";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | [
"public",
"ArrayList",
"<",
"OvhLanguageEnum",
">",
"serviceName_cronAvailableLanguage_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/cronAvailableLanguage\"",
";",
"StringBuilder",
"sb",
"=",
"pa... | List available cron language
REST: GET /hosting/web/{serviceName}/cronAvailableLanguage
@param serviceName [required] The internal name of your hosting | [
"List",
"available",
"cron",
"language"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1368-L1373 |
zamrokk/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Peer.java | Peer.sendTransaction | public Response sendTransaction(Transaction transaction) throws PeerException {
logger.debug("peer.sendTransaction");
// Send the transaction to the peer node via grpc
// The rpc specification on the peer side is:
// rpc ProcessTransaction(Transaction) returns (Response) {}
Response response = peerClient.processTransaction(transaction.getTxBuilder().build());
if (response.getStatus() != Response.StatusCode.SUCCESS) {
return response;
}
logger.debug(String.format("peer.sendTransaction: received %s", response.getMsg().toStringUtf8()));
// Check transaction type here, as invoke is an asynchronous call,
// whereas a deploy and a query are synchonous calls. As such,
// invoke will emit 'submitted' and 'error', while a deploy/query
// will emit 'complete' and 'error'.
Fabric.Transaction.Type txType = transaction.getTxBuilder().getType();
switch (txType) {
case CHAINCODE_DEPLOY: // async
String txid = response.getMsg().toStringUtf8();
// Deploy transaction has been completed
if (txid == null || txid.isEmpty()) {
throw new ExecuteException("the deploy response is missing the transaction UUID");
} else if (!this.waitForDeployComplete(txid)) {
throw new ExecuteException("the deploy request is submitted, but is not completed");
} else {
return response;
}
case CHAINCODE_INVOKE: // async
txid = response.getMsg().toStringUtf8();
// Invoke transaction has been submitted
if (txid == null || txid.isEmpty()) {
throw new ExecuteException("the invoke response is missing the transaction UUID");
} else if(!this.waitForInvokeComplete(txid)) {
throw new ExecuteException("the invoke request is submitted, but is not completed");
} else {
return response;
}
case CHAINCODE_QUERY: // sync
return response;
default: // not implemented
throw new ExecuteException("processTransaction for this transaction type is not yet implemented!");
}
} | java | public Response sendTransaction(Transaction transaction) throws PeerException {
logger.debug("peer.sendTransaction");
// Send the transaction to the peer node via grpc
// The rpc specification on the peer side is:
// rpc ProcessTransaction(Transaction) returns (Response) {}
Response response = peerClient.processTransaction(transaction.getTxBuilder().build());
if (response.getStatus() != Response.StatusCode.SUCCESS) {
return response;
}
logger.debug(String.format("peer.sendTransaction: received %s", response.getMsg().toStringUtf8()));
// Check transaction type here, as invoke is an asynchronous call,
// whereas a deploy and a query are synchonous calls. As such,
// invoke will emit 'submitted' and 'error', while a deploy/query
// will emit 'complete' and 'error'.
Fabric.Transaction.Type txType = transaction.getTxBuilder().getType();
switch (txType) {
case CHAINCODE_DEPLOY: // async
String txid = response.getMsg().toStringUtf8();
// Deploy transaction has been completed
if (txid == null || txid.isEmpty()) {
throw new ExecuteException("the deploy response is missing the transaction UUID");
} else if (!this.waitForDeployComplete(txid)) {
throw new ExecuteException("the deploy request is submitted, but is not completed");
} else {
return response;
}
case CHAINCODE_INVOKE: // async
txid = response.getMsg().toStringUtf8();
// Invoke transaction has been submitted
if (txid == null || txid.isEmpty()) {
throw new ExecuteException("the invoke response is missing the transaction UUID");
} else if(!this.waitForInvokeComplete(txid)) {
throw new ExecuteException("the invoke request is submitted, but is not completed");
} else {
return response;
}
case CHAINCODE_QUERY: // sync
return response;
default: // not implemented
throw new ExecuteException("processTransaction for this transaction type is not yet implemented!");
}
} | [
"public",
"Response",
"sendTransaction",
"(",
"Transaction",
"transaction",
")",
"throws",
"PeerException",
"{",
"logger",
".",
"debug",
"(",
"\"peer.sendTransaction\"",
")",
";",
"// Send the transaction to the peer node via grpc",
"// The rpc specification on the peer side is:"... | Send a transaction to this peer.
@param transaction A transaction
@throws PeerException | [
"Send",
"a",
"transaction",
"to",
"this",
"peer",
"."
] | train | https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/Peer.java#L70-L117 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java | MavenProjectScannerPlugin.scanArtifact | private JavaArtifactFileDescriptor scanArtifact(MavenProjectDirectoryDescriptor projectDescriptor, ArtifactFileDescriptor artifactDescriptor, File file,
String path, Scanner scanner) {
JavaArtifactFileDescriptor javaArtifactFileDescriptor = scanner.getContext().getStore().addDescriptorType(artifactDescriptor,
JavaClassesDirectoryDescriptor.class);
ScannerContext context = scanner.getContext();
context.push(JavaArtifactFileDescriptor.class, javaArtifactFileDescriptor);
try {
return scanFile(projectDescriptor, file, path, CLASSPATH, scanner);
} finally {
context.pop(JavaArtifactFileDescriptor.class);
}
} | java | private JavaArtifactFileDescriptor scanArtifact(MavenProjectDirectoryDescriptor projectDescriptor, ArtifactFileDescriptor artifactDescriptor, File file,
String path, Scanner scanner) {
JavaArtifactFileDescriptor javaArtifactFileDescriptor = scanner.getContext().getStore().addDescriptorType(artifactDescriptor,
JavaClassesDirectoryDescriptor.class);
ScannerContext context = scanner.getContext();
context.push(JavaArtifactFileDescriptor.class, javaArtifactFileDescriptor);
try {
return scanFile(projectDescriptor, file, path, CLASSPATH, scanner);
} finally {
context.pop(JavaArtifactFileDescriptor.class);
}
} | [
"private",
"JavaArtifactFileDescriptor",
"scanArtifact",
"(",
"MavenProjectDirectoryDescriptor",
"projectDescriptor",
",",
"ArtifactFileDescriptor",
"artifactDescriptor",
",",
"File",
"file",
",",
"String",
"path",
",",
"Scanner",
"scanner",
")",
"{",
"JavaArtifactFileDescrip... | Scan a {@link File} that represents a Java artifact.
@param projectDescriptor
The maven project descriptor.
@param artifactDescriptor
The resolved {@link MavenArtifactDescriptor}.
@param file
The {@link File}.
@param path
The path of the file.
@param scanner
The {@link Scanner}. | [
"Scan",
"a",
"{",
"@link",
"File",
"}",
"that",
"represents",
"a",
"Java",
"artifact",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java#L304-L315 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetEnable.java | AbstractSetEnable.applyEnableAction | private void applyEnableAction(final WComponent target, final boolean enabled) {
// Found Disableable component
if (target instanceof Disableable) {
target.setValidate(enabled);
((Disableable) target).setDisabled(!enabled);
} else if (target instanceof Container) { // Apply to any Disableable children
Container cont = (Container) target;
final int size = cont.getChildCount();
for (int i = 0; i < size; i++) {
WComponent child = cont.getChildAt(i);
applyEnableAction(child, enabled);
}
}
} | java | private void applyEnableAction(final WComponent target, final boolean enabled) {
// Found Disableable component
if (target instanceof Disableable) {
target.setValidate(enabled);
((Disableable) target).setDisabled(!enabled);
} else if (target instanceof Container) { // Apply to any Disableable children
Container cont = (Container) target;
final int size = cont.getChildCount();
for (int i = 0; i < size; i++) {
WComponent child = cont.getChildAt(i);
applyEnableAction(child, enabled);
}
}
} | [
"private",
"void",
"applyEnableAction",
"(",
"final",
"WComponent",
"target",
",",
"final",
"boolean",
"enabled",
")",
"{",
"// Found Disableable component",
"if",
"(",
"target",
"instanceof",
"Disableable",
")",
"{",
"target",
".",
"setValidate",
"(",
"enabled",
... | Apply the enable action against the target and its children.
@param target the target of this action
@param enabled is the evaluated value | [
"Apply",
"the",
"enable",
"action",
"against",
"the",
"target",
"and",
"its",
"children",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetEnable.java#L47-L61 |
algolia/instantsearch-android | ui/src/main/java/com/algolia/instantsearch/ui/views/Hits.java | Hits.getFinalAttributeValue | protected
@Nullable
Spannable getFinalAttributeValue(@NonNull JSONObject hit, @NonNull View view, @NonNull String attribute, @Nullable String attributeValue) {
Spannable attributeText = null;
if (attributeValue != null) {
if (RenderingHelper.getDefault().shouldHighlight(view, attribute)) {
final int highlightColor = RenderingHelper.getDefault().getHighlightColor(view, attribute);
final String prefix = BindingHelper.getPrefix(view);
final String suffix = BindingHelper.getSuffix(view);
final boolean snippetted = RenderingHelper.getDefault().shouldSnippet(view, attribute);
attributeText = Highlighter.getDefault().setInput(hit, attribute, prefix, suffix, false, snippetted)
.setStyle(highlightColor).render();
} else {
attributeText = new SpannableString(attributeValue);
}
}
return attributeText;
} | java | protected
@Nullable
Spannable getFinalAttributeValue(@NonNull JSONObject hit, @NonNull View view, @NonNull String attribute, @Nullable String attributeValue) {
Spannable attributeText = null;
if (attributeValue != null) {
if (RenderingHelper.getDefault().shouldHighlight(view, attribute)) {
final int highlightColor = RenderingHelper.getDefault().getHighlightColor(view, attribute);
final String prefix = BindingHelper.getPrefix(view);
final String suffix = BindingHelper.getSuffix(view);
final boolean snippetted = RenderingHelper.getDefault().shouldSnippet(view, attribute);
attributeText = Highlighter.getDefault().setInput(hit, attribute, prefix, suffix, false, snippetted)
.setStyle(highlightColor).render();
} else {
attributeText = new SpannableString(attributeValue);
}
}
return attributeText;
} | [
"protected",
"@",
"Nullable",
"Spannable",
"getFinalAttributeValue",
"(",
"@",
"NonNull",
"JSONObject",
"hit",
",",
"@",
"NonNull",
"View",
"view",
",",
"@",
"NonNull",
"String",
"attribute",
",",
"@",
"Nullable",
"String",
"attributeValue",
")",
"{",
"Spannable... | Returns the attribute's value, {@link RenderingHelper#shouldHighlight(View, String) highlighted} and {@link RenderingHelper#shouldSnippet(View, String) snippetted} if required to. | [
"Returns",
"the",
"attribute",
"s",
"value",
"{"
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/views/Hits.java#L279-L296 |
apereo/cas | support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java | OAuth20HandlerInterceptorAdapter.isAuthorizationRequest | protected boolean isAuthorizationRequest(final HttpServletRequest request, final HttpServletResponse response) {
val requestPath = request.getRequestURI();
return doesUriMatchPattern(requestPath, OAuth20Constants.AUTHORIZE_URL);
} | java | protected boolean isAuthorizationRequest(final HttpServletRequest request, final HttpServletResponse response) {
val requestPath = request.getRequestURI();
return doesUriMatchPattern(requestPath, OAuth20Constants.AUTHORIZE_URL);
} | [
"protected",
"boolean",
"isAuthorizationRequest",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"{",
"val",
"requestPath",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"return",
"doesUriMatchPattern",
"(",... | Is authorization request.
@param request the request
@param response the response
@return the boolean | [
"Is",
"authorization",
"request",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java#L120-L123 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.addBlock | private long addBlock(Block block, List<BlockWithLocations> results) {
ArrayList<String> machineSet =
new ArrayList<String>(blocksMap.numNodes(block));
for (Iterator<DatanodeDescriptor> it =
blocksMap.nodeIterator(block); it.hasNext();) {
String storageID = it.next().getStorageID();
// filter invalidate replicas
LightWeightHashSet<Block> blocks = recentInvalidateSets.get(storageID);
if (blocks == null || !blocks.contains(block)) {
machineSet.add(storageID);
}
}
if (machineSet.size() == 0) {
return 0;
} else {
results.add(new BlockWithLocations(block,
machineSet.toArray(new String[machineSet.size()])));
return block.getNumBytes();
}
} | java | private long addBlock(Block block, List<BlockWithLocations> results) {
ArrayList<String> machineSet =
new ArrayList<String>(blocksMap.numNodes(block));
for (Iterator<DatanodeDescriptor> it =
blocksMap.nodeIterator(block); it.hasNext();) {
String storageID = it.next().getStorageID();
// filter invalidate replicas
LightWeightHashSet<Block> blocks = recentInvalidateSets.get(storageID);
if (blocks == null || !blocks.contains(block)) {
machineSet.add(storageID);
}
}
if (machineSet.size() == 0) {
return 0;
} else {
results.add(new BlockWithLocations(block,
machineSet.toArray(new String[machineSet.size()])));
return block.getNumBytes();
}
} | [
"private",
"long",
"addBlock",
"(",
"Block",
"block",
",",
"List",
"<",
"BlockWithLocations",
">",
"results",
")",
"{",
"ArrayList",
"<",
"String",
">",
"machineSet",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"blocksMap",
".",
"numNodes",
"(",
"blo... | Get all valid locations of the block & add the block to results
return the length of the added block; 0 if the block is not added | [
"Get",
"all",
"valid",
"locations",
"of",
"the",
"block",
"&",
"add",
"the",
"block",
"to",
"results",
"return",
"the",
"length",
"of",
"the",
"added",
"block",
";",
"0",
"if",
"the",
"block",
"is",
"not",
"added"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1185-L1204 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/FreezableMutableURI.java | FreezableMutableURI.addParameter | public void addParameter( String name, String value, boolean encoded )
{
testFrozen();
super.addParameter( name, value, encoded );
} | java | public void addParameter( String name, String value, boolean encoded )
{
testFrozen();
super.addParameter( name, value, encoded );
} | [
"public",
"void",
"addParameter",
"(",
"String",
"name",
",",
"String",
"value",
",",
"boolean",
"encoded",
")",
"{",
"testFrozen",
"(",
")",
";",
"super",
".",
"addParameter",
"(",
"name",
",",
"value",
",",
"encoded",
")",
";",
"}"
] | Add a parameter for the query string.
<p> If the encoded flag is true then this method assumes that
the name and value do not need encoding or are already encoded
correctly. Otherwise, it translates the name and value with the
character encoding of this URI and adds them to the set of
parameters for the query. If the encoding for this URI has
not been set, then the default encoding used is "UTF-8". </p>
<p> Multiple values for the same parameter can be set by
calling this method multiple times with the same name. </p>
@param name name
@param value value
@param encoded Flag indicating whether the names and values are
already encoded. | [
"Add",
"a",
"parameter",
"for",
"the",
"query",
"string",
".",
"<p",
">",
"If",
"the",
"encoded",
"flag",
"is",
"true",
"then",
"this",
"method",
"assumes",
"that",
"the",
"name",
"and",
"value",
"do",
"not",
"need",
"encoding",
"or",
"are",
"already",
... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/FreezableMutableURI.java#L245-L249 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java | Requests.createPublishNotify | public static PublishNotify createPublishNotify(Identifier i1,
Collection<Document> mdlist) {
return createPublishNotify(i1, null, mdlist);
} | java | public static PublishNotify createPublishNotify(Identifier i1,
Collection<Document> mdlist) {
return createPublishNotify(i1, null, mdlist);
} | [
"public",
"static",
"PublishNotify",
"createPublishNotify",
"(",
"Identifier",
"i1",
",",
"Collection",
"<",
"Document",
">",
"mdlist",
")",
"{",
"return",
"createPublishNotify",
"(",
"i1",
",",
"null",
",",
"mdlist",
")",
";",
"}"
] | Create a new {@link PublishNotify} instance that is used to publish
a list of metadata instances.
@param i1 the {@link Identifier} to which the given metadata is published to
@param mdlist a list of metadata objects
@return the new {@link PublishNotify} instance | [
"Create",
"a",
"new",
"{",
"@link",
"PublishNotify",
"}",
"instance",
"that",
"is",
"used",
"to",
"publish",
"a",
"list",
"of",
"metadata",
"instances",
"."
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java#L482-L485 |
yanzhenjie/Album | album/src/main/java/com/yanzhenjie/album/api/VideoMultipleWrapper.java | VideoMultipleWrapper.selectCount | public VideoMultipleWrapper selectCount(@IntRange(from = 1, to = Integer.MAX_VALUE) int count) {
this.mLimitCount = count;
return this;
} | java | public VideoMultipleWrapper selectCount(@IntRange(from = 1, to = Integer.MAX_VALUE) int count) {
this.mLimitCount = count;
return this;
} | [
"public",
"VideoMultipleWrapper",
"selectCount",
"(",
"@",
"IntRange",
"(",
"from",
"=",
"1",
",",
"to",
"=",
"Integer",
".",
"MAX_VALUE",
")",
"int",
"count",
")",
"{",
"this",
".",
"mLimitCount",
"=",
"count",
";",
"return",
"this",
";",
"}"
] | Set the maximum number to be selected.
@param count the maximum number. | [
"Set",
"the",
"maximum",
"number",
"to",
"be",
"selected",
"."
] | train | https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/api/VideoMultipleWrapper.java#L56-L59 |
weld/core | impl/src/main/java/org/jboss/weld/bootstrap/events/ContainerLifecycleEventPreloader.java | ContainerLifecycleEventPreloader.preloadContainerLifecycleEvent | @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", justification = "We never need to synchronize with the preloader.")
void preloadContainerLifecycleEvent(Class<?> eventRawType, Type... typeParameters) {
executor.submit(new PreloadingTask(new ParameterizedTypeImpl(eventRawType, typeParameters, null)));
} | java | @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", justification = "We never need to synchronize with the preloader.")
void preloadContainerLifecycleEvent(Class<?> eventRawType, Type... typeParameters) {
executor.submit(new PreloadingTask(new ParameterizedTypeImpl(eventRawType, typeParameters, null)));
} | [
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"RV_RETURN_VALUE_IGNORED_BAD_PRACTICE\"",
",",
"justification",
"=",
"\"We never need to synchronize with the preloader.\"",
")",
"void",
"preloadContainerLifecycleEvent",
"(",
"Class",
"<",
"?",
">",
"eventRawType",
",",
"Type"... | In multi-threaded environment we often cannot leverage multiple core fully in bootstrap because the deployer
threads are often blocked by the reflection API or waiting to get a classloader lock. While waiting for classes to be loaded or
reflection metadata to be obtained, we can make use of the idle CPU cores and start resolving container lifecycle event observers
(extensions) upfront for those types of events we know we will be firing. Since these resolutions are cached, firing of the
lifecycle events will then be very fast. | [
"In",
"multi",
"-",
"threaded",
"environment",
"we",
"often",
"cannot",
"leverage",
"multiple",
"core",
"fully",
"in",
"bootstrap",
"because",
"the",
"deployer",
"threads",
"are",
"often",
"blocked",
"by",
"the",
"reflection",
"API",
"or",
"waiting",
"to",
"ge... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/events/ContainerLifecycleEventPreloader.java#L70-L73 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java | SequenceGibbsSampler.collectSamples | public List<int[]> collectSamples(SequenceModel model, int numSamples, int sampleInterval, int[] initialSequence) {
if (verbose>0) System.err.print("Collecting samples");
listener.setInitialSequence(initialSequence);
List<int[]> result = new ArrayList<int[]>();
int[] sequence = initialSequence;
for (int i=0; i<numSamples; i++) {
sequence = copy(sequence); // so we don't change the initial, or the one we just stored
sampleSequenceRepeatedly(model, sequence, sampleInterval); // modifies tagSequence
result.add(sequence); // save it to return later
if (verbose>0) System.err.print(".");
System.err.flush();
}
if (verbose>1) {
System.err.println();
printSamples(result, System.err);
}
if (verbose>0) System.err.println("done.");
return result;
} | java | public List<int[]> collectSamples(SequenceModel model, int numSamples, int sampleInterval, int[] initialSequence) {
if (verbose>0) System.err.print("Collecting samples");
listener.setInitialSequence(initialSequence);
List<int[]> result = new ArrayList<int[]>();
int[] sequence = initialSequence;
for (int i=0; i<numSamples; i++) {
sequence = copy(sequence); // so we don't change the initial, or the one we just stored
sampleSequenceRepeatedly(model, sequence, sampleInterval); // modifies tagSequence
result.add(sequence); // save it to return later
if (verbose>0) System.err.print(".");
System.err.flush();
}
if (verbose>1) {
System.err.println();
printSamples(result, System.err);
}
if (verbose>0) System.err.println("done.");
return result;
} | [
"public",
"List",
"<",
"int",
"[",
"]",
">",
"collectSamples",
"(",
"SequenceModel",
"model",
",",
"int",
"numSamples",
",",
"int",
"sampleInterval",
",",
"int",
"[",
"]",
"initialSequence",
")",
"{",
"if",
"(",
"verbose",
">",
"0",
")",
"System",
".",
... | Collects numSamples samples of sequences, from the distribution over sequences defined
by the sequence model passed on construction.
All samples collected are sampleInterval samples apart, in an attempt to reduce
autocorrelation.
@return a Counter containing the sequence samples, as arrays of type int, and their scores | [
"Collects",
"numSamples",
"samples",
"of",
"sequences",
"from",
"the",
"distribution",
"over",
"sequences",
"defined",
"by",
"the",
"sequence",
"model",
"passed",
"on",
"construction",
".",
"All",
"samples",
"collected",
"are",
"sampleInterval",
"samples",
"apart",
... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java#L144-L162 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointDataPropertiesAxiomImpl_CustomFieldSerializer.java | OWLDisjointDataPropertiesAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDisjointDataPropertiesAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDisjointDataPropertiesAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLDisjointDataPropertiesAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
... | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointDataPropertiesAxiomImpl_CustomFieldSerializer.java#L74-L77 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.dateTimeTemplate | public static <T extends Comparable<?>> DateTimeTemplate<T> dateTimeTemplate(Class<? extends T> cl, String template, List<?> args) {
return dateTimeTemplate(cl, createTemplate(template), args);
} | java | public static <T extends Comparable<?>> DateTimeTemplate<T> dateTimeTemplate(Class<? extends T> cl, String template, List<?> args) {
return dateTimeTemplate(cl, createTemplate(template), args);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
">",
">",
"DateTimeTemplate",
"<",
"T",
">",
"dateTimeTemplate",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"cl",
",",
"String",
"template",
",",
"List",
"<",
"?",
">",
"args",
")",
"... | Create a new Template expression
@param cl type of expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L591-L593 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/data/conversion/DefaultableConverter.java | DefaultableConverter.canConvert | @Override
public boolean canConvert(Class<?> fromType, Class<?> toType) {
return (fromType == null && getDefaultValue() != null);
} | java | @Override
public boolean canConvert(Class<?> fromType, Class<?> toType) {
return (fromType == null && getDefaultValue() != null);
} | [
"@",
"Override",
"public",
"boolean",
"canConvert",
"(",
"Class",
"<",
"?",
">",
"fromType",
",",
"Class",
"<",
"?",
">",
"toType",
")",
"{",
"return",
"(",
"fromType",
"==",
"null",
"&&",
"getDefaultValue",
"(",
")",
"!=",
"null",
")",
";",
"}"
] | Determines whether this {@link Converter} can convert {@link Object Objects}
{@link Class from type} {@link Class to type}.
@param fromType {@link Class type} to convert from.
@param toType {@link Class type} to convert to.
@return a boolean indicating whether this {@link Converter} can convert {@link Object Objects}
{@link Class from type} {@link Class to type}.
@see org.cp.elements.data.conversion.ConversionService#canConvert(Class, Class) | [
"Determines",
"whether",
"this",
"{",
"@link",
"Converter",
"}",
"can",
"convert",
"{",
"@link",
"Object",
"Objects",
"}",
"{",
"@link",
"Class",
"from",
"type",
"}",
"{",
"@link",
"Class",
"to",
"type",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/conversion/DefaultableConverter.java#L65-L68 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java | RecoveryMgr.logLogicalAbort | public LogSeqNum logLogicalAbort(long txNum, LogSeqNum undoNextLSN) {
if (enableLogging) {
return new LogicalAbortRecord(txNum, undoNextLSN).writeToLog();
} else
return null;
} | java | public LogSeqNum logLogicalAbort(long txNum, LogSeqNum undoNextLSN) {
if (enableLogging) {
return new LogicalAbortRecord(txNum, undoNextLSN).writeToLog();
} else
return null;
} | [
"public",
"LogSeqNum",
"logLogicalAbort",
"(",
"long",
"txNum",
",",
"LogSeqNum",
"undoNextLSN",
")",
"{",
"if",
"(",
"enableLogging",
")",
"{",
"return",
"new",
"LogicalAbortRecord",
"(",
"txNum",
",",
"undoNextLSN",
")",
".",
"writeToLog",
"(",
")",
";",
"... | Writes a logical abort record into the log.
@param txNum
the number of aborted transaction
@param undoNextLSN
the LSN which the redo the Abort record should jump to
@return the LSN of the log record, or null if recovery manager turns off
the logging | [
"Writes",
"a",
"logical",
"abort",
"record",
"into",
"the",
"log",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java#L172-L177 |
Red5/red5-server-common | src/main/java/org/red5/server/messaging/AbstractPipe.java | AbstractPipe.sendOOBControlMessage | public void sendOOBControlMessage(IProvider provider, OOBControlMessage oobCtrlMsg) {
for (IConsumer consumer : consumers) {
try {
consumer.onOOBControlMessage(provider, this, oobCtrlMsg);
} catch (Throwable t) {
log.error("exception when passing OOBCM from provider to consumers", t);
}
}
} | java | public void sendOOBControlMessage(IProvider provider, OOBControlMessage oobCtrlMsg) {
for (IConsumer consumer : consumers) {
try {
consumer.onOOBControlMessage(provider, this, oobCtrlMsg);
} catch (Throwable t) {
log.error("exception when passing OOBCM from provider to consumers", t);
}
}
} | [
"public",
"void",
"sendOOBControlMessage",
"(",
"IProvider",
"provider",
",",
"OOBControlMessage",
"oobCtrlMsg",
")",
"{",
"for",
"(",
"IConsumer",
"consumer",
":",
"consumers",
")",
"{",
"try",
"{",
"consumer",
".",
"onOOBControlMessage",
"(",
"provider",
",",
... | Send out-of-band ("special") control message to all consumers
@param provider
Provider, may be used in concrete implementations
@param oobCtrlMsg
Out-of-band control message | [
"Send",
"out",
"-",
"of",
"-",
"band",
"(",
"special",
")",
"control",
"message",
"to",
"all",
"consumers"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L163-L171 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.scaleAroundLocal | public Matrix4f scaleAroundLocal(float factor, float ox, float oy, float oz) {
return scaleAroundLocal(factor, factor, factor, ox, oy, oz, thisOrNew());
} | java | public Matrix4f scaleAroundLocal(float factor, float ox, float oy, float oz) {
return scaleAroundLocal(factor, factor, factor, ox, oy, oz, thisOrNew());
} | [
"public",
"Matrix4f",
"scaleAroundLocal",
"(",
"float",
"factor",
",",
"float",
"ox",
",",
"float",
"oy",
",",
"float",
"oz",
")",
"{",
"return",
"scaleAroundLocal",
"(",
"factor",
",",
"factor",
",",
"factor",
",",
"ox",
",",
"oy",
",",
"oz",
",",
"th... | Pre-multiply scaling to this matrix by scaling all three base axes by the given <code>factor</code>
while using <code>(ox, oy, oz)</code> as the scaling origin.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>S * M</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>S * M * v</code>, the
scaling will be applied last!
<p>
This method is equivalent to calling: <code>new Matrix4f().translate(ox, oy, oz).scale(factor).translate(-ox, -oy, -oz).mul(this, this)</code>
@param factor
the scaling factor for all three axes
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param oz
the z coordinate of the scaling origin
@return a matrix holding the result | [
"Pre",
"-",
"multiply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"all",
"three",
"base",
"axes",
"by",
"the",
"given",
"<code",
">",
"factor<",
"/",
"code",
">",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
"oz",
")",
"<",
"/",
"code",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L5044-L5046 |
alkacon/opencms-core | src/org/opencms/security/CmsRoleManager.java | CmsRoleManager.removeUserFromRole | public void removeUserFromRole(CmsObject cms, CmsRole role, String username) throws CmsException {
m_securityManager.removeUserFromGroup(cms.getRequestContext(), username, role.getGroupName(), true);
} | java | public void removeUserFromRole(CmsObject cms, CmsRole role, String username) throws CmsException {
m_securityManager.removeUserFromGroup(cms.getRequestContext(), username, role.getGroupName(), true);
} | [
"public",
"void",
"removeUserFromRole",
"(",
"CmsObject",
"cms",
",",
"CmsRole",
"role",
",",
"String",
"username",
")",
"throws",
"CmsException",
"{",
"m_securityManager",
".",
"removeUserFromGroup",
"(",
"cms",
".",
"getRequestContext",
"(",
")",
",",
"username"... | Removes a user from a role, in the given organizational unit.<p>
@param cms the opencms context
@param role the role to remove the user from
@param username the name of the user that is to be removed from the group
@throws CmsException if operation was not successful | [
"Removes",
"a",
"user",
"from",
"a",
"role",
"in",
"the",
"given",
"organizational",
"unit",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsRoleManager.java#L533-L536 |
mockito/mockito | src/main/java/org/mockito/Mockito.java | Mockito.doThrow | @SuppressWarnings ({"unchecked", "varargs"})
@CheckReturnValue
public static Stubber doThrow(Class<? extends Throwable> toBeThrown, Class<? extends Throwable>... toBeThrownNext) {
return MOCKITO_CORE.stubber().doThrow(toBeThrown, toBeThrownNext);
} | java | @SuppressWarnings ({"unchecked", "varargs"})
@CheckReturnValue
public static Stubber doThrow(Class<? extends Throwable> toBeThrown, Class<? extends Throwable>... toBeThrownNext) {
return MOCKITO_CORE.stubber().doThrow(toBeThrown, toBeThrownNext);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"varargs\"",
"}",
")",
"@",
"CheckReturnValue",
"public",
"static",
"Stubber",
"doThrow",
"(",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"toBeThrown",
",",
"Class",
"<",
"?",
"extends",
"Throwabl... | Additional method helps users of JDK7+ to hide heap pollution / unchecked generics array creation | [
"Additional",
"method",
"helps",
"users",
"of",
"JDK7",
"+",
"to",
"hide",
"heap",
"pollution",
"/",
"unchecked",
"generics",
"array",
"creation"
] | train | https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/Mockito.java#L2320-L2324 |
groovy/groovy-core | src/main/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.preInstantiate | protected void preInstantiate(Object name, Map attributes, Object value) {
for (Closure preInstantiateDelegate : getProxyBuilder().getPreInstantiateDelegates()) {
(preInstantiateDelegate).call(new Object[]{this, attributes, value});
}
} | java | protected void preInstantiate(Object name, Map attributes, Object value) {
for (Closure preInstantiateDelegate : getProxyBuilder().getPreInstantiateDelegates()) {
(preInstantiateDelegate).call(new Object[]{this, attributes, value});
}
} | [
"protected",
"void",
"preInstantiate",
"(",
"Object",
"name",
",",
"Map",
"attributes",
",",
"Object",
"value",
")",
"{",
"for",
"(",
"Closure",
"preInstantiateDelegate",
":",
"getProxyBuilder",
"(",
")",
".",
"getPreInstantiateDelegates",
"(",
")",
")",
"{",
... | A hook before the factory creates the node.<br>
It will call any registered preInstantiateDelegates, if you override this
method be sure to call this impl somewhere in your code.
@param name the name of the node
@param attributes the attributes of the node
@param value the value argument(s) of the node | [
"A",
"hook",
"before",
"the",
"factory",
"creates",
"the",
"node",
".",
"<br",
">",
"It",
"will",
"call",
"any",
"registered",
"preInstantiateDelegates",
"if",
"you",
"override",
"this",
"method",
"be",
"sure",
"to",
"call",
"this",
"impl",
"somewhere",
"in"... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/util/FactoryBuilderSupport.java#L1056-L1060 |
google/closure-compiler | src/com/google/javascript/jscomp/MaybeReachingVariableUse.java | MaybeReachingVariableUse.addToUseIfLocal | private void addToUseIfLocal(String name, Node node, ReachingUses use) {
Var var = allVarsInFn.get(name);
if (var == null) {
return;
}
if (!escaped.contains(var)) {
use.mayUseMap.put(var, node);
}
} | java | private void addToUseIfLocal(String name, Node node, ReachingUses use) {
Var var = allVarsInFn.get(name);
if (var == null) {
return;
}
if (!escaped.contains(var)) {
use.mayUseMap.put(var, node);
}
} | [
"private",
"void",
"addToUseIfLocal",
"(",
"String",
"name",
",",
"Node",
"node",
",",
"ReachingUses",
"use",
")",
"{",
"Var",
"var",
"=",
"allVarsInFn",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"var",
"==",
"null",
")",
"{",
"return",
";",
"}",... | Sets the variable for the given name to the node value in the upward
exposed lattice. Do nothing if the variable name is one of the escaped
variable. | [
"Sets",
"the",
"variable",
"for",
"the",
"given",
"name",
"to",
"the",
"node",
"value",
"in",
"the",
"upward",
"exposed",
"lattice",
".",
"Do",
"nothing",
"if",
"the",
"variable",
"name",
"is",
"one",
"of",
"the",
"escaped",
"variable",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MaybeReachingVariableUse.java#L308-L316 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java | WatchUtil.createAll | public static WatchMonitor createAll(File file, int maxDepth, Watcher watcher) {
return createAll(file.toPath(), 0, watcher);
} | java | public static WatchMonitor createAll(File file, int maxDepth, Watcher watcher) {
return createAll(file.toPath(), 0, watcher);
} | [
"public",
"static",
"WatchMonitor",
"createAll",
"(",
"File",
"file",
",",
"int",
"maxDepth",
",",
"Watcher",
"watcher",
")",
"{",
"return",
"createAll",
"(",
"file",
".",
"toPath",
"(",
")",
",",
"0",
",",
"watcher",
")",
";",
"}"
] | 创建并初始化监听,监听所有事件
@param file 被监听文件
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@param watcher {@link Watcher}
@return {@link WatchMonitor} | [
"创建并初始化监听,监听所有事件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java#L201-L203 |
mozilla/rhino | toolsrc/org/mozilla/javascript/tools/shell/Main.java | Main.readFileOrUrl | private static Object readFileOrUrl(String path, boolean convertToString)
throws IOException
{
return SourceReader.readFileOrUrl(path, convertToString,
shellContextFactory.getCharacterEncoding());
} | java | private static Object readFileOrUrl(String path, boolean convertToString)
throws IOException
{
return SourceReader.readFileOrUrl(path, convertToString,
shellContextFactory.getCharacterEncoding());
} | [
"private",
"static",
"Object",
"readFileOrUrl",
"(",
"String",
"path",
",",
"boolean",
"convertToString",
")",
"throws",
"IOException",
"{",
"return",
"SourceReader",
".",
"readFileOrUrl",
"(",
"path",
",",
"convertToString",
",",
"shellContextFactory",
".",
"getCha... | Read file or url specified by <tt>path</tt>.
@return file or url content as <tt>byte[]</tt> or as <tt>String</tt> if
<tt>convertToString</tt> is true. | [
"Read",
"file",
"or",
"url",
"specified",
"by",
"<tt",
">",
"path<",
"/",
"tt",
">",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/shell/Main.java#L698-L703 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java | DataLakeStoreAccountsInner.addAsync | public Observable<Void> addAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName) {
return addWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> addAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName) {
return addWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"addAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"dataLakeStoreAccountName",
")",
"{",
"return",
"addWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"da... | Updates the specified Data Lake Analytics account to include the additional Data Lake Store account.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param dataLakeStoreAccountName The name of the Data Lake Store account to add.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"include",
"the",
"additional",
"Data",
"Lake",
"Store",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java#L399-L406 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.newDataSet | public static DataSet newDataSet(final String keyColumnName, final String valueColumnName, final Map<?, ?> m) {
final List<Object> keyColumn = new ArrayList<>(m.size());
final List<Object> valueColumn = new ArrayList<>(m.size());
for (Map.Entry<?, ?> entry : m.entrySet()) {
keyColumn.add(entry.getKey());
valueColumn.add(entry.getValue());
}
final List<String> columnNameList = N.asList(keyColumnName, valueColumnName);
final List<List<Object>> columnList = N.asList(keyColumn, valueColumn);
return newDataSet(columnNameList, columnList);
} | java | public static DataSet newDataSet(final String keyColumnName, final String valueColumnName, final Map<?, ?> m) {
final List<Object> keyColumn = new ArrayList<>(m.size());
final List<Object> valueColumn = new ArrayList<>(m.size());
for (Map.Entry<?, ?> entry : m.entrySet()) {
keyColumn.add(entry.getKey());
valueColumn.add(entry.getValue());
}
final List<String> columnNameList = N.asList(keyColumnName, valueColumnName);
final List<List<Object>> columnList = N.asList(keyColumn, valueColumn);
return newDataSet(columnNameList, columnList);
} | [
"public",
"static",
"DataSet",
"newDataSet",
"(",
"final",
"String",
"keyColumnName",
",",
"final",
"String",
"valueColumnName",
",",
"final",
"Map",
"<",
"?",
",",
"?",
">",
"m",
")",
"{",
"final",
"List",
"<",
"Object",
">",
"keyColumn",
"=",
"new",
"A... | Convert the specified Map to a two columns <code>DataSet</code>: one column is for keys and one column is for values
@param keyColumnName
@param valueColumnName
@param m
@return | [
"Convert",
"the",
"specified",
"Map",
"to",
"a",
"two",
"columns",
"<code",
">",
"DataSet<",
"/",
"code",
">",
":",
"one",
"column",
"is",
"for",
"keys",
"and",
"one",
"column",
"is",
"for",
"values"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L1251-L1264 |
lucasr/probe | library/src/main/java/org/lucasr/probe/Interceptor.java | Interceptor.onLayout | public void onLayout(View view, boolean changed, int l, int t, int r, int b) {
invokeOnLayout(view, changed, l, t, r, b);
} | java | public void onLayout(View view, boolean changed, int l, int t, int r, int b) {
invokeOnLayout(view, changed, l, t, r, b);
} | [
"public",
"void",
"onLayout",
"(",
"View",
"view",
",",
"boolean",
"changed",
",",
"int",
"l",
",",
"int",
"t",
",",
"int",
"r",
",",
"int",
"b",
")",
"{",
"invokeOnLayout",
"(",
"view",
",",
"changed",
",",
"l",
",",
"t",
",",
"r",
",",
"b",
"... | Intercepts an {@link View#onLayout(boolean, int, int, int, int)} call on the
given {@link View}. By default, it simply calls the view's original method. | [
"Intercepts",
"an",
"{"
] | train | https://github.com/lucasr/probe/blob/cd15cc04383a1bf85de2f4c345d2018415b9ddc9/library/src/main/java/org/lucasr/probe/Interceptor.java#L67-L69 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java | CustomerAccountUrl.setPasswordChangeRequiredUrl | public static MozuUrl setPasswordChangeRequiredUrl(Integer accountId, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/Set-Password-Change-Required?userId={userId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl setPasswordChangeRequiredUrl(Integer accountId, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/Set-Password-Change-Required?userId={userId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"setPasswordChangeRequiredUrl",
"(",
"Integer",
"accountId",
",",
"String",
"userId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/accounts/{accountId}/Set-Password-Change-Required?userId={userId}... | Get Resource Url for SetPasswordChangeRequired
@param accountId Unique identifier of the customer account.
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"SetPasswordChangeRequired"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java#L150-L156 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/BOCSU.java | BOCSU.getNegDivMod | private static final long getNegDivMod(int number, int factor)
{
int modulo = number % factor;
long result = number / factor;
if (modulo < 0) {
-- result;
modulo += factor;
}
return (result << 32) | modulo;
} | java | private static final long getNegDivMod(int number, int factor)
{
int modulo = number % factor;
long result = number / factor;
if (modulo < 0) {
-- result;
modulo += factor;
}
return (result << 32) | modulo;
} | [
"private",
"static",
"final",
"long",
"getNegDivMod",
"(",
"int",
"number",
",",
"int",
"factor",
")",
"{",
"int",
"modulo",
"=",
"number",
"%",
"factor",
";",
"long",
"result",
"=",
"number",
"/",
"factor",
";",
"if",
"(",
"modulo",
"<",
"0",
")",
"... | Integer division and modulo with negative numerators
yields negative modulo results and quotients that are one more than
what we need here.
@param number which operations are to be performed on
@param factor the factor to use for division
@return (result of division) << 32 | modulo | [
"Integer",
"division",
"and",
"modulo",
"with",
"negative",
"numerators",
"yields",
"negative",
"modulo",
"results",
"and",
"quotients",
"that",
"are",
"one",
"more",
"than",
"what",
"we",
"need",
"here",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/BOCSU.java#L240-L249 |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newRole | public Predicate.Role newRole(String id, Predicate predicate, String semRole, Span<Term> span) {
idManager.updateCounter(AnnotationType.ROLE, id);
Predicate.Role newRole = new Predicate.Role(id, semRole, span);
return newRole;
} | java | public Predicate.Role newRole(String id, Predicate predicate, String semRole, Span<Term> span) {
idManager.updateCounter(AnnotationType.ROLE, id);
Predicate.Role newRole = new Predicate.Role(id, semRole, span);
return newRole;
} | [
"public",
"Predicate",
".",
"Role",
"newRole",
"(",
"String",
"id",
",",
"Predicate",
"predicate",
",",
"String",
"semRole",
",",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"ROLE",
",",
"id",
... | Creates a Role object to load an existing role. It receives the ID as an argument. It doesn't add the role to the predicate.
@param id role's ID.
@param predicate the predicate which this role is part of
@param semRole semantic role
@param span span containing all the targets of the role
@return a new role. | [
"Creates",
"a",
"Role",
"object",
"to",
"load",
"an",
"existing",
"role",
".",
"It",
"receives",
"the",
"ID",
"as",
"an",
"argument",
".",
"It",
"doesn",
"t",
"add",
"the",
"role",
"to",
"the",
"predicate",
"."
] | train | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1021-L1025 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java | TypeAnnotationPosition.methodRefTypeArg | public static TypeAnnotationPosition
methodRefTypeArg(final List<TypePathEntry> location,
final int type_index) {
return methodRefTypeArg(location, null, type_index, -1);
} | java | public static TypeAnnotationPosition
methodRefTypeArg(final List<TypePathEntry> location,
final int type_index) {
return methodRefTypeArg(location, null, type_index, -1);
} | [
"public",
"static",
"TypeAnnotationPosition",
"methodRefTypeArg",
"(",
"final",
"List",
"<",
"TypePathEntry",
">",
"location",
",",
"final",
"int",
"type_index",
")",
"{",
"return",
"methodRefTypeArg",
"(",
"location",
",",
"null",
",",
"type_index",
",",
"-",
"... | Create a {@code TypeAnnotationPosition} for a method reference
type argument.
@param location The type path.
@param type_index The index of the type argument. | [
"Create",
"a",
"{",
"@code",
"TypeAnnotationPosition",
"}",
"for",
"a",
"method",
"reference",
"type",
"argument",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java#L1070-L1074 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/LayerValidation.java | LayerValidation.assertNOutSet | public static void assertNOutSet(String layerType, String layerName, long layerIndex, long nOut) {
if (nOut <= 0) {
if (layerName == null)
layerName = "(name not set)";
throw new DL4JInvalidConfigException(layerType + " (index=" + layerIndex + ", name=" + layerName + ") nOut="
+ nOut + "; nOut must be > 0");
}
} | java | public static void assertNOutSet(String layerType, String layerName, long layerIndex, long nOut) {
if (nOut <= 0) {
if (layerName == null)
layerName = "(name not set)";
throw new DL4JInvalidConfigException(layerType + " (index=" + layerIndex + ", name=" + layerName + ") nOut="
+ nOut + "; nOut must be > 0");
}
} | [
"public",
"static",
"void",
"assertNOutSet",
"(",
"String",
"layerType",
",",
"String",
"layerName",
",",
"long",
"layerIndex",
",",
"long",
"nOut",
")",
"{",
"if",
"(",
"nOut",
"<=",
"0",
")",
"{",
"if",
"(",
"layerName",
"==",
"null",
")",
"layerName",... | Asserts that the layer nOut value is set for the layer
@param layerType Type of layer ("DenseLayer", etc)
@param layerName Name of the layer (may be null if not set)
@param layerIndex Index of the layer
@param nOut nOut value | [
"Asserts",
"that",
"the",
"layer",
"nOut",
"value",
"is",
"set",
"for",
"the",
"layer"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/LayerValidation.java#L67-L74 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java | ServerPluginRepository.appendDependentPluginKeys | private void appendDependentPluginKeys(String pluginKey, Set<String> appendTo) {
for (PluginInfo otherPlugin : getPluginInfos()) {
if (!otherPlugin.getKey().equals(pluginKey)) {
for (PluginInfo.RequiredPlugin requirement : otherPlugin.getRequiredPlugins()) {
if (requirement.getKey().equals(pluginKey)) {
appendTo.add(otherPlugin.getKey());
appendDependentPluginKeys(otherPlugin.getKey(), appendTo);
}
}
}
}
} | java | private void appendDependentPluginKeys(String pluginKey, Set<String> appendTo) {
for (PluginInfo otherPlugin : getPluginInfos()) {
if (!otherPlugin.getKey().equals(pluginKey)) {
for (PluginInfo.RequiredPlugin requirement : otherPlugin.getRequiredPlugins()) {
if (requirement.getKey().equals(pluginKey)) {
appendTo.add(otherPlugin.getKey());
appendDependentPluginKeys(otherPlugin.getKey(), appendTo);
}
}
}
}
} | [
"private",
"void",
"appendDependentPluginKeys",
"(",
"String",
"pluginKey",
",",
"Set",
"<",
"String",
">",
"appendTo",
")",
"{",
"for",
"(",
"PluginInfo",
"otherPlugin",
":",
"getPluginInfos",
"(",
")",
")",
"{",
"if",
"(",
"!",
"otherPlugin",
".",
"getKey"... | Appends dependent plugins, only the ones that still exist in the plugins folder. | [
"Appends",
"dependent",
"plugins",
"only",
"the",
"ones",
"that",
"still",
"exist",
"in",
"the",
"plugins",
"folder",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java#L314-L325 |
w3c/epubcheck | src/main/java/com/adobe/epubcheck/opf/MetadataSet.java | MetadataSet.containsPrimary | public boolean containsPrimary(Property property, String value)
{
for (Metadata meta : primary.get(property))
{
if (meta.getValue().equals(value))
{
return true;
}
}
return false;
} | java | public boolean containsPrimary(Property property, String value)
{
for (Metadata meta : primary.get(property))
{
if (meta.getValue().equals(value))
{
return true;
}
}
return false;
} | [
"public",
"boolean",
"containsPrimary",
"(",
"Property",
"property",
",",
"String",
"value",
")",
"{",
"for",
"(",
"Metadata",
"meta",
":",
"primary",
".",
"get",
"(",
"property",
")",
")",
"{",
"if",
"(",
"meta",
".",
"getValue",
"(",
")",
".",
"equal... | Returns <code>true</code> if this metadata set contains a primary
expression for the given property and the given value
@param property
a property from a metadata vocabulary
@param value
the value to search
@return <code>true</code> if this metadata set contains a primary
expression for the given property and value | [
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"this",
"metadata",
"set",
"contains",
"a",
"primary",
"expression",
"for",
"the",
"given",
"property",
"and",
"the",
"given",
"value"
] | train | https://github.com/w3c/epubcheck/blob/4d5a24d9f2878a2a5497eb11c036cc18fe2c0a78/src/main/java/com/adobe/epubcheck/opf/MetadataSet.java#L124-L134 |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/ssh/SshUtilities.java | SshUtilities.getPreference | public static String getPreference( String preferenceKey, String defaultValue ) {
Preferences preferences = Preferences.userRoot().node(PREFS_NODE_NAME);
String preference = preferences.get(preferenceKey, defaultValue);
return preference;
} | java | public static String getPreference( String preferenceKey, String defaultValue ) {
Preferences preferences = Preferences.userRoot().node(PREFS_NODE_NAME);
String preference = preferences.get(preferenceKey, defaultValue);
return preference;
} | [
"public",
"static",
"String",
"getPreference",
"(",
"String",
"preferenceKey",
",",
"String",
"defaultValue",
")",
"{",
"Preferences",
"preferences",
"=",
"Preferences",
".",
"userRoot",
"(",
")",
".",
"node",
"(",
"PREFS_NODE_NAME",
")",
";",
"String",
"prefere... | Get from preference.
@param preferenceKey
the preference key.
@param defaultValue
the default value in case of <code>null</code>.
@return the string preference asked. | [
"Get",
"from",
"preference",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/ssh/SshUtilities.java#L56-L60 |
Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/RunReflectiveCall.java | RunReflectiveCall.methodHash | public static int methodHash(Object runner, FrameworkMethod method) {
return ((Thread.currentThread().hashCode() * 31) + runner.hashCode()) * 31 + method.hashCode();
} | java | public static int methodHash(Object runner, FrameworkMethod method) {
return ((Thread.currentThread().hashCode() * 31) + runner.hashCode()) * 31 + method.hashCode();
} | [
"public",
"static",
"int",
"methodHash",
"(",
"Object",
"runner",
",",
"FrameworkMethod",
"method",
")",
"{",
"return",
"(",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"hashCode",
"(",
")",
"*",
"31",
")",
"+",
"runner",
".",
"hashCode",
"(",
... | Generate a hash code for the specified runner/method pair.
@param runner JUnit test runner
@param method {@link FrameworkMethod} object
@return hash code for the specified runner/method pair | [
"Generate",
"a",
"hash",
"code",
"for",
"the",
"specified",
"runner",
"/",
"method",
"pair",
"."
] | train | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RunReflectiveCall.java#L217-L219 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java | DialogFragmentUtils.supportFindDialogFragmentByTag | @SuppressWarnings("unchecked") // we know the dialog fragment is a child of fragment.
public static <F extends android.support.v4.app.DialogFragment> F supportFindDialogFragmentByTag(android.support.v4.app.FragmentManager manager, String tag) {
return (F) manager.findFragmentByTag(tag);
} | java | @SuppressWarnings("unchecked") // we know the dialog fragment is a child of fragment.
public static <F extends android.support.v4.app.DialogFragment> F supportFindDialogFragmentByTag(android.support.v4.app.FragmentManager manager, String tag) {
return (F) manager.findFragmentByTag(tag);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// we know the dialog fragment is a child of fragment.",
"public",
"static",
"<",
"F",
"extends",
"android",
".",
"support",
".",
"v4",
".",
"app",
".",
"DialogFragment",
">",
"F",
"supportFindDialogFragmentByTag",
"(... | Find fragment registered on the manager.
@param manager the manager.
@param tag the tag string that is related to the {@link android.support.v4.app.DialogFragment}.
@param <F> the dialog fragment impl.
@return the {@link android.support.v4.app.DialogFragment}. {@code null} if the fragment not found. | [
"Find",
"fragment",
"registered",
"on",
"the",
"manager",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java#L54-L57 |
square/protoparser | src/main/java/com/squareup/protoparser/ProtoParser.java | ProtoParser.parseUtf8 | public static ProtoFile parseUtf8(String name, InputStream is) throws IOException {
return parse(name, new InputStreamReader(is, UTF_8));
} | java | public static ProtoFile parseUtf8(String name, InputStream is) throws IOException {
return parse(name, new InputStreamReader(is, UTF_8));
} | [
"public",
"static",
"ProtoFile",
"parseUtf8",
"(",
"String",
"name",
",",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"return",
"parse",
"(",
"name",
",",
"new",
"InputStreamReader",
"(",
"is",
",",
"UTF_8",
")",
")",
";",
"}"
] | Parse a named {@code .proto} schema. The {@code InputStream} is not closed. | [
"Parse",
"a",
"named",
"{"
] | train | https://github.com/square/protoparser/blob/8be66bb8fe6658b04741df0358daabca501f2524/src/main/java/com/squareup/protoparser/ProtoParser.java#L44-L46 |
calimero-project/calimero-core | src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java | TranslatorTypes.createTranslator | public static DPTXlator createTranslator(final int mainNumber, final String dptId) throws KNXException
{
int main = 0;
try {
main = getMainNumber(mainNumber, dptId);
}
catch (final NumberFormatException e) {}
final MainType type = map.get(main);
if (type == null)
throw new KNXException("no DPT translator available for main number " + main + " (ID " + dptId + ")");
final String id = dptId != null && !dptId.isEmpty() ? dptId : type.getSubTypes().keySet().iterator().next();
return type.createTranslator(id);
} | java | public static DPTXlator createTranslator(final int mainNumber, final String dptId) throws KNXException
{
int main = 0;
try {
main = getMainNumber(mainNumber, dptId);
}
catch (final NumberFormatException e) {}
final MainType type = map.get(main);
if (type == null)
throw new KNXException("no DPT translator available for main number " + main + " (ID " + dptId + ")");
final String id = dptId != null && !dptId.isEmpty() ? dptId : type.getSubTypes().keySet().iterator().next();
return type.createTranslator(id);
} | [
"public",
"static",
"DPTXlator",
"createTranslator",
"(",
"final",
"int",
"mainNumber",
",",
"final",
"String",
"dptId",
")",
"throws",
"KNXException",
"{",
"int",
"main",
"=",
"0",
";",
"try",
"{",
"main",
"=",
"getMainNumber",
"(",
"mainNumber",
",",
"dptI... | Creates a DPT translator for the given datapoint type ID.
<p>
The translation behavior of a DPT translator instance is uniquely defined by the supplied datapoint type ID.
<p>
If the <code>dptId</code> argument is built up the recommended way, that is "<i>main number</i>.<i>sub number</i>
", the <code>mainNumber</code> argument might be left 0 to use the datapoint type ID only.<br>
Note, that we don't enforce any particular or standardized format on the <code>dptId</code> structure, so using a
different formatted dptId solely without main number argument results in undefined behavior.
@param mainNumber data type main number, number ≥ 0; use 0 to infer translator type from <code>dptId</code>
argument only
@param dptId datapoint type ID for selecting a particular kind of value translation
@return the new {@link DPTXlator} object
@throws KNXException on main type not found or creation failed (refer to
{@link MainType#createTranslator(String)}) | [
"Creates",
"a",
"DPT",
"translator",
"for",
"the",
"given",
"datapoint",
"type",
"ID",
".",
"<p",
">",
"The",
"translation",
"behavior",
"of",
"a",
"DPT",
"translator",
"instance",
"is",
"uniquely",
"defined",
"by",
"the",
"supplied",
"datapoint",
"type",
"I... | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java#L562-L575 |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/visitor/VisitorHelper.java | VisitorHelper.getValue | public static Object getValue(Object object, Field field) throws VisitorException {
boolean reprotect = false;
if(object == null) {
return null;
}
try {
if(!field.isAccessible()) {
field.setAccessible(true);
reprotect = true;
}
Object value = field.get(object);
logger.trace("field '{}' has value '{}'", field.getName(), value);
return value;
} catch (IllegalArgumentException e) {
logger.error("Trying to access field '{}' on invalid object of class '{}'", field.getName(), object.getClass().getSimpleName());
throw new VisitorException("Trying to access field on invalid object", e);
} catch (IllegalAccessException e) {
logger.error("Illegal access to class '{}'", object.getClass().getSimpleName());
throw new VisitorException("Illegal access to class", e);
} finally {
if(reprotect) {
field.setAccessible(false);
}
}
} | java | public static Object getValue(Object object, Field field) throws VisitorException {
boolean reprotect = false;
if(object == null) {
return null;
}
try {
if(!field.isAccessible()) {
field.setAccessible(true);
reprotect = true;
}
Object value = field.get(object);
logger.trace("field '{}' has value '{}'", field.getName(), value);
return value;
} catch (IllegalArgumentException e) {
logger.error("Trying to access field '{}' on invalid object of class '{}'", field.getName(), object.getClass().getSimpleName());
throw new VisitorException("Trying to access field on invalid object", e);
} catch (IllegalAccessException e) {
logger.error("Illegal access to class '{}'", object.getClass().getSimpleName());
throw new VisitorException("Illegal access to class", e);
} finally {
if(reprotect) {
field.setAccessible(false);
}
}
} | [
"public",
"static",
"Object",
"getValue",
"(",
"Object",
"object",
",",
"Field",
"field",
")",
"throws",
"VisitorException",
"{",
"boolean",
"reprotect",
"=",
"false",
";",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"... | Returns the value of the given field on the given object.
@param object
the object whose field is to be retrieved.
@param field
the field being retrieved.
@return
the value of the field.
@throws VisitorException
if an error occurs while evaluating the node's value. | [
"Returns",
"the",
"value",
"of",
"the",
"given",
"field",
"on",
"the",
"given",
"object",
"."
] | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/visitor/VisitorHelper.java#L64-L88 |
finmath/finmath-lib | src/main/java/net/finmath/time/SchedulePrototype.java | SchedulePrototype.generateSchedule | public Schedule generateSchedule(LocalDate referenceDate, int maturity, int termination, OffsetUnit unit) {
LocalDate startDate;
LocalDate endDate;
switch(unit) {
case YEARS : startDate = referenceDate.plusYears(maturity); endDate = startDate.plusYears(termination); break;
case MONTHS : startDate = referenceDate.plusMonths(maturity); endDate = startDate.plusMonths(termination); break;
case DAYS : startDate = referenceDate.plusDays(maturity); endDate = startDate.plusDays(termination); break;
case WEEKS : startDate = referenceDate.plusDays(maturity *7); endDate = startDate.plusDays(termination *7); break;
default : startDate = referenceDate.plusMonths(maturity); endDate = startDate.plusMonths(termination); break;
}
return generateSchedule(referenceDate, startDate, endDate);
} | java | public Schedule generateSchedule(LocalDate referenceDate, int maturity, int termination, OffsetUnit unit) {
LocalDate startDate;
LocalDate endDate;
switch(unit) {
case YEARS : startDate = referenceDate.plusYears(maturity); endDate = startDate.plusYears(termination); break;
case MONTHS : startDate = referenceDate.plusMonths(maturity); endDate = startDate.plusMonths(termination); break;
case DAYS : startDate = referenceDate.plusDays(maturity); endDate = startDate.plusDays(termination); break;
case WEEKS : startDate = referenceDate.plusDays(maturity *7); endDate = startDate.plusDays(termination *7); break;
default : startDate = referenceDate.plusMonths(maturity); endDate = startDate.plusMonths(termination); break;
}
return generateSchedule(referenceDate, startDate, endDate);
} | [
"public",
"Schedule",
"generateSchedule",
"(",
"LocalDate",
"referenceDate",
",",
"int",
"maturity",
",",
"int",
"termination",
",",
"OffsetUnit",
"unit",
")",
"{",
"LocalDate",
"startDate",
";",
"LocalDate",
"endDate",
";",
"switch",
"(",
"unit",
")",
"{",
"c... | Generate a schedule with start / end date determined by an offset from the reference date.
@param referenceDate The reference date (corresponds to \( t = 0 \).
@param maturity Offset of the start date to the reference date
@param termination Offset of the end date to the start date
@param unit The convention to use for the offset
@return The schedule | [
"Generate",
"a",
"schedule",
"with",
"start",
"/",
"end",
"date",
"determined",
"by",
"an",
"offset",
"from",
"the",
"reference",
"date",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/SchedulePrototype.java#L165-L179 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/JobLeaderIdService.java | JobLeaderIdService.addJob | public void addJob(JobID jobId) throws Exception {
Preconditions.checkNotNull(jobLeaderIdActions);
LOG.debug("Add job {} to job leader id monitoring.", jobId);
if (!jobLeaderIdListeners.containsKey(jobId)) {
LeaderRetrievalService leaderRetrievalService = highAvailabilityServices.getJobManagerLeaderRetriever(jobId);
JobLeaderIdListener jobIdListener = new JobLeaderIdListener(jobId, jobLeaderIdActions, leaderRetrievalService);
jobLeaderIdListeners.put(jobId, jobIdListener);
}
} | java | public void addJob(JobID jobId) throws Exception {
Preconditions.checkNotNull(jobLeaderIdActions);
LOG.debug("Add job {} to job leader id monitoring.", jobId);
if (!jobLeaderIdListeners.containsKey(jobId)) {
LeaderRetrievalService leaderRetrievalService = highAvailabilityServices.getJobManagerLeaderRetriever(jobId);
JobLeaderIdListener jobIdListener = new JobLeaderIdListener(jobId, jobLeaderIdActions, leaderRetrievalService);
jobLeaderIdListeners.put(jobId, jobIdListener);
}
} | [
"public",
"void",
"addJob",
"(",
"JobID",
"jobId",
")",
"throws",
"Exception",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"jobLeaderIdActions",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Add job {} to job leader id monitoring.\"",
",",
"jobId",
")",
";",
"if",
... | Add a job to be monitored to retrieve the job leader id.
@param jobId identifying the job to monitor
@throws Exception if the job could not be added to the service | [
"Add",
"a",
"job",
"to",
"be",
"monitored",
"to",
"retrieve",
"the",
"job",
"leader",
"id",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/JobLeaderIdService.java#L145-L156 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java | PageFlowManagedObject.initializeField | protected void initializeField( Field field, Object instance )
{
if ( instance != null )
{
if ( _log.isTraceEnabled() )
{
_log.trace( "Initializing field " + field.getName() + " in " + getDisplayName() + " with " + instance );
}
try
{
field.set( this, instance );
}
catch ( IllegalArgumentException e )
{
_log.error( "Could not set field " + field.getName() + " on " + getDisplayName() +
"; instance is of type " + instance.getClass().getName() + ", field type is "
+ field.getType().getName() );
}
catch ( IllegalAccessException e )
{
_log.error( "Error initializing field " + field.getName() + " in " + getDisplayName(), e );
}
}
} | java | protected void initializeField( Field field, Object instance )
{
if ( instance != null )
{
if ( _log.isTraceEnabled() )
{
_log.trace( "Initializing field " + field.getName() + " in " + getDisplayName() + " with " + instance );
}
try
{
field.set( this, instance );
}
catch ( IllegalArgumentException e )
{
_log.error( "Could not set field " + field.getName() + " on " + getDisplayName() +
"; instance is of type " + instance.getClass().getName() + ", field type is "
+ field.getType().getName() );
}
catch ( IllegalAccessException e )
{
_log.error( "Error initializing field " + field.getName() + " in " + getDisplayName(), e );
}
}
} | [
"protected",
"void",
"initializeField",
"(",
"Field",
"field",
",",
"Object",
"instance",
")",
"{",
"if",
"(",
"instance",
"!=",
"null",
")",
"{",
"if",
"(",
"_log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"_log",
".",
"trace",
"(",
"\"Initializing fi... | Initialize the given field with an instance. Mainly useful for the error handling. | [
"Initialize",
"the",
"given",
"field",
"with",
"an",
"instance",
".",
"Mainly",
"useful",
"for",
"the",
"error",
"handling",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java#L214-L238 |
LableOrg/java-uniqueid | uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ExpiringResourceClaim.java | ExpiringResourceClaim.claimExpiring | public static ResourceClaim claimExpiring(ZooKeeperConnection zooKeeperConnection,
int poolSize,
String znode,
Long timeout)
throws IOException {
long timeoutNonNull = timeout == null ? DEFAULT_TIMEOUT : timeout;
logger.debug("Preparing expiring resource-claim; will release it in {}ms.", timeout);
return new ExpiringResourceClaim(zooKeeperConnection, poolSize, znode, timeoutNonNull);
} | java | public static ResourceClaim claimExpiring(ZooKeeperConnection zooKeeperConnection,
int poolSize,
String znode,
Long timeout)
throws IOException {
long timeoutNonNull = timeout == null ? DEFAULT_TIMEOUT : timeout;
logger.debug("Preparing expiring resource-claim; will release it in {}ms.", timeout);
return new ExpiringResourceClaim(zooKeeperConnection, poolSize, znode, timeoutNonNull);
} | [
"public",
"static",
"ResourceClaim",
"claimExpiring",
"(",
"ZooKeeperConnection",
"zooKeeperConnection",
",",
"int",
"poolSize",
",",
"String",
"znode",
",",
"Long",
"timeout",
")",
"throws",
"IOException",
"{",
"long",
"timeoutNonNull",
"=",
"timeout",
"==",
"null"... | Claim a resource.
@param zooKeeperConnection ZooKeeper connection to use.
@param poolSize Size of the resource pool.
@param znode Root znode of the ZooKeeper resource-pool.
@param timeout Delay in milliseconds before the claim expires.
@return A resource claim. | [
"Claim",
"a",
"resource",
"."
] | train | https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ExpiringResourceClaim.java#L68-L78 |
mgm-tp/jfunk | jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ResourceLoader.java | ResourceLoader.getConfigInputStreamReader | public static InputStreamReader getConfigInputStreamReader(final String resource, final String encoding) throws IOException {
return new InputStreamReader(getConfigInputStream(resource), encoding);
} | java | public static InputStreamReader getConfigInputStreamReader(final String resource, final String encoding) throws IOException {
return new InputStreamReader(getConfigInputStream(resource), encoding);
} | [
"public",
"static",
"InputStreamReader",
"getConfigInputStreamReader",
"(",
"final",
"String",
"resource",
",",
"final",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"return",
"new",
"InputStreamReader",
"(",
"getConfigInputStream",
"(",
"resource",
")",
"... | Loads a resource as {@link InputStreamReader} relative to {@link #getConfigDir()}.
@param resource
The resource to be loaded.
@param encoding
The encoding to use
@return The reader | [
"Loads",
"a",
"resource",
"as",
"{",
"@link",
"InputStreamReader",
"}",
"relative",
"to",
"{",
"@link",
"#getConfigDir",
"()",
"}",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ResourceLoader.java#L176-L178 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java | ExpressRouteGatewaysInner.beginCreateOrUpdateAsync | public Observable<ExpressRouteGatewayInner> beginCreateOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, ExpressRouteGatewayInner putExpressRouteGatewayParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters).map(new Func1<ServiceResponse<ExpressRouteGatewayInner>, ExpressRouteGatewayInner>() {
@Override
public ExpressRouteGatewayInner call(ServiceResponse<ExpressRouteGatewayInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteGatewayInner> beginCreateOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, ExpressRouteGatewayInner putExpressRouteGatewayParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters).map(new Func1<ServiceResponse<ExpressRouteGatewayInner>, ExpressRouteGatewayInner>() {
@Override
public ExpressRouteGatewayInner call(ServiceResponse<ExpressRouteGatewayInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteGatewayInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"ExpressRouteGatewayInner",
"putExpressRouteGatewayParameters",
")",
"{",
"return",
"beginCreateOrUpdateWit... | Creates or updates a ExpressRoute gateway in a specified resource group.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param putExpressRouteGatewayParameters Parameters required in an ExpressRoute gateway PUT operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteGatewayInner object | [
"Creates",
"or",
"updates",
"a",
"ExpressRoute",
"gateway",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java#L372-L379 |
junit-team/junit4 | src/main/java/org/junit/runner/JUnitCore.java | JUnitCore.runClasses | public static Result runClasses(Computer computer, Class<?>... classes) {
return new JUnitCore().run(computer, classes);
} | java | public static Result runClasses(Computer computer, Class<?>... classes) {
return new JUnitCore().run(computer, classes);
} | [
"public",
"static",
"Result",
"runClasses",
"(",
"Computer",
"computer",
",",
"Class",
"<",
"?",
">",
"...",
"classes",
")",
"{",
"return",
"new",
"JUnitCore",
"(",
")",
".",
"run",
"(",
"computer",
",",
"classes",
")",
";",
"}"
] | Run the tests contained in <code>classes</code>. Write feedback while the tests
are running and write stack traces for all failed tests after all tests complete. This is
similar to {@link #main(String[])}, but intended to be used programmatically.
@param computer Helps construct Runners from classes
@param classes Classes in which to find tests
@return a {@link Result} describing the details of the test run and the failed tests. | [
"Run",
"the",
"tests",
"contained",
"in",
"<code",
">",
"classes<",
"/",
"code",
">",
".",
"Write",
"feedback",
"while",
"the",
"tests",
"are",
"running",
"and",
"write",
"stack",
"traces",
"for",
"all",
"failed",
"tests",
"after",
"all",
"tests",
"complet... | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/JUnitCore.java#L61-L63 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/json/JSONDeserializer.java | JSONDeserializer.deserializeToField | public static void deserializeToField(final Object containingObject, final String fieldName, final String json)
throws IllegalArgumentException {
final ClassFieldCache typeCache = new ClassFieldCache(/* resolveTypes = */ true,
/* onlySerializePublicFields = */ false);
deserializeToField(containingObject, fieldName, json, typeCache);
} | java | public static void deserializeToField(final Object containingObject, final String fieldName, final String json)
throws IllegalArgumentException {
final ClassFieldCache typeCache = new ClassFieldCache(/* resolveTypes = */ true,
/* onlySerializePublicFields = */ false);
deserializeToField(containingObject, fieldName, json, typeCache);
} | [
"public",
"static",
"void",
"deserializeToField",
"(",
"final",
"Object",
"containingObject",
",",
"final",
"String",
"fieldName",
",",
"final",
"String",
"json",
")",
"throws",
"IllegalArgumentException",
"{",
"final",
"ClassFieldCache",
"typeCache",
"=",
"new",
"C... | Deserialize JSON to a new object graph, with the root object of the specified expected type, and store the
root object in the named field of the given containing object. Works for generic types, since it is possible
to obtain the generic type of a field.
@param containingObject
The object containing the named field to deserialize the object graph into.
@param fieldName
The name of the field to set with the result.
@param json
the JSON string to deserialize.
@throws IllegalArgumentException
If anything goes wrong during deserialization. | [
"Deserialize",
"JSON",
"to",
"a",
"new",
"object",
"graph",
"with",
"the",
"root",
"object",
"of",
"the",
"specified",
"expected",
"type",
"and",
"store",
"the",
"root",
"object",
"in",
"the",
"named",
"field",
"of",
"the",
"given",
"containing",
"object",
... | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/json/JSONDeserializer.java#L754-L759 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PhysicalDatabaseParent.java | PhysicalDatabaseParent.setProperty | public void setProperty(String strKey, Object objValue)
{
if (m_mapParams == null)
m_mapParams = new HashMap<String,Object>();
m_mapParams.put(strKey, objValue);
} | java | public void setProperty(String strKey, Object objValue)
{
if (m_mapParams == null)
m_mapParams = new HashMap<String,Object>();
m_mapParams.put(strKey, objValue);
} | [
"public",
"void",
"setProperty",
"(",
"String",
"strKey",
",",
"Object",
"objValue",
")",
"{",
"if",
"(",
"m_mapParams",
"==",
"null",
")",
"m_mapParams",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"m_mapParams",
".",
"put",... | Set the value of this property (passed in on initialization).
@param key The parameter key value.
@param objValue The key's value. | [
"Set",
"the",
"value",
"of",
"this",
"property",
"(",
"passed",
"in",
"on",
"initialization",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PhysicalDatabaseParent.java#L269-L274 |
aerogear/aerogear-unifiedpush-server | push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/jms/AbstractJMSMessageProducer.java | AbstractJMSMessageProducer.sendTransacted | protected void sendTransacted(Destination destination, Serializable message, String propertyName, String propertValue) {
send(destination, message, propertyName, propertValue, true);
} | java | protected void sendTransacted(Destination destination, Serializable message, String propertyName, String propertValue) {
send(destination, message, propertyName, propertValue, true);
} | [
"protected",
"void",
"sendTransacted",
"(",
"Destination",
"destination",
",",
"Serializable",
"message",
",",
"String",
"propertyName",
",",
"String",
"propertValue",
")",
"{",
"send",
"(",
"destination",
",",
"message",
",",
"propertyName",
",",
"propertValue",
... | Sends message to destination with given JMS message property name and value in transactional manner.
@param destination where to send
@param message what to send
@param propertyName property of obj
@param propertValue value of obj
Since transacted session is used, the message won't be committed until whole enclosing transaction ends. | [
"Sends",
"message",
"to",
"destination",
"with",
"given",
"JMS",
"message",
"property",
"name",
"and",
"value",
"in",
"transactional",
"manner",
"."
] | train | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/jms/AbstractJMSMessageProducer.java#L94-L96 |
Chorus-bdd/Chorus | interpreter/chorus-remoting/src/main/java/org/chorusbdd/chorus/remoting/jmx/remotingmanager/ChorusHandlerJmxProxy.java | ChorusHandlerJmxProxy.invokeStep | public Object invokeStep(String remoteStepInvokerId, String stepTokenId, List<String> params) throws Exception {
try {
//call the remote method
Object[] args = {remoteStepInvokerId, stepTokenId, ChorusContext.getContext().getSnapshot(), params};
String[] signature = {"java.lang.String", "java.lang.String", "java.util.Map", "java.util.List"};
log.debug(String.format("About to invoke step (%s) on MBean (%s)", remoteStepInvokerId, objectName));
JmxStepResult r = (JmxStepResult) mBeanServerConnection.invoke(objectName, "invokeStep", args, signature);
//update the local context with any changes made remotely
Map newContextState = r.getChorusContext();
ChorusContext.resetContext(newContextState);
//return the result which the remote step method returned
return r.getResult();
} catch (MBeanException e) {
throw e.getTargetException();
}
} | java | public Object invokeStep(String remoteStepInvokerId, String stepTokenId, List<String> params) throws Exception {
try {
//call the remote method
Object[] args = {remoteStepInvokerId, stepTokenId, ChorusContext.getContext().getSnapshot(), params};
String[] signature = {"java.lang.String", "java.lang.String", "java.util.Map", "java.util.List"};
log.debug(String.format("About to invoke step (%s) on MBean (%s)", remoteStepInvokerId, objectName));
JmxStepResult r = (JmxStepResult) mBeanServerConnection.invoke(objectName, "invokeStep", args, signature);
//update the local context with any changes made remotely
Map newContextState = r.getChorusContext();
ChorusContext.resetContext(newContextState);
//return the result which the remote step method returned
return r.getResult();
} catch (MBeanException e) {
throw e.getTargetException();
}
} | [
"public",
"Object",
"invokeStep",
"(",
"String",
"remoteStepInvokerId",
",",
"String",
"stepTokenId",
",",
"List",
"<",
"String",
">",
"params",
")",
"throws",
"Exception",
"{",
"try",
"{",
"//call the remote method",
"Object",
"[",
"]",
"args",
"=",
"{",
"rem... | Calls the invoke Step method on the remote MBean. The current ChorusContext will be
serialized as part of this and marshalled to the remote bean.
@param remoteStepInvokerId the id of the step to call
@param params params to pass in the call | [
"Calls",
"the",
"invoke",
"Step",
"method",
"on",
"the",
"remote",
"MBean",
".",
"The",
"current",
"ChorusContext",
"will",
"be",
"serialized",
"as",
"part",
"of",
"this",
"and",
"marshalled",
"to",
"the",
"remote",
"bean",
"."
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-remoting/src/main/java/org/chorusbdd/chorus/remoting/jmx/remotingmanager/ChorusHandlerJmxProxy.java#L89-L106 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java | WorkflowsInner.createOrUpdateAsync | public Observable<WorkflowInner> createOrUpdateAsync(String resourceGroupName, String workflowName, WorkflowInner workflow) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, workflowName, workflow).map(new Func1<ServiceResponse<WorkflowInner>, WorkflowInner>() {
@Override
public WorkflowInner call(ServiceResponse<WorkflowInner> response) {
return response.body();
}
});
} | java | public Observable<WorkflowInner> createOrUpdateAsync(String resourceGroupName, String workflowName, WorkflowInner workflow) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, workflowName, workflow).map(new Func1<ServiceResponse<WorkflowInner>, WorkflowInner>() {
@Override
public WorkflowInner call(ServiceResponse<WorkflowInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkflowInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
",",
"WorkflowInner",
"workflow",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"wor... | Creates or updates a workflow.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param workflow The workflow.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowInner object | [
"Creates",
"or",
"updates",
"a",
"workflow",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L721-L728 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java | MapFixture.setDoubleValueForIn | public void setDoubleValueForIn(double value, String name, Map<String, Object> map) {
setValueForIn(Double.valueOf(value), name, map);
} | java | public void setDoubleValueForIn(double value, String name, Map<String, Object> map) {
setValueForIn(Double.valueOf(value), name, map);
} | [
"public",
"void",
"setDoubleValueForIn",
"(",
"double",
"value",
",",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"setValueForIn",
"(",
"Double",
".",
"valueOf",
"(",
"value",
")",
",",
"name",
",",
"map",
")",
";"... | Stores double value in map.
@param value value to be passed.
@param name name to use this value for.
@param map map to store value in. | [
"Stores",
"double",
"value",
"in",
"map",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java#L65-L67 |
google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.compareStrings | protected static int compareStrings(int offset_1, int offset_2, ByteBuffer bb) {
offset_1 += bb.getInt(offset_1);
offset_2 += bb.getInt(offset_2);
int len_1 = bb.getInt(offset_1);
int len_2 = bb.getInt(offset_2);
int startPos_1 = offset_1 + SIZEOF_INT;
int startPos_2 = offset_2 + SIZEOF_INT;
int len = Math.min(len_1, len_2);
for(int i = 0; i < len; i++) {
if (bb.get(i + startPos_1) != bb.get(i + startPos_2))
return bb.get(i + startPos_1) - bb.get(i + startPos_2);
}
return len_1 - len_2;
} | java | protected static int compareStrings(int offset_1, int offset_2, ByteBuffer bb) {
offset_1 += bb.getInt(offset_1);
offset_2 += bb.getInt(offset_2);
int len_1 = bb.getInt(offset_1);
int len_2 = bb.getInt(offset_2);
int startPos_1 = offset_1 + SIZEOF_INT;
int startPos_2 = offset_2 + SIZEOF_INT;
int len = Math.min(len_1, len_2);
for(int i = 0; i < len; i++) {
if (bb.get(i + startPos_1) != bb.get(i + startPos_2))
return bb.get(i + startPos_1) - bb.get(i + startPos_2);
}
return len_1 - len_2;
} | [
"protected",
"static",
"int",
"compareStrings",
"(",
"int",
"offset_1",
",",
"int",
"offset_2",
",",
"ByteBuffer",
"bb",
")",
"{",
"offset_1",
"+=",
"bb",
".",
"getInt",
"(",
"offset_1",
")",
";",
"offset_2",
"+=",
"bb",
".",
"getInt",
"(",
"offset_2",
"... | Compare two strings in the buffer.
@param offset_1 An 'int' index of the first string into the bb.
@param offset_2 An 'int' index of the second string into the bb.
@param bb A {@code ByteBuffer} to get the strings. | [
"Compare",
"two",
"strings",
"in",
"the",
"buffer",
"."
] | train | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L231-L244 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java | CPInstancePersistenceImpl.fetchByUUID_G | @Override
public CPInstance fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | java | @Override
public CPInstance fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CPInstance",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the cp instance where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching cp instance, or <code>null</code> if a matching cp instance could not be found | [
"Returns",
"the",
"cp",
"instance",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"cache",
"."... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L698-L701 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java | IntegralImageOps.block_unsafe | public static double block_unsafe(GrayF64 integral , int x0 , int y0 , int x1 , int y1 )
{
return ImplIntegralImageOps.block_unsafe(integral,x0,y0,x1,y1);
} | java | public static double block_unsafe(GrayF64 integral , int x0 , int y0 , int x1 , int y1 )
{
return ImplIntegralImageOps.block_unsafe(integral,x0,y0,x1,y1);
} | [
"public",
"static",
"double",
"block_unsafe",
"(",
"GrayF64",
"integral",
",",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"x1",
",",
"int",
"y1",
")",
"{",
"return",
"ImplIntegralImageOps",
".",
"block_unsafe",
"(",
"integral",
",",
"x0",
",",
"y0",
",",... | <p>
Computes the value of a block inside an integral image without bounds checking. The block is
defined as follows: x0 < x ≤ x1 and y0 < y ≤ y1.
</p>
@param integral Integral image.
@param x0 Lower bound of the block. Exclusive.
@param y0 Lower bound of the block. Exclusive.
@param x1 Upper bound of the block. Inclusive.
@param y1 Upper bound of the block. Inclusive.
@return Value inside the block. | [
"<p",
">",
"Computes",
"the",
"value",
"of",
"a",
"block",
"inside",
"an",
"integral",
"image",
"without",
"bounds",
"checking",
".",
"The",
"block",
"is",
"defined",
"as",
"follows",
":",
"x0",
"<",
";",
"x",
"&le",
";",
"x1",
"and",
"y0",
"<",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L372-L375 |
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/internal/util/UrlUtil.java | UrlUtil.toUrl | public static URL toUrl(@Nonnull final File file) {
Check.notNull(file, "file");
URL url = null;
try {
url = file.toURI().toURL();
} catch (final MalformedURLException e) {
throw new IllegalStateException("Can not construct an URL for passed file.", e);
}
return url;
} | java | public static URL toUrl(@Nonnull final File file) {
Check.notNull(file, "file");
URL url = null;
try {
url = file.toURI().toURL();
} catch (final MalformedURLException e) {
throw new IllegalStateException("Can not construct an URL for passed file.", e);
}
return url;
} | [
"public",
"static",
"URL",
"toUrl",
"(",
"@",
"Nonnull",
"final",
"File",
"file",
")",
"{",
"Check",
".",
"notNull",
"(",
"file",
",",
"\"file\"",
")",
";",
"URL",
"url",
"=",
"null",
";",
"try",
"{",
"url",
"=",
"file",
".",
"toURI",
"(",
")",
"... | Gets the URL to a given {@code File}.
@param file
file to be converted to a URL
@return an URL to the passed file
@throws IllegalStateException
if no URL can be resolved to the given file | [
"Gets",
"the",
"URL",
"to",
"a",
"given",
"{",
"@code",
"File",
"}",
"."
] | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/internal/util/UrlUtil.java#L152-L162 |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java | PrimaveraReader.populateUserDefinedFieldValues | private void populateUserDefinedFieldValues(String tableName, FieldTypeClass type, FieldContainer container, Integer uniqueID)
{
Map<Integer, List<Row>> tableData = m_udfValues.get(tableName);
if (tableData != null)
{
List<Row> udf = tableData.get(uniqueID);
if (udf != null)
{
for (Row r : udf)
{
addUDFValue(type, container, r);
}
}
}
} | java | private void populateUserDefinedFieldValues(String tableName, FieldTypeClass type, FieldContainer container, Integer uniqueID)
{
Map<Integer, List<Row>> tableData = m_udfValues.get(tableName);
if (tableData != null)
{
List<Row> udf = tableData.get(uniqueID);
if (udf != null)
{
for (Row r : udf)
{
addUDFValue(type, container, r);
}
}
}
} | [
"private",
"void",
"populateUserDefinedFieldValues",
"(",
"String",
"tableName",
",",
"FieldTypeClass",
"type",
",",
"FieldContainer",
"container",
",",
"Integer",
"uniqueID",
")",
"{",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"tableData",
"=",
... | Populate the UDF values for this entity.
@param tableName parent table name
@param type entity type
@param container entity
@param uniqueID entity Unique ID | [
"Populate",
"the",
"UDF",
"values",
"for",
"this",
"entity",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L951-L965 |
jmeter-maven-plugin/jmeter-maven-plugin | src/main/java/com/lazerycode/jmeter/mojo/ConfigureJMeterMojo.java | ConfigureJMeterMojo.copyExplicitLibraries | private void copyExplicitLibraries(List<String> desiredArtifacts, File destination, boolean downloadDependencies) throws MojoExecutionException {
for (String desiredArtifact : desiredArtifacts) {
copyExplicitLibrary(desiredArtifact, destination, downloadDependencies);
}
} | java | private void copyExplicitLibraries(List<String> desiredArtifacts, File destination, boolean downloadDependencies) throws MojoExecutionException {
for (String desiredArtifact : desiredArtifacts) {
copyExplicitLibrary(desiredArtifact, destination, downloadDependencies);
}
} | [
"private",
"void",
"copyExplicitLibraries",
"(",
"List",
"<",
"String",
">",
"desiredArtifacts",
",",
"File",
"destination",
",",
"boolean",
"downloadDependencies",
")",
"throws",
"MojoExecutionException",
"{",
"for",
"(",
"String",
"desiredArtifact",
":",
"desiredArt... | Copy a list of libraries to a specific folder.
@param desiredArtifacts A list of artifacts
@param destination A destination folder to copy these artifacts to
@param downloadDependencies Do we download dependencies
@throws MojoExecutionException MojoExecutionException | [
"Copy",
"a",
"list",
"of",
"libraries",
"to",
"a",
"specific",
"folder",
"."
] | train | https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/mojo/ConfigureJMeterMojo.java#L464-L468 |
square/dagger | core/src/main/java/dagger/internal/Keys.java | Keys.getSetKey | public static String getSetKey(Type type, Annotation[] annotations, Object subject) {
Annotation qualifier = extractQualifier(annotations, subject);
type = boxIfPrimitive(type);
StringBuilder result = new StringBuilder();
if (qualifier != null) {
result.append(qualifier).append("/");
}
result.append(SET_PREFIX);
typeToString(type, result, true);
result.append(">");
return result.toString();
} | java | public static String getSetKey(Type type, Annotation[] annotations, Object subject) {
Annotation qualifier = extractQualifier(annotations, subject);
type = boxIfPrimitive(type);
StringBuilder result = new StringBuilder();
if (qualifier != null) {
result.append(qualifier).append("/");
}
result.append(SET_PREFIX);
typeToString(type, result, true);
result.append(">");
return result.toString();
} | [
"public",
"static",
"String",
"getSetKey",
"(",
"Type",
"type",
",",
"Annotation",
"[",
"]",
"annotations",
",",
"Object",
"subject",
")",
"{",
"Annotation",
"qualifier",
"=",
"extractQualifier",
"(",
"annotations",
",",
"subject",
")",
";",
"type",
"=",
"bo... | Returns a key for {@code type} annotated with {@code annotations},
wrapped by {@code Set}, reporting failures against {@code subject}.
@param annotations the annotations on a single method, field or parameter.
This array may contain at most one qualifier annotation. | [
"Returns",
"a",
"key",
"for",
"{",
"@code",
"type",
"}",
"annotated",
"with",
"{",
"@code",
"annotations",
"}",
"wrapped",
"by",
"{",
"@code",
"Set",
"}",
"reporting",
"failures",
"against",
"{",
"@code",
"subject",
"}",
"."
] | train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/core/src/main/java/dagger/internal/Keys.java#L91-L102 |
xwiki/xwiki-rendering | xwiki-rendering-api/src/main/java/org/xwiki/rendering/util/IdGenerator.java | IdGenerator.generateUniqueId | public String generateUniqueId(String prefix, String text)
{
// Verify that the passed prefix contains only alpha characters since the generated id must be a valid HTML id.
if (StringUtils.isEmpty(prefix) || !StringUtils.isAlpha(prefix)) {
throw new IllegalArgumentException(
"The prefix [" + prefix + "] should only contain alphanumerical characters and not be empty.");
}
String idPrefix = prefix + normalizeId(text);
int occurence = 0;
String id = idPrefix;
while (this.generatedIds.contains(id)) {
occurence++;
id = idPrefix + "-" + occurence;
}
// Save the generated id so that the next call to this method will not generate the same id.
this.generatedIds.add(id);
return id;
} | java | public String generateUniqueId(String prefix, String text)
{
// Verify that the passed prefix contains only alpha characters since the generated id must be a valid HTML id.
if (StringUtils.isEmpty(prefix) || !StringUtils.isAlpha(prefix)) {
throw new IllegalArgumentException(
"The prefix [" + prefix + "] should only contain alphanumerical characters and not be empty.");
}
String idPrefix = prefix + normalizeId(text);
int occurence = 0;
String id = idPrefix;
while (this.generatedIds.contains(id)) {
occurence++;
id = idPrefix + "-" + occurence;
}
// Save the generated id so that the next call to this method will not generate the same id.
this.generatedIds.add(id);
return id;
} | [
"public",
"String",
"generateUniqueId",
"(",
"String",
"prefix",
",",
"String",
"text",
")",
"{",
"// Verify that the passed prefix contains only alpha characters since the generated id must be a valid HTML id.",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"prefix",
")",
"... | Generate a unique id attribute using the passed text as the seed value. The generated id complies with the XHTML
specification. Extract from <a href="http://www.w3.org/TR/xhtml1/#C_8">XHTML RFC</a>:
<p>
<code> When defining fragment identifiers to be backward-compatible, only strings matching the pattern
[A-Za-z][A-Za-z0-9:_.-]* should be used.</code>
</p>
@param prefix the prefix of the identifier. Has to match [a-zA-Z].
@param text the text used to generate the unique id
@return the unique id. For example "Hello world" will generate prefix + "Helloworld". | [
"Generate",
"a",
"unique",
"id",
"attribute",
"using",
"the",
"passed",
"text",
"as",
"the",
"seed",
"value",
".",
"The",
"generated",
"id",
"complies",
"with",
"the",
"XHTML",
"specification",
".",
"Extract",
"from",
"<a",
"href",
"=",
"http",
":",
"//",
... | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-api/src/main/java/org/xwiki/rendering/util/IdGenerator.java#L117-L138 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java | MapMessage.put | public void put(final String key, final String value) {
if (value == null) {
throw new IllegalArgumentException("No value provided for key " + key);
}
validate(key, value);
data.putValue(key, value);
} | java | public void put(final String key, final String value) {
if (value == null) {
throw new IllegalArgumentException("No value provided for key " + key);
}
validate(key, value);
data.putValue(key, value);
} | [
"public",
"void",
"put",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No value provided for key \"",
"+",
"key",
")",
";",
"}",
"va... | Adds an item to the data Map.
@param key The name of the data item.
@param value The value of the data item. | [
"Adds",
"an",
"item",
"to",
"the",
"data",
"Map",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java#L190-L196 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/evaluation/DefaultXPathEvaluator.java | DefaultXPathEvaluator.asInt | @Override
public int asInt() {
final Class<?> callerClass = ReflectionHelper.getDirectCallerClass();
return evaluateSingeValue(Integer.TYPE, callerClass);
} | java | @Override
public int asInt() {
final Class<?> callerClass = ReflectionHelper.getDirectCallerClass();
return evaluateSingeValue(Integer.TYPE, callerClass);
} | [
"@",
"Override",
"public",
"int",
"asInt",
"(",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"callerClass",
"=",
"ReflectionHelper",
".",
"getDirectCallerClass",
"(",
")",
";",
"return",
"evaluateSingeValue",
"(",
"Integer",
".",
"TYPE",
",",
"callerClass",
")... | Evaluates the XPath as a int value. This method is just a shortcut for as(Integer.TYPE);
@return int value of evaluation result. | [
"Evaluates",
"the",
"XPath",
"as",
"a",
"int",
"value",
".",
"This",
"method",
"is",
"just",
"a",
"shortcut",
"for",
"as",
"(",
"Integer",
".",
"TYPE",
")",
";"
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/evaluation/DefaultXPathEvaluator.java#L91-L95 |
scalanlp/breeze | math/src/main/java/breeze/linalg/operators/DenseVectorSupportMethods.java | DenseVectorSupportMethods.smallDotProduct_Float | public static float smallDotProduct_Float(float[] a, float[] b, int length) {
float sumA = 0.0f;
float sumB = 0.0f;
switch (length) {
case 7:
sumA = a[6] * b[6];
case 6:
sumB = a[5] * b[5];
case 5:
sumA += a[4] * b[4];
case 4:
sumB += a[3] * b[3];
case 3:
sumA += a[2] * b[2];
case 2:
sumB += a[1] * b[1];
case 1:
sumA += a[0] * b[0];
case 0:
default:
return sumA + sumB;
}
} | java | public static float smallDotProduct_Float(float[] a, float[] b, int length) {
float sumA = 0.0f;
float sumB = 0.0f;
switch (length) {
case 7:
sumA = a[6] * b[6];
case 6:
sumB = a[5] * b[5];
case 5:
sumA += a[4] * b[4];
case 4:
sumB += a[3] * b[3];
case 3:
sumA += a[2] * b[2];
case 2:
sumB += a[1] * b[1];
case 1:
sumA += a[0] * b[0];
case 0:
default:
return sumA + sumB;
}
} | [
"public",
"static",
"float",
"smallDotProduct_Float",
"(",
"float",
"[",
"]",
"a",
",",
"float",
"[",
"]",
"b",
",",
"int",
"length",
")",
"{",
"float",
"sumA",
"=",
"0.0f",
";",
"float",
"sumB",
"=",
"0.0f",
";",
"switch",
"(",
"length",
")",
"{",
... | WARNING: only returns the right answer for vectors of length < MAX_SMALL_DOT_PRODUCT_LENGTH
@param a
@param b
@param length
@return | [
"WARNING",
":",
"only",
"returns",
"the",
"right",
"answer",
"for",
"vectors",
"of",
"length",
"<",
"MAX_SMALL_DOT_PRODUCT_LENGTH"
] | train | https://github.com/scalanlp/breeze/blob/aeb3360ce77d79490fe48bc5fe2bb40f18289908/math/src/main/java/breeze/linalg/operators/DenseVectorSupportMethods.java#L85-L107 |
paymill/paymill-java | src/main/java/com/paymill/services/SubscriptionService.java | SubscriptionService.changeAmount | public Subscription changeAmount( String subscriptionId, Integer amount ) {
return this.changeAmount( new Subscription( subscriptionId ), amount );
} | java | public Subscription changeAmount( String subscriptionId, Integer amount ) {
return this.changeAmount( new Subscription( subscriptionId ), amount );
} | [
"public",
"Subscription",
"changeAmount",
"(",
"String",
"subscriptionId",
",",
"Integer",
"amount",
")",
"{",
"return",
"this",
".",
"changeAmount",
"(",
"new",
"Subscription",
"(",
"subscriptionId",
")",
",",
"amount",
")",
";",
"}"
] | Changes the amount of a subscription.<br>
<br>
The new amount is valid until the end of the subscription. If you want to set a temporary one-time amount use
{@link SubscriptionService#changeAmountTemporary(String, Integer)}
@param subscriptionId
the Id of the subscription.
@param amount
the new amount.
@return the updated subscription. | [
"Changes",
"the",
"amount",
"of",
"a",
"subscription",
".",
"<br",
">",
"<br",
">",
"The",
"new",
"amount",
"is",
"valid",
"until",
"the",
"end",
"of",
"the",
"subscription",
".",
"If",
"you",
"want",
"to",
"set",
"a",
"temporary",
"one",
"-",
"time",
... | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/SubscriptionService.java#L289-L291 |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java | SoapClient.create | public static SoapClient create(String url, SoapProtocol protocol, String namespaceURI) {
return new SoapClient(url, protocol, namespaceURI);
} | java | public static SoapClient create(String url, SoapProtocol protocol, String namespaceURI) {
return new SoapClient(url, protocol, namespaceURI);
} | [
"public",
"static",
"SoapClient",
"create",
"(",
"String",
"url",
",",
"SoapProtocol",
"protocol",
",",
"String",
"namespaceURI",
")",
"{",
"return",
"new",
"SoapClient",
"(",
"url",
",",
"protocol",
",",
"namespaceURI",
")",
";",
"}"
] | 创建SOAP客户端
@param url WS的URL地址
@param protocol 协议,见{@link SoapProtocol}
@param namespaceURI 方法上的命名空间URI
@return {@link SoapClient}
@since 4.5.6 | [
"创建SOAP客户端"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L85-L87 |
haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTImageReader.java | PICTImageReader.readPoly | private Polygon readPoly(DataInput pStream, Rectangle pBounds) throws IOException {
// Get polygon data size
int size = pStream.readUnsignedShort();
// Get poly bounds
readRectangle(pStream, pBounds);
// Initialize the point array to the right size
int points = (size - 10) / 4;
// Get the rest of the polygon points
Polygon polygon = new Polygon();
for (int i = 0; i < points; i++) {
int y = getYPtCoord(pStream.readShort());
int x = getXPtCoord(pStream.readShort());
polygon.addPoint(x, y);
}
if (!pBounds.contains(polygon.getBounds())) {
processWarningOccurred("Bad poly, contains point(s) out of bounds " + pBounds + ": " + polygon);
}
return polygon;
} | java | private Polygon readPoly(DataInput pStream, Rectangle pBounds) throws IOException {
// Get polygon data size
int size = pStream.readUnsignedShort();
// Get poly bounds
readRectangle(pStream, pBounds);
// Initialize the point array to the right size
int points = (size - 10) / 4;
// Get the rest of the polygon points
Polygon polygon = new Polygon();
for (int i = 0; i < points; i++) {
int y = getYPtCoord(pStream.readShort());
int x = getXPtCoord(pStream.readShort());
polygon.addPoint(x, y);
}
if (!pBounds.contains(polygon.getBounds())) {
processWarningOccurred("Bad poly, contains point(s) out of bounds " + pBounds + ": " + polygon);
}
return polygon;
} | [
"private",
"Polygon",
"readPoly",
"(",
"DataInput",
"pStream",
",",
"Rectangle",
"pBounds",
")",
"throws",
"IOException",
"{",
"// Get polygon data size",
"int",
"size",
"=",
"pStream",
".",
"readUnsignedShort",
"(",
")",
";",
"// Get poly bounds",
"readRectangle",
... | Read in a polygon. The input stream should be positioned at the first byte
of the polygon.
@param pStream the stream to read from
@param pBounds the bounds rectangle to read into
@return the polygon
@throws IOException if an I/O error occurs while reading the image. | [
"Read",
"in",
"a",
"polygon",
".",
"The",
"input",
"stream",
"should",
"be",
"positioned",
"at",
"the",
"first",
"byte",
"of",
"the",
"polygon",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTImageReader.java#L2452-L2476 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.