id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
162,600 | klarna/HiveRunner | src/main/java/com/klarna/hiverunner/StandaloneHiveRunner.java | StandaloneHiveRunner.evaluateStatement | public HiveShellContainer evaluateStatement(List<? extends Script> scripts, Object target, TemporaryFolder temporaryFolder, Statement base) throws Throwable {
container = null;
FileUtil.setPermission(temporaryFolder.getRoot(), FsPermission.getDirDefault());
try {
LOGGER.info("Setting... | java | public HiveShellContainer evaluateStatement(List<? extends Script> scripts, Object target, TemporaryFolder temporaryFolder, Statement base) throws Throwable {
container = null;
FileUtil.setPermission(temporaryFolder.getRoot(), FsPermission.getDirDefault());
try {
LOGGER.info("Setting... | [
"public",
"HiveShellContainer",
"evaluateStatement",
"(",
"List",
"<",
"?",
"extends",
"Script",
">",
"scripts",
",",
"Object",
"target",
",",
"TemporaryFolder",
"temporaryFolder",
",",
"Statement",
"base",
")",
"throws",
"Throwable",
"{",
"container",
"=",
"null"... | Drives the unit test. | [
"Drives",
"the",
"unit",
"test",
"."
] | c8899237db6122127f16e3d8a740c1f8657c2ae3 | https://github.com/klarna/HiveRunner/blob/c8899237db6122127f16e3d8a740c1f8657c2ae3/src/main/java/com/klarna/hiverunner/StandaloneHiveRunner.java#L160-L171 |
162,601 | klarna/HiveRunner | src/main/java/com/klarna/hiverunner/StandaloneHiveRunner.java | StandaloneHiveRunner.createHiveServerContainer | private HiveShellContainer createHiveServerContainer(final List<? extends Script> scripts, final Object testCase, TemporaryFolder baseDir)
throws IOException {
HiveServerContext context = new StandaloneHiveServerContext(baseDir, config);
final HiveServerContainer hiveTestHarness = new HiveSer... | java | private HiveShellContainer createHiveServerContainer(final List<? extends Script> scripts, final Object testCase, TemporaryFolder baseDir)
throws IOException {
HiveServerContext context = new StandaloneHiveServerContext(baseDir, config);
final HiveServerContainer hiveTestHarness = new HiveSer... | [
"private",
"HiveShellContainer",
"createHiveServerContainer",
"(",
"final",
"List",
"<",
"?",
"extends",
"Script",
">",
"scripts",
",",
"final",
"Object",
"testCase",
",",
"TemporaryFolder",
"baseDir",
")",
"throws",
"IOException",
"{",
"HiveServerContext",
"context",... | Traverses the test case annotations. Will inject a HiveShell in the test case that envelopes the HiveServer. | [
"Traverses",
"the",
"test",
"case",
"annotations",
".",
"Will",
"inject",
"a",
"HiveShell",
"in",
"the",
"test",
"case",
"that",
"envelopes",
"the",
"HiveServer",
"."
] | c8899237db6122127f16e3d8a740c1f8657c2ae3 | https://github.com/klarna/HiveRunner/blob/c8899237db6122127f16e3d8a740c1f8657c2ae3/src/main/java/com/klarna/hiverunner/StandaloneHiveRunner.java#L187-L221 |
162,602 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java | CommandFactory.newInsert | public static Command newInsert(Object object,
String outIdentifier) {
return getCommandFactoryProvider().newInsert( object,
outIdentifier );
} | java | public static Command newInsert(Object object,
String outIdentifier) {
return getCommandFactoryProvider().newInsert( object,
outIdentifier );
} | [
"public",
"static",
"Command",
"newInsert",
"(",
"Object",
"object",
",",
"String",
"outIdentifier",
")",
"{",
"return",
"getCommandFactoryProvider",
"(",
")",
".",
"newInsert",
"(",
"object",
",",
"outIdentifier",
")",
";",
"}"
] | Inserts a new instance but references via the outIdentifier, which is returned as part of the ExecutionResults
@param object
@param outIdentifier
@return | [
"Inserts",
"a",
"new",
"instance",
"but",
"references",
"via",
"the",
"outIdentifier",
"which",
"is",
"returned",
"as",
"part",
"of",
"the",
"ExecutionResults"
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java#L69-L73 |
162,603 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java | CommandFactory.newInsert | public static Command newInsert(Object object,
String outIdentifier,
boolean returnObject,
String entryPoint ) {
return getCommandFactoryProvider().newInsert( object,
... | java | public static Command newInsert(Object object,
String outIdentifier,
boolean returnObject,
String entryPoint ) {
return getCommandFactoryProvider().newInsert( object,
... | [
"public",
"static",
"Command",
"newInsert",
"(",
"Object",
"object",
",",
"String",
"outIdentifier",
",",
"boolean",
"returnObject",
",",
"String",
"entryPoint",
")",
"{",
"return",
"getCommandFactoryProvider",
"(",
")",
".",
"newInsert",
"(",
"object",
",",
"ou... | Inserts a new instance but references via the outIdentifier, which is returned as part of the ExecutionResults
The outIdentifier can be null.
The entryPoint, which can also be null, specifies the entrypoint the object is inserted into.
@param object
@param outIdentifier
@param entryPoint
@return | [
"Inserts",
"a",
"new",
"instance",
"but",
"references",
"via",
"the",
"outIdentifier",
"which",
"is",
"returned",
"as",
"part",
"of",
"the",
"ExecutionResults",
"The",
"outIdentifier",
"can",
"be",
"null",
".",
"The",
"entryPoint",
"which",
"can",
"also",
"be"... | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java#L85-L93 |
162,604 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java | CommandFactory.newInsertElements | public static Command newInsertElements(Collection objects, String outIdentifier, boolean returnObject, String entryPoint) {
return getCommandFactoryProvider().newInsertElements( objects, outIdentifier, returnObject, entryPoint );
} | java | public static Command newInsertElements(Collection objects, String outIdentifier, boolean returnObject, String entryPoint) {
return getCommandFactoryProvider().newInsertElements( objects, outIdentifier, returnObject, entryPoint );
} | [
"public",
"static",
"Command",
"newInsertElements",
"(",
"Collection",
"objects",
",",
"String",
"outIdentifier",
",",
"boolean",
"returnObject",
",",
"String",
"entryPoint",
")",
"{",
"return",
"getCommandFactoryProvider",
"(",
")",
".",
"newInsertElements",
"(",
"... | Iterate and insert each of the elements of the Collection.
@param objects
The objects to insert
@param outIdentifier
Identifier to lookup the returned objects
@param returnObject
boolean to specify whether the inserted Collection is part of the ExecutionResults
@param entryPoint
Optional EntryPoint for the insertions
... | [
"Iterate",
"and",
"insert",
"each",
"of",
"the",
"elements",
"of",
"the",
"Collection",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java#L120-L122 |
162,605 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java | CommandFactory.newSetGlobal | public static Command newSetGlobal(String identifier,
Object object) {
return getCommandFactoryProvider().newSetGlobal( identifier,
object );
} | java | public static Command newSetGlobal(String identifier,
Object object) {
return getCommandFactoryProvider().newSetGlobal( identifier,
object );
} | [
"public",
"static",
"Command",
"newSetGlobal",
"(",
"String",
"identifier",
",",
"Object",
"object",
")",
"{",
"return",
"getCommandFactoryProvider",
"(",
")",
".",
"newSetGlobal",
"(",
"identifier",
",",
"object",
")",
";",
"}"
] | Sets the global. Does not add the global to the ExecutionResults.
@param identifier
The identifier of the global
@param object
The instance to be set as the global.
@return | [
"Sets",
"the",
"global",
".",
"Does",
"not",
"add",
"the",
"global",
"to",
"the",
"ExecutionResults",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java#L185-L189 |
162,606 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java | CommandFactory.newGetGlobal | public static Command newGetGlobal(String identifier,
String outIdentifier) {
return getCommandFactoryProvider().newGetGlobal( identifier,
outIdentifier );
} | java | public static Command newGetGlobal(String identifier,
String outIdentifier) {
return getCommandFactoryProvider().newGetGlobal( identifier,
outIdentifier );
} | [
"public",
"static",
"Command",
"newGetGlobal",
"(",
"String",
"identifier",
",",
"String",
"outIdentifier",
")",
"{",
"return",
"getCommandFactoryProvider",
"(",
")",
".",
"newGetGlobal",
"(",
"identifier",
",",
"outIdentifier",
")",
";",
"}"
] | Gets the global and adds it ot the BatchExecutionresults using the alternative outIdentifier.
@param identifier
The identifier of the global
@param outIdentifier
The identifier used in the ExecutionResults to store the global.
@return | [
"Gets",
"the",
"global",
"and",
"adds",
"it",
"ot",
"the",
"BatchExecutionresults",
"using",
"the",
"alternative",
"outIdentifier",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java#L248-L252 |
162,607 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java | CommandFactory.newStartProcess | public static Command newStartProcess(String processId,
Map<String, Object> parameters) {
return getCommandFactoryProvider().newStartProcess( processId,
parameters );
} | java | public static Command newStartProcess(String processId,
Map<String, Object> parameters) {
return getCommandFactoryProvider().newStartProcess( processId,
parameters );
} | [
"public",
"static",
"Command",
"newStartProcess",
"(",
"String",
"processId",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"return",
"getCommandFactoryProvider",
"(",
")",
".",
"newStartProcess",
"(",
"processId",
",",
"parameters",
")"... | Start a process using the given parameters.
@param processId
@param parameters
@return | [
"Start",
"a",
"process",
"using",
"the",
"given",
"parameters",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java#L283-L287 |
162,608 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java | CommandFactory.newQuery | public static Command newQuery(String identifier,
String name) {
return getCommandFactoryProvider().newQuery( identifier,
name );
} | java | public static Command newQuery(String identifier,
String name) {
return getCommandFactoryProvider().newQuery( identifier,
name );
} | [
"public",
"static",
"Command",
"newQuery",
"(",
"String",
"identifier",
",",
"String",
"name",
")",
"{",
"return",
"getCommandFactoryProvider",
"(",
")",
".",
"newQuery",
"(",
"identifier",
",",
"name",
")",
";",
"}"
] | Executes a query. The query results will be added to the ExecutionResults using the
given identifier.
@param identifier
The identifier to be used for the results when added to the ExecutionResults
@param name
The name of the query to execute
@return | [
"Executes",
"a",
"query",
".",
"The",
"query",
"results",
"will",
"be",
"added",
"to",
"the",
"ExecutionResults",
"using",
"the",
"given",
"identifier",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java#L329-L334 |
162,609 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java | CommandFactory.newQuery | public static Command newQuery(String identifier,
String name,
Object[] arguments) {
return getCommandFactoryProvider().newQuery( identifier,
name,
... | java | public static Command newQuery(String identifier,
String name,
Object[] arguments) {
return getCommandFactoryProvider().newQuery( identifier,
name,
... | [
"public",
"static",
"Command",
"newQuery",
"(",
"String",
"identifier",
",",
"String",
"name",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"return",
"getCommandFactoryProvider",
"(",
")",
".",
"newQuery",
"(",
"identifier",
",",
"name",
",",
"arguments",
... | Executes a query using the given parameters. The query results will be added to the
ExecutionResults using the given identifier.
@param identifier
The identifier to be used for the results when added to the ExecutionResults
@param name
The name of the query to execute
@param arguments
The arguments to be used for the ... | [
"Executes",
"a",
"query",
"using",
"the",
"given",
"parameters",
".",
"The",
"query",
"results",
"will",
"be",
"added",
"to",
"the",
"ExecutionResults",
"using",
"the",
"given",
"identifier",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java#L348-L354 |
162,610 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/builder/KnowledgeBuilderFactory.java | KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration | public static KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration(Properties properties,
ClassLoader... classLoaders) {
return FactoryServiceHolder.factoryService.newKnowledgeBuilderConfiguration( properties, classLoader... | java | public static KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration(Properties properties,
ClassLoader... classLoaders) {
return FactoryServiceHolder.factoryService.newKnowledgeBuilderConfiguration( properties, classLoader... | [
"public",
"static",
"KnowledgeBuilderConfiguration",
"newKnowledgeBuilderConfiguration",
"(",
"Properties",
"properties",
",",
"ClassLoader",
"...",
"classLoaders",
")",
"{",
"return",
"FactoryServiceHolder",
".",
"factoryService",
".",
"newKnowledgeBuilderConfiguration",
"(",
... | Create a KnowledgeBuilderConfiguration on which properties can be set. Use
the given properties file and ClassLoader - either of which can be null.
@return
The KnowledgeBuilderConfiguration. | [
"Create",
"a",
"KnowledgeBuilderConfiguration",
"on",
"which",
"properties",
"can",
"be",
"set",
".",
"Use",
"the",
"given",
"properties",
"file",
"and",
"ClassLoader",
"-",
"either",
"of",
"which",
"can",
"be",
"null",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/builder/KnowledgeBuilderFactory.java#L84-L87 |
162,611 | kiegroup/droolsjbpm-knowledge | kie-api/src/main/java/org/kie/api/internal/utils/OSGiLocator.java | OSGiLocator.unregister | public static synchronized void unregister(final String serviceName,
final Callable<Class< ? >> factory) {
if ( serviceName == null ) {
throw new IllegalArgumentException( "serviceName cannot be null" );
}
if ( factories != null ) {
... | java | public static synchronized void unregister(final String serviceName,
final Callable<Class< ? >> factory) {
if ( serviceName == null ) {
throw new IllegalArgumentException( "serviceName cannot be null" );
}
if ( factories != null ) {
... | [
"public",
"static",
"synchronized",
"void",
"unregister",
"(",
"final",
"String",
"serviceName",
",",
"final",
"Callable",
"<",
"Class",
"<",
"?",
">",
">",
"factory",
")",
"{",
"if",
"(",
"serviceName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgu... | Removes the given service provider factory from the set of
providers for the service.
@param serviceName
The fully qualified name of the service interface.
@param factory
A factory for creating a specific type of service
provider. May be <tt>null</tt> in which case this
method does nothing.
@throws IllegalArgumentExce... | [
"Removes",
"the",
"given",
"service",
"provider",
"factory",
"from",
"the",
"set",
"of",
"providers",
"for",
"the",
"service",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-api/src/main/java/org/kie/api/internal/utils/OSGiLocator.java#L68-L79 |
162,612 | kiegroup/droolsjbpm-knowledge | kie-api/src/main/java/org/kie/api/internal/utils/OSGiLocator.java | OSGiLocator.register | public static synchronized void register(final String serviceName,
final Callable<Class< ? >> factory) {
if ( serviceName == null ) {
throw new IllegalArgumentException( "serviceName cannot be null" );
}
if ( factory != null ) {
... | java | public static synchronized void register(final String serviceName,
final Callable<Class< ? >> factory) {
if ( serviceName == null ) {
throw new IllegalArgumentException( "serviceName cannot be null" );
}
if ( factory != null ) {
... | [
"public",
"static",
"synchronized",
"void",
"register",
"(",
"final",
"String",
"serviceName",
",",
"final",
"Callable",
"<",
"Class",
"<",
"?",
">",
">",
"factory",
")",
"{",
"if",
"(",
"serviceName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgume... | Adds the given service provider factory to the set of
providers for the service.
@param serviceName
The fully qualified name of the service interface.
@param factory
A factory for creating a specific type of service
provider. May be <tt>null</tt> in which case this
method does nothing.
@throws IllegalArgumentException... | [
"Adds",
"the",
"given",
"service",
"provider",
"factory",
"to",
"the",
"set",
"of",
"providers",
"for",
"the",
"service",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-api/src/main/java/org/kie/api/internal/utils/OSGiLocator.java#L93-L110 |
162,613 | kiegroup/droolsjbpm-knowledge | kie-api/src/main/java/org/kie/api/internal/utils/OSGiLocator.java | OSGiLocator.locate | public static synchronized Class< ? > locate(final String serviceName) {
if ( serviceName == null ) {
throw new IllegalArgumentException( "serviceName cannot be null" );
}
if ( factories != null ) {
List<Callable<Class< ? >>> l = factories.get( serviceName );
... | java | public static synchronized Class< ? > locate(final String serviceName) {
if ( serviceName == null ) {
throw new IllegalArgumentException( "serviceName cannot be null" );
}
if ( factories != null ) {
List<Callable<Class< ? >>> l = factories.get( serviceName );
... | [
"public",
"static",
"synchronized",
"Class",
"<",
"?",
">",
"locate",
"(",
"final",
"String",
"serviceName",
")",
"{",
"if",
"(",
"serviceName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"serviceName cannot be null\"",
")",
";",
... | Finds the preferred provider for the given service. The preferred
provider is the last one added to the set of providers.
@param serviceName
The fully qualified name of the service interface.
@return
The last provider added for the service if any exists.
Otherwise, it returns <tt>null</tt>.
@throws IllegalArgumentExce... | [
"Finds",
"the",
"preferred",
"provider",
"for",
"the",
"given",
"service",
".",
"The",
"preferred",
"provider",
"is",
"the",
"last",
"one",
"added",
"to",
"the",
"set",
"of",
"providers",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-api/src/main/java/org/kie/api/internal/utils/OSGiLocator.java#L123-L138 |
162,614 | kiegroup/droolsjbpm-knowledge | kie-api/src/main/java/org/kie/api/internal/utils/OSGiLocator.java | OSGiLocator.locateAll | public static synchronized List<Class< ? >> locateAll(final String serviceName) {
if ( serviceName == null ) {
throw new IllegalArgumentException( "serviceName cannot be null" );
}
List<Class< ? >> classes = new ArrayList<Class< ? >>();
if ( factories != null ) {
... | java | public static synchronized List<Class< ? >> locateAll(final String serviceName) {
if ( serviceName == null ) {
throw new IllegalArgumentException( "serviceName cannot be null" );
}
List<Class< ? >> classes = new ArrayList<Class< ? >>();
if ( factories != null ) {
... | [
"public",
"static",
"synchronized",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"locateAll",
"(",
"final",
"String",
"serviceName",
")",
"{",
"if",
"(",
"serviceName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"serviceName cannot... | Finds all providers for the given service.
@param serviceName
The fully qualified name of the service interface.
@return
The ordered set of providers for the service if any exists.
Otherwise, it returns an empty list.
@throws IllegalArgumentException if serviceName is <tt>null</tt> | [
"Finds",
"all",
"providers",
"for",
"the",
"given",
"service",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-api/src/main/java/org/kie/api/internal/utils/OSGiLocator.java#L150-L167 |
162,615 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/logger/KnowledgeRuntimeLoggerFactory.java | KnowledgeRuntimeLoggerFactory.newFileLogger | public static KieRuntimeLogger newFileLogger(KieRuntimeEventManager session,
String fileName) {
return getKnowledgeRuntimeLoggerProvider().newFileLogger( session,
fileName );
} | java | public static KieRuntimeLogger newFileLogger(KieRuntimeEventManager session,
String fileName) {
return getKnowledgeRuntimeLoggerProvider().newFileLogger( session,
fileName );
} | [
"public",
"static",
"KieRuntimeLogger",
"newFileLogger",
"(",
"KieRuntimeEventManager",
"session",
",",
"String",
"fileName",
")",
"{",
"return",
"getKnowledgeRuntimeLoggerProvider",
"(",
")",
".",
"newFileLogger",
"(",
"session",
",",
"fileName",
")",
";",
"}"
] | Creates a file logger in the current thread. The file is in XML format, suitable for interpretation by Eclipse's Drools Audit View
or other tools. Note that while events are written as they happen, the file will not be flushed until it is closed or the underlying
file buffer is filled. If you need real time logging the... | [
"Creates",
"a",
"file",
"logger",
"in",
"the",
"current",
"thread",
".",
"The",
"file",
"is",
"in",
"XML",
"format",
"suitable",
"for",
"interpretation",
"by",
"Eclipse",
"s",
"Drools",
"Audit",
"View",
"or",
"other",
"tools",
".",
"Note",
"that",
"while",... | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/logger/KnowledgeRuntimeLoggerFactory.java#L52-L56 |
162,616 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/runtime/manager/deploy/DeploymentDescriptorIO.java | DeploymentDescriptorIO.toXml | public static String toXml(DeploymentDescriptor descriptor) {
try {
Marshaller marshaller = getContext().createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "http://www.jboss.org/... | java | public static String toXml(DeploymentDescriptor descriptor) {
try {
Marshaller marshaller = getContext().createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "http://www.jboss.org/... | [
"public",
"static",
"String",
"toXml",
"(",
"DeploymentDescriptor",
"descriptor",
")",
"{",
"try",
"{",
"Marshaller",
"marshaller",
"=",
"getContext",
"(",
")",
".",
"createMarshaller",
"(",
")",
";",
"marshaller",
".",
"setProperty",
"(",
"Marshaller",
".",
"... | Serializes descriptor instance to XML
@param descriptor descriptor to be serialized
@return xml representation of descriptor as string | [
"Serializes",
"descriptor",
"instance",
"to",
"XML"
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/runtime/manager/deploy/DeploymentDescriptorIO.java#L68-L87 |
162,617 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/runtime/conf/ObjectModelResolverProvider.java | ObjectModelResolverProvider.getResolvers | public static List<ObjectModelResolver> getResolvers() {
if (resolvers == null) {
synchronized (serviceLoader) {
if (resolvers == null) {
List<ObjectModelResolver> foundResolvers = new ArrayList<ObjectModelResolver>();
for (ObjectModelResolver ... | java | public static List<ObjectModelResolver> getResolvers() {
if (resolvers == null) {
synchronized (serviceLoader) {
if (resolvers == null) {
List<ObjectModelResolver> foundResolvers = new ArrayList<ObjectModelResolver>();
for (ObjectModelResolver ... | [
"public",
"static",
"List",
"<",
"ObjectModelResolver",
">",
"getResolvers",
"(",
")",
"{",
"if",
"(",
"resolvers",
"==",
"null",
")",
"{",
"synchronized",
"(",
"serviceLoader",
")",
"{",
"if",
"(",
"resolvers",
"==",
"null",
")",
"{",
"List",
"<",
"Obje... | Returns all found resolvers
@return | [
"Returns",
"all",
"found",
"resolvers"
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/runtime/conf/ObjectModelResolverProvider.java#L36-L50 |
162,618 | kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/runtime/conf/ObjectModelResolverProvider.java | ObjectModelResolverProvider.get | public static ObjectModelResolver get(String resolverId) {
List<ObjectModelResolver> resolvers = getResolvers();
for (ObjectModelResolver resolver : resolvers) {
if (resolver.accept(resolverId)) {
return resolver;
}
}
return null;
} | java | public static ObjectModelResolver get(String resolverId) {
List<ObjectModelResolver> resolvers = getResolvers();
for (ObjectModelResolver resolver : resolvers) {
if (resolver.accept(resolverId)) {
return resolver;
}
}
return null;
} | [
"public",
"static",
"ObjectModelResolver",
"get",
"(",
"String",
"resolverId",
")",
"{",
"List",
"<",
"ObjectModelResolver",
">",
"resolvers",
"=",
"getResolvers",
"(",
")",
";",
"for",
"(",
"ObjectModelResolver",
"resolver",
":",
"resolvers",
")",
"{",
"if",
... | Returns first resolver that accepts the given resolverId.
In case none is found null is returned.
@param resolverId identifier of the resolver
@return found resolver or null otherwise | [
"Returns",
"first",
"resolver",
"that",
"accepts",
"the",
"given",
"resolverId",
".",
"In",
"case",
"none",
"is",
"found",
"null",
"is",
"returned",
"."
] | fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5 | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/runtime/conf/ObjectModelResolverProvider.java#L58-L68 |
162,619 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/QueuePoller.java | QueuePoller.reset | void reset()
{
if (!hasStopped)
{
throw new IllegalStateException("cannot reset a non stopped queue poller");
}
hasStopped = false;
run = true;
lastLoop = null;
loop = new Semaphore(0);
} | java | void reset()
{
if (!hasStopped)
{
throw new IllegalStateException("cannot reset a non stopped queue poller");
}
hasStopped = false;
run = true;
lastLoop = null;
loop = new Semaphore(0);
} | [
"void",
"reset",
"(",
")",
"{",
"if",
"(",
"!",
"hasStopped",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"cannot reset a non stopped queue poller\"",
")",
";",
"}",
"hasStopped",
"=",
"false",
";",
"run",
"=",
"true",
";",
"lastLoop",
"=",
"nu... | Will make the thread ready to run once again after it has stopped. | [
"Will",
"make",
"the",
"thread",
"ready",
"to",
"run",
"once",
"again",
"after",
"it",
"has",
"stopped",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/QueuePoller.java#L87-L97 |
162,620 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/QueuePoller.java | QueuePoller.releaseResources | void releaseResources(JobInstance ji)
{
this.peremption.remove(ji.getId());
this.actualNbThread.decrementAndGet();
for (ResourceManagerBase rm : this.resourceManagers)
{
rm.releaseResource(ji);
}
if (!this.strictPollingPeriod)
{
// Fo... | java | void releaseResources(JobInstance ji)
{
this.peremption.remove(ji.getId());
this.actualNbThread.decrementAndGet();
for (ResourceManagerBase rm : this.resourceManagers)
{
rm.releaseResource(ji);
}
if (!this.strictPollingPeriod)
{
// Fo... | [
"void",
"releaseResources",
"(",
"JobInstance",
"ji",
")",
"{",
"this",
".",
"peremption",
".",
"remove",
"(",
"ji",
".",
"getId",
"(",
")",
")",
";",
"this",
".",
"actualNbThread",
".",
"decrementAndGet",
"(",
")",
";",
"for",
"(",
"ResourceManagerBase",
... | Called when a payload thread has ended. This also notifies the poller to poll once again. | [
"Called",
"when",
"a",
"payload",
"thread",
"has",
"ended",
".",
"This",
"also",
"notifies",
"the",
"poller",
"to",
"poll",
"once",
"again",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/QueuePoller.java#L409-L425 |
162,621 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JqmEngineFactory.java | JqmEngineFactory.startEngine | public static JqmEngineOperations startEngine(String name, JqmEngineHandler handler)
{
JqmEngine e = new JqmEngine();
e.start(name, handler);
return e;
} | java | public static JqmEngineOperations startEngine(String name, JqmEngineHandler handler)
{
JqmEngine e = new JqmEngine();
e.start(name, handler);
return e;
} | [
"public",
"static",
"JqmEngineOperations",
"startEngine",
"(",
"String",
"name",
",",
"JqmEngineHandler",
"handler",
")",
"{",
"JqmEngine",
"e",
"=",
"new",
"JqmEngine",
"(",
")",
";",
"e",
".",
"start",
"(",
"name",
",",
"handler",
")",
";",
"return",
"e"... | Creates and start an engine representing the node named as the given parameter.
@param name
name of the node, as present in the configuration (case sensitive)
@param handler
can be null. A set of callbacks hooked on different engine life cycle events.
@return an object allowing to stop the engine. | [
"Creates",
"and",
"start",
"an",
"engine",
"representing",
"the",
"node",
"named",
"as",
"the",
"given",
"parameter",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JqmEngineFactory.java#L23-L28 |
162,622 | enioka/jqm | jqm-all/jqm-ws/src/main/java/com/enioka/jqm/api/ErrorHandler.java | ErrorHandler.toResponse | @Override
public Response toResponse(ErrorDto e)
{
// String type = headers.getContentType() == null ? MediaType.APPLICATION_JSON : headers.getContentType();
return Response.status(e.httpStatus).entity(e).type(MediaType.APPLICATION_JSON).build();
} | java | @Override
public Response toResponse(ErrorDto e)
{
// String type = headers.getContentType() == null ? MediaType.APPLICATION_JSON : headers.getContentType();
return Response.status(e.httpStatus).entity(e).type(MediaType.APPLICATION_JSON).build();
} | [
"@",
"Override",
"public",
"Response",
"toResponse",
"(",
"ErrorDto",
"e",
")",
"{",
"// String type = headers.getContentType() == null ? MediaType.APPLICATION_JSON : headers.getContentType();",
"return",
"Response",
".",
"status",
"(",
"e",
".",
"httpStatus",
")",
".",
"en... | private HttpServletResponse headers; | [
"private",
"HttpServletResponse",
"headers",
";"
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/api/ErrorHandler.java#L29-L34 |
162,623 | enioka/jqm | jqm-all/jqm-client/jqm-api-client-core/src/main/java/com/enioka/jqm/api/JqmClientFactory.java | JqmClientFactory.getClient | public static JqmClient getClient(String name, Properties p, boolean cached)
{
Properties p2 = null;
if (binder == null)
{
bind();
}
if (p == null)
{
p2 = props;
}
else
{
p2 = new Properties(props);
... | java | public static JqmClient getClient(String name, Properties p, boolean cached)
{
Properties p2 = null;
if (binder == null)
{
bind();
}
if (p == null)
{
p2 = props;
}
else
{
p2 = new Properties(props);
... | [
"public",
"static",
"JqmClient",
"getClient",
"(",
"String",
"name",
",",
"Properties",
"p",
",",
"boolean",
"cached",
")",
"{",
"Properties",
"p2",
"=",
"null",
";",
"if",
"(",
"binder",
"==",
"null",
")",
"{",
"bind",
"(",
")",
";",
"}",
"if",
"(",... | Return a new client that may be cached or not. Given properties are always use when not cached, and only used at creation time for
cached clients.
@param name
if null, default client. Otherwise, helpful to retrieve cached clients later.
@param p
a set of properties. Implementation specific. Unknown properties are sile... | [
"Return",
"a",
"new",
"client",
"that",
"may",
"be",
"cached",
"or",
"not",
".",
"Given",
"properties",
"are",
"always",
"use",
"when",
"not",
"cached",
"and",
"only",
"used",
"at",
"creation",
"time",
"for",
"cached",
"clients",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-client/jqm-api-client-core/src/main/java/com/enioka/jqm/api/JqmClientFactory.java#L157-L174 |
162,624 | enioka/jqm | jqm-all/jqm-admin/src/main/java/com/enioka/api/admin/ScheduledJob.java | ScheduledJob.create | public static ScheduledJob create(String cronExpression)
{
ScheduledJob res = new ScheduledJob();
res.cronExpression = cronExpression;
return res;
} | java | public static ScheduledJob create(String cronExpression)
{
ScheduledJob res = new ScheduledJob();
res.cronExpression = cronExpression;
return res;
} | [
"public",
"static",
"ScheduledJob",
"create",
"(",
"String",
"cronExpression",
")",
"{",
"ScheduledJob",
"res",
"=",
"new",
"ScheduledJob",
"(",
")",
";",
"res",
".",
"cronExpression",
"=",
"cronExpression",
";",
"return",
"res",
";",
"}"
] | Fluent API builder.
@param cronExpression
@return | [
"Fluent",
"API",
"builder",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-admin/src/main/java/com/enioka/api/admin/ScheduledJob.java#L37-L42 |
162,625 | enioka/jqm | jqm-all/jqm-xml/src/main/java/com/enioka/jqm/tools/XmlQueueExporter.java | XmlQueueExporter.export | static void export(String path, String queueName, DbConn cnx) throws JqmXmlException
{
// Argument tests
if (queueName == null)
{
throw new IllegalArgumentException("queue name cannot be null");
}
if (cnx == null)
{
throw new IllegalArgumentExc... | java | static void export(String path, String queueName, DbConn cnx) throws JqmXmlException
{
// Argument tests
if (queueName == null)
{
throw new IllegalArgumentException("queue name cannot be null");
}
if (cnx == null)
{
throw new IllegalArgumentExc... | [
"static",
"void",
"export",
"(",
"String",
"path",
",",
"String",
"queueName",
",",
"DbConn",
"cnx",
")",
"throws",
"JqmXmlException",
"{",
"// Argument tests",
"if",
"(",
"queueName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\... | Exports a single queue to an XML file. | [
"Exports",
"a",
"single",
"queue",
"to",
"an",
"XML",
"file",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-xml/src/main/java/com/enioka/jqm/tools/XmlQueueExporter.java#L41-L61 |
162,626 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java | Helpers.createMessage | static void createMessage(String textMessage, JobInstance jobInstance, DbConn cnx)
{
cnx.runUpdate("message_insert", jobInstance.getId(), textMessage);
} | java | static void createMessage(String textMessage, JobInstance jobInstance, DbConn cnx)
{
cnx.runUpdate("message_insert", jobInstance.getId(), textMessage);
} | [
"static",
"void",
"createMessage",
"(",
"String",
"textMessage",
",",
"JobInstance",
"jobInstance",
",",
"DbConn",
"cnx",
")",
"{",
"cnx",
".",
"runUpdate",
"(",
"\"message_insert\"",
",",
"jobInstance",
".",
"getId",
"(",
")",
",",
"textMessage",
")",
";",
... | Create a text message that will be stored in the database. Must be called inside a transaction. | [
"Create",
"a",
"text",
"message",
"that",
"will",
"be",
"stored",
"in",
"the",
"database",
".",
"Must",
"be",
"called",
"inside",
"a",
"transaction",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java#L190-L193 |
162,627 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java | Helpers.createDeliverable | static int createDeliverable(String path, String originalFileName, String fileFamily, Integer jobId, DbConn cnx)
{
QueryResult qr = cnx.runUpdate("deliverable_insert", fileFamily, path, jobId, originalFileName, UUID.randomUUID().toString());
return qr.getGeneratedId();
} | java | static int createDeliverable(String path, String originalFileName, String fileFamily, Integer jobId, DbConn cnx)
{
QueryResult qr = cnx.runUpdate("deliverable_insert", fileFamily, path, jobId, originalFileName, UUID.randomUUID().toString());
return qr.getGeneratedId();
} | [
"static",
"int",
"createDeliverable",
"(",
"String",
"path",
",",
"String",
"originalFileName",
",",
"String",
"fileFamily",
",",
"Integer",
"jobId",
",",
"DbConn",
"cnx",
")",
"{",
"QueryResult",
"qr",
"=",
"cnx",
".",
"runUpdate",
"(",
"\"deliverable_insert\""... | Create a Deliverable inside the database that will track a file created by a JobInstance Must be called from inside a transaction
@param path
FilePath (relative to a root directory - cf. Node)
@param originalFileName
FileName
@param fileFamily
File family (may be null). E.g.: "daily report"
@param jobId
Job Instance I... | [
"Create",
"a",
"Deliverable",
"inside",
"the",
"database",
"that",
"will",
"track",
"a",
"file",
"created",
"by",
"a",
"JobInstance",
"Must",
"be",
"called",
"from",
"inside",
"a",
"transaction"
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java#L209-L213 |
162,628 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java | Helpers.initSingleParam | static void initSingleParam(String key, String initValue, DbConn cnx)
{
try
{
cnx.runSelectSingle("globalprm_select_by_key", 2, String.class, key);
return;
}
catch (NoResultException e)
{
GlobalParameter.create(cnx, key, initValue);
... | java | static void initSingleParam(String key, String initValue, DbConn cnx)
{
try
{
cnx.runSelectSingle("globalprm_select_by_key", 2, String.class, key);
return;
}
catch (NoResultException e)
{
GlobalParameter.create(cnx, key, initValue);
... | [
"static",
"void",
"initSingleParam",
"(",
"String",
"key",
",",
"String",
"initValue",
",",
"DbConn",
"cnx",
")",
"{",
"try",
"{",
"cnx",
".",
"runSelectSingle",
"(",
"\"globalprm_select_by_key\"",
",",
"2",
",",
"String",
".",
"class",
",",
"key",
")",
";... | Checks if a parameter exists. If it exists, it is left untouched. If it doesn't, it is created. Only works for parameters which key
is unique. Must be called from within an open transaction. | [
"Checks",
"if",
"a",
"parameter",
"exists",
".",
"If",
"it",
"exists",
"it",
"is",
"left",
"untouched",
".",
"If",
"it",
"doesn",
"t",
"it",
"is",
"created",
".",
"Only",
"works",
"for",
"parameters",
"which",
"key",
"is",
"unique",
".",
"Must",
"be",
... | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java#L219-L234 |
162,629 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java | Helpers.setSingleParam | static void setSingleParam(String key, String value, DbConn cnx)
{
QueryResult r = cnx.runUpdate("globalprm_update_value_by_key", value, key);
if (r.nbUpdated == 0)
{
cnx.runUpdate("globalprm_insert", key, value);
}
cnx.commit();
} | java | static void setSingleParam(String key, String value, DbConn cnx)
{
QueryResult r = cnx.runUpdate("globalprm_update_value_by_key", value, key);
if (r.nbUpdated == 0)
{
cnx.runUpdate("globalprm_insert", key, value);
}
cnx.commit();
} | [
"static",
"void",
"setSingleParam",
"(",
"String",
"key",
",",
"String",
"value",
",",
"DbConn",
"cnx",
")",
"{",
"QueryResult",
"r",
"=",
"cnx",
".",
"runUpdate",
"(",
"\"globalprm_update_value_by_key\"",
",",
"value",
",",
"key",
")",
";",
"if",
"(",
"r"... | Checks if a parameter exists. If it exists, it is updated. If it doesn't, it is created. Only works for parameters which key is
unique. Will create a transaction on the given entity manager. | [
"Checks",
"if",
"a",
"parameter",
"exists",
".",
"If",
"it",
"exists",
"it",
"is",
"updated",
".",
"If",
"it",
"doesn",
"t",
"it",
"is",
"created",
".",
"Only",
"works",
"for",
"parameters",
"which",
"key",
"is",
"unique",
".",
"Will",
"create",
"a",
... | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java#L240-L248 |
162,630 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbConn.java | DbConn.close | public void close()
{
if (transac_open)
{
try
{
this._cnx.rollback();
}
catch (Exception e)
{
// Ignore.
}
}
for (Statement s : toClose)
{
closeQuietly(s);
... | java | public void close()
{
if (transac_open)
{
try
{
this._cnx.rollback();
}
catch (Exception e)
{
// Ignore.
}
}
for (Statement s : toClose)
{
closeQuietly(s);
... | [
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"transac_open",
")",
"{",
"try",
"{",
"this",
".",
"_cnx",
".",
"rollback",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Ignore.",
"}",
"}",
"for",
"(",
"Statement",
"s",
"... | Close all JDBC objects related to this connection. | [
"Close",
"all",
"JDBC",
"objects",
"related",
"to",
"this",
"connection",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbConn.java#L407-L429 |
162,631 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/RunningJobInstanceManager.java | RunningJobInstanceManager.killAll | void killAll()
{
for (RjiRegistration reg : this.instancesById.values().toArray(new RjiRegistration[] {}))
{
reg.rji.handleInstruction(Instruction.KILL);
}
} | java | void killAll()
{
for (RjiRegistration reg : this.instancesById.values().toArray(new RjiRegistration[] {}))
{
reg.rji.handleInstruction(Instruction.KILL);
}
} | [
"void",
"killAll",
"(",
")",
"{",
"for",
"(",
"RjiRegistration",
"reg",
":",
"this",
".",
"instancesById",
".",
"values",
"(",
")",
".",
"toArray",
"(",
"new",
"RjiRegistration",
"[",
"]",
"{",
"}",
")",
")",
"{",
"reg",
".",
"rji",
".",
"handleInstr... | Send a kill signal to all running instances and return as soon as the signal is sent. | [
"Send",
"a",
"kill",
"signal",
"to",
"all",
"running",
"instances",
"and",
"return",
"as",
"soon",
"as",
"the",
"signal",
"is",
"sent",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/RunningJobInstanceManager.java#L78-L84 |
162,632 | enioka/jqm | jqm-all/jqm-ws/src/main/java/com/enioka/jqm/api/ServiceClient.java | ServiceClient.setJobQueue | @Override
public void setJobQueue(int jobId, Queue queue)
{
JqmClientFactory.getClient().setJobQueue(jobId, queue);
} | java | @Override
public void setJobQueue(int jobId, Queue queue)
{
JqmClientFactory.getClient().setJobQueue(jobId, queue);
} | [
"@",
"Override",
"public",
"void",
"setJobQueue",
"(",
"int",
"jobId",
",",
"Queue",
"queue",
")",
"{",
"JqmClientFactory",
".",
"getClient",
"(",
")",
".",
"setJobQueue",
"(",
"jobId",
",",
"queue",
")",
";",
"}"
] | No need to expose. Client side work. | [
"No",
"need",
"to",
"expose",
".",
"Client",
"side",
"work",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/api/ServiceClient.java#L173-L177 |
162,633 | enioka/jqm | jqm-all/jqm-ws/src/main/java/com/enioka/jqm/api/ServiceClient.java | ServiceClient.getJobs | @Override
public List<JobInstance> getJobs(Query query)
{
return JqmClientFactory.getClient().getJobs(query);
} | java | @Override
public List<JobInstance> getJobs(Query query)
{
return JqmClientFactory.getClient().getJobs(query);
} | [
"@",
"Override",
"public",
"List",
"<",
"JobInstance",
">",
"getJobs",
"(",
"Query",
"query",
")",
"{",
"return",
"JqmClientFactory",
".",
"getClient",
"(",
")",
".",
"getJobs",
"(",
"query",
")",
";",
"}"
] | Not exposed directly - the Query object passed as parameter actually contains results... | [
"Not",
"exposed",
"directly",
"-",
"the",
"Query",
"object",
"passed",
"as",
"parameter",
"actually",
"contains",
"results",
"..."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/api/ServiceClient.java#L275-L279 |
162,634 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JqmEngine.java | JqmEngine.stop | @Override
public void stop()
{
synchronized (killHook)
{
jqmlogger.info("JQM engine " + this.node.getName() + " has received a stop order");
// Kill hook should be removed
try
{
if (!Runtime.getRuntime().removeShutdownHook(killHook... | java | @Override
public void stop()
{
synchronized (killHook)
{
jqmlogger.info("JQM engine " + this.node.getName() + " has received a stop order");
// Kill hook should be removed
try
{
if (!Runtime.getRuntime().removeShutdownHook(killHook... | [
"@",
"Override",
"public",
"void",
"stop",
"(",
")",
"{",
"synchronized",
"(",
"killHook",
")",
"{",
"jqmlogger",
".",
"info",
"(",
"\"JQM engine \"",
"+",
"this",
".",
"node",
".",
"getName",
"(",
")",
"+",
"\" has received a stop order\"",
")",
";",
"// ... | Gracefully stop the engine | [
"Gracefully",
"stop",
"the",
"engine"
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JqmEngine.java#L266-L328 |
162,635 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JqmEngine.java | JqmEngine.purgeDeadJobInstances | private void purgeDeadJobInstances(DbConn cnx, Node node)
{
for (JobInstance ji : JobInstance.select(cnx, "ji_select_by_node", node.getId()))
{
try
{
cnx.runSelectSingle("history_select_state_by_id", String.class, ji.getId());
}
catch (... | java | private void purgeDeadJobInstances(DbConn cnx, Node node)
{
for (JobInstance ji : JobInstance.select(cnx, "ji_select_by_node", node.getId()))
{
try
{
cnx.runSelectSingle("history_select_state_by_id", String.class, ji.getId());
}
catch (... | [
"private",
"void",
"purgeDeadJobInstances",
"(",
"DbConn",
"cnx",
",",
"Node",
"node",
")",
"{",
"for",
"(",
"JobInstance",
"ji",
":",
"JobInstance",
".",
"select",
"(",
"cnx",
",",
"\"ji_select_by_node\"",
",",
"node",
".",
"getId",
"(",
")",
")",
")",
... | To be called at node startup - it purges all job instances associated to this node.
@param cnx
@param node | [
"To",
"be",
"called",
"at",
"node",
"startup",
"-",
"it",
"purges",
"all",
"job",
"instances",
"associated",
"to",
"this",
"node",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JqmEngine.java#L492-L511 |
162,636 | enioka/jqm | jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/tools/ClassloaderManager.java | ClassloaderManager.getClasspath | private URL[] getClasspath(JobInstance ji, JobRunnerCallback cb) throws JqmPayloadException
{
switch (ji.getJD().getPathType())
{
case MAVEN:
return mavenResolver.resolve(ji);
case MEMORY:
return new URL[0];
case FS:
default:
return... | java | private URL[] getClasspath(JobInstance ji, JobRunnerCallback cb) throws JqmPayloadException
{
switch (ji.getJD().getPathType())
{
case MAVEN:
return mavenResolver.resolve(ji);
case MEMORY:
return new URL[0];
case FS:
default:
return... | [
"private",
"URL",
"[",
"]",
"getClasspath",
"(",
"JobInstance",
"ji",
",",
"JobRunnerCallback",
"cb",
")",
"throws",
"JqmPayloadException",
"{",
"switch",
"(",
"ji",
".",
"getJD",
"(",
")",
".",
"getPathType",
"(",
")",
")",
"{",
"case",
"MAVEN",
":",
"r... | Returns all the URL that should be inside the classpath. This includes the jar itself if any.
@throws JqmPayloadException | [
"Returns",
"all",
"the",
"URL",
"that",
"should",
"be",
"inside",
"the",
"classpath",
".",
"This",
"includes",
"the",
"jar",
"itself",
"if",
"any",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/tools/ClassloaderManager.java#L222-L234 |
162,637 | enioka/jqm | jqm-all/jqm-providers/src/main/java/com/enioka/jqm/providers/PayloadInterceptor.java | PayloadInterceptor.forceCleanup | public static int forceCleanup(Thread t)
{
int i = 0;
for (Map.Entry<ConnectionPool, Set<ConnPair>> e : conns.entrySet())
{
for (ConnPair c : e.getValue())
{
if (c.thread.equals(t))
{
try
{
... | java | public static int forceCleanup(Thread t)
{
int i = 0;
for (Map.Entry<ConnectionPool, Set<ConnPair>> e : conns.entrySet())
{
for (ConnPair c : e.getValue())
{
if (c.thread.equals(t))
{
try
{
... | [
"public",
"static",
"int",
"forceCleanup",
"(",
"Thread",
"t",
")",
"{",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"ConnectionPool",
",",
"Set",
"<",
"ConnPair",
">",
">",
"e",
":",
"conns",
".",
"entrySet",
"(",
")",
")",
... | Called by the engine to trigger the cleanup at the end of a payload thread. | [
"Called",
"by",
"the",
"engine",
"to",
"trigger",
"the",
"cleanup",
"at",
"the",
"end",
"of",
"a",
"payload",
"thread",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-providers/src/main/java/com/enioka/jqm/providers/PayloadInterceptor.java#L98-L121 |
162,638 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java | GlobalParameter.create | public static GlobalParameter create(DbConn cnx, String key, String value)
{
QueryResult r = cnx.runUpdate("globalprm_insert", key, value);
GlobalParameter res = new GlobalParameter();
res.id = r.getGeneratedId();
res.key = key;
res.value = value;
return res;
} | java | public static GlobalParameter create(DbConn cnx, String key, String value)
{
QueryResult r = cnx.runUpdate("globalprm_insert", key, value);
GlobalParameter res = new GlobalParameter();
res.id = r.getGeneratedId();
res.key = key;
res.value = value;
return res;
} | [
"public",
"static",
"GlobalParameter",
"create",
"(",
"DbConn",
"cnx",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"QueryResult",
"r",
"=",
"cnx",
".",
"runUpdate",
"(",
"\"globalprm_insert\"",
",",
"key",
",",
"value",
")",
";",
"GlobalParameter... | Create a new GP entry in the database. No commit performed. | [
"Create",
"a",
"new",
"GP",
"entry",
"in",
"the",
"database",
".",
"No",
"commit",
"performed",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java#L110-L118 |
162,639 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java | GlobalParameter.getParameter | public static String getParameter(DbConn cnx, String key, String defaultValue)
{
try
{
return cnx.runSelectSingle("globalprm_select_by_key", 3, String.class, key);
}
catch (NoResultException e)
{
return defaultValue;
}
} | java | public static String getParameter(DbConn cnx, String key, String defaultValue)
{
try
{
return cnx.runSelectSingle("globalprm_select_by_key", 3, String.class, key);
}
catch (NoResultException e)
{
return defaultValue;
}
} | [
"public",
"static",
"String",
"getParameter",
"(",
"DbConn",
"cnx",
",",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"cnx",
".",
"runSelectSingle",
"(",
"\"globalprm_select_by_key\"",
",",
"3",
",",
"String",
".",
"class",
... | Retrieve the value of a single-valued parameter.
@param key
@param defaultValue
@param cnx | [
"Retrieve",
"the",
"value",
"of",
"a",
"single",
"-",
"valued",
"parameter",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java#L154-L164 |
162,640 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JndiContext.java | JndiContext.createJndiContext | static JndiContext createJndiContext() throws NamingException
{
try
{
if (!NamingManager.hasInitialContextFactoryBuilder())
{
JndiContext ctx = new JndiContext();
NamingManager.setInitialContextFactoryBuilder(ctx);
return ctx;
... | java | static JndiContext createJndiContext() throws NamingException
{
try
{
if (!NamingManager.hasInitialContextFactoryBuilder())
{
JndiContext ctx = new JndiContext();
NamingManager.setInitialContextFactoryBuilder(ctx);
return ctx;
... | [
"static",
"JndiContext",
"createJndiContext",
"(",
")",
"throws",
"NamingException",
"{",
"try",
"{",
"if",
"(",
"!",
"NamingManager",
".",
"hasInitialContextFactoryBuilder",
"(",
")",
")",
"{",
"JndiContext",
"ctx",
"=",
"new",
"JndiContext",
"(",
")",
";",
"... | Will create a JNDI Context and register it as the initial context factory builder
@return the context
@throws NamingException
on any issue during initial context factory builder registration | [
"Will",
"create",
"a",
"JNDI",
"Context",
"and",
"register",
"it",
"as",
"the",
"initial",
"context",
"factory",
"builder"
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JndiContext.java#L75-L97 |
162,641 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JndiContext.java | JndiContext.getParentCl | private static ClassLoader getParentCl()
{
try
{
Method m = ClassLoader.class.getMethod("getPlatformClassLoader");
return (ClassLoader) m.invoke(null);
}
catch (NoSuchMethodException e)
{
// Java < 9, just use the bootstrap CL.
... | java | private static ClassLoader getParentCl()
{
try
{
Method m = ClassLoader.class.getMethod("getPlatformClassLoader");
return (ClassLoader) m.invoke(null);
}
catch (NoSuchMethodException e)
{
// Java < 9, just use the bootstrap CL.
... | [
"private",
"static",
"ClassLoader",
"getParentCl",
"(",
")",
"{",
"try",
"{",
"Method",
"m",
"=",
"ClassLoader",
".",
"class",
".",
"getMethod",
"(",
"\"getPlatformClassLoader\"",
")",
";",
"return",
"(",
"ClassLoader",
")",
"m",
".",
"invoke",
"(",
"null",
... | A helper - in Java 9, the extension CL was renamed to platform CL and hosts all the JDK classes. Before 9, it was useless and we used
bootstrap CL instead.
@return the base CL to use. | [
"A",
"helper",
"-",
"in",
"Java",
"9",
"the",
"extension",
"CL",
"was",
"renamed",
"to",
"platform",
"CL",
"and",
"hosts",
"all",
"the",
"JDK",
"classes",
".",
"Before",
"9",
"it",
"was",
"useless",
"and",
"we",
"used",
"bootstrap",
"CL",
"instead",
".... | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JndiContext.java#L413-L429 |
162,642 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java | Db.loadProperties | public static Properties loadProperties(String[] filesToLoad)
{
Properties p = new Properties();
InputStream fis = null;
for (String path : filesToLoad)
{
try
{
fis = Db.class.getClassLoader().getResourceAsStream(path);
if (fis ... | java | public static Properties loadProperties(String[] filesToLoad)
{
Properties p = new Properties();
InputStream fis = null;
for (String path : filesToLoad)
{
try
{
fis = Db.class.getClassLoader().getResourceAsStream(path);
if (fis ... | [
"public",
"static",
"Properties",
"loadProperties",
"(",
"String",
"[",
"]",
"filesToLoad",
")",
"{",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"InputStream",
"fis",
"=",
"null",
";",
"for",
"(",
"String",
"path",
":",
"filesToLoad",
")",... | Helper method to load a property file from class path.
@param filesToLoad
an array of paths (class path paths) designating where the files may be. All files are loaded, in the order
given. Missing files are silently ignored.
@return a Properties object, which may be empty but not null. | [
"Helper",
"method",
"to",
"load",
"a",
"property",
"file",
"from",
"class",
"path",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java#L225-L260 |
162,643 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java | Db.init | private void init(boolean upgrade)
{
initAdapter();
initQueries();
if (upgrade)
{
dbUpgrade();
}
// First contact with the DB is version checking (if no connection opened by pool).
// If DB is in wrong version or not available, just wait for it to... | java | private void init(boolean upgrade)
{
initAdapter();
initQueries();
if (upgrade)
{
dbUpgrade();
}
// First contact with the DB is version checking (if no connection opened by pool).
// If DB is in wrong version or not available, just wait for it to... | [
"private",
"void",
"init",
"(",
"boolean",
"upgrade",
")",
"{",
"initAdapter",
"(",
")",
";",
"initQueries",
"(",
")",
";",
"if",
"(",
"upgrade",
")",
"{",
"dbUpgrade",
"(",
")",
";",
"}",
"// First contact with the DB is version checking (if no connection opened ... | Main database initialization. To be called only when _ds is a valid DataSource. | [
"Main",
"database",
"initialization",
".",
"To",
"be",
"called",
"only",
"when",
"_ds",
"is",
"a",
"valid",
"DataSource",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java#L265-L301 |
162,644 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java | Db.dbUpgrade | private void dbUpgrade()
{
DbConn cnx = this.getConn();
Map<String, Object> rs = null;
int db_schema_version = 0;
try
{
rs = cnx.runSelectSingleRow("version_select_latest");
db_schema_version = (Integer) rs.get("VERSION_D1");
}
catch (E... | java | private void dbUpgrade()
{
DbConn cnx = this.getConn();
Map<String, Object> rs = null;
int db_schema_version = 0;
try
{
rs = cnx.runSelectSingleRow("version_select_latest");
db_schema_version = (Integer) rs.get("VERSION_D1");
}
catch (E... | [
"private",
"void",
"dbUpgrade",
"(",
")",
"{",
"DbConn",
"cnx",
"=",
"this",
".",
"getConn",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"rs",
"=",
"null",
";",
"int",
"db_schema_version",
"=",
"0",
";",
"try",
"{",
"rs",
"=",
"cnx",
... | Updates the database. Never call this during normal operations, upgrade is a user-controlled operation. | [
"Updates",
"the",
"database",
".",
"Never",
"call",
"this",
"during",
"normal",
"operations",
"upgrade",
"is",
"a",
"user",
"-",
"controlled",
"operation",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java#L359-L435 |
162,645 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java | Db.initAdapter | private void initAdapter()
{
Connection tmp = null;
DatabaseMetaData meta = null;
try
{
tmp = _ds.getConnection();
meta = tmp.getMetaData();
product = meta.getDatabaseProductName().toLowerCase();
}
catch (SQLException e)
{
... | java | private void initAdapter()
{
Connection tmp = null;
DatabaseMetaData meta = null;
try
{
tmp = _ds.getConnection();
meta = tmp.getMetaData();
product = meta.getDatabaseProductName().toLowerCase();
}
catch (SQLException e)
{
... | [
"private",
"void",
"initAdapter",
"(",
")",
"{",
"Connection",
"tmp",
"=",
"null",
";",
"DatabaseMetaData",
"meta",
"=",
"null",
";",
"try",
"{",
"tmp",
"=",
"_ds",
".",
"getConnection",
"(",
")",
";",
"meta",
"=",
"tmp",
".",
"getMetaData",
"(",
")",
... | Creates the adapter for the target database. | [
"Creates",
"the",
"adapter",
"for",
"the",
"target",
"database",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java#L440-L496 |
162,646 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java | Db.getConn | public DbConn getConn()
{
Connection cnx = null;
try
{
Thread.interrupted(); // this is VERY sad. Needed for Oracle driver which otherwise fails spectacularly.
cnx = _ds.getConnection();
if (cnx.getAutoCommit())
{
cnx.setAutoCom... | java | public DbConn getConn()
{
Connection cnx = null;
try
{
Thread.interrupted(); // this is VERY sad. Needed for Oracle driver which otherwise fails spectacularly.
cnx = _ds.getConnection();
if (cnx.getAutoCommit())
{
cnx.setAutoCom... | [
"public",
"DbConn",
"getConn",
"(",
")",
"{",
"Connection",
"cnx",
"=",
"null",
";",
"try",
"{",
"Thread",
".",
"interrupted",
"(",
")",
";",
"// this is VERY sad. Needed for Oracle driver which otherwise fails spectacularly.",
"cnx",
"=",
"_ds",
".",
"getConnection",... | A connection to the database. Should be short-lived. No transaction active by default.
@return a new open connection. | [
"A",
"connection",
"to",
"the",
"database",
".",
"Should",
"be",
"short",
"-",
"lived",
".",
"No",
"transaction",
"active",
"by",
"default",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java#L513-L538 |
162,647 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java | Db.getQuery | String getQuery(String key)
{
String res = this.adapter.getSqlText(key);
if (res == null)
{
throw new DatabaseException("Query " + key + " does not exist");
}
return res;
} | java | String getQuery(String key)
{
String res = this.adapter.getSqlText(key);
if (res == null)
{
throw new DatabaseException("Query " + key + " does not exist");
}
return res;
} | [
"String",
"getQuery",
"(",
"String",
"key",
")",
"{",
"String",
"res",
"=",
"this",
".",
"adapter",
".",
"getSqlText",
"(",
"key",
")",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"throw",
"new",
"DatabaseException",
"(",
"\"Query \"",
"+",
"key",
... | Gets the interpolated text of a query from cache. If key does not exist, an exception is thrown.
@param key
name of the query
@return the query text | [
"Gets",
"the",
"interpolated",
"text",
"of",
"a",
"query",
"from",
"cache",
".",
"If",
"key",
"does",
"not",
"exist",
"an",
"exception",
"is",
"thrown",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/Db.java#L547-L555 |
162,648 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobInstance.java | JobInstance.addParameter | public RuntimeParameter addParameter(String key, String value)
{
RuntimeParameter jp = new RuntimeParameter();
jp.setJi(this.getId());
jp.setKey(key);
jp.setValue(value);
return jp;
} | java | public RuntimeParameter addParameter(String key, String value)
{
RuntimeParameter jp = new RuntimeParameter();
jp.setJi(this.getId());
jp.setKey(key);
jp.setValue(value);
return jp;
} | [
"public",
"RuntimeParameter",
"addParameter",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"RuntimeParameter",
"jp",
"=",
"new",
"RuntimeParameter",
"(",
")",
";",
"jp",
".",
"setJi",
"(",
"this",
".",
"getId",
"(",
")",
")",
";",
"jp",
".",
... | Helper method to add a parameter without having to create it explicitely. The created parameter should be persisted afterwards.
@param key
name of the parameter to add
@param value
value of the parameter to create
@return the newly created parameter | [
"Helper",
"method",
"to",
"add",
"a",
"parameter",
"without",
"having",
"to",
"create",
"it",
"explicitely",
".",
"The",
"created",
"parameter",
"should",
"be",
"persisted",
"afterwards",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobInstance.java#L89-L96 |
162,649 | enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/RunningJobInstance.java | RunningJobInstance.endOfRunDb | void endOfRunDb()
{
DbConn cnx = null;
try
{
cnx = Helpers.getNewDbSession();
// Done: put inside history & remove instance from queue.
History.create(cnx, this.ji, this.resultStatus, endDate);
jqmlogger.trace("An History was just created for... | java | void endOfRunDb()
{
DbConn cnx = null;
try
{
cnx = Helpers.getNewDbSession();
// Done: put inside history & remove instance from queue.
History.create(cnx, this.ji, this.resultStatus, endDate);
jqmlogger.trace("An History was just created for... | [
"void",
"endOfRunDb",
"(",
")",
"{",
"DbConn",
"cnx",
"=",
"null",
";",
"try",
"{",
"cnx",
"=",
"Helpers",
".",
"getNewDbSession",
"(",
")",
";",
"// Done: put inside history & remove instance from queue.",
"History",
".",
"create",
"(",
"cnx",
",",
"this",
".... | Part of the endOfRun process that needs the database. May be deferred if the database is not available. | [
"Part",
"of",
"the",
"endOfRun",
"process",
"that",
"needs",
"the",
"database",
".",
"May",
"be",
"deferred",
"if",
"the",
"database",
"is",
"not",
"available",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/RunningJobInstance.java#L292-L314 |
162,650 | enioka/jqm | jqm-all/jqm-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/api/JdbcClient.java | JdbcClient.highlanderMode | private Integer highlanderMode(JobDef jd, DbConn cnx)
{
if (!jd.isHighlander())
{
return null;
}
try
{
Integer existing = cnx.runSelectSingle("ji_select_existing_highlander", Integer.class, jd.getId());
return existing;
}
c... | java | private Integer highlanderMode(JobDef jd, DbConn cnx)
{
if (!jd.isHighlander())
{
return null;
}
try
{
Integer existing = cnx.runSelectSingle("ji_select_existing_highlander", Integer.class, jd.getId());
return existing;
}
c... | [
"private",
"Integer",
"highlanderMode",
"(",
"JobDef",
"jd",
",",
"DbConn",
"cnx",
")",
"{",
"if",
"(",
"!",
"jd",
".",
"isHighlander",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"Integer",
"existing",
"=",
"cnx",
".",
"runSelectSingle... | Helper. Current transaction is committed in some cases. | [
"Helper",
".",
"Current",
"transaction",
"is",
"committed",
"in",
"some",
"cases",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/api/JdbcClient.java#L374-L415 |
162,651 | enioka/jqm | jqm-all/jqm-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/api/JdbcClient.java | JdbcClient.getStringPredicate | private String getStringPredicate(String fieldName, List<String> filterValues, List<Object> prms)
{
if (filterValues != null && !filterValues.isEmpty())
{
String res = "";
for (String filterValue : filterValues)
{
if (filterValue == null)
... | java | private String getStringPredicate(String fieldName, List<String> filterValues, List<Object> prms)
{
if (filterValues != null && !filterValues.isEmpty())
{
String res = "";
for (String filterValue : filterValues)
{
if (filterValue == null)
... | [
"private",
"String",
"getStringPredicate",
"(",
"String",
"fieldName",
",",
"List",
"<",
"String",
">",
"filterValues",
",",
"List",
"<",
"Object",
">",
"prms",
")",
"{",
"if",
"(",
"filterValues",
"!=",
"null",
"&&",
"!",
"filterValues",
".",
"isEmpty",
"... | GetJob helper - String predicates are all created the same way, so this factors some code. | [
"GetJob",
"helper",
"-",
"String",
"predicates",
"are",
"all",
"created",
"the",
"same",
"way",
"so",
"this",
"factors",
"some",
"code",
"."
] | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/api/JdbcClient.java#L1099-L1134 |
162,652 | enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbAdapter.java | DbAdapter.prepare | public void prepare(Properties p, Connection cnx)
{
this.tablePrefix = p.getProperty("com.enioka.jqm.jdbc.tablePrefix", "");
queries.putAll(DbImplBase.queries);
for (Map.Entry<String, String> entry : DbImplBase.queries.entrySet())
{
queries.put(entry.getKey(), this.adaptS... | java | public void prepare(Properties p, Connection cnx)
{
this.tablePrefix = p.getProperty("com.enioka.jqm.jdbc.tablePrefix", "");
queries.putAll(DbImplBase.queries);
for (Map.Entry<String, String> entry : DbImplBase.queries.entrySet())
{
queries.put(entry.getKey(), this.adaptS... | [
"public",
"void",
"prepare",
"(",
"Properties",
"p",
",",
"Connection",
"cnx",
")",
"{",
"this",
".",
"tablePrefix",
"=",
"p",
".",
"getProperty",
"(",
"\"com.enioka.jqm.jdbc.tablePrefix\"",
",",
"\"\"",
")",
";",
"queries",
".",
"putAll",
"(",
"DbImplBase",
... | Called after creating the first connection. The adapter should create its caches and do all initialization it requires. Most
importantly, the SQL query cache should be created.
@param cnx
an open ready to use connection to the database. | [
"Called",
"after",
"creating",
"the",
"first",
"connection",
".",
"The",
"adapter",
"should",
"create",
"its",
"caches",
"and",
"do",
"all",
"initialization",
"it",
"requires",
".",
"Most",
"importantly",
"the",
"SQL",
"query",
"cache",
"should",
"be",
"create... | 391733b8e291404b97c714c3727a241c4a861f98 | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbAdapter.java#L94-L102 |
162,653 | Angads25/android-filepicker | filepicker/src/main/java/com/github/angads25/filepicker/utils/ExtensionFilter.java | ExtensionFilter.accept | @Override
public boolean accept(File file) {
//All directories are added in the least that can be read by the Application
if (file.isDirectory()&&file.canRead())
{ return true;
}
else if(properties.selection_type==DialogConfigs.DIR_SELECT)
{ /* True for files, If... | java | @Override
public boolean accept(File file) {
//All directories are added in the least that can be read by the Application
if (file.isDirectory()&&file.canRead())
{ return true;
}
else if(properties.selection_type==DialogConfigs.DIR_SELECT)
{ /* True for files, If... | [
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"file",
")",
"{",
"//All directories are added in the least that can be read by the Application",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
"&&",
"file",
".",
"canRead",
"(",
")",
")",
"{",
"retur... | Function to filter files based on defined rules. | [
"Function",
"to",
"filter",
"files",
"based",
"on",
"defined",
"rules",
"."
] | 46fd8825e6d88c69462078a0300d905739a803ea | https://github.com/Angads25/android-filepicker/blob/46fd8825e6d88c69462078a0300d905739a803ea/filepicker/src/main/java/com/github/angads25/filepicker/utils/ExtensionFilter.java#L49-L74 |
162,654 | omadahealth/SwipyRefreshLayout | lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java | SwipyRefreshLayout.setSize | public void setSize(int size) {
if (size != MaterialProgressDrawable.LARGE && size != MaterialProgressDrawable.DEFAULT) {
return;
}
final DisplayMetrics metrics = getResources().getDisplayMetrics();
if (size == MaterialProgressDrawable.LARGE) {
mCircleHeight = mCi... | java | public void setSize(int size) {
if (size != MaterialProgressDrawable.LARGE && size != MaterialProgressDrawable.DEFAULT) {
return;
}
final DisplayMetrics metrics = getResources().getDisplayMetrics();
if (size == MaterialProgressDrawable.LARGE) {
mCircleHeight = mCi... | [
"public",
"void",
"setSize",
"(",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"!=",
"MaterialProgressDrawable",
".",
"LARGE",
"&&",
"size",
"!=",
"MaterialProgressDrawable",
".",
"DEFAULT",
")",
"{",
"return",
";",
"}",
"final",
"DisplayMetrics",
"metrics",
... | One of DEFAULT, or LARGE. | [
"One",
"of",
"DEFAULT",
"or",
"LARGE",
"."
] | 890e92d7f2779dce85d3358093135d6b3be58986 | https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L246-L262 |
162,655 | omadahealth/SwipyRefreshLayout | lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java | SwipyRefreshLayout.setRefreshing | public void setRefreshing(boolean refreshing) {
if (refreshing && mRefreshing != refreshing) {
// scale and show
mRefreshing = refreshing;
int endTarget = 0;
if (!mUsingCustomStart) {
switch (mDirection) {
case BOTTOM:
... | java | public void setRefreshing(boolean refreshing) {
if (refreshing && mRefreshing != refreshing) {
// scale and show
mRefreshing = refreshing;
int endTarget = 0;
if (!mUsingCustomStart) {
switch (mDirection) {
case BOTTOM:
... | [
"public",
"void",
"setRefreshing",
"(",
"boolean",
"refreshing",
")",
"{",
"if",
"(",
"refreshing",
"&&",
"mRefreshing",
"!=",
"refreshing",
")",
"{",
"// scale and show",
"mRefreshing",
"=",
"refreshing",
";",
"int",
"endTarget",
"=",
"0",
";",
"if",
"(",
"... | Notify the widget that refresh state has changed. Do not call this when
refresh is triggered by a swipe gesture.
@param refreshing Whether or not the view should show refresh progress. | [
"Notify",
"the",
"widget",
"that",
"refresh",
"state",
"has",
"changed",
".",
"Do",
"not",
"call",
"this",
"when",
"refresh",
"is",
"triggered",
"by",
"a",
"swipe",
"gesture",
"."
] | 890e92d7f2779dce85d3358093135d6b3be58986 | https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L361-L386 |
162,656 | omadahealth/SwipyRefreshLayout | lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java | SwipyRefreshLayout.setAnimationProgress | private void setAnimationProgress(float progress) {
if (isAlphaUsedForScale()) {
setColorViewAlpha((int) (progress * MAX_ALPHA));
} else {
ViewCompat.setScaleX(mCircleView, progress);
ViewCompat.setScaleY(mCircleView, progress);
}
} | java | private void setAnimationProgress(float progress) {
if (isAlphaUsedForScale()) {
setColorViewAlpha((int) (progress * MAX_ALPHA));
} else {
ViewCompat.setScaleX(mCircleView, progress);
ViewCompat.setScaleY(mCircleView, progress);
}
} | [
"private",
"void",
"setAnimationProgress",
"(",
"float",
"progress",
")",
"{",
"if",
"(",
"isAlphaUsedForScale",
"(",
")",
")",
"{",
"setColorViewAlpha",
"(",
"(",
"int",
")",
"(",
"progress",
"*",
"MAX_ALPHA",
")",
")",
";",
"}",
"else",
"{",
"ViewCompat"... | Pre API 11, this does an alpha animation.
@param progress | [
"Pre",
"API",
"11",
"this",
"does",
"an",
"alpha",
"animation",
"."
] | 890e92d7f2779dce85d3358093135d6b3be58986 | https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L415-L422 |
162,657 | omadahealth/SwipyRefreshLayout | lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java | SwipyRefreshLayout.setProgressBackgroundColor | public void setProgressBackgroundColor(int colorRes) {
mCircleView.setBackgroundColor(colorRes);
mProgress.setBackgroundColor(getResources().getColor(colorRes));
} | java | public void setProgressBackgroundColor(int colorRes) {
mCircleView.setBackgroundColor(colorRes);
mProgress.setBackgroundColor(getResources().getColor(colorRes));
} | [
"public",
"void",
"setProgressBackgroundColor",
"(",
"int",
"colorRes",
")",
"{",
"mCircleView",
".",
"setBackgroundColor",
"(",
"colorRes",
")",
";",
"mProgress",
".",
"setBackgroundColor",
"(",
"getResources",
"(",
")",
".",
"getColor",
"(",
"colorRes",
")",
"... | Set the background color of the progress spinner disc.
@param colorRes Resource id of the color. | [
"Set",
"the",
"background",
"color",
"of",
"the",
"progress",
"spinner",
"disc",
"."
] | 890e92d7f2779dce85d3358093135d6b3be58986 | https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L485-L488 |
162,658 | omadahealth/SwipyRefreshLayout | lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java | SwipyRefreshLayout.setRawDirection | private void setRawDirection(SwipyRefreshLayoutDirection direction) {
if (mDirection == direction) {
return;
}
mDirection = direction;
switch (mDirection) {
case BOTTOM:
mCurrentTargetOffsetTop = mOriginalOffsetTop = getMeasuredHeight();
... | java | private void setRawDirection(SwipyRefreshLayoutDirection direction) {
if (mDirection == direction) {
return;
}
mDirection = direction;
switch (mDirection) {
case BOTTOM:
mCurrentTargetOffsetTop = mOriginalOffsetTop = getMeasuredHeight();
... | [
"private",
"void",
"setRawDirection",
"(",
"SwipyRefreshLayoutDirection",
"direction",
")",
"{",
"if",
"(",
"mDirection",
"==",
"direction",
")",
"{",
"return",
";",
"}",
"mDirection",
"=",
"direction",
";",
"switch",
"(",
"mDirection",
")",
"{",
"case",
"BOTT... | only TOP or Bottom | [
"only",
"TOP",
"or",
"Bottom"
] | 890e92d7f2779dce85d3358093135d6b3be58986 | https://github.com/omadahealth/SwipyRefreshLayout/blob/890e92d7f2779dce85d3358093135d6b3be58986/lib/src/main/java/com/orangegangsters/github/swipyrefreshlayout/library/SwipyRefreshLayout.java#L1136-L1151 |
162,659 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java | PixelTools.uniform | public static boolean uniform(Color color, Pixel[] pixels) {
return Arrays.stream(pixels).allMatch(p -> p.toInt() == color.toRGB().toInt());
} | java | public static boolean uniform(Color color, Pixel[] pixels) {
return Arrays.stream(pixels).allMatch(p -> p.toInt() == color.toRGB().toInt());
} | [
"public",
"static",
"boolean",
"uniform",
"(",
"Color",
"color",
",",
"Pixel",
"[",
"]",
"pixels",
")",
"{",
"return",
"Arrays",
".",
"stream",
"(",
"pixels",
")",
".",
"allMatch",
"(",
"p",
"->",
"p",
".",
"toInt",
"(",
")",
"==",
"color",
".",
"t... | Returns true if all pixels in the array have the same color | [
"Returns",
"true",
"if",
"all",
"pixels",
"in",
"the",
"array",
"have",
"the",
"same",
"color"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java#L74-L76 |
162,660 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java | PixelTools.scale | public static int scale(Double factor, int pixel) {
return rgb(
(int) Math.round(factor * red(pixel)),
(int) Math.round(factor * green(pixel)),
(int) Math.round(factor * blue(pixel))
);
} | java | public static int scale(Double factor, int pixel) {
return rgb(
(int) Math.round(factor * red(pixel)),
(int) Math.round(factor * green(pixel)),
(int) Math.round(factor * blue(pixel))
);
} | [
"public",
"static",
"int",
"scale",
"(",
"Double",
"factor",
",",
"int",
"pixel",
")",
"{",
"return",
"rgb",
"(",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"factor",
"*",
"red",
"(",
"pixel",
")",
")",
",",
"(",
"int",
")",
"Math",
".",
"round"... | Scales the brightness of a pixel. | [
"Scales",
"the",
"brightness",
"of",
"a",
"pixel",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/PixelTools.java#L81-L87 |
162,661 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinAttributes.java | MarvinAttributes.set | public void set(String name, Object value) {
hashAttributes.put(name, value);
if (plugin != null) {
plugin.invalidate();
}
} | java | public void set(String name, Object value) {
hashAttributes.put(name, value);
if (plugin != null) {
plugin.invalidate();
}
} | [
"public",
"void",
"set",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"hashAttributes",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"if",
"(",
"plugin",
"!=",
"null",
")",
"{",
"plugin",
".",
"invalidate",
"(",
")",
";",
"}",
"}"
] | Set an attribute.
@param name attribute name.
@param value attribute value. | [
"Set",
"an",
"attribute",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinAttributes.java#L34-L40 |
162,662 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Spectrum.java | Spectrum.wavelengthToRGB | public static int wavelengthToRGB(float wavelength) {
float gamma = 0.80f;
float r, g, b, factor;
int w = (int)wavelength;
if (w < 380) {
r = 0.0f;
g = 0.0f;
b = 0.0f;
} else if (w < 440) {
r = -(wavelength - 440) / (440 - 380);
g = 0.0f;
b = 1.0f;
} else if (w < 490) {
r = 0.0f;
g ... | java | public static int wavelengthToRGB(float wavelength) {
float gamma = 0.80f;
float r, g, b, factor;
int w = (int)wavelength;
if (w < 380) {
r = 0.0f;
g = 0.0f;
b = 0.0f;
} else if (w < 440) {
r = -(wavelength - 440) / (440 - 380);
g = 0.0f;
b = 1.0f;
} else if (w < 490) {
r = 0.0f;
g ... | [
"public",
"static",
"int",
"wavelengthToRGB",
"(",
"float",
"wavelength",
")",
"{",
"float",
"gamma",
"=",
"0.80f",
";",
"float",
"r",
",",
"g",
",",
"b",
",",
"factor",
";",
"int",
"w",
"=",
"(",
"int",
")",
"wavelength",
";",
"if",
"(",
"w",
"<",... | Convert a wavelength to an RGB value.
@param wavelength wavelength in nanometres
@return the RGB value | [
"Convert",
"a",
"wavelength",
"to",
"an",
"RGB",
"value",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Spectrum.java#L35-L89 |
162,663 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ConvolveFilter.java | ConvolveFilter.convolveHV | public static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData( null );
int rows = kernel.getHeight();
int cols = kernel.getWidth();
int rows2 = rows/2;
int cols2 = cols/2;
for (int... | java | public static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
int index = 0;
float[] matrix = kernel.getKernelData( null );
int rows = kernel.getHeight();
int cols = kernel.getWidth();
int rows2 = rows/2;
int cols2 = cols/2;
for (int... | [
"public",
"static",
"void",
"convolveHV",
"(",
"Kernel",
"kernel",
",",
"int",
"[",
"]",
"inPixels",
",",
"int",
"[",
"]",
"outPixels",
",",
"int",
"width",
",",
"int",
"height",
",",
"boolean",
"alpha",
",",
"int",
"edgeAction",
")",
"{",
"int",
"inde... | Convolve with a 2D kernel.
@param kernel the kernel
@param inPixels the input pixels
@param outPixels the output pixels
@param width the width
@param height the height
@param alpha include alpha channel
@param edgeAction what to do at the edges | [
"Convolve",
"with",
"a",
"2D",
"kernel",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ConvolveFilter.java#L253-L305 |
162,664 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/misc/DaisyFilter.java | DaisyFilter.initPixelsArray | private void initPixelsArray(BufferedImage image) {
int width = image.getWidth();
int height = image.getHeight();
pixels = new int[width * height];
image.getRGB(0, 0, width, height, pixels, 0, width);
} | java | private void initPixelsArray(BufferedImage image) {
int width = image.getWidth();
int height = image.getHeight();
pixels = new int[width * height];
image.getRGB(0, 0, width, height, pixels, 0, width);
} | [
"private",
"void",
"initPixelsArray",
"(",
"BufferedImage",
"image",
")",
"{",
"int",
"width",
"=",
"image",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"image",
".",
"getHeight",
"(",
")",
";",
"pixels",
"=",
"new",
"int",
"[",
"width",
"*",... | takes the pixels from a BufferedImage and stores them in an array | [
"takes",
"the",
"pixels",
"from",
"a",
"BufferedImage",
"and",
"stores",
"them",
"in",
"an",
"array"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/misc/DaisyFilter.java#L158-L164 |
162,665 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/misc/DaisyFilter.java | DaisyFilter.changeColor | private int[] changeColor() {
int[] changedPixels = new int[pixels.length];
double frequenz = 2 * Math.PI / 1020;
for (int i = 0; i < pixels.length; i++) {
int argb = pixels[i];
int a = (argb >> 24) & 0xff;
int r = (argb >> 16) & 0xff;
int g = (ar... | java | private int[] changeColor() {
int[] changedPixels = new int[pixels.length];
double frequenz = 2 * Math.PI / 1020;
for (int i = 0; i < pixels.length; i++) {
int argb = pixels[i];
int a = (argb >> 24) & 0xff;
int r = (argb >> 16) & 0xff;
int g = (ar... | [
"private",
"int",
"[",
"]",
"changeColor",
"(",
")",
"{",
"int",
"[",
"]",
"changedPixels",
"=",
"new",
"int",
"[",
"pixels",
".",
"length",
"]",
";",
"double",
"frequenz",
"=",
"2",
"*",
"Math",
".",
"PI",
"/",
"1020",
";",
"for",
"(",
"int",
"i... | changes the color of the image - more red and less blue
@return new pixel array | [
"changes",
"the",
"color",
"of",
"the",
"image",
"-",
"more",
"red",
"and",
"less",
"blue"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/misc/DaisyFilter.java#L171-L189 |
162,666 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/Orientation.java | Orientation.imageOrientationsOf | private static Set<String> imageOrientationsOf(ImageMetadata metadata) {
String exifIFD0DirName = new ExifIFD0Directory().getName();
Tag[] tags = Arrays.stream(metadata.getDirectories())
.filter(dir -> dir.getName().equals(exifIFD0DirName))
.findFirst()
.map(Directory::getT... | java | private static Set<String> imageOrientationsOf(ImageMetadata metadata) {
String exifIFD0DirName = new ExifIFD0Directory().getName();
Tag[] tags = Arrays.stream(metadata.getDirectories())
.filter(dir -> dir.getName().equals(exifIFD0DirName))
.findFirst()
.map(Directory::getT... | [
"private",
"static",
"Set",
"<",
"String",
">",
"imageOrientationsOf",
"(",
"ImageMetadata",
"metadata",
")",
"{",
"String",
"exifIFD0DirName",
"=",
"new",
"ExifIFD0Directory",
"(",
")",
".",
"getName",
"(",
")",
";",
"Tag",
"[",
"]",
"tags",
"=",
"Arrays",
... | returns the values of the orientation tag | [
"returns",
"the",
"values",
"of",
"the",
"orientation",
"tag"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/Orientation.java#L65-L79 |
162,667 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/math/Noise.java | Noise.noise1 | public static float noise1(float x) {
int bx0, bx1;
float rx0, rx1, sx, t, u, v;
if (start) {
start = false;
init();
}
t = x + N;
bx0 = ((int)t) & BM;
bx1 = (bx0+1) & BM;
rx0 = t - (int)t;
rx1 = rx0 - 1.0f;
sx = s... | java | public static float noise1(float x) {
int bx0, bx1;
float rx0, rx1, sx, t, u, v;
if (start) {
start = false;
init();
}
t = x + N;
bx0 = ((int)t) & BM;
bx1 = (bx0+1) & BM;
rx0 = t - (int)t;
rx1 = rx0 - 1.0f;
sx = s... | [
"public",
"static",
"float",
"noise1",
"(",
"float",
"x",
")",
"{",
"int",
"bx0",
",",
"bx1",
";",
"float",
"rx0",
",",
"rx1",
",",
"sx",
",",
"t",
",",
"u",
",",
"v",
";",
"if",
"(",
"start",
")",
"{",
"start",
"=",
"false",
";",
"init",
"("... | Compute 1-dimensional Perlin noise.
@param x the x value
@return noise value at x in the range -1..1 | [
"Compute",
"1",
"-",
"dimensional",
"Perlin",
"noise",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/math/Noise.java#L89-L109 |
162,668 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/math/Noise.java | Noise.noise2 | public static float noise2(float x, float y) {
int bx0, bx1, by0, by1, b00, b10, b01, b11;
float rx0, rx1, ry0, ry1, q[], sx, sy, a, b, t, u, v;
int i, j;
if (start) {
start = false;
init();
}
t = x + N;
bx0 = ((int)t) & BM;
bx1 =... | java | public static float noise2(float x, float y) {
int bx0, bx1, by0, by1, b00, b10, b01, b11;
float rx0, rx1, ry0, ry1, q[], sx, sy, a, b, t, u, v;
int i, j;
if (start) {
start = false;
init();
}
t = x + N;
bx0 = ((int)t) & BM;
bx1 =... | [
"public",
"static",
"float",
"noise2",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"int",
"bx0",
",",
"bx1",
",",
"by0",
",",
"by1",
",",
"b00",
",",
"b10",
",",
"b01",
",",
"b11",
";",
"float",
"rx0",
",",
"rx1",
",",
"ry0",
",",
"ry1",
... | Compute 2-dimensional Perlin noise.
@param x the x coordinate
@param y the y coordinate
@return noise value at (x,y) | [
"Compute",
"2",
"-",
"dimensional",
"Perlin",
"noise",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/math/Noise.java#L117-L159 |
162,669 | sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/LinearSubpixelInterpolator.java | LinearSubpixelInterpolator.integerPixelCoordinatesAndWeights | private List<Pair<Integer, Double>> integerPixelCoordinatesAndWeights(double d, int numPixels) {
if (d <= 0.5) return Collections.singletonList(new Pair<>(0, 1.0));
else if (d >= numPixels - 0.5) return Collections.singletonList(new Pair<>(numPixels - 1, 1.0));
else {
double shifted ... | java | private List<Pair<Integer, Double>> integerPixelCoordinatesAndWeights(double d, int numPixels) {
if (d <= 0.5) return Collections.singletonList(new Pair<>(0, 1.0));
else if (d >= numPixels - 0.5) return Collections.singletonList(new Pair<>(numPixels - 1, 1.0));
else {
double shifted ... | [
"private",
"List",
"<",
"Pair",
"<",
"Integer",
",",
"Double",
">",
">",
"integerPixelCoordinatesAndWeights",
"(",
"double",
"d",
",",
"int",
"numPixels",
")",
"{",
"if",
"(",
"d",
"<=",
"0.5",
")",
"return",
"Collections",
".",
"singletonList",
"(",
"new"... | Operates on one dimension at a time. | [
"Operates",
"on",
"one",
"dimension",
"at",
"a",
"time",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/LinearSubpixelInterpolator.java#L25-L37 |
162,670 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java | ImageUtils.createImage | public static BufferedImage createImage(ImageProducer producer) {
PixelGrabber pg = new PixelGrabber(producer, 0, 0, -1, -1, null, 0, 0);
try {
pg.grabPixels();
} catch (InterruptedException e) {
throw new RuntimeException("Image fetch interrupted");
}
if ((pg.status() & ImageObserver.ABORT) != 0)
th... | java | public static BufferedImage createImage(ImageProducer producer) {
PixelGrabber pg = new PixelGrabber(producer, 0, 0, -1, -1, null, 0, 0);
try {
pg.grabPixels();
} catch (InterruptedException e) {
throw new RuntimeException("Image fetch interrupted");
}
if ((pg.status() & ImageObserver.ABORT) != 0)
th... | [
"public",
"static",
"BufferedImage",
"createImage",
"(",
"ImageProducer",
"producer",
")",
"{",
"PixelGrabber",
"pg",
"=",
"new",
"PixelGrabber",
"(",
"producer",
",",
"0",
",",
"0",
",",
"-",
"1",
",",
"-",
"1",
",",
"null",
",",
"0",
",",
"0",
")",
... | Cretae a BufferedImage from an ImageProducer.
@param producer the ImageProducer
@return a new TYPE_INT_ARGB BufferedImage | [
"Cretae",
"a",
"BufferedImage",
"from",
"an",
"ImageProducer",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L35-L49 |
162,671 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java | ImageUtils.convertImageToARGB | public static BufferedImage convertImageToARGB( Image image ) {
if ( image instanceof BufferedImage && ((BufferedImage)image).getType() == BufferedImage.TYPE_INT_ARGB )
return (BufferedImage)image;
BufferedImage p = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
G... | java | public static BufferedImage convertImageToARGB( Image image ) {
if ( image instanceof BufferedImage && ((BufferedImage)image).getType() == BufferedImage.TYPE_INT_ARGB )
return (BufferedImage)image;
BufferedImage p = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
G... | [
"public",
"static",
"BufferedImage",
"convertImageToARGB",
"(",
"Image",
"image",
")",
"{",
"if",
"(",
"image",
"instanceof",
"BufferedImage",
"&&",
"(",
"(",
"BufferedImage",
")",
"image",
")",
".",
"getType",
"(",
")",
"==",
"BufferedImage",
".",
"TYPE_INT_A... | Convert an Image into a TYPE_INT_ARGB BufferedImage. If the image is already of this type, the original image is returned unchanged.
@param image the image to convert
@return the converted image | [
"Convert",
"an",
"Image",
"into",
"a",
"TYPE_INT_ARGB",
"BufferedImage",
".",
"If",
"the",
"image",
"is",
"already",
"of",
"this",
"type",
"the",
"original",
"image",
"is",
"returned",
"unchanged",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L56-L64 |
162,672 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java | ImageUtils.cloneImage | public static BufferedImage cloneImage( BufferedImage image ) {
BufferedImage newImage = new BufferedImage( image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB );
Graphics2D g = newImage.createGraphics();
g.drawRenderedImage( image, null );
g.dispose();
return newImage;
} | java | public static BufferedImage cloneImage( BufferedImage image ) {
BufferedImage newImage = new BufferedImage( image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB );
Graphics2D g = newImage.createGraphics();
g.drawRenderedImage( image, null );
g.dispose();
return newImage;
} | [
"public",
"static",
"BufferedImage",
"cloneImage",
"(",
"BufferedImage",
"image",
")",
"{",
"BufferedImage",
"newImage",
"=",
"new",
"BufferedImage",
"(",
"image",
".",
"getWidth",
"(",
")",
",",
"image",
".",
"getHeight",
"(",
")",
",",
"BufferedImage",
".",
... | Clones a BufferedImage.
@param image the image to clone
@return the cloned image | [
"Clones",
"a",
"BufferedImage",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L88-L94 |
162,673 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java | ImageUtils.paintCheckedBackground | public static void paintCheckedBackground(Component c, Graphics g, int x, int y, int width, int height) {
if ( backgroundImage == null ) {
backgroundImage = new BufferedImage( 64, 64, BufferedImage.TYPE_INT_ARGB );
Graphics bg = backgroundImage.createGraphics();
for ( int by = 0; by < 64; by += 8 ) {
for... | java | public static void paintCheckedBackground(Component c, Graphics g, int x, int y, int width, int height) {
if ( backgroundImage == null ) {
backgroundImage = new BufferedImage( 64, 64, BufferedImage.TYPE_INT_ARGB );
Graphics bg = backgroundImage.createGraphics();
for ( int by = 0; by < 64; by += 8 ) {
for... | [
"public",
"static",
"void",
"paintCheckedBackground",
"(",
"Component",
"c",
",",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"if",
"(",
"backgroundImage",
"==",
"null",
")",
"{",
"backgroundIma... | Paint a check pattern, used for a background to indicate image transparency.
@param c the component to draw into
@param g the Graphics objects
@param x the x position
@param y the y position
@param width the width
@param height the height | [
"Paint",
"a",
"check",
"pattern",
"used",
"for",
"a",
"background",
"to",
"indicate",
"image",
"transparency",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L105-L138 |
162,674 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java | ImageUtils.getSelectedBounds | public static Rectangle getSelectedBounds(BufferedImage p) {
int width = p.getWidth();
int height = p.getHeight();
int maxX = 0, maxY = 0, minX = width, minY = height;
boolean anySelected = false;
int y1;
int [] pixels = null;
for (y1 = height-1; y1 >= 0; y1--) {
pixels = getRGB( p, 0, y1, wid... | java | public static Rectangle getSelectedBounds(BufferedImage p) {
int width = p.getWidth();
int height = p.getHeight();
int maxX = 0, maxY = 0, minX = width, minY = height;
boolean anySelected = false;
int y1;
int [] pixels = null;
for (y1 = height-1; y1 >= 0; y1--) {
pixels = getRGB( p, 0, y1, wid... | [
"public",
"static",
"Rectangle",
"getSelectedBounds",
"(",
"BufferedImage",
"p",
")",
"{",
"int",
"width",
"=",
"p",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"p",
".",
"getHeight",
"(",
")",
";",
"int",
"maxX",
"=",
"0",
",",
"maxY",
"="... | Calculates the bounds of the non-transparent parts of the given image.
@param p the image
@return the bounds of the non-transparent area | [
"Calculates",
"the",
"bounds",
"of",
"the",
"non",
"-",
"transparent",
"parts",
"of",
"the",
"given",
"image",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L145-L199 |
162,675 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java | ImageUtils.composeThroughMask | public static void composeThroughMask(Raster src, WritableRaster dst, Raster sel) {
int x = src.getMinX();
int y = src.getMinY();
int w = src.getWidth();
int h = src.getHeight();
int srcRGB[] = null;
int selRGB[] = null;
int dstRGB[] = null;
for ( int i = 0; i < h; i++ ) {
srcRGB = src.getPixels(x,... | java | public static void composeThroughMask(Raster src, WritableRaster dst, Raster sel) {
int x = src.getMinX();
int y = src.getMinY();
int w = src.getWidth();
int h = src.getHeight();
int srcRGB[] = null;
int selRGB[] = null;
int dstRGB[] = null;
for ( int i = 0; i < h; i++ ) {
srcRGB = src.getPixels(x,... | [
"public",
"static",
"void",
"composeThroughMask",
"(",
"Raster",
"src",
",",
"WritableRaster",
"dst",
",",
"Raster",
"sel",
")",
"{",
"int",
"x",
"=",
"src",
".",
"getMinX",
"(",
")",
";",
"int",
"y",
"=",
"src",
".",
"getMinY",
"(",
")",
";",
"int",... | Compose src onto dst using the alpha of sel to interpolate between the two.
I can't think of a way to do this using AlphaComposite.
@param src the source raster
@param dst the destination raster
@param sel the mask raster | [
"Compose",
"src",
"onto",
"dst",
"using",
"the",
"alpha",
"of",
"sel",
"to",
"interpolate",
"between",
"the",
"two",
".",
"I",
"can",
"t",
"think",
"of",
"a",
"way",
"to",
"do",
"this",
"using",
"AlphaComposite",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L208-L247 |
162,676 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/DiffusionFilter.java | DiffusionFilter.setMatrix | public void setMatrix(int[] matrix) {
this.matrix = matrix;
sum = 0;
for (int i = 0; i < matrix.length; i++)
sum += matrix[i];
} | java | public void setMatrix(int[] matrix) {
this.matrix = matrix;
sum = 0;
for (int i = 0; i < matrix.length; i++)
sum += matrix[i];
} | [
"public",
"void",
"setMatrix",
"(",
"int",
"[",
"]",
"matrix",
")",
"{",
"this",
".",
"matrix",
"=",
"matrix",
";",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"matrix",
".",
"length",
";",
"i",
"++",
")",
"sum",
"+... | Set the dither matrix.
@param matrix the dither matrix
@see #getMatrix | [
"Set",
"the",
"dither",
"matrix",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/DiffusionFilter.java#L86-L91 |
162,677 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java | ImageMath.gain | public static float gain(float a, float b) {
/*
float p = (float)Math.log(1.0 - b) / (float)Math.log(0.5);
if (a < .001)
return 0.0f;
else if (a > .999)
return 1.0f;
if (a < 0.5)
return (float)Math.pow(2 * a, p) / 2;
else
return 1.0f - (float)Math.pow(2 * (1. - a), p) / 2;
*/
float c = (1.0f/b-... | java | public static float gain(float a, float b) {
/*
float p = (float)Math.log(1.0 - b) / (float)Math.log(0.5);
if (a < .001)
return 0.0f;
else if (a > .999)
return 1.0f;
if (a < 0.5)
return (float)Math.pow(2 * a, p) / 2;
else
return 1.0f - (float)Math.pow(2 * (1. - a), p) / 2;
*/
float c = (1.0f/b-... | [
"public",
"static",
"float",
"gain",
"(",
"float",
"a",
",",
"float",
"b",
")",
"{",
"/*\n\t\tfloat p = (float)Math.log(1.0 - b) / (float)Math.log(0.5);\n\n\t\tif (a < .001)\n\t\t\treturn 0.0f;\n\t\telse if (a > .999)\n\t\t\treturn 1.0f;\n\t\tif (a < 0.5)\n\t\t\treturn (float)Math.pow(2 * a,... | A variant of the gamma function.
@param a the number to apply gain to
@param b the gain parameter. 0.5 means no change, smaller values reduce gain, larger values increase gain.
@return the output value | [
"A",
"variant",
"of",
"the",
"gamma",
"function",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L62-L80 |
162,678 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java | ImageMath.smoothPulse | public static float smoothPulse(float a1, float a2, float b1, float b2, float x) {
if (x < a1 || x >= b2)
return 0;
if (x >= a2) {
if (x < b1)
return 1.0f;
x = (x - b1) / (b2 - b1);
return 1.0f - (x*x * (3.0f - 2.0f*x));
}
x = (x - a1) / (a2 - a1);
return x*x * (3.0f - 2.0f*x);
} | java | public static float smoothPulse(float a1, float a2, float b1, float b2, float x) {
if (x < a1 || x >= b2)
return 0;
if (x >= a2) {
if (x < b1)
return 1.0f;
x = (x - b1) / (b2 - b1);
return 1.0f - (x*x * (3.0f - 2.0f*x));
}
x = (x - a1) / (a2 - a1);
return x*x * (3.0f - 2.0f*x);
} | [
"public",
"static",
"float",
"smoothPulse",
"(",
"float",
"a1",
",",
"float",
"a2",
",",
"float",
"b1",
",",
"float",
"b2",
",",
"float",
"x",
")",
"{",
"if",
"(",
"x",
"<",
"a1",
"||",
"x",
">=",
"b2",
")",
"return",
"0",
";",
"if",
"(",
"x",
... | A smoothed pulse function. A cubic function is used to smooth the step between two thresholds.
@param a1 the lower threshold position for the start of the pulse
@param a2 the upper threshold position for the start of the pulse
@param b1 the lower threshold position for the end of the pulse
@param b2 the upper threshold... | [
"A",
"smoothed",
"pulse",
"function",
".",
"A",
"cubic",
"function",
"is",
"used",
"to",
"smooth",
"the",
"step",
"between",
"two",
"thresholds",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L112-L123 |
162,679 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java | ImageMath.smoothStep | public static float smoothStep(float a, float b, float x) {
if (x < a)
return 0;
if (x >= b)
return 1;
x = (x - a) / (b - a);
return x*x * (3 - 2*x);
} | java | public static float smoothStep(float a, float b, float x) {
if (x < a)
return 0;
if (x >= b)
return 1;
x = (x - a) / (b - a);
return x*x * (3 - 2*x);
} | [
"public",
"static",
"float",
"smoothStep",
"(",
"float",
"a",
",",
"float",
"b",
",",
"float",
"x",
")",
"{",
"if",
"(",
"x",
"<",
"a",
")",
"return",
"0",
";",
"if",
"(",
"x",
">=",
"b",
")",
"return",
"1",
";",
"x",
"=",
"(",
"x",
"-",
"a... | A smoothed step function. A cubic function is used to smooth the step between two thresholds.
@param a the lower threshold position
@param b the upper threshold position
@param x the input parameter
@return the output value | [
"A",
"smoothed",
"step",
"function",
".",
"A",
"cubic",
"function",
"is",
"used",
"to",
"smooth",
"the",
"step",
"between",
"two",
"thresholds",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L132-L139 |
162,680 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java | ImageMath.mixColors | public static int mixColors(float t, int rgb1, int rgb2) {
int a1 = (rgb1 >> 24) & 0xff;
int r1 = (rgb1 >> 16) & 0xff;
int g1 = (rgb1 >> 8) & 0xff;
int b1 = rgb1 & 0xff;
int a2 = (rgb2 >> 24) & 0xff;
int r2 = (rgb2 >> 16) & 0xff;
int g2 = (rgb2 >> 8) & 0xff;
int b2 = rgb2 & 0xff;
a1 = lerp(t, a1, a2);... | java | public static int mixColors(float t, int rgb1, int rgb2) {
int a1 = (rgb1 >> 24) & 0xff;
int r1 = (rgb1 >> 16) & 0xff;
int g1 = (rgb1 >> 8) & 0xff;
int b1 = rgb1 & 0xff;
int a2 = (rgb2 >> 24) & 0xff;
int r2 = (rgb2 >> 16) & 0xff;
int g2 = (rgb2 >> 8) & 0xff;
int b2 = rgb2 & 0xff;
a1 = lerp(t, a1, a2);... | [
"public",
"static",
"int",
"mixColors",
"(",
"float",
"t",
",",
"int",
"rgb1",
",",
"int",
"rgb2",
")",
"{",
"int",
"a1",
"=",
"(",
"rgb1",
">>",
"24",
")",
"&",
"0xff",
";",
"int",
"r1",
"=",
"(",
"rgb1",
">>",
"16",
")",
"&",
"0xff",
";",
"... | Linear interpolation of ARGB values.
@param t the interpolation parameter
@param rgb1 the lower interpolation range
@param rgb2 the upper interpolation range
@return the interpolated value | [
"Linear",
"interpolation",
"of",
"ARGB",
"values",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L266-L280 |
162,681 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java | ImageMath.bilinearInterpolate | public static int bilinearInterpolate(float x, float y, int nw, int ne, int sw, int se) {
float m0, m1;
int a0 = (nw >> 24) & 0xff;
int r0 = (nw >> 16) & 0xff;
int g0 = (nw >> 8) & 0xff;
int b0 = nw & 0xff;
int a1 = (ne >> 24) & 0xff;
int r1 = (ne >> 16) & 0xff;
int g1 = (ne >> 8) & 0xff;
int b1 = ne ... | java | public static int bilinearInterpolate(float x, float y, int nw, int ne, int sw, int se) {
float m0, m1;
int a0 = (nw >> 24) & 0xff;
int r0 = (nw >> 16) & 0xff;
int g0 = (nw >> 8) & 0xff;
int b0 = nw & 0xff;
int a1 = (ne >> 24) & 0xff;
int r1 = (ne >> 16) & 0xff;
int g1 = (ne >> 8) & 0xff;
int b1 = ne ... | [
"public",
"static",
"int",
"bilinearInterpolate",
"(",
"float",
"x",
",",
"float",
"y",
",",
"int",
"nw",
",",
"int",
"ne",
",",
"int",
"sw",
",",
"int",
"se",
")",
"{",
"float",
"m0",
",",
"m1",
";",
"int",
"a0",
"=",
"(",
"nw",
">>",
"24",
")... | Bilinear interpolation of ARGB values.
@param x the X interpolation parameter 0..1
@param y the y interpolation parameter 0..1
@param rgb array of four ARGB values in the order NW, NE, SW, SE
@return the interpolated value | [
"Bilinear",
"interpolation",
"of",
"ARGB",
"values",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L289-L328 |
162,682 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java | ImageMath.brightnessNTSC | public static int brightnessNTSC(int rgb) {
int r = (rgb >> 16) & 0xff;
int g = (rgb >> 8) & 0xff;
int b = rgb & 0xff;
return (int)(r*0.299f + g*0.587f + b*0.114f);
} | java | public static int brightnessNTSC(int rgb) {
int r = (rgb >> 16) & 0xff;
int g = (rgb >> 8) & 0xff;
int b = rgb & 0xff;
return (int)(r*0.299f + g*0.587f + b*0.114f);
} | [
"public",
"static",
"int",
"brightnessNTSC",
"(",
"int",
"rgb",
")",
"{",
"int",
"r",
"=",
"(",
"rgb",
">>",
"16",
")",
"&",
"0xff",
";",
"int",
"g",
"=",
"(",
"rgb",
">>",
"8",
")",
"&",
"0xff",
";",
"int",
"b",
"=",
"rgb",
"&",
"0xff",
";",... | Return the NTSC gray level of an RGB value.
@param rgb1 the input pixel
@return the gray level (0-255) | [
"Return",
"the",
"NTSC",
"gray",
"level",
"of",
"an",
"RGB",
"value",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L335-L340 |
162,683 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java | ImageMath.colorSpline | public static int colorSpline(int x, int numKnots, int[] xknots, int[] yknots) {
int span;
int numSpans = numKnots - 3;
float k0, k1, k2, k3;
float c0, c1, c2, c3;
if (numSpans < 1)
throw new IllegalArgumentException("Too few knots in spline");
for (span = 0; span < numSpans; span++)
if (xknots[... | java | public static int colorSpline(int x, int numKnots, int[] xknots, int[] yknots) {
int span;
int numSpans = numKnots - 3;
float k0, k1, k2, k3;
float c0, c1, c2, c3;
if (numSpans < 1)
throw new IllegalArgumentException("Too few knots in spline");
for (span = 0; span < numSpans; span++)
if (xknots[... | [
"public",
"static",
"int",
"colorSpline",
"(",
"int",
"x",
",",
"int",
"numKnots",
",",
"int",
"[",
"]",
"xknots",
",",
"int",
"[",
"]",
"yknots",
")",
"{",
"int",
"span",
";",
"int",
"numSpans",
"=",
"numKnots",
"-",
"3",
";",
"float",
"k0",
",",
... | Compute a Catmull-Rom spline for RGB values, but with variable knot spacing.
@param x the input parameter
@param numKnots the number of knots in the spline
@param xknots the array of knot x values
@param yknots the array of knot y values
@return the spline value | [
"Compute",
"a",
"Catmull",
"-",
"Rom",
"spline",
"for",
"RGB",
"values",
"but",
"with",
"variable",
"knot",
"spacing",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L491-L534 |
162,684 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.copyTo | public void copyTo(Gradient g) {
g.numKnots = numKnots;
g.map = (int[])map.clone();
g.xKnots = (int[])xKnots.clone();
g.yKnots = (int[])yKnots.clone();
g.knotTypes = (byte[])knotTypes.clone();
} | java | public void copyTo(Gradient g) {
g.numKnots = numKnots;
g.map = (int[])map.clone();
g.xKnots = (int[])xKnots.clone();
g.yKnots = (int[])yKnots.clone();
g.knotTypes = (byte[])knotTypes.clone();
} | [
"public",
"void",
"copyTo",
"(",
"Gradient",
"g",
")",
"{",
"g",
".",
"numKnots",
"=",
"numKnots",
";",
"g",
".",
"map",
"=",
"(",
"int",
"[",
"]",
")",
"map",
".",
"clone",
"(",
")",
";",
"g",
".",
"xKnots",
"=",
"(",
"int",
"[",
"]",
")",
... | Copy one Gradient into another.
@param g the Gradient to copy into | [
"Copy",
"one",
"Gradient",
"into",
"another",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L138-L144 |
162,685 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.setColor | public void setColor(int n, int color) {
int firstColor = map[0];
int lastColor = map[256-1];
if (n > 0)
for (int i = 0; i < n; i++)
map[i] = ImageMath.mixColors((float)i/n, firstColor, color);
if (n < 256-1)
for (int i = n; i < 256; i++)
map[i] = ImageMath.mixColors((float)(i-n)/(256-n), color, l... | java | public void setColor(int n, int color) {
int firstColor = map[0];
int lastColor = map[256-1];
if (n > 0)
for (int i = 0; i < n; i++)
map[i] = ImageMath.mixColors((float)i/n, firstColor, color);
if (n < 256-1)
for (int i = n; i < 256; i++)
map[i] = ImageMath.mixColors((float)(i-n)/(256-n), color, l... | [
"public",
"void",
"setColor",
"(",
"int",
"n",
",",
"int",
"color",
")",
"{",
"int",
"firstColor",
"=",
"map",
"[",
"0",
"]",
";",
"int",
"lastColor",
"=",
"map",
"[",
"256",
"-",
"1",
"]",
";",
"if",
"(",
"n",
">",
"0",
")",
"for",
"(",
"int... | Set a knot color.
@param n the knot index
@param color the color | [
"Set",
"a",
"knot",
"color",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L151-L160 |
162,686 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.setKnotType | public void setKnotType(int n, int type) {
knotTypes[n] = (byte)((knotTypes[n] & ~COLOR_MASK) | type);
rebuildGradient();
} | java | public void setKnotType(int n, int type) {
knotTypes[n] = (byte)((knotTypes[n] & ~COLOR_MASK) | type);
rebuildGradient();
} | [
"public",
"void",
"setKnotType",
"(",
"int",
"n",
",",
"int",
"type",
")",
"{",
"knotTypes",
"[",
"n",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"knotTypes",
"[",
"n",
"]",
"&",
"~",
"COLOR_MASK",
")",
"|",
"type",
")",
";",
"rebuildGradient",
"(",
"... | Set a knot type.
@param n the knot index
@param type the type
@see #getKnotType | [
"Set",
"a",
"knot",
"type",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L197-L200 |
162,687 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.setKnotBlend | public void setKnotBlend(int n, int type) {
knotTypes[n] = (byte)((knotTypes[n] & ~BLEND_MASK) | type);
rebuildGradient();
} | java | public void setKnotBlend(int n, int type) {
knotTypes[n] = (byte)((knotTypes[n] & ~BLEND_MASK) | type);
rebuildGradient();
} | [
"public",
"void",
"setKnotBlend",
"(",
"int",
"n",
",",
"int",
"type",
")",
"{",
"knotTypes",
"[",
"n",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"knotTypes",
"[",
"n",
"]",
"&",
"~",
"BLEND_MASK",
")",
"|",
"type",
")",
";",
"rebuildGradient",
"(",
... | Set a knot blend type.
@param n the knot index
@param type the knot blend type
@see #getKnotBlend | [
"Set",
"a",
"knot",
"blend",
"type",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L218-L221 |
162,688 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.setKnots | public void setKnots(int[] x, int[] rgb, byte[] types) {
numKnots = rgb.length+2;
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
if (x != null)
System.arraycopy(x, 0, xKnots, 1, numKnots-2);
else
for (int i = 1; i > numKnots-1; i++)
xKnots[i] = 255*i/(numKn... | java | public void setKnots(int[] x, int[] rgb, byte[] types) {
numKnots = rgb.length+2;
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
if (x != null)
System.arraycopy(x, 0, xKnots, 1, numKnots-2);
else
for (int i = 1; i > numKnots-1; i++)
xKnots[i] = 255*i/(numKn... | [
"public",
"void",
"setKnots",
"(",
"int",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"rgb",
",",
"byte",
"[",
"]",
"types",
")",
"{",
"numKnots",
"=",
"rgb",
".",
"length",
"+",
"2",
";",
"xKnots",
"=",
"new",
"int",
"[",
"numKnots",
"]",
";",
"yKnot... | Set the values of all the knots.
This version does not require the "extra" knots at -1 and 256
@param x the knot positions
@param rgb the knot colors
@param types the knot types | [
"Set",
"the",
"values",
"of",
"all",
"the",
"knots",
".",
"This",
"version",
"does",
"not",
"require",
"the",
"extra",
"knots",
"at",
"-",
"1",
"and",
"256"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L288-L306 |
162,689 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.setKnots | public void setKnots(int[] x, int[] y, byte[] types, int offset, int count) {
numKnots = count;
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
System.arraycopy(x, offset, xKnots, 0, numKnots);
System.arraycopy(y, offset, yKnots, 0, numKnots);
System.arraycopy(types... | java | public void setKnots(int[] x, int[] y, byte[] types, int offset, int count) {
numKnots = count;
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
System.arraycopy(x, offset, xKnots, 0, numKnots);
System.arraycopy(y, offset, yKnots, 0, numKnots);
System.arraycopy(types... | [
"public",
"void",
"setKnots",
"(",
"int",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
",",
"byte",
"[",
"]",
"types",
",",
"int",
"offset",
",",
"int",
"count",
")",
"{",
"numKnots",
"=",
"count",
";",
"xKnots",
"=",
"new",
"int",
"[",
"numKnots",
... | Set the values of a set of knots.
@param x the knot positions
@param y the knot colors
@param types the knot types
@param offset the first knot to set
@param count the number of knots | [
"Set",
"the",
"values",
"of",
"a",
"set",
"of",
"knots",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L316-L326 |
162,690 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.splitSpan | public void splitSpan(int n) {
int x = (xKnots[n] + xKnots[n+1])/2;
addKnot(x, getColor(x/256.0f), knotTypes[n]);
rebuildGradient();
} | java | public void splitSpan(int n) {
int x = (xKnots[n] + xKnots[n+1])/2;
addKnot(x, getColor(x/256.0f), knotTypes[n]);
rebuildGradient();
} | [
"public",
"void",
"splitSpan",
"(",
"int",
"n",
")",
"{",
"int",
"x",
"=",
"(",
"xKnots",
"[",
"n",
"]",
"+",
"xKnots",
"[",
"n",
"+",
"1",
"]",
")",
"/",
"2",
";",
"addKnot",
"(",
"x",
",",
"getColor",
"(",
"x",
"/",
"256.0f",
")",
",",
"k... | Split a span into two by adding a knot in the middle.
@param n the span index | [
"Split",
"a",
"span",
"into",
"two",
"by",
"adding",
"a",
"knot",
"in",
"the",
"middle",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L332-L336 |
162,691 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.knotAt | public int knotAt(int x) {
for (int i = 1; i < numKnots-1; i++)
if (xKnots[i+1] > x)
return i;
return 1;
} | java | public int knotAt(int x) {
for (int i = 1; i < numKnots-1; i++)
if (xKnots[i+1] > x)
return i;
return 1;
} | [
"public",
"int",
"knotAt",
"(",
"int",
"x",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"numKnots",
"-",
"1",
";",
"i",
"++",
")",
"if",
"(",
"xKnots",
"[",
"i",
"+",
"1",
"]",
">",
"x",
")",
"return",
"i",
";",
"return",
"... | Return the knot at a given position.
@param x the position
@return the knot number, or 1 if no knot found | [
"Return",
"the",
"knot",
"at",
"a",
"given",
"position",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L365-L370 |
162,692 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.randomize | public void randomize() {
numKnots = 4 + (int)(6*Math.random());
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
for (int i = 0; i < numKnots; i++) {
xKnots[i] = (int)(255 * Math.random());
yKnots[i] = 0xff000000 | ((int)(255 * Math.random()) << 16) | ((int)(255 *... | java | public void randomize() {
numKnots = 4 + (int)(6*Math.random());
xKnots = new int[numKnots];
yKnots = new int[numKnots];
knotTypes = new byte[numKnots];
for (int i = 0; i < numKnots; i++) {
xKnots[i] = (int)(255 * Math.random());
yKnots[i] = 0xff000000 | ((int)(255 * Math.random()) << 16) | ((int)(255 *... | [
"public",
"void",
"randomize",
"(",
")",
"{",
"numKnots",
"=",
"4",
"+",
"(",
"int",
")",
"(",
"6",
"*",
"Math",
".",
"random",
"(",
")",
")",
";",
"xKnots",
"=",
"new",
"int",
"[",
"numKnots",
"]",
";",
"yKnots",
"=",
"new",
"int",
"[",
"numKn... | Randomize the gradient. | [
"Randomize",
"the",
"gradient",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L464-L480 |
162,693 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.mutate | public void mutate(float amount) {
for (int i = 0; i < numKnots; i++) {
int rgb = yKnots[i];
int r = ((rgb >> 16) & 0xff);
int g = ((rgb >> 8) & 0xff);
int b = (rgb & 0xff);
r = PixelUtils.clamp( (int)(r + amount * 255 * (Math.random()-0.5)) );
g = PixelUtils.clamp( (int)(g + amount * 255 * (Math.ra... | java | public void mutate(float amount) {
for (int i = 0; i < numKnots; i++) {
int rgb = yKnots[i];
int r = ((rgb >> 16) & 0xff);
int g = ((rgb >> 8) & 0xff);
int b = (rgb & 0xff);
r = PixelUtils.clamp( (int)(r + amount * 255 * (Math.random()-0.5)) );
g = PixelUtils.clamp( (int)(g + amount * 255 * (Math.ra... | [
"public",
"void",
"mutate",
"(",
"float",
"amount",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numKnots",
";",
"i",
"++",
")",
"{",
"int",
"rgb",
"=",
"yKnots",
"[",
"i",
"]",
";",
"int",
"r",
"=",
"(",
"(",
"rgb",
">>",
"1... | Mutate the gradient.
@param amount the amount in the range zero to one | [
"Mutate",
"the",
"gradient",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L486-L500 |
162,694 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java | MarvinImage.setBufferedImage | public void setBufferedImage(BufferedImage img) {
image = img;
width = img.getWidth();
height = img.getHeight();
updateColorArray();
} | java | public void setBufferedImage(BufferedImage img) {
image = img;
width = img.getWidth();
height = img.getHeight();
updateColorArray();
} | [
"public",
"void",
"setBufferedImage",
"(",
"BufferedImage",
"img",
")",
"{",
"image",
"=",
"img",
";",
"width",
"=",
"img",
".",
"getWidth",
"(",
")",
";",
"height",
"=",
"img",
".",
"getHeight",
"(",
")",
";",
"updateColorArray",
"(",
")",
";",
"}"
] | Sets a new image
@param BufferedImage imagem | [
"Sets",
"a",
"new",
"image"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L353-L358 |
162,695 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java | MarvinImage.getNewImageInstance | public BufferedImage getNewImageInstance() {
BufferedImage buf = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
buf.setData(image.getData());
return buf;
} | java | public BufferedImage getNewImageInstance() {
BufferedImage buf = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
buf.setData(image.getData());
return buf;
} | [
"public",
"BufferedImage",
"getNewImageInstance",
"(",
")",
"{",
"BufferedImage",
"buf",
"=",
"new",
"BufferedImage",
"(",
"image",
".",
"getWidth",
"(",
")",
",",
"image",
".",
"getHeight",
"(",
")",
",",
"image",
".",
"getType",
"(",
")",
")",
";",
"bu... | Return a new instance of the BufferedImage
@return BufferedImage | [
"Return",
"a",
"new",
"instance",
"of",
"the",
"BufferedImage"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L467-L471 |
162,696 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java | MarvinImage.getBufferedImage | public BufferedImage getBufferedImage(int width, int height) {
// using the new approach of Java 2D API
BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) buf.getGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATIO... | java | public BufferedImage getBufferedImage(int width, int height) {
// using the new approach of Java 2D API
BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) buf.getGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATIO... | [
"public",
"BufferedImage",
"getBufferedImage",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"// using the new approach of Java 2D API",
"BufferedImage",
"buf",
"=",
"new",
"BufferedImage",
"(",
"width",
",",
"height",
",",
"BufferedImage",
".",
"TYPE_INT_ARGB"... | Resize and return the image passing the new height and width
@param height
@param width
@return | [
"Resize",
"and",
"return",
"the",
"image",
"passing",
"the",
"new",
"height",
"and",
"width"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L480-L488 |
162,697 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java | MarvinImage.resize | public void resize(int w, int h) {
// using the new approach of Java 2D API
BufferedImage buf = new BufferedImage(w, h, image.getType());
Graphics2D g2d = (Graphics2D) buf.getGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);... | java | public void resize(int w, int h) {
// using the new approach of Java 2D API
BufferedImage buf = new BufferedImage(w, h, image.getType());
Graphics2D g2d = (Graphics2D) buf.getGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);... | [
"public",
"void",
"resize",
"(",
"int",
"w",
",",
"int",
"h",
")",
"{",
"// using the new approach of Java 2D API",
"BufferedImage",
"buf",
"=",
"new",
"BufferedImage",
"(",
"w",
",",
"h",
",",
"image",
".",
"getType",
"(",
")",
")",
";",
"Graphics2D",
"g2... | Resize the image passing the new height and width
@param height
@param width
@return | [
"Resize",
"the",
"image",
"passing",
"the",
"new",
"height",
"and",
"width"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L534-L546 |
162,698 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java | MarvinImage.multi8p | public double multi8p(int x, int y, double masc) {
int aR = getIntComponent0(x - 1, y - 1);
int bR = getIntComponent0(x - 1, y);
int cR = getIntComponent0(x - 1, y + 1);
int aG = getIntComponent1(x - 1, y - 1);
int bG = getIntComponent1(x - 1, y);
int cG = getIntComponent... | java | public double multi8p(int x, int y, double masc) {
int aR = getIntComponent0(x - 1, y - 1);
int bR = getIntComponent0(x - 1, y);
int cR = getIntComponent0(x - 1, y + 1);
int aG = getIntComponent1(x - 1, y - 1);
int bG = getIntComponent1(x - 1, y);
int cG = getIntComponent... | [
"public",
"double",
"multi8p",
"(",
"int",
"x",
",",
"int",
"y",
",",
"double",
"masc",
")",
"{",
"int",
"aR",
"=",
"getIntComponent0",
"(",
"x",
"-",
"1",
",",
"y",
"-",
"1",
")",
";",
"int",
"bR",
"=",
"getIntComponent0",
"(",
"x",
"-",
"1",
... | Multiple of gradient windwos per masc relation of x y
@return int[] | [
"Multiple",
"of",
"gradient",
"windwos",
"per",
"masc",
"relation",
"of",
"x",
"y"
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L565-L606 |
162,699 | sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java | MarvinImage.fillRect | public void fillRect(int x, int y, int w, int h, Color c) {
int color = c.getRGB();
for (int i = x; i < x + w; i++) {
for (int j = y; j < y + h; j++) {
setIntColor(i, j, color);
}
}
} | java | public void fillRect(int x, int y, int w, int h, Color c) {
int color = c.getRGB();
for (int i = x; i < x + w; i++) {
for (int j = y; j < y + h; j++) {
setIntColor(i, j, color);
}
}
} | [
"public",
"void",
"fillRect",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
",",
"Color",
"c",
")",
"{",
"int",
"color",
"=",
"c",
".",
"getRGB",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"x",
";",
"i",
"<",
"x",
"... | Fills a rectangle in the image.
@param x rect�s start position in x-axis
@param y rect�s start positioj in y-axis
@param w rect�s width
@param h rect�s height
@param c rect�s color | [
"Fills",
"a",
"rectangle",
"in",
"the",
"image",
"."
] | 52dab448136e6657a71951b0e6b7d5e64dc979ac | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L707-L714 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.