repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
deeplearning4j/deeplearning4j
arbiter/arbiter-deeplearning4j/src/main/java/org/deeplearning4j/arbiter/scoring/util/ScoreUtil.java
ScoreUtil.getEvaluation
public static Evaluation getEvaluation(ComputationGraph model, MultiDataSetIterator testData) { if (model.getNumOutputArrays() != 1) throw new IllegalStateException("GraphSetSetAccuracyScoreFunction cannot be " + "applied to ComputationGraphs with more than one output. NumOutputs = " + model.getNumOutputArrays()); return model.evaluate(testData); }
java
public static Evaluation getEvaluation(ComputationGraph model, MultiDataSetIterator testData) { if (model.getNumOutputArrays() != 1) throw new IllegalStateException("GraphSetSetAccuracyScoreFunction cannot be " + "applied to ComputationGraphs with more than one output. NumOutputs = " + model.getNumOutputArrays()); return model.evaluate(testData); }
[ "public", "static", "Evaluation", "getEvaluation", "(", "ComputationGraph", "model", ",", "MultiDataSetIterator", "testData", ")", "{", "if", "(", "model", ".", "getNumOutputArrays", "(", ")", "!=", "1", ")", "throw", "new", "IllegalStateException", "(", "\"GraphS...
Get the evaluation for the given model and test dataset @param model the model to get the evaluation from @param testData the test data to do the evaluation on @return the evaluation object with accumulated statistics for the current test data
[ "Get", "the", "evaluation", "for", "the", "given", "model", "and", "test", "dataset" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-deeplearning4j/src/main/java/org/deeplearning4j/arbiter/scoring/util/ScoreUtil.java#L105-L112
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/massindex/impl/Executors.java
Executors.newFixedThreadPool
public static ThreadPoolExecutor newFixedThreadPool(int threads, String groupname, int queueSize) { return new ThreadPoolExecutor( threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>( queueSize ), new SearchThreadFactory( groupname ), new BlockPolicy() ); }
java
public static ThreadPoolExecutor newFixedThreadPool(int threads, String groupname, int queueSize) { return new ThreadPoolExecutor( threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>( queueSize ), new SearchThreadFactory( groupname ), new BlockPolicy() ); }
[ "public", "static", "ThreadPoolExecutor", "newFixedThreadPool", "(", "int", "threads", ",", "String", "groupname", ",", "int", "queueSize", ")", "{", "return", "new", "ThreadPoolExecutor", "(", "threads", ",", "threads", ",", "0L", ",", "TimeUnit", ".", "MILLISE...
Creates a new fixed size ThreadPoolExecutor @param threads the number of threads @param groupname a label to identify the threadpool; useful for profiling. @param queueSize the size of the queue to store Runnables when all threads are busy @return the new ExecutorService
[ "Creates", "a", "new", "fixed", "size", "ThreadPoolExecutor" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/massindex/impl/Executors.java#L61-L64
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java
CommerceNotificationTemplatePersistenceImpl.fetchByUUID_G
@Override public CommerceNotificationTemplate fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
java
@Override public CommerceNotificationTemplate fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
[ "@", "Override", "public", "CommerceNotificationTemplate", "fetchByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "{", "return", "fetchByUUID_G", "(", "uuid", ",", "groupId", ",", "true", ")", ";", "}" ]
Returns the commerce notification template where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param uuid the uuid @param groupId the group ID @return the matching commerce notification template, or <code>null</code> if a matching commerce notification template could not be found
[ "Returns", "the", "commerce", "notification", "template", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "f...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L716-L719
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/logs/Log4jConfigurationHelper.java
Log4jConfigurationHelper.updateLog4jConfiguration
public static void updateLog4jConfiguration(Class<?> targetClass, String log4jPath, String log4jFileName) throws IOException { Closer closer = Closer.create(); try { InputStream fileInputStream = closer.register(new FileInputStream(log4jPath)); InputStream inputStream = closer.register(targetClass.getResourceAsStream("/" + log4jFileName)); Properties customProperties = new Properties(); customProperties.load(fileInputStream); Properties originalProperties = new Properties(); originalProperties.load(inputStream); for (Entry<Object, Object> entry : customProperties.entrySet()) { originalProperties.setProperty(entry.getKey().toString(), entry.getValue().toString()); } LogManager.resetConfiguration(); PropertyConfigurator.configure(originalProperties); } catch (Throwable t) { throw closer.rethrow(t); } finally { closer.close(); } }
java
public static void updateLog4jConfiguration(Class<?> targetClass, String log4jPath, String log4jFileName) throws IOException { Closer closer = Closer.create(); try { InputStream fileInputStream = closer.register(new FileInputStream(log4jPath)); InputStream inputStream = closer.register(targetClass.getResourceAsStream("/" + log4jFileName)); Properties customProperties = new Properties(); customProperties.load(fileInputStream); Properties originalProperties = new Properties(); originalProperties.load(inputStream); for (Entry<Object, Object> entry : customProperties.entrySet()) { originalProperties.setProperty(entry.getKey().toString(), entry.getValue().toString()); } LogManager.resetConfiguration(); PropertyConfigurator.configure(originalProperties); } catch (Throwable t) { throw closer.rethrow(t); } finally { closer.close(); } }
[ "public", "static", "void", "updateLog4jConfiguration", "(", "Class", "<", "?", ">", "targetClass", ",", "String", "log4jPath", ",", "String", "log4jFileName", ")", "throws", "IOException", "{", "Closer", "closer", "=", "Closer", ".", "create", "(", ")", ";", ...
Update the log4j configuration. @param targetClass the target class used to get the original log4j configuration file as a resource @param log4jPath the custom log4j configuration properties file path @param log4jFileName the custom log4j configuration properties file name @throws IOException if there's something wrong with updating the log4j configuration
[ "Update", "the", "log4j", "configuration", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/logs/Log4jConfigurationHelper.java#L47-L69
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
ComponentSupport.getViewRoot
public static UIViewRoot getViewRoot(FaceletContext ctx, UIComponent parent) { UIComponent c = parent; do { if (c instanceof UIViewRoot) { return (UIViewRoot) c; } else { c = c.getParent(); } } while (c != null); UIViewRoot root = ctx.getFacesContext().getViewRoot(); if (root == null) { root = FaceletCompositionContext.getCurrentInstance(ctx).getViewRoot(ctx.getFacesContext()); } return root; }
java
public static UIViewRoot getViewRoot(FaceletContext ctx, UIComponent parent) { UIComponent c = parent; do { if (c instanceof UIViewRoot) { return (UIViewRoot) c; } else { c = c.getParent(); } } while (c != null); UIViewRoot root = ctx.getFacesContext().getViewRoot(); if (root == null) { root = FaceletCompositionContext.getCurrentInstance(ctx).getViewRoot(ctx.getFacesContext()); } return root; }
[ "public", "static", "UIViewRoot", "getViewRoot", "(", "FaceletContext", "ctx", ",", "UIComponent", "parent", ")", "{", "UIComponent", "c", "=", "parent", ";", "do", "{", "if", "(", "c", "instanceof", "UIViewRoot", ")", "{", "return", "(", "UIViewRoot", ")", ...
Tries to walk up the parent to find the UIViewRoot, if not found, then go to FaceletContext's FacesContext for the view root. @param ctx FaceletContext @param parent UIComponent to search from @return UIViewRoot instance for this evaluation
[ "Tries", "to", "walk", "up", "the", "parent", "to", "find", "the", "UIViewRoot", "if", "not", "found", "then", "go", "to", "FaceletContext", "s", "FacesContext", "for", "the", "view", "root", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java#L448-L469
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/Validator.java
Validator.mergeMultiValuePropertyForKey
ValidationResult mergeMultiValuePropertyForKey(JSONArray currentValues, JSONArray newValues, String action, String key) { ValidationResult vr = new ValidationResult(); Boolean remove = REMOVE_VALUES_OPERATION.equals(action); vr = _mergeListInternalForKey(key, currentValues, newValues, remove, vr); return vr; }
java
ValidationResult mergeMultiValuePropertyForKey(JSONArray currentValues, JSONArray newValues, String action, String key) { ValidationResult vr = new ValidationResult(); Boolean remove = REMOVE_VALUES_OPERATION.equals(action); vr = _mergeListInternalForKey(key, currentValues, newValues, remove, vr); return vr; }
[ "ValidationResult", "mergeMultiValuePropertyForKey", "(", "JSONArray", "currentValues", ",", "JSONArray", "newValues", ",", "String", "action", ",", "String", "key", ")", "{", "ValidationResult", "vr", "=", "new", "ValidationResult", "(", ")", ";", "Boolean", "remov...
Merges a multi-value property JSONArray. <p/> trims to max length currently 100 items, on a FIFO basis <p/> please clean the key and newValues values before calling this @param currentValues current JSONArray property value @param newValues JSONArray of new values @param action String the action to take relative to the new values ($add, $remove) @param key String the property key @return The {@link ValidationResult} object containing the merged value, and the error code(if any)
[ "Merges", "a", "multi", "-", "value", "property", "JSONArray", ".", "<p", "/", ">", "trims", "to", "max", "length", "currently", "100", "items", "on", "a", "FIFO", "basis", "<p", "/", ">", "please", "clean", "the", "key", "and", "newValues", "values", ...
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/Validator.java#L177-L182
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java
SnapshotsInner.beginCreateOrUpdate
public SnapshotInner beginCreateOrUpdate(String resourceGroupName, String snapshotName, SnapshotInner snapshot) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).toBlocking().single().body(); }
java
public SnapshotInner beginCreateOrUpdate(String resourceGroupName, String snapshotName, SnapshotInner snapshot) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).toBlocking().single().body(); }
[ "public", "SnapshotInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "snapshotName", ",", "SnapshotInner", "snapshot", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "snapshotName", ",", "sna...
Creates or updates a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @param snapshot Snapshot object supplied in the body of the Put disk operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SnapshotInner object if successful.
[ "Creates", "or", "updates", "a", "snapshot", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L221-L223
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.rebootComputeNode
public void rebootComputeNode(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption) throws BatchErrorException, IOException { rebootComputeNode(poolId, nodeId, nodeRebootOption, null); }
java
public void rebootComputeNode(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption) throws BatchErrorException, IOException { rebootComputeNode(poolId, nodeId, nodeRebootOption, null); }
[ "public", "void", "rebootComputeNode", "(", "String", "poolId", ",", "String", "nodeId", ",", "ComputeNodeRebootOption", "nodeRebootOption", ")", "throws", "BatchErrorException", ",", "IOException", "{", "rebootComputeNode", "(", "poolId", ",", "nodeId", ",", "nodeReb...
Reboots the specified compute node. <p>You can reboot a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p> @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node to reboot. @param nodeRebootOption Specifies when to reboot the node and what to do with currently running tasks. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Reboots", "the", "specified", "compute", "node", ".", "<p", ">", "You", "can", "reboot", "a", "compute", "node", "only", "when", "it", "is", "in", "the", "{", "@link", "com", ".", "microsoft", ".", "azure", ".", "batch", ".", "protocol", ".", "models"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L291-L293
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/TransactionImpl.java
TransactionImpl.setCascadingDelete
public void setCascadingDelete(Class target, String referenceField, boolean doCascade) { ClassDescriptor cld = getBroker().getClassDescriptor(target); ObjectReferenceDescriptor ord = cld.getObjectReferenceDescriptorByName(referenceField); if(ord == null) { ord = cld.getCollectionDescriptorByName(referenceField); } if(ord == null) { throw new CascadeSettingException("Invalid reference field name '" + referenceField + "', can't find 1:1, 1:n or m:n relation with that name in " + target); } runtimeCascadeDeleteMap.put(ord, (doCascade ? Boolean.TRUE : Boolean.FALSE)); }
java
public void setCascadingDelete(Class target, String referenceField, boolean doCascade) { ClassDescriptor cld = getBroker().getClassDescriptor(target); ObjectReferenceDescriptor ord = cld.getObjectReferenceDescriptorByName(referenceField); if(ord == null) { ord = cld.getCollectionDescriptorByName(referenceField); } if(ord == null) { throw new CascadeSettingException("Invalid reference field name '" + referenceField + "', can't find 1:1, 1:n or m:n relation with that name in " + target); } runtimeCascadeDeleteMap.put(ord, (doCascade ? Boolean.TRUE : Boolean.FALSE)); }
[ "public", "void", "setCascadingDelete", "(", "Class", "target", ",", "String", "referenceField", ",", "boolean", "doCascade", ")", "{", "ClassDescriptor", "cld", "=", "getBroker", "(", ")", ".", "getClassDescriptor", "(", "target", ")", ";", "ObjectReferenceDescri...
Allows to change the <em>cascading delete</em> behavior of the specified reference of the target class while this transaction is in use. @param target The class to change cascading delete behavior of the references. @param referenceField The field name of the 1:1, 1:n or 1:n reference. @param doCascade If <em>true</em> cascading delete is enabled, <em>false</em> disabled.
[ "Allows", "to", "change", "the", "<em", ">", "cascading", "delete<", "/", "em", ">", "behavior", "of", "the", "specified", "reference", "of", "the", "target", "class", "while", "this", "transaction", "is", "in", "use", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/TransactionImpl.java#L1395-L1409
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/Mappings.java
Mappings.toArray
public int[][] toArray() { int[][] res = new int[14][]; int size = 0; for (int[] map : this) { if (size == res.length) res = Arrays.copyOf(res, size + (size >> 1)); res[size++] = map.clone(); } return Arrays.copyOf(res, size); }
java
public int[][] toArray() { int[][] res = new int[14][]; int size = 0; for (int[] map : this) { if (size == res.length) res = Arrays.copyOf(res, size + (size >> 1)); res[size++] = map.clone(); } return Arrays.copyOf(res, size); }
[ "public", "int", "[", "]", "[", "]", "toArray", "(", ")", "{", "int", "[", "]", "[", "]", "res", "=", "new", "int", "[", "14", "]", "[", "", "]", ";", "int", "size", "=", "0", ";", "for", "(", "int", "[", "]", "map", ":", "this", ")", "...
Mappings are lazily generated and best used in a loop. However if all mappings are required this method can provide a fixed size array of mappings. <blockquote><pre> IAtomContainer query = ...; IAtomContainer target = ...; Pattern pat = Pattern.findSubstructure(query); // lazily iterator for (int[] mapping : pat.matchAll(target)) { // logic... } int[][] mappings = pat.matchAll(target) .toArray(); // same as lazy iterator but we now can refer to and parse 'mappings' // to other methods without regenerating the graph match for (int[] mapping : mappings) { // logic... } </pre></blockquote> The method can be used in combination with other modifiers. <blockquote><pre> IAtomContainer query = ...; IAtomContainer target = ...; Pattern pat = Pattern.findSubstructure(query); // array of the first 5 unique atom mappings int[][] mappings = pat.matchAll(target) .uniqueAtoms() .limit(5) .toArray(); </pre></blockquote> @return array of mappings
[ "Mappings", "are", "lazily", "generated", "and", "best", "used", "in", "a", "loop", ".", "However", "if", "all", "mappings", "are", "required", "this", "method", "can", "provide", "a", "fixed", "size", "array", "of", "mappings", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/Mappings.java#L355-L364
tvesalainen/util
util/src/main/java/org/vesalainen/navi/Navis.java
Navis.radBearing
public static final double radBearing(double lat1, double lon1, double lat2, double lon2) { checkLatitude(lat1); checkLongitude(lon1); checkLatitude(lat2); checkLongitude(lon2); double dep = departure(lat1, lat2); double aa = dep*(lon2-lon1); double bb = lat2-lat1; double dd = Math.atan2(aa, bb); if (dd < 0) { dd += 2*Math.PI; } return dd; }
java
public static final double radBearing(double lat1, double lon1, double lat2, double lon2) { checkLatitude(lat1); checkLongitude(lon1); checkLatitude(lat2); checkLongitude(lon2); double dep = departure(lat1, lat2); double aa = dep*(lon2-lon1); double bb = lat2-lat1; double dd = Math.atan2(aa, bb); if (dd < 0) { dd += 2*Math.PI; } return dd; }
[ "public", "static", "final", "double", "radBearing", "(", "double", "lat1", ",", "double", "lon1", ",", "double", "lat2", ",", "double", "lon2", ")", "{", "checkLatitude", "(", "lat1", ")", ";", "checkLongitude", "(", "lon1", ")", ";", "checkLatitude", "("...
Returns bearing from (lat1, lon1) to (lat2, lon2) in radians @param lat1 @param lon1 @param lat2 @param lon2 @return
[ "Returns", "bearing", "from", "(", "lat1", "lon1", ")", "to", "(", "lat2", "lon2", ")", "in", "radians" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/Navis.java#L131-L146
graphql-java/graphql-java
src/main/java/graphql/schema/idl/SchemaTypeExtensionsChecker.java
SchemaTypeExtensionsChecker.checkScalarTypeExtensions
private void checkScalarTypeExtensions(List<GraphQLError> errors, TypeDefinitionRegistry typeRegistry) { typeRegistry.scalarTypeExtensions() .forEach((name, extensions) -> { checkTypeExtensionHasCorrespondingType(errors, typeRegistry, name, extensions, ScalarTypeDefinition.class); checkTypeExtensionDirectiveRedefinition(errors, typeRegistry, name, extensions, ScalarTypeDefinition.class); }); }
java
private void checkScalarTypeExtensions(List<GraphQLError> errors, TypeDefinitionRegistry typeRegistry) { typeRegistry.scalarTypeExtensions() .forEach((name, extensions) -> { checkTypeExtensionHasCorrespondingType(errors, typeRegistry, name, extensions, ScalarTypeDefinition.class); checkTypeExtensionDirectiveRedefinition(errors, typeRegistry, name, extensions, ScalarTypeDefinition.class); }); }
[ "private", "void", "checkScalarTypeExtensions", "(", "List", "<", "GraphQLError", ">", "errors", ",", "TypeDefinitionRegistry", "typeRegistry", ")", "{", "typeRegistry", ".", "scalarTypeExtensions", "(", ")", ".", "forEach", "(", "(", "name", ",", "extensions", ")...
/* Scalar type extensions have the potential to be invalid if incorrectly defined. The named type must already be defined and must be a Scalar type. Any directives provided must not already apply to the original Scalar type.
[ "/", "*", "Scalar", "type", "extensions", "have", "the", "potential", "to", "be", "invalid", "if", "incorrectly", "defined", "." ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/idl/SchemaTypeExtensionsChecker.java#L242-L249
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/corpus/processing/ProcessorContext.java
ProcessorContext.getAs
public <T> T getAs(String name, @NonNull Class<T> clazz) { if (properties.containsKey(name)) { return Cast.as(properties.get(name), clazz); } return Config.get(name).as(clazz); }
java
public <T> T getAs(String name, @NonNull Class<T> clazz) { if (properties.containsKey(name)) { return Cast.as(properties.get(name), clazz); } return Config.get(name).as(clazz); }
[ "public", "<", "T", ">", "T", "getAs", "(", "String", "name", ",", "@", "NonNull", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "properties", ".", "containsKey", "(", "name", ")", ")", "{", "return", "Cast", ".", "as", "(", "properties", ...
Gets as. @param <T> the type parameter @param name the name @param clazz the clazz @return the as
[ "Gets", "as", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/corpus/processing/ProcessorContext.java#L69-L75
meltmedia/cadmium
deployer/src/main/java/com/meltmedia/cadmium/deployer/DeployerModule.java
DeployerModule.configure
@Override protected void configure() { try { InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory()); File appRoot = new File(System.getProperty(CadmiumListener.BASE_PATH_ENV), "maven"); FileUtils.forceMkdir(appRoot); String remoteMavenRepo = System.getProperty(MAVEN_REPOSITORY); ArtifactResolver resolver = new ArtifactResolver(remoteMavenRepo, appRoot.getAbsolutePath()); bind(ArtifactResolver.class).toInstance(resolver); bind(JBossAdminApi.class); Multibinder<ConfigurationListener> listenerBinder = Multibinder.newSetBinder(binder(), ConfigurationListener.class); listenerBinder.addBinding().to(JBossAdminApi.class); bind(IJBossUtil.class).to(JBossDelegator.class); } catch(Exception e) { logger.error("Failed to initialize maven artifact resolver.", e); } }
java
@Override protected void configure() { try { InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory()); File appRoot = new File(System.getProperty(CadmiumListener.BASE_PATH_ENV), "maven"); FileUtils.forceMkdir(appRoot); String remoteMavenRepo = System.getProperty(MAVEN_REPOSITORY); ArtifactResolver resolver = new ArtifactResolver(remoteMavenRepo, appRoot.getAbsolutePath()); bind(ArtifactResolver.class).toInstance(resolver); bind(JBossAdminApi.class); Multibinder<ConfigurationListener> listenerBinder = Multibinder.newSetBinder(binder(), ConfigurationListener.class); listenerBinder.addBinding().to(JBossAdminApi.class); bind(IJBossUtil.class).to(JBossDelegator.class); } catch(Exception e) { logger.error("Failed to initialize maven artifact resolver.", e); } }
[ "@", "Override", "protected", "void", "configure", "(", ")", "{", "try", "{", "InternalLoggerFactory", ".", "setDefaultFactory", "(", "new", "Slf4JLoggerFactory", "(", ")", ")", ";", "File", "appRoot", "=", "new", "File", "(", "System", ".", "getProperty", "...
Called to do all bindings for this module. @see <a href="http://code.google.com/p/google-guice/">Google Guice</a>
[ "Called", "to", "do", "all", "bindings", "for", "this", "module", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/deployer/src/main/java/com/meltmedia/cadmium/deployer/DeployerModule.java#L55-L71
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsContentFolderDescriptor.java
CmsContentFolderDescriptor.getFolderPath
public String getFolderPath(CmsObject cms, String pageFolderPath) { if (m_folder != null) { try { return OpenCms.getADEManager().getRootPath( m_folder.getStructureId(), cms.getRequestContext().getCurrentProject().isOnlineProject()); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); return m_folder.getRootPath(); } } else if (m_basePath != null) { return CmsStringUtil.joinPaths(m_basePath, m_folderName); } else if (m_isPageRelative) { if (pageFolderPath == null) { throw new IllegalArgumentException( "getFolderPath called without page folder, but pageRelative is enabled!"); } return CmsStringUtil.joinPaths(pageFolderPath, ELEMENTS_FOLDER_NAME); } else { return CmsStringUtil.joinPaths( cms.getRequestContext().getSiteRoot(), CmsADEManager.CONTENT_FOLDER_NAME, m_folderName); } }
java
public String getFolderPath(CmsObject cms, String pageFolderPath) { if (m_folder != null) { try { return OpenCms.getADEManager().getRootPath( m_folder.getStructureId(), cms.getRequestContext().getCurrentProject().isOnlineProject()); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); return m_folder.getRootPath(); } } else if (m_basePath != null) { return CmsStringUtil.joinPaths(m_basePath, m_folderName); } else if (m_isPageRelative) { if (pageFolderPath == null) { throw new IllegalArgumentException( "getFolderPath called without page folder, but pageRelative is enabled!"); } return CmsStringUtil.joinPaths(pageFolderPath, ELEMENTS_FOLDER_NAME); } else { return CmsStringUtil.joinPaths( cms.getRequestContext().getSiteRoot(), CmsADEManager.CONTENT_FOLDER_NAME, m_folderName); } }
[ "public", "String", "getFolderPath", "(", "CmsObject", "cms", ",", "String", "pageFolderPath", ")", "{", "if", "(", "m_folder", "!=", "null", ")", "{", "try", "{", "return", "OpenCms", ".", "getADEManager", "(", ")", ".", "getRootPath", "(", "m_folder", "....
Computes the folder root path.<p> @param cms the CMS context to use @param pageFolderPath the root path of the folder containing the current container page @return the folder root path
[ "Computes", "the", "folder", "root", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsContentFolderDescriptor.java#L141-L167
ops4j/org.ops4j.pax.wicket
service/src/main/java/org/ops4j/pax/wicket/internal/HttpTracker.java
HttpTracker.addServlet
public final void addServlet(String mountPoint, Servlet servlet, Map<?, ?> contextParams, Bundle paxWicketBundle) { mountPoint = GenericContext.normalizeMountPoint(mountPoint); ServletDescriptor descriptor = new ServletDescriptor(servlet, mountPoint, paxWicketBundle, contextParams); synchronized (servlets) { ServletDescriptor put = servlets.put(mountPoint, descriptor); if (put != null) { LOG.warn( "Two servlets are registered under the same mountpoint '{}' the first of them is overwritten by the second call", mountPoint); unregisterServletDescriptor(put); } registerServletDescriptor(descriptor); } }
java
public final void addServlet(String mountPoint, Servlet servlet, Map<?, ?> contextParams, Bundle paxWicketBundle) { mountPoint = GenericContext.normalizeMountPoint(mountPoint); ServletDescriptor descriptor = new ServletDescriptor(servlet, mountPoint, paxWicketBundle, contextParams); synchronized (servlets) { ServletDescriptor put = servlets.put(mountPoint, descriptor); if (put != null) { LOG.warn( "Two servlets are registered under the same mountpoint '{}' the first of them is overwritten by the second call", mountPoint); unregisterServletDescriptor(put); } registerServletDescriptor(descriptor); } }
[ "public", "final", "void", "addServlet", "(", "String", "mountPoint", ",", "Servlet", "servlet", ",", "Map", "<", "?", ",", "?", ">", "contextParams", ",", "Bundle", "paxWicketBundle", ")", "{", "mountPoint", "=", "GenericContext", ".", "normalizeMountPoint", ...
<p>addServlet.</p> @param mountPoint a {@link java.lang.String} object. @param servlet a {@link javax.servlet.Servlet} object. @param contextParams a {@link java.util.Map} object. @param paxWicketBundle a {@link org.osgi.framework.Bundle} object.
[ "<p", ">", "addServlet", ".", "<", "/", "p", ">" ]
train
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/internal/HttpTracker.java#L121-L135
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java
FileSystem.hasExtension
@Pure public static boolean hasExtension(File filename, String extension) { if (filename == null) { return false; } assert extension != null; String extent = extension; if (!"".equals(extent) && !extent.startsWith(EXTENSION_SEPARATOR)) { //$NON-NLS-1$ extent = EXTENSION_SEPARATOR + extent; } final String ext = extension(filename); if (ext == null) { return false; } if (isCaseSensitiveFilenameSystem()) { return ext.equals(extent); } return ext.equalsIgnoreCase(extent); }
java
@Pure public static boolean hasExtension(File filename, String extension) { if (filename == null) { return false; } assert extension != null; String extent = extension; if (!"".equals(extent) && !extent.startsWith(EXTENSION_SEPARATOR)) { //$NON-NLS-1$ extent = EXTENSION_SEPARATOR + extent; } final String ext = extension(filename); if (ext == null) { return false; } if (isCaseSensitiveFilenameSystem()) { return ext.equals(extent); } return ext.equalsIgnoreCase(extent); }
[ "@", "Pure", "public", "static", "boolean", "hasExtension", "(", "File", "filename", ",", "String", "extension", ")", "{", "if", "(", "filename", "==", "null", ")", "{", "return", "false", ";", "}", "assert", "extension", "!=", "null", ";", "String", "ex...
Replies if the specified file has the specified extension. <p>The test is dependent of the case-sensitive attribute of operating system. @param filename is the filename to parse @param extension is the extension to test. @return <code>true</code> if the given filename has the given extension, otherwise <code>false</code>
[ "Replies", "if", "the", "specified", "file", "has", "the", "specified", "extension", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L1137-L1155
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/InputAction.java
InputAction.checkAnswer
private boolean checkAnswer(String input) { StringTokenizer tok = new StringTokenizer(validAnswers, ANSWER_SEPARATOR); while (tok.hasMoreTokens()) { if (tok.nextElement().toString().trim().equalsIgnoreCase(input.trim())) { return true; } } log.info("User input is not valid - must be one of " + validAnswers); return false; }
java
private boolean checkAnswer(String input) { StringTokenizer tok = new StringTokenizer(validAnswers, ANSWER_SEPARATOR); while (tok.hasMoreTokens()) { if (tok.nextElement().toString().trim().equalsIgnoreCase(input.trim())) { return true; } } log.info("User input is not valid - must be one of " + validAnswers); return false; }
[ "private", "boolean", "checkAnswer", "(", "String", "input", ")", "{", "StringTokenizer", "tok", "=", "new", "StringTokenizer", "(", "validAnswers", ",", "ANSWER_SEPARATOR", ")", ";", "while", "(", "tok", ".", "hasMoreTokens", "(", ")", ")", "{", "if", "(", ...
Validate given input according to valid answer tokens. @param input @return
[ "Validate", "given", "input", "according", "to", "valid", "answer", "tokens", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/InputAction.java#L108-L120
cycorp/api-suite
core-api/src/main/java/com/cyc/kb/exception/KbException.java
KbException.fromThrowable
public static KbException fromThrowable(String message, Throwable cause) { return (cause instanceof KbException && Objects.equals(message, cause.getMessage())) ? (KbException) cause : new KbException(message, cause); }
java
public static KbException fromThrowable(String message, Throwable cause) { return (cause instanceof KbException && Objects.equals(message, cause.getMessage())) ? (KbException) cause : new KbException(message, cause); }
[ "public", "static", "KbException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "KbException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getMessage", "(", ")", ...
Converts a Throwable to a KbException with the specified detail message. If the Throwable is a KbException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new KbException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a KbException
[ "Converts", "a", "Throwable", "to", "a", "KbException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "KbException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the", "one", "supplie...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbException.java#L62-L66
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java
DefaultProgression.setValue
void setValue(SubProgressionModel subTask, double newValue, String comment) { setProperties(newValue, this.min, this.max, this.isAdjusting, comment == null ? this.comment : comment, true, true, false, subTask); }
java
void setValue(SubProgressionModel subTask, double newValue, String comment) { setProperties(newValue, this.min, this.max, this.isAdjusting, comment == null ? this.comment : comment, true, true, false, subTask); }
[ "void", "setValue", "(", "SubProgressionModel", "subTask", ",", "double", "newValue", ",", "String", "comment", ")", "{", "setProperties", "(", "newValue", ",", "this", ".", "min", ",", "this", ".", "max", ",", "this", ".", "isAdjusting", ",", "comment", "...
Set the value with a float-point precision. This method is invoked from a subtask. @param subTask the subtask. @param newValue the new value. @param comment the new comment.
[ "Set", "the", "value", "with", "a", "float", "-", "point", "precision", ".", "This", "method", "is", "invoked", "from", "a", "subtask", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java#L342-L346
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
ModuleIndexWriter.addModulesList
protected void addModulesList(Collection<ModuleElement> modules, String text, String tableSummary, Content body) { Content table = (configuration.isOutputHtml5()) ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text))) : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text))); table.addContent(getSummaryTableHeader(moduleTableHeader, "col")); Content tbody = new HtmlTree(HtmlTag.TBODY); addModulesList(modules, tbody); table.addContent(tbody); Content anchor = getMarkerAnchor(text); Content div = HtmlTree.DIV(HtmlStyle.contentContainer, anchor); div.addContent(table); if (configuration.allowTag(HtmlTag.MAIN)) { htmlTree.addContent(div); } else { body.addContent(div); } }
java
protected void addModulesList(Collection<ModuleElement> modules, String text, String tableSummary, Content body) { Content table = (configuration.isOutputHtml5()) ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text))) : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text))); table.addContent(getSummaryTableHeader(moduleTableHeader, "col")); Content tbody = new HtmlTree(HtmlTag.TBODY); addModulesList(modules, tbody); table.addContent(tbody); Content anchor = getMarkerAnchor(text); Content div = HtmlTree.DIV(HtmlStyle.contentContainer, anchor); div.addContent(table); if (configuration.allowTag(HtmlTag.MAIN)) { htmlTree.addContent(div); } else { body.addContent(div); } }
[ "protected", "void", "addModulesList", "(", "Collection", "<", "ModuleElement", ">", "modules", ",", "String", "text", ",", "String", "tableSummary", ",", "Content", "body", ")", "{", "Content", "table", "=", "(", "configuration", ".", "isOutputHtml5", "(", ")...
Add the list of modules. @param text The table caption @param tableSummary the summary of the table tag @param body the content tree to which the module list will be added
[ "Add", "the", "list", "of", "modules", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java#L144-L160
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java
BaseAsyncInterceptor.asyncInvokeNext
public final Object asyncInvokeNext(InvocationContext ctx, VisitableCommand command, CompletionStage<?> delay) { if (delay == null || CompletionStages.isCompletedSuccessfully(delay)) { return invokeNext(ctx, command); } return asyncValue(delay).thenApply(ctx, command, invokeNextFunction); }
java
public final Object asyncInvokeNext(InvocationContext ctx, VisitableCommand command, CompletionStage<?> delay) { if (delay == null || CompletionStages.isCompletedSuccessfully(delay)) { return invokeNext(ctx, command); } return asyncValue(delay).thenApply(ctx, command, invokeNextFunction); }
[ "public", "final", "Object", "asyncInvokeNext", "(", "InvocationContext", "ctx", ",", "VisitableCommand", "command", ",", "CompletionStage", "<", "?", ">", "delay", ")", "{", "if", "(", "delay", "==", "null", "||", "CompletionStages", ".", "isCompletedSuccessfully...
Suspend the invocation until {@code delay} completes, then if successful invoke the next interceptor. <p>If {@code delay} is null or already completed normally, immediately invoke the next interceptor in this thread.</p> <p>If {@code delay} completes exceptionally, skip the next interceptor and continue with the exception.</p> <p>You need to wrap the result with {@link #makeStage(Object)} if you need to add another handler.</p>
[ "Suspend", "the", "invocation", "until", "{", "@code", "delay", "}", "completes", "then", "if", "successful", "invoke", "the", "next", "interceptor", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java#L226-L232
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.putAsync
public <T> CompletableFuture<T> putAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { return CompletableFuture.supplyAsync(() -> put(type, closure), getExecutor()); }
java
public <T> CompletableFuture<T> putAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { return CompletableFuture.supplyAsync(() -> put(type, closure), getExecutor()); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "T", ">", "putAsync", "(", "final", "Class", "<", "T", ">", "type", ",", "@", "DelegatesTo", "(", "HttpConfig", ".", "class", ")", "final", "Closure", "closure", ")", "{", "return", "CompletableFuture", ...
Executes an asynchronous PUT request on the configured URI (asynchronous alias to the `put(Class,Closure)` method), with additional configuration provided by the configuration closure. The result will be cast to the specified `type`. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } CompletedFuture<Date> future = http.putAsync(Date){ request.uri.path = '/date' request.body = '{ "timezone": "America/Chicago" }' request.contentType = 'application/json' response.parser('text/date') { ChainedHttpConfig config, FromServer fromServer -> Date.parse('yyyy.MM.dd HH:mm', fromServer.inputStream.text) } } Date date = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} containing the result of the request
[ "Executes", "an", "asynchronous", "PUT", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "the", "put", "(", "Class", "Closure", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", ...
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1054-L1056
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/index/service/ClusteringKeyMapper.java
ClusteringKeyMapper.addFields
public final void addFields(Document document, CellName cellName) { String serializedKey = ByteBufferUtils.toString(cellName.toByteBuffer()); Field field = new StringField(FIELD_NAME, serializedKey, Field.Store.YES); document.add(field); }
java
public final void addFields(Document document, CellName cellName) { String serializedKey = ByteBufferUtils.toString(cellName.toByteBuffer()); Field field = new StringField(FIELD_NAME, serializedKey, Field.Store.YES); document.add(field); }
[ "public", "final", "void", "addFields", "(", "Document", "document", ",", "CellName", "cellName", ")", "{", "String", "serializedKey", "=", "ByteBufferUtils", ".", "toString", "(", "cellName", ".", "toByteBuffer", "(", ")", ")", ";", "Field", "field", "=", "...
Adds to the specified document the clustering key contained in the specified cell name. @param document The document where the clustering key is going to be added. @param cellName A cell name containing the clustering key to be added.
[ "Adds", "to", "the", "specified", "document", "the", "clustering", "key", "contained", "in", "the", "specified", "cell", "name", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/ClusteringKeyMapper.java#L110-L114
nielsbasjes/logparser
parser-core/src/main/java/nl/basjes/parse/core/Parser.java
Parser.getCasts
public EnumSet<Casts> getCasts(String name) throws MissingDissectorsException, InvalidDissectorException { assembleDissectors(); return castsOfTargets.get(name); }
java
public EnumSet<Casts> getCasts(String name) throws MissingDissectorsException, InvalidDissectorException { assembleDissectors(); return castsOfTargets.get(name); }
[ "public", "EnumSet", "<", "Casts", ">", "getCasts", "(", "String", "name", ")", "throws", "MissingDissectorsException", ",", "InvalidDissectorException", "{", "assembleDissectors", "(", ")", ";", "return", "castsOfTargets", ".", "get", "(", "name", ")", ";", "}"...
Returns the casts possible for the specified path. Before you call 'getCasts' the actual parser needs to be constructed. Simply calling getPossiblePaths does not build the actual parser. If you want to get the casts for all possible paths the code looks something like this: <pre>{@code Parser<Object> dummyParser= new HttpdLoglineParser<>(Object.class, logformat); List<String> possiblePaths = dummyParser.getPossiblePaths(); // Use a random method that has the right signature dummyParser.addParseTarget(String.class.getMethod("indexOf", String.class), possiblePaths); for (String path : possiblePaths) { LOG.info("{} {}", path, dummyParser.getCasts(path)); } }</pre> @param name The name of the path for which you want the casts @return The set of casts that are valid for this name. Null if this name is unknown.
[ "Returns", "the", "casts", "possible", "for", "the", "specified", "path", ".", "Before", "you", "call", "getCasts", "the", "actual", "parser", "needs", "to", "be", "constructed", ".", "Simply", "calling", "getPossiblePaths", "does", "not", "build", "the", "act...
train
https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/parser-core/src/main/java/nl/basjes/parse/core/Parser.java#L126-L129
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java
DisasterRecoveryConfigurationsInner.failoverAllowDataLoss
public void failoverAllowDataLoss(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().last().body(); }
java
public void failoverAllowDataLoss(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().last().body(); }
[ "public", "void", "failoverAllowDataLoss", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "disasterRecoveryConfigurationName", ")", "{", "failoverAllowDataLossWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "disast...
Fails over from the current primary server to this server. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Fails", "over", "from", "the", "current", "primary", "server", "to", "this", "server", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java#L802-L804
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/h2gis/H2GisServer.java
H2GisServer.startWebServerMode
public static Server startWebServerMode( String port, boolean doSSL, boolean ifExists, String baseDir ) throws SQLException { List<String> params = new ArrayList<>(); params.add("-webAllowOthers"); if (port != null) { params.add("-webPort"); params.add(port); } if (doSSL) { params.add("-webSSL"); } if (ifExists) { params.add("-ifExists"); } if (baseDir != null) { params.add("-baseDir"); params.add(baseDir); } Server server = Server.createWebServer(params.toArray(new String[0])).start(); return server; }
java
public static Server startWebServerMode( String port, boolean doSSL, boolean ifExists, String baseDir ) throws SQLException { List<String> params = new ArrayList<>(); params.add("-webAllowOthers"); if (port != null) { params.add("-webPort"); params.add(port); } if (doSSL) { params.add("-webSSL"); } if (ifExists) { params.add("-ifExists"); } if (baseDir != null) { params.add("-baseDir"); params.add(baseDir); } Server server = Server.createWebServer(params.toArray(new String[0])).start(); return server; }
[ "public", "static", "Server", "startWebServerMode", "(", "String", "port", ",", "boolean", "doSSL", ",", "boolean", "ifExists", ",", "String", "baseDir", ")", "throws", "SQLException", "{", "List", "<", "String", ">", "params", "=", "new", "ArrayList", "<>", ...
Start the web server mode. @param port the optional port to use. @param doSSL if <code>true</code>, ssl is used. @param ifExists is <code>true</code>, the database to connect to has to exist. @param baseDir an optional basedir into which it is allowed to connect. @return @throws SQLException
[ "Start", "the", "web", "server", "mode", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/h2gis/H2GisServer.java#L99-L122
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginGetTroubleshooting
public TroubleshootingResultInner beginGetTroubleshooting(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) { return beginGetTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
java
public TroubleshootingResultInner beginGetTroubleshooting(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) { return beginGetTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
[ "public", "TroubleshootingResultInner", "beginGetTroubleshooting", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "TroubleshootingParameters", "parameters", ")", "{", "return", "beginGetTroubleshootingWithServiceResponseAsync", "(", "resourceGroupName...
Initiate troubleshooting on a specified resource. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that define the resource to troubleshoot. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the TroubleshootingResultInner object if successful.
[ "Initiate", "troubleshooting", "on", "a", "specified", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1539-L1541
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/bitset/CountTreeBitsCollection.java
CountTreeBitsCollection.readTerminalCount
protected long readTerminalCount(final BitInputStream in, final long size) throws IOException { if (SERIALIZATION_CHECKS) { in.expect(SerializationChecks.BeforeTerminal); } final long readBoundedLong = in.readBoundedLong(1 + size); if (SERIALIZATION_CHECKS) { in.expect(SerializationChecks.AfterTerminal); } return readBoundedLong; }
java
protected long readTerminalCount(final BitInputStream in, final long size) throws IOException { if (SERIALIZATION_CHECKS) { in.expect(SerializationChecks.BeforeTerminal); } final long readBoundedLong = in.readBoundedLong(1 + size); if (SERIALIZATION_CHECKS) { in.expect(SerializationChecks.AfterTerminal); } return readBoundedLong; }
[ "protected", "long", "readTerminalCount", "(", "final", "BitInputStream", "in", ",", "final", "long", "size", ")", "throws", "IOException", "{", "if", "(", "SERIALIZATION_CHECKS", ")", "{", "in", ".", "expect", "(", "SerializationChecks", ".", "BeforeTerminal", ...
Read terminal count long. @param in the in @param size the size @return the long @throws IOException the io exception
[ "Read", "terminal", "count", "long", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/bitset/CountTreeBitsCollection.java#L227-L237
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/taskmanager/Task.java
Task.setParams
void setParams(String hostID, TaskRecord taskRecord) { m_hostID = hostID; m_taskRecord = taskRecord; assert m_taskRecord.getTaskID().equals(getTaskID()); }
java
void setParams(String hostID, TaskRecord taskRecord) { m_hostID = hostID; m_taskRecord = taskRecord; assert m_taskRecord.getTaskID().equals(getTaskID()); }
[ "void", "setParams", "(", "String", "hostID", ",", "TaskRecord", "taskRecord", ")", "{", "m_hostID", "=", "hostID", ";", "m_taskRecord", "=", "taskRecord", ";", "assert", "m_taskRecord", ".", "getTaskID", "(", ")", ".", "equals", "(", "getTaskID", "(", ")", ...
Set the execution parameters for this task. This method is called by the {@link TaskManagerService} immediately after constructing the job object. @param hostID Identifier of the executing node (IP address). @param taskRecord {@link TaskRecord} containing the task's current execution properties from the Tasks table. This record is updated and persisted as task execution proceeds.
[ "Set", "the", "execution", "parameters", "for", "this", "task", ".", "This", "method", "is", "called", "by", "the", "{", "@link", "TaskManagerService", "}", "immediately", "after", "constructing", "the", "job", "object", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/taskmanager/Task.java#L82-L86
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
ThriftHttpServlet.createCookie
private Cookie createCookie(String str) throws UnsupportedEncodingException { if (LOG.isDebugEnabled()) { LOG.debug("Cookie name = " + AUTH_COOKIE + " value = " + str); } Cookie cookie = new Cookie(AUTH_COOKIE, str); cookie.setMaxAge(cookieMaxAge); if (cookieDomain != null) { cookie.setDomain(cookieDomain); } if (cookiePath != null) { cookie.setPath(cookiePath); } cookie.setSecure(isCookieSecure); return cookie; }
java
private Cookie createCookie(String str) throws UnsupportedEncodingException { if (LOG.isDebugEnabled()) { LOG.debug("Cookie name = " + AUTH_COOKIE + " value = " + str); } Cookie cookie = new Cookie(AUTH_COOKIE, str); cookie.setMaxAge(cookieMaxAge); if (cookieDomain != null) { cookie.setDomain(cookieDomain); } if (cookiePath != null) { cookie.setPath(cookiePath); } cookie.setSecure(isCookieSecure); return cookie; }
[ "private", "Cookie", "createCookie", "(", "String", "str", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Cookie name = \"", "+", "AUTH_COOKIE", "+", "\" value = \"", ...
Generate a server side cookie given the cookie value as the input. @param str Input string token. @return The generated cookie. @throws UnsupportedEncodingException
[ "Generate", "a", "server", "side", "cookie", "given", "the", "cookie", "value", "as", "the", "input", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L281-L296
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/Actions.java
Actions.keyUp
public Actions keyUp(CharSequence key) { if (isBuildingActions()) { action.addAction(new KeyUpAction(jsonKeyboard, jsonMouse, asKeys(key))); } return addKeyAction(key, codePoint -> tick(defaultKeyboard.createKeyUp(codePoint))); }
java
public Actions keyUp(CharSequence key) { if (isBuildingActions()) { action.addAction(new KeyUpAction(jsonKeyboard, jsonMouse, asKeys(key))); } return addKeyAction(key, codePoint -> tick(defaultKeyboard.createKeyUp(codePoint))); }
[ "public", "Actions", "keyUp", "(", "CharSequence", "key", ")", "{", "if", "(", "isBuildingActions", "(", ")", ")", "{", "action", ".", "addAction", "(", "new", "KeyUpAction", "(", "jsonKeyboard", ",", "jsonMouse", ",", "asKeys", "(", "key", ")", ")", ")"...
Performs a modifier key release. Releasing a non-depressed modifier key will yield undefined behaviour. @param key Either {@link Keys#SHIFT}, {@link Keys#ALT} or {@link Keys#CONTROL}. @return A self reference.
[ "Performs", "a", "modifier", "key", "release", ".", "Releasing", "a", "non", "-", "depressed", "modifier", "key", "will", "yield", "undefined", "behaviour", "." ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L119-L125
geomajas/geomajas-project-server
plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/CriteriaVisitor.java
CriteriaVisitor.parsePropertyName
private String parsePropertyName(String orgPropertyName, Object userData) { // try to assure the correct separator is used String propertyName = orgPropertyName.replace(HibernateLayerUtil.XPATH_SEPARATOR, HibernateLayerUtil.SEPARATOR); // split the path (separator is defined in the HibernateLayerUtil) String[] props = propertyName.split(HibernateLayerUtil.SEPARATOR_REGEXP); String finalName; if (props.length > 1 && userData instanceof Criteria) { // the criteria API requires an alias for each join table !!! String prevAlias = null; for (int i = 0; i < props.length - 1; i++) { String alias = props[i] + "_alias"; if (!aliases.contains(alias)) { Criteria criteria = (Criteria) userData; if (i == 0) { criteria.createAlias(props[0], alias); } else { criteria.createAlias(prevAlias + "." + props[i], alias); } aliases.add(alias); } prevAlias = alias; } finalName = prevAlias + "." + props[props.length - 1]; } else { finalName = propertyName; } return finalName; }
java
private String parsePropertyName(String orgPropertyName, Object userData) { // try to assure the correct separator is used String propertyName = orgPropertyName.replace(HibernateLayerUtil.XPATH_SEPARATOR, HibernateLayerUtil.SEPARATOR); // split the path (separator is defined in the HibernateLayerUtil) String[] props = propertyName.split(HibernateLayerUtil.SEPARATOR_REGEXP); String finalName; if (props.length > 1 && userData instanceof Criteria) { // the criteria API requires an alias for each join table !!! String prevAlias = null; for (int i = 0; i < props.length - 1; i++) { String alias = props[i] + "_alias"; if (!aliases.contains(alias)) { Criteria criteria = (Criteria) userData; if (i == 0) { criteria.createAlias(props[0], alias); } else { criteria.createAlias(prevAlias + "." + props[i], alias); } aliases.add(alias); } prevAlias = alias; } finalName = prevAlias + "." + props[props.length - 1]; } else { finalName = propertyName; } return finalName; }
[ "private", "String", "parsePropertyName", "(", "String", "orgPropertyName", ",", "Object", "userData", ")", "{", "// try to assure the correct separator is used", "String", "propertyName", "=", "orgPropertyName", ".", "replace", "(", "HibernateLayerUtil", ".", "XPATH_SEPARA...
Go through the property name to see if it is a complex one. If it is, aliases must be declared. @param orgPropertyName The propertyName. Can be complex. @param userData The userData object that is passed in each method of the FilterVisitor. Should always be of the info "Criteria". @return property name
[ "Go", "through", "the", "property", "name", "to", "see", "if", "it", "is", "a", "complex", "one", ".", "If", "it", "is", "aliases", "must", "be", "declared", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/CriteriaVisitor.java#L534-L562
pravega/pravega
bindings/src/main/java/io/pravega/storage/hdfs/HDFSStorage.java
HDFSStorage.findStatusForSegment
private FileStatus findStatusForSegment(String segmentName, boolean enforceExistence) throws IOException { FileStatus[] rawFiles = findAllRaw(segmentName); if (rawFiles == null || rawFiles.length == 0) { if (enforceExistence) { throw HDFSExceptionHelpers.segmentNotExistsException(segmentName); } return null; } val result = Arrays.stream(rawFiles) .sorted(this::compareFileStatus) .collect(Collectors.toList()); return result.get(result.size() -1); }
java
private FileStatus findStatusForSegment(String segmentName, boolean enforceExistence) throws IOException { FileStatus[] rawFiles = findAllRaw(segmentName); if (rawFiles == null || rawFiles.length == 0) { if (enforceExistence) { throw HDFSExceptionHelpers.segmentNotExistsException(segmentName); } return null; } val result = Arrays.stream(rawFiles) .sorted(this::compareFileStatus) .collect(Collectors.toList()); return result.get(result.size() -1); }
[ "private", "FileStatus", "findStatusForSegment", "(", "String", "segmentName", ",", "boolean", "enforceExistence", ")", "throws", "IOException", "{", "FileStatus", "[", "]", "rawFiles", "=", "findAllRaw", "(", "segmentName", ")", ";", "if", "(", "rawFiles", "==", ...
Gets the filestatus representing the segment. @param segmentName The name of the Segment to retrieve for. @param enforceExistence If true, it will throw a FileNotFoundException if no files are found, otherwise null is returned. @return FileStatus of the HDFS file. @throws IOException If an exception occurred.
[ "Gets", "the", "filestatus", "representing", "the", "segment", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/bindings/src/main/java/io/pravega/storage/hdfs/HDFSStorage.java#L563-L577
nats-io/java-nats
src/main/java/io/nats/client/NKey.java
NKey.createUser
public static NKey createUser(SecureRandom random) throws IOException, NoSuchProviderException, NoSuchAlgorithmException { return createPair(Type.USER, random); }
java
public static NKey createUser(SecureRandom random) throws IOException, NoSuchProviderException, NoSuchAlgorithmException { return createPair(Type.USER, random); }
[ "public", "static", "NKey", "createUser", "(", "SecureRandom", "random", ")", "throws", "IOException", ",", "NoSuchProviderException", ",", "NoSuchAlgorithmException", "{", "return", "createPair", "(", "Type", ".", "USER", ",", "random", ")", ";", "}" ]
Create a User NKey from the provided random number generator. If no random is provided, SecureRandom.getInstance("SHA1PRNG", "SUN") will be used to creat eone. The new NKey contains the private seed, which should be saved in a secure location. @param random A secure random provider @return the new Nkey @throws IOException if the seed cannot be encoded to a string @throws NoSuchProviderException if the default secure random cannot be created @throws NoSuchAlgorithmException if the default secure random cannot be created
[ "Create", "a", "User", "NKey", "from", "the", "provided", "random", "number", "generator", "." ]
train
https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L551-L554
centic9/commons-dost
src/main/java/org/dstadler/commons/metrics/MetricsUtils.java
MetricsUtils.sendDocument
public static void sendDocument(String json, CloseableHttpClient httpClient, String url) throws IOException { final HttpPut httpPut = new HttpPut(url); httpPut.addHeader("Content-Type", NanoHTTPD.MIME_JSON); httpPut.setEntity(new StringEntity( json, ContentType.APPLICATION_JSON)); try (CloseableHttpResponse response = httpClient.execute(httpPut)) { HttpEntity entity = HttpClientWrapper.checkAndFetch(response, url); try { log.info("Had result when sending document to Elasticsearch at " + url + ": " + IOUtils.toString(entity.getContent(), "UTF-8")); } finally { // ensure all content is taken out to free resources EntityUtils.consume(entity); } } }
java
public static void sendDocument(String json, CloseableHttpClient httpClient, String url) throws IOException { final HttpPut httpPut = new HttpPut(url); httpPut.addHeader("Content-Type", NanoHTTPD.MIME_JSON); httpPut.setEntity(new StringEntity( json, ContentType.APPLICATION_JSON)); try (CloseableHttpResponse response = httpClient.execute(httpPut)) { HttpEntity entity = HttpClientWrapper.checkAndFetch(response, url); try { log.info("Had result when sending document to Elasticsearch at " + url + ": " + IOUtils.toString(entity.getContent(), "UTF-8")); } finally { // ensure all content is taken out to free resources EntityUtils.consume(entity); } } }
[ "public", "static", "void", "sendDocument", "(", "String", "json", ",", "CloseableHttpClient", "httpClient", ",", "String", "url", ")", "throws", "IOException", "{", "final", "HttpPut", "httpPut", "=", "new", "HttpPut", "(", "url", ")", ";", "httpPut", ".", ...
Send the given document to the given Elasticsearch URL/Index Authentication can be provided via the configured {@link HttpClient} instance. @param json The json-string to store as document @param httpClient The HTTP Client that can be used to send metrics. This can also contain credentials for basic authentication if necessary @param url The base URL where Elasticsearch is available. @throws IOException If the HTTP call fails with an HTTP status code.
[ "Send", "the", "given", "document", "to", "the", "given", "Elasticsearch", "URL", "/", "Index" ]
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/metrics/MetricsUtils.java#L100-L116
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/layer/feature/AttributeService.java
AttributeService.setAttributeEditable
public void setAttributeEditable(Attribute attribute, boolean editable) { attribute.setEditable(editable); if (!(attribute instanceof LazyAttribute)) { // should not instantiate lazy attributes! if (attribute instanceof ManyToOneAttribute) { setAttributeEditable(((ManyToOneAttribute) attribute).getValue(), editable); } else if (attribute instanceof OneToManyAttribute) { List<AssociationValue> values = ((OneToManyAttribute) attribute).getValue(); for (AssociationValue value : values) { setAttributeEditable(value, editable); } } } }
java
public void setAttributeEditable(Attribute attribute, boolean editable) { attribute.setEditable(editable); if (!(attribute instanceof LazyAttribute)) { // should not instantiate lazy attributes! if (attribute instanceof ManyToOneAttribute) { setAttributeEditable(((ManyToOneAttribute) attribute).getValue(), editable); } else if (attribute instanceof OneToManyAttribute) { List<AssociationValue> values = ((OneToManyAttribute) attribute).getValue(); for (AssociationValue value : values) { setAttributeEditable(value, editable); } } } }
[ "public", "void", "setAttributeEditable", "(", "Attribute", "attribute", ",", "boolean", "editable", ")", "{", "attribute", ".", "setEditable", "(", "editable", ")", ";", "if", "(", "!", "(", "attribute", "instanceof", "LazyAttribute", ")", ")", "{", "// shoul...
Set editable state on an attribute. This needs to also set the state on the associated attributes. @param attribute attribute for which the editable state needs to be set @param editable new editable state
[ "Set", "editable", "state", "on", "an", "attribute", ".", "This", "needs", "to", "also", "set", "the", "state", "on", "the", "associated", "attributes", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/layer/feature/AttributeService.java#L124-L136
OpenLiberty/open-liberty
dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/DiscoveredBdas.java
DiscoveredBdas.isAlreadyAccessible
public boolean isAlreadyAccessible(ArchiveType archiveType, CDIArchive archive) throws CDIException { String path = archive.getPath(); if (libraryPaths.contains(path)) { return true; } else if (archiveType == ArchiveType.EAR_LIB || archiveType == ArchiveType.RAR_MODULE || archiveType == ArchiveType.EJB_MODULE || archiveType == ArchiveType.WEB_MODULE || archiveType == ArchiveType.CLIENT_MODULE) { return modulePaths.contains(path); } else { return false; } }
java
public boolean isAlreadyAccessible(ArchiveType archiveType, CDIArchive archive) throws CDIException { String path = archive.getPath(); if (libraryPaths.contains(path)) { return true; } else if (archiveType == ArchiveType.EAR_LIB || archiveType == ArchiveType.RAR_MODULE || archiveType == ArchiveType.EJB_MODULE || archiveType == ArchiveType.WEB_MODULE || archiveType == ArchiveType.CLIENT_MODULE) { return modulePaths.contains(path); } else { return false; } }
[ "public", "boolean", "isAlreadyAccessible", "(", "ArchiveType", "archiveType", ",", "CDIArchive", "archive", ")", "throws", "CDIException", "{", "String", "path", "=", "archive", ".", "getPath", "(", ")", ";", "if", "(", "libraryPaths", ".", "contains", "(", "...
Returns true if the given archive is accessible to all modules of the given module type <ul> <li>EAR and shared libraries are available to all modules</li> <li>EJB and RAR modules are accessible to all other EJB modules, RAR modules and Web modules</li> <li>Web and App Client modules are not accessible to other modules</li> </ul> @param archiveType the module type @param archive an archive @return true if the archive is available to all modules of archiveType, otherwise false @throws CDIException
[ "Returns", "true", "if", "the", "given", "archive", "is", "accessible", "to", "all", "modules", "of", "the", "given", "module", "type", "<ul", ">", "<li", ">", "EAR", "and", "shared", "libraries", "are", "available", "to", "all", "modules<", "/", "li", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/DiscoveredBdas.java#L71-L81
alkacon/opencms-core
src/org/opencms/db/generic/CmsUserDriver.java
CmsUserDriver.internalCreateAce
protected CmsAccessControlEntry internalCreateAce(ResultSet res, CmsUUID newId) throws SQLException { return new CmsAccessControlEntry( newId, new CmsUUID(res.getString(m_sqlManager.readQuery("C_ACCESS_PRINCIPAL_ID_0"))), res.getInt(m_sqlManager.readQuery("C_ACCESS_ACCESS_ALLOWED_0")), res.getInt(m_sqlManager.readQuery("C_ACCESS_ACCESS_DENIED_0")), res.getInt(m_sqlManager.readQuery("C_ACCESS_ACCESS_FLAGS_0"))); }
java
protected CmsAccessControlEntry internalCreateAce(ResultSet res, CmsUUID newId) throws SQLException { return new CmsAccessControlEntry( newId, new CmsUUID(res.getString(m_sqlManager.readQuery("C_ACCESS_PRINCIPAL_ID_0"))), res.getInt(m_sqlManager.readQuery("C_ACCESS_ACCESS_ALLOWED_0")), res.getInt(m_sqlManager.readQuery("C_ACCESS_ACCESS_DENIED_0")), res.getInt(m_sqlManager.readQuery("C_ACCESS_ACCESS_FLAGS_0"))); }
[ "protected", "CmsAccessControlEntry", "internalCreateAce", "(", "ResultSet", "res", ",", "CmsUUID", "newId", ")", "throws", "SQLException", "{", "return", "new", "CmsAccessControlEntry", "(", "newId", ",", "new", "CmsUUID", "(", "res", ".", "getString", "(", "m_sq...
Internal helper method to create an access control entry from a database record.<p> @param res resultset of the current query @param newId the id of the new access control entry @return a new {@link CmsAccessControlEntry} initialized with the values from the current database record @throws SQLException if something goes wrong
[ "Internal", "helper", "method", "to", "create", "an", "access", "control", "entry", "from", "a", "database", "record", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserDriver.java#L2179-L2187
google/closure-compiler
src/com/google/javascript/jscomp/VarCheck.java
VarCheck.createScopeCreator
private Es6SyntacticScopeCreator createScopeCreator() { if (validityCheck) { return new Es6SyntacticScopeCreator(compiler); } else { dupHandler = new RedeclarationCheckHandler(); return new Es6SyntacticScopeCreator(compiler, dupHandler); } }
java
private Es6SyntacticScopeCreator createScopeCreator() { if (validityCheck) { return new Es6SyntacticScopeCreator(compiler); } else { dupHandler = new RedeclarationCheckHandler(); return new Es6SyntacticScopeCreator(compiler, dupHandler); } }
[ "private", "Es6SyntacticScopeCreator", "createScopeCreator", "(", ")", "{", "if", "(", "validityCheck", ")", "{", "return", "new", "Es6SyntacticScopeCreator", "(", "compiler", ")", ";", "}", "else", "{", "dupHandler", "=", "new", "RedeclarationCheckHandler", "(", ...
Creates the scope creator used by this pass. If not in validity check mode, use a {@link RedeclarationCheckHandler} to check var redeclarations.
[ "Creates", "the", "scope", "creator", "used", "by", "this", "pass", ".", "If", "not", "in", "validity", "check", "mode", "use", "a", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/VarCheck.java#L123-L130
azkaban/azkaban
azkaban-web-server/src/main/java/azkaban/flowtrigger/plugin/FlowTriggerDependencyPluginManager.java
FlowTriggerDependencyPluginManager.getFilesMatchingPath
private File[] getFilesMatchingPath(final String path) { if (path.endsWith("*")) { final File dir = new File(path.substring(0, path.lastIndexOf("/") + 1)); final FileFilter fileFilter = new WildcardFileFilter(path.substring(path.lastIndexOf("/") + 1)); final File[] files = dir.listFiles(fileFilter); return files; } else { return new File[]{new File(path)}; } }
java
private File[] getFilesMatchingPath(final String path) { if (path.endsWith("*")) { final File dir = new File(path.substring(0, path.lastIndexOf("/") + 1)); final FileFilter fileFilter = new WildcardFileFilter(path.substring(path.lastIndexOf("/") + 1)); final File[] files = dir.listFiles(fileFilter); return files; } else { return new File[]{new File(path)}; } }
[ "private", "File", "[", "]", "getFilesMatchingPath", "(", "final", "String", "path", ")", "{", "if", "(", "path", ".", "endsWith", "(", "\"*\"", ")", ")", "{", "final", "File", "dir", "=", "new", "File", "(", "path", ".", "substring", "(", "0", ",", ...
retrieve files with wildcard matching. Only support "dir/*". Pattern like "dir/foo*" or "dir/*foo*" will not be supported since user shouldn't upload the jars they don't want to import the reason for supporting dir/* is to provide another packaging option which let user upload a dir of all required jars in addition to one fat jar.
[ "retrieve", "files", "with", "wildcard", "matching", ".", "Only", "support", "dir", "/", "*", ".", "Pattern", "like", "dir", "/", "foo", "*", "or", "dir", "/", "*", "foo", "*", "will", "not", "be", "supported", "since", "user", "shouldn", "t", "upload"...
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/flowtrigger/plugin/FlowTriggerDependencyPluginManager.java#L74-L84
alkacon/opencms-core
src/org/opencms/gwt/CmsIconUtil.java
CmsIconUtil.getResourceTypeIconClass
static String getResourceTypeIconClass(String resourceTypeName, boolean small) { StringBuffer sb = new StringBuffer(CmsGwtConstants.TYPE_ICON_CLASS); sb.append("_").append(resourceTypeName.hashCode()); if (small) { sb.append(SMALL_SUFFIX); } return sb.toString(); }
java
static String getResourceTypeIconClass(String resourceTypeName, boolean small) { StringBuffer sb = new StringBuffer(CmsGwtConstants.TYPE_ICON_CLASS); sb.append("_").append(resourceTypeName.hashCode()); if (small) { sb.append(SMALL_SUFFIX); } return sb.toString(); }
[ "static", "String", "getResourceTypeIconClass", "(", "String", "resourceTypeName", ",", "boolean", "small", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "CmsGwtConstants", ".", "TYPE_ICON_CLASS", ")", ";", "sb", ".", "append", "(", "\"_\"", "...
Returns the CSS class for the given resource type.<p> @param resourceTypeName the resource type name @param small if true, get the icon class for the small icon, else for the biggest one available @return the CSS class
[ "Returns", "the", "CSS", "class", "for", "the", "given", "resource", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsIconUtil.java#L451-L459
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/config/WorkingDirectories.java
WorkingDirectories.setWorking
public final void setWorking(final String working) { final String webappPath = this.servletContext.getRealPath("/"); final String webappName; if (webappPath != null) { webappName = new File(webappPath).getName(); } else { webappName = "default"; // left like that only in UTs } this.working = new File(working.replace("{WEBAPP}", webappName)); createIfMissing(this.working, "working"); LOGGER.debug("Working directory: {}", this.working); }
java
public final void setWorking(final String working) { final String webappPath = this.servletContext.getRealPath("/"); final String webappName; if (webappPath != null) { webappName = new File(webappPath).getName(); } else { webappName = "default"; // left like that only in UTs } this.working = new File(working.replace("{WEBAPP}", webappName)); createIfMissing(this.working, "working"); LOGGER.debug("Working directory: {}", this.working); }
[ "public", "final", "void", "setWorking", "(", "final", "String", "working", ")", "{", "final", "String", "webappPath", "=", "this", ".", "servletContext", ".", "getRealPath", "(", "\"/\"", ")", ";", "final", "String", "webappName", ";", "if", "(", "webappPat...
Defines what is the root directory used to store every temporary files. <p> The given path can contain the pattern "{WEBAPP}" and it will replaced by the webapp name. @param working The path
[ "Defines", "what", "is", "the", "root", "directory", "used", "to", "store", "every", "temporary", "files", ".", "<p", ">", "The", "given", "path", "can", "contain", "the", "pattern", "{", "WEBAPP", "}", "and", "it", "will", "replaced", "by", "the", "weba...
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/config/WorkingDirectories.java#L47-L58
basho/riak-java-client
src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java
AnnotationUtil.setVClock
public static <T> T setVClock(T domainObject, VClock vclock) throws ConversionException { T obj = AnnotationHelper.getInstance().setRiakVClock(domainObject, vclock); return obj; }
java
public static <T> T setVClock(T domainObject, VClock vclock) throws ConversionException { T obj = AnnotationHelper.getInstance().setRiakVClock(domainObject, vclock); return obj; }
[ "public", "static", "<", "T", ">", "T", "setVClock", "(", "T", "domainObject", ",", "VClock", "vclock", ")", "throws", "ConversionException", "{", "T", "obj", "=", "AnnotationHelper", ".", "getInstance", "(", ")", ".", "setRiakVClock", "(", "domainObject", "...
Attempts to inject <code>vclock</code> as the value of the {@literal @RiakVClock} annotated member of <code>domainObject</code> @param <T> the type of <code>domainObject</code> @param domainObject the object to inject the key into @param vclock the vclock to inject @return <code>domainObject</code> with {@literal @RiakVClock} annotated member set to <code>vclock</code> @throws ConversionException if there is a {@literal @RiakVClock} annotated member but it cannot be set to the value of <code>vclock</code>
[ "Attempts", "to", "inject", "<code", ">", "vclock<", "/", "code", ">", "as", "the", "value", "of", "the", "{", "@literal", "@RiakVClock", "}", "annotated", "member", "of", "<code", ">", "domainObject<", "/", "code", ">" ]
train
https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java#L139-L143
jenkinsci/jenkins
core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol4.java
JnlpSlaveAgentProtocol4.setHub
@Inject public void setHub(IOHubProvider hub) { this.hub = hub; handler = new JnlpProtocol4Handler(JnlpAgentReceiver.DATABASE, Computer.threadPoolForRemoting, hub.getHub(), sslContext, false, true); }
java
@Inject public void setHub(IOHubProvider hub) { this.hub = hub; handler = new JnlpProtocol4Handler(JnlpAgentReceiver.DATABASE, Computer.threadPoolForRemoting, hub.getHub(), sslContext, false, true); }
[ "@", "Inject", "public", "void", "setHub", "(", "IOHubProvider", "hub", ")", "{", "this", ".", "hub", "=", "hub", ";", "handler", "=", "new", "JnlpProtocol4Handler", "(", "JnlpAgentReceiver", ".", "DATABASE", ",", "Computer", ".", "threadPoolForRemoting", ",",...
Inject the {@link IOHubProvider} @param hub the hub provider.
[ "Inject", "the", "{", "@link", "IOHubProvider", "}" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol4.java#L154-L159
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.writeConfigFile
public static void writeConfigFile(File configFile, File searchDir) throws SQLException, IOException { writeConfigFile(configFile, searchDir, false); }
java
public static void writeConfigFile(File configFile, File searchDir) throws SQLException, IOException { writeConfigFile(configFile, searchDir, false); }
[ "public", "static", "void", "writeConfigFile", "(", "File", "configFile", ",", "File", "searchDir", ")", "throws", "SQLException", ",", "IOException", "{", "writeConfigFile", "(", "configFile", ",", "searchDir", ",", "false", ")", ";", "}" ]
Finds the annotated classes in the specified search directory or below and writes a configuration file.
[ "Finds", "the", "annotated", "classes", "in", "the", "specified", "search", "directory", "or", "below", "and", "writes", "a", "configuration", "file", "." ]
train
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L166-L168
awin/rabbiteasy
rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageWriter.java
MessageWriter.writeBodyFromString
public void writeBodyFromString(String bodyAsString, Charset charset) { message.contentEncoding(charset.name()) .contentType(Message.TEXT_PLAIN); byte[] bodyContent = bodyAsString.getBytes(charset); message.body(bodyContent); }
java
public void writeBodyFromString(String bodyAsString, Charset charset) { message.contentEncoding(charset.name()) .contentType(Message.TEXT_PLAIN); byte[] bodyContent = bodyAsString.getBytes(charset); message.body(bodyContent); }
[ "public", "void", "writeBodyFromString", "(", "String", "bodyAsString", ",", "Charset", "charset", ")", "{", "message", ".", "contentEncoding", "(", "charset", ".", "name", "(", ")", ")", ".", "contentType", "(", "Message", ".", "TEXT_PLAIN", ")", ";", "byte...
Writes the message body from a string using the given charset as encoding and setting the content type to text/plain. @param bodyAsString Body to write as string @param charset The charset to encode the string
[ "Writes", "the", "message", "body", "from", "a", "string", "using", "the", "given", "charset", "as", "encoding", "and", "setting", "the", "content", "type", "to", "text", "/", "plain", "." ]
train
https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageWriter.java#L67-L72
alipay/sofa-rpc
extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/context/BaggageResolver.java
BaggageResolver.pickupFromRequest
public static void pickupFromRequest(RpcInvokeContext context, SofaRequest request, boolean init) { if (context == null && !init) { return; } // 解析请求 Map<String, String> requestBaggage = (Map<String, String>) request .getRequestProp(RemotingConstants.RPC_REQUEST_BAGGAGE); if (CommonUtils.isNotEmpty(requestBaggage)) { if (context == null) { context = RpcInvokeContext.getContext(); } context.putAllRequestBaggage(requestBaggage); } }
java
public static void pickupFromRequest(RpcInvokeContext context, SofaRequest request, boolean init) { if (context == null && !init) { return; } // 解析请求 Map<String, String> requestBaggage = (Map<String, String>) request .getRequestProp(RemotingConstants.RPC_REQUEST_BAGGAGE); if (CommonUtils.isNotEmpty(requestBaggage)) { if (context == null) { context = RpcInvokeContext.getContext(); } context.putAllRequestBaggage(requestBaggage); } }
[ "public", "static", "void", "pickupFromRequest", "(", "RpcInvokeContext", "context", ",", "SofaRequest", "request", ",", "boolean", "init", ")", "{", "if", "(", "context", "==", "null", "&&", "!", "init", ")", "{", "return", ";", "}", "// 解析请求 ", "Map", "<...
从请求里获取透传数据 @param context RpcInvokeContext @param request 请求 @param init 传入上下文为空时,是否初始化
[ "从请求里获取透传数据" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/context/BaggageResolver.java#L62-L75
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/rule/NotEqualsRule.java
NotEqualsRule.getRule
public static Rule getRule(final String field, final String value) { if (field.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) { return NotLevelEqualsRule.getRule(value); } else { return new NotEqualsRule(field, value); } }
java
public static Rule getRule(final String field, final String value) { if (field.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) { return NotLevelEqualsRule.getRule(value); } else { return new NotEqualsRule(field, value); } }
[ "public", "static", "Rule", "getRule", "(", "final", "String", "field", ",", "final", "String", "value", ")", "{", "if", "(", "field", ".", "equalsIgnoreCase", "(", "LoggingEventFieldResolver", ".", "LEVEL_FIELD", ")", ")", "{", "return", "NotLevelEqualsRule", ...
Get new instance. @param field field @param value value @return new instance.
[ "Get", "new", "instance", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/rule/NotEqualsRule.java#L75-L81
cojen/Cojen
src/main/java/org/cojen/classfile/attribute/CodeAttr.java
CodeAttr.mapLineNumber
public void mapLineNumber(Location start, int line_number) { if (mLineNumberTable == null) { addAttribute(new LineNumberTableAttr(getConstantPool())); } mLineNumberTable.addEntry(start, line_number); }
java
public void mapLineNumber(Location start, int line_number) { if (mLineNumberTable == null) { addAttribute(new LineNumberTableAttr(getConstantPool())); } mLineNumberTable.addEntry(start, line_number); }
[ "public", "void", "mapLineNumber", "(", "Location", "start", ",", "int", "line_number", ")", "{", "if", "(", "mLineNumberTable", "==", "null", ")", "{", "addAttribute", "(", "new", "LineNumberTableAttr", "(", "getConstantPool", "(", ")", ")", ")", ";", "}", ...
Map a bytecode address (start_pc) to a line number in the source code as a debugging aid.
[ "Map", "a", "bytecode", "address", "(", "start_pc", ")", "to", "a", "line", "number", "in", "the", "source", "code", "as", "a", "debugging", "aid", "." ]
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/attribute/CodeAttr.java#L187-L192
qiniu/android-sdk
library/src/main/java/com/qiniu/android/storage/UploadManager.java
UploadManager.syncPut
public ResponseInfo syncPut(String file, String key, String token, UploadOptions options) { return syncPut(new File(file), key, token, options); }
java
public ResponseInfo syncPut(String file, String key, String token, UploadOptions options) { return syncPut(new File(file), key, token, options); }
[ "public", "ResponseInfo", "syncPut", "(", "String", "file", ",", "String", "key", ",", "String", "token", ",", "UploadOptions", "options", ")", "{", "return", "syncPut", "(", "new", "File", "(", "file", ")", ",", "key", ",", "token", ",", "options", ")",...
同步上传文件。使用 form 表单方式上传,建议只在文件较小情况下使用此方式,如 file.size() < 1024 * 1024。 @param file 上传的文件绝对路径 @param key 上传数据保存的文件名 @param token 上传凭证 @param options 上传数据的可选参数 @return 响应信息 ResponseInfo#response 响应体,序列化后 json 格式
[ "同步上传文件。使用", "form", "表单方式上传,建议只在文件较小情况下使用此方式,如", "file", ".", "size", "()", "<", "1024", "*", "1024。" ]
train
https://github.com/qiniu/android-sdk/blob/dbd2a01fb3bff7a5e75e8934bbf81713124d8466/library/src/main/java/com/qiniu/android/storage/UploadManager.java#L237-L239
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalExtractGeometries.java
TrifocalExtractGeometries.extractFundmental
public void extractFundmental( DMatrixRMaj F21 , DMatrixRMaj F31 ) { // compute the camera matrices one column at a time for( int i = 0; i < 3; i++ ) { DMatrixRMaj T = tensor.getT(i); GeometryMath_F64.mult(T,e3,temp0); GeometryMath_F64.cross(e2,temp0,column); F21.set(0,i,column.x); F21.set(1,i,column.y); F21.set(2,i,column.z); GeometryMath_F64.multTran(T,e2,temp0); GeometryMath_F64.cross(e3,temp0,column); F31.set(0,i,column.x); F31.set(1,i,column.y); F31.set(2,i,column.z); } }
java
public void extractFundmental( DMatrixRMaj F21 , DMatrixRMaj F31 ) { // compute the camera matrices one column at a time for( int i = 0; i < 3; i++ ) { DMatrixRMaj T = tensor.getT(i); GeometryMath_F64.mult(T,e3,temp0); GeometryMath_F64.cross(e2,temp0,column); F21.set(0,i,column.x); F21.set(1,i,column.y); F21.set(2,i,column.z); GeometryMath_F64.multTran(T,e2,temp0); GeometryMath_F64.cross(e3,temp0,column); F31.set(0,i,column.x); F31.set(1,i,column.y); F31.set(2,i,column.z); } }
[ "public", "void", "extractFundmental", "(", "DMatrixRMaj", "F21", ",", "DMatrixRMaj", "F31", ")", "{", "// compute the camera matrices one column at a time", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "DMatrixRMaj", "T", ...
<p> Extract the fundamental matrices between views 1 + 2 and views 1 + 3. The returned Fundamental matrices will have the following properties: x<sub>i</sub><sup>T</sup>*Fi*x<sub>1</sub> = 0, where i is view 2 or 3. </p> <p> NOTE: The first camera is assumed to have the camera matrix of P1 = [I|0]. Thus observations in pixels for the first camera will not meet the epipolar constraint when applied to the returned fundamental matrices. </p> <pre> F21=[e2]x *[T1,T2,T3]*e3 and F31 = [e3]x*[T1,T2,T3]*e3 </pre> @param F21 (Output) Fundamental matrix @param F31 (Output) Fundamental matrix
[ "<p", ">", "Extract", "the", "fundamental", "matrices", "between", "views", "1", "+", "2", "and", "views", "1", "+", "3", ".", "The", "returned", "Fundamental", "matrices", "will", "have", "the", "following", "properties", ":", "x<sub", ">", "i<", "/", "...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalExtractGeometries.java#L210-L230
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java
SvgGraphicsContext.setController
public void setController(Object parent, String name, GraphicsController controller) { if (isAttached()) { helper.setController(parent, name, controller); } }
java
public void setController(Object parent, String name, GraphicsController controller) { if (isAttached()) { helper.setController(parent, name, controller); } }
[ "public", "void", "setController", "(", "Object", "parent", ",", "String", "name", ",", "GraphicsController", "controller", ")", "{", "if", "(", "isAttached", "(", ")", ")", "{", "helper", ".", "setController", "(", "parent", ",", "name", ",", "controller", ...
Set the controller on an element of this <code>GraphicsContext</code> so it can react to events. @param parent the parent of the element on which the controller should be set. @param name the name of the child element on which the controller should be set @param controller The new <code>GraphicsController</code>
[ "Set", "the", "controller", "on", "an", "element", "of", "this", "<code", ">", "GraphicsContext<", "/", "code", ">", "so", "it", "can", "react", "to", "events", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L631-L635
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/networking/v1/SilentTrainingDriver.java
SilentTrainingDriver.finishTraining
@Override public void finishTraining(long originatorId, long taskId) { // on Master thread we'll be applying final gradients if (params != null && stepFunction != null) { if (hasSomething.get()) { stepFunction.step(params, updates); //Nd4j.getMemoryManager().memset(updates); updates.assign(0.0); } } }
java
@Override public void finishTraining(long originatorId, long taskId) { // on Master thread we'll be applying final gradients if (params != null && stepFunction != null) { if (hasSomething.get()) { stepFunction.step(params, updates); //Nd4j.getMemoryManager().memset(updates); updates.assign(0.0); } } }
[ "@", "Override", "public", "void", "finishTraining", "(", "long", "originatorId", ",", "long", "taskId", ")", "{", "// on Master thread we'll be applying final gradients", "if", "(", "params", "!=", "null", "&&", "stepFunction", "!=", "null", ")", "{", "if", "(", ...
This method is used on Master only, applies buffered updates to params @param originatorId @param taskId
[ "This", "method", "is", "used", "on", "Master", "only", "applies", "buffered", "updates", "to", "params" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/networking/v1/SilentTrainingDriver.java#L218-L230
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/RTMPUtils.java
RTMPUtils.diffTimestamps
public static long diffTimestamps(final int a, final int b) { // first convert each to unsigned integers final long unsignedA = a & 0xFFFFFFFFL; final long unsignedB = b & 0xFFFFFFFFL; // then find the delta final long delta = unsignedA - unsignedB; return delta; }
java
public static long diffTimestamps(final int a, final int b) { // first convert each to unsigned integers final long unsignedA = a & 0xFFFFFFFFL; final long unsignedB = b & 0xFFFFFFFFL; // then find the delta final long delta = unsignedA - unsignedB; return delta; }
[ "public", "static", "long", "diffTimestamps", "(", "final", "int", "a", ",", "final", "int", "b", ")", "{", "// first convert each to unsigned integers\r", "final", "long", "unsignedA", "=", "a", "&", "0xFFFFFFFF", "L", ";", "final", "long", "unsignedB", "=", ...
Calculates the delta between two time stamps, adjusting for time stamp wrapping. @param a First time stamp @param b Second time stamp @return the distance between a and b, which will be negative if a is less than b.
[ "Calculates", "the", "delta", "between", "two", "time", "stamps", "adjusting", "for", "time", "stamp", "wrapping", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPUtils.java#L219-L226
j-a-w-r/jawr-main-repo
jawr-tools/jawr-bundle-processor/src/main/java/net/jawr/web/bundle/processor/BundleProcessor.java
BundleProcessor.getWebXmlDocument
protected Document getWebXmlDocument(String baseDir) throws ParserConfigurationException, FactoryConfigurationError, SAXException, IOException { File webXml = new File(baseDir, WEB_XML_FILE_PATH); DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance() .newDocumentBuilder(); docBuilder.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { return null; } }); Document doc = docBuilder.parse(webXml); return doc; }
java
protected Document getWebXmlDocument(String baseDir) throws ParserConfigurationException, FactoryConfigurationError, SAXException, IOException { File webXml = new File(baseDir, WEB_XML_FILE_PATH); DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance() .newDocumentBuilder(); docBuilder.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { return null; } }); Document doc = docBuilder.parse(webXml); return doc; }
[ "protected", "Document", "getWebXmlDocument", "(", "String", "baseDir", ")", "throws", "ParserConfigurationException", ",", "FactoryConfigurationError", ",", "SAXException", ",", "IOException", "{", "File", "webXml", "=", "new", "File", "(", "baseDir", ",", "WEB_XML_F...
Returns the XML document of the web.xml file @param webXmlPath the web.xml path @return the Xml document of the web.xml file @throws ParserConfigurationException if a parser configuration exception occurs @throws FactoryConfigurationError if a factory configuration exception occurs @throws SAXException if a SAX exception occurs @throws IOException if an IO exception occurs
[ "Returns", "the", "XML", "document", "of", "the", "web", ".", "xml", "file" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr-tools/jawr-bundle-processor/src/main/java/net/jawr/web/bundle/processor/BundleProcessor.java#L297-L314
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.isCase
public static boolean isCase(Class caseValue, Object switchValue) { if (switchValue instanceof Class) { Class val = (Class) switchValue; return caseValue.isAssignableFrom(val); } return caseValue.isInstance(switchValue); }
java
public static boolean isCase(Class caseValue, Object switchValue) { if (switchValue instanceof Class) { Class val = (Class) switchValue; return caseValue.isAssignableFrom(val); } return caseValue.isInstance(switchValue); }
[ "public", "static", "boolean", "isCase", "(", "Class", "caseValue", ",", "Object", "switchValue", ")", "{", "if", "(", "switchValue", "instanceof", "Class", ")", "{", "Class", "val", "=", "(", "Class", ")", "switchValue", ";", "return", "caseValue", ".", "...
Special 'Case' implementation for Class, which allows testing for a certain class in a switch statement. For example: <pre>switch( obj ) { case List : // obj is a list break; case Set : // etc }</pre> @param caseValue the case value @param switchValue the switch value @return true if the switchValue is deemed to be assignable from the given class @since 1.0
[ "Special", "Case", "implementation", "for", "Class", "which", "allows", "testing", "for", "a", "certain", "class", "in", "a", "switch", "statement", ".", "For", "example", ":", "<pre", ">", "switch", "(", "obj", ")", "{", "case", "List", ":", "//", "obj"...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L1134-L1140
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/formatstring/FormatStringValidation.java
FormatStringValidation.getInstance
@Nullable private static Object getInstance(Tree tree, VisitorState state) { Object value = ASTHelpers.constValue(tree); if (value != null) { return value; } Type type = ASTHelpers.getType(tree); return getInstance(type, state); }
java
@Nullable private static Object getInstance(Tree tree, VisitorState state) { Object value = ASTHelpers.constValue(tree); if (value != null) { return value; } Type type = ASTHelpers.getType(tree); return getInstance(type, state); }
[ "@", "Nullable", "private", "static", "Object", "getInstance", "(", "Tree", "tree", ",", "VisitorState", "state", ")", "{", "Object", "value", "=", "ASTHelpers", ".", "constValue", "(", "tree", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "retur...
Return an instance of the given type if it receives special handling by {@code String.format}. For example, an intance of {@link Integer} will be returned for an input of type {@code int} or {@link Integer}.
[ "Return", "an", "instance", "of", "the", "given", "type", "if", "it", "receives", "special", "handling", "by", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/formatstring/FormatStringValidation.java#L141-L149
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.orthoSymmetricLH
public Matrix4d orthoSymmetricLH(double width, double height, double zNear, double zFar, boolean zZeroToOne, Matrix4d dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.setOrthoSymmetricLH(width, height, zNear, zFar, zZeroToOne); return orthoSymmetricLHGeneric(width, height, zNear, zFar, zZeroToOne, dest); }
java
public Matrix4d orthoSymmetricLH(double width, double height, double zNear, double zFar, boolean zZeroToOne, Matrix4d dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.setOrthoSymmetricLH(width, height, zNear, zFar, zZeroToOne); return orthoSymmetricLHGeneric(width, height, zNear, zFar, zZeroToOne, dest); }
[ "public", "Matrix4d", "orthoSymmetricLH", "(", "double", "width", ",", "double", "height", ",", "double", "zNear", ",", "double", "zFar", ",", "boolean", "zZeroToOne", ",", "Matrix4d", "dest", ")", "{", "if", "(", "(", "properties", "&", "PROPERTY_IDENTITY", ...
Apply a symmetric orthographic projection transformation for a left-handed coordinate system using the given NDC z range to this matrix and store the result in <code>dest</code>. <p> This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double, boolean, Matrix4d) orthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetricLH(double, double, double, double, boolean) setOrthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetricLH(double, double, double, double, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param dest will hold the result @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return dest
[ "Apply", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", "to", "this", "matrix", "and", "store", "the", "result", "in", "<code", ">", "...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L10261-L10265
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldComparatorSource.java
SharedFieldComparatorSource.newComparator
@Override public FieldComparator<?> newComparator(String propertyName, int numHits, int sortPos, boolean reversed) throws IOException { try { QPath path = locationFactory.parseJCRPath(propertyName).getInternalPath(); SimpleFieldComparator simple = (SimpleFieldComparator)createSimpleComparator(numHits, path); if (path.getEntries().length == 1) { return simple; } else { return createCompoundComparator(numHits, path, simple); } } catch (IllegalNameException e) { throw Util.createIOException(e); } catch (RepositoryException e) { throw Util.createIOException(e); } }
java
@Override public FieldComparator<?> newComparator(String propertyName, int numHits, int sortPos, boolean reversed) throws IOException { try { QPath path = locationFactory.parseJCRPath(propertyName).getInternalPath(); SimpleFieldComparator simple = (SimpleFieldComparator)createSimpleComparator(numHits, path); if (path.getEntries().length == 1) { return simple; } else { return createCompoundComparator(numHits, path, simple); } } catch (IllegalNameException e) { throw Util.createIOException(e); } catch (RepositoryException e) { throw Util.createIOException(e); } }
[ "@", "Override", "public", "FieldComparator", "<", "?", ">", "newComparator", "(", "String", "propertyName", ",", "int", "numHits", ",", "int", "sortPos", ",", "boolean", "reversed", ")", "throws", "IOException", "{", "try", "{", "QPath", "path", "=", "locat...
Create a new <code>FieldComparator</code> for an embedded <code>propertyName</code> and a <code>reader</code>. @param propertyName the relative path to the property to sort on as returned by org.apache.jackrabbit.spi.Path#getString(). @return a <code>FieldComparator</code> @throws java.io.IOException if an error occurs
[ "Create", "a", "new", "<code", ">", "FieldComparator<", "/", "code", ">", "for", "an", "embedded", "<code", ">", "propertyName<", "/", "code", ">", "and", "a", "<code", ">", "reader<", "/", "code", ">", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldComparatorSource.java#L107-L133
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setEnterpriseCustomField
public void setEnterpriseCustomField(int index, String value) { set(selectField(TaskFieldLists.ENTERPRISE_CUSTOM_FIELD, index), value); }
java
public void setEnterpriseCustomField(int index, String value) { set(selectField(TaskFieldLists.ENTERPRISE_CUSTOM_FIELD, index), value); }
[ "public", "void", "setEnterpriseCustomField", "(", "int", "index", ",", "String", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "ENTERPRISE_CUSTOM_FIELD", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise custom field value. @param index field index @param value field value
[ "Set", "an", "enterprise", "custom", "field", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L3969-L3972
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.getPermissions
public CmsPermissionSet getPermissions(String resourceName) throws CmsException { return getPermissions(resourceName, m_context.getCurrentUser().getName()); }
java
public CmsPermissionSet getPermissions(String resourceName) throws CmsException { return getPermissions(resourceName, m_context.getCurrentUser().getName()); }
[ "public", "CmsPermissionSet", "getPermissions", "(", "String", "resourceName", ")", "throws", "CmsException", "{", "return", "getPermissions", "(", "resourceName", ",", "m_context", ".", "getCurrentUser", "(", ")", ".", "getName", "(", ")", ")", ";", "}" ]
Returns the set of permissions of the current user for a given resource.<p> @param resourceName the name of the resource @return the bit set of the permissions of the current user @throws CmsException if something goes wrong
[ "Returns", "the", "set", "of", "permissions", "of", "the", "current", "user", "for", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1662-L1665
MenoData/Time4J
base/src/main/java/net/time4j/range/TimestampInterval.java
TimestampInterval.until
public static TimestampInterval until(PlainTimestamp end) { Boundary<PlainTimestamp> past = Boundary.infinitePast(); return new TimestampInterval(past, Boundary.of(OPEN, end)); }
java
public static TimestampInterval until(PlainTimestamp end) { Boundary<PlainTimestamp> past = Boundary.infinitePast(); return new TimestampInterval(past, Boundary.of(OPEN, end)); }
[ "public", "static", "TimestampInterval", "until", "(", "PlainTimestamp", "end", ")", "{", "Boundary", "<", "PlainTimestamp", ">", "past", "=", "Boundary", ".", "infinitePast", "(", ")", ";", "return", "new", "TimestampInterval", "(", "past", ",", "Boundary", "...
/*[deutsch] <p>Erzeugt ein unbegrenztes offenes Intervall bis zum angegebenen Endzeitpunkt. </p> @param end timestamp of upper boundary (exclusive) @return new timestamp interval @since 2.0
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Erzeugt", "ein", "unbegrenztes", "offenes", "Intervall", "bis", "zum", "angegebenen", "Endzeitpunkt", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/TimestampInterval.java#L274-L279
ldapchai/ldapchai
src/main/java/com/novell/ldapchai/impl/edir/entry/EdirEntries.java
EdirEntries.writeGroupMembership
public static void writeGroupMembership( final ChaiUser user, final ChaiGroup group ) throws ChaiOperationException, ChaiUnavailableException { if ( user == null ) { throw new NullPointerException( "user cannot be null" ); } if ( group == null ) { throw new NullPointerException( "group cannot be null" ); } user.addAttribute( ChaiConstant.ATTR_LDAP_GROUP_MEMBERSHIP, group.getEntryDN() ); user.addAttribute( ChaiConstant.ATTR_LDAP_SECURITY_EQUALS, group.getEntryDN() ); group.addAttribute( ChaiConstant.ATTR_LDAP_MEMBER, user.getEntryDN() ); group.addAttribute( ChaiConstant.ATTR_LDAP_EQUIVALENT_TO_ME, user.getEntryDN() ); }
java
public static void writeGroupMembership( final ChaiUser user, final ChaiGroup group ) throws ChaiOperationException, ChaiUnavailableException { if ( user == null ) { throw new NullPointerException( "user cannot be null" ); } if ( group == null ) { throw new NullPointerException( "group cannot be null" ); } user.addAttribute( ChaiConstant.ATTR_LDAP_GROUP_MEMBERSHIP, group.getEntryDN() ); user.addAttribute( ChaiConstant.ATTR_LDAP_SECURITY_EQUALS, group.getEntryDN() ); group.addAttribute( ChaiConstant.ATTR_LDAP_MEMBER, user.getEntryDN() ); group.addAttribute( ChaiConstant.ATTR_LDAP_EQUIVALENT_TO_ME, user.getEntryDN() ); }
[ "public", "static", "void", "writeGroupMembership", "(", "final", "ChaiUser", "user", ",", "final", "ChaiGroup", "group", ")", "throws", "ChaiOperationException", ",", "ChaiUnavailableException", "{", "if", "(", "user", "==", "null", ")", "{", "throw", "new", "N...
Add a group membership for the supplied user and group. This implementation takes care of all four attributes used in eDirectory static group associations: <ul> <li>{@link com.novell.ldapchai.ChaiConstant#ATTR_LDAP_GROUP_MEMBERSHIP}</li> <li>{@link com.novell.ldapchai.ChaiConstant#ATTR_LDAP_MEMBER}</li> <li>{@link com.novell.ldapchai.ChaiConstant#ATTR_LDAP_SECURITY_EQUALS}</li> <li>{@link com.novell.ldapchai.ChaiConstant#ATTR_LDAP_EQUIVALENT_TO_ME}</li> </ul> @param user A valid {@code ChaiUser} @param group A valid {@code ChaiGroup} @throws com.novell.ldapchai.exception.ChaiUnavailableException If the ldap server(s) are not available @throws com.novell.ldapchai.exception.ChaiOperationException If there is an error during the operation
[ "Add", "a", "group", "membership", "for", "the", "supplied", "user", "and", "group", ".", "This", "implementation", "takes", "care", "of", "all", "four", "attributes", "used", "in", "eDirectory", "static", "group", "associations", ":", "<ul", ">", "<li", ">"...
train
https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/impl/edir/entry/EdirEntries.java#L257-L275
real-logic/agrona
agrona/src/main/java/org/agrona/BufferUtil.java
BufferUtil.boundsCheck
public static void boundsCheck(final byte[] buffer, final long index, final int length) { final int capacity = buffer.length; final long resultingPosition = index + (long)length; if (index < 0 || resultingPosition > capacity) { throw new IndexOutOfBoundsException("index=" + index + " length=" + length + " capacity=" + capacity); } }
java
public static void boundsCheck(final byte[] buffer, final long index, final int length) { final int capacity = buffer.length; final long resultingPosition = index + (long)length; if (index < 0 || resultingPosition > capacity) { throw new IndexOutOfBoundsException("index=" + index + " length=" + length + " capacity=" + capacity); } }
[ "public", "static", "void", "boundsCheck", "(", "final", "byte", "[", "]", "buffer", ",", "final", "long", "index", ",", "final", "int", "length", ")", "{", "final", "int", "capacity", "=", "buffer", ".", "length", ";", "final", "long", "resultingPosition"...
Bounds check the access range and throw a {@link IndexOutOfBoundsException} if exceeded. @param buffer to be checked. @param index at which the access will begin. @param length of the range accessed.
[ "Bounds", "check", "the", "access", "range", "and", "throw", "a", "{", "@link", "IndexOutOfBoundsException", "}", "if", "exceeded", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/BufferUtil.java#L61-L69
j256/ormlite-core
src/main/java/com/j256/ormlite/misc/TransactionManager.java
TransactionManager.callInTransaction
public static <T> T callInTransaction(String tableName, final ConnectionSource connectionSource, final Callable<T> callable) throws SQLException { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableName); try { boolean saved = connectionSource.saveSpecialConnection(connection); return callInTransaction(connection, saved, connectionSource.getDatabaseType(), callable); } finally { // we should clear aggressively connectionSource.clearSpecialConnection(connection); connectionSource.releaseConnection(connection); } }
java
public static <T> T callInTransaction(String tableName, final ConnectionSource connectionSource, final Callable<T> callable) throws SQLException { DatabaseConnection connection = connectionSource.getReadWriteConnection(tableName); try { boolean saved = connectionSource.saveSpecialConnection(connection); return callInTransaction(connection, saved, connectionSource.getDatabaseType(), callable); } finally { // we should clear aggressively connectionSource.clearSpecialConnection(connection); connectionSource.releaseConnection(connection); } }
[ "public", "static", "<", "T", ">", "T", "callInTransaction", "(", "String", "tableName", ",", "final", "ConnectionSource", "connectionSource", ",", "final", "Callable", "<", "T", ">", "callable", ")", "throws", "SQLException", "{", "DatabaseConnection", "connectio...
Same as {@link #callInTransaction(ConnectionSource, Callable)} except this has a table-name. <p> WARNING: it is up to you to properly synchronize around this method if multiple threads are using a connection-source which works gives out a single-connection. The reason why this is necessary is that multiple operations are performed on the connection and race-conditions will exist with multiple threads working on the same connection. </p>
[ "Same", "as", "{", "@link", "#callInTransaction", "(", "ConnectionSource", "Callable", ")", "}", "except", "this", "has", "a", "table", "-", "name", "." ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/misc/TransactionManager.java#L171-L183
EXIficient/exificient-core
src/main/java/com/siemens/ct/exi/core/io/channel/AbstractDecoderChannel.java
AbstractDecoderChannel.decodeDecimalValue
public DecimalValue decodeDecimalValue() throws IOException { boolean negative = decodeBoolean(); IntegerValue integral = decodeUnsignedIntegerValue(false); IntegerValue revFractional = decodeUnsignedIntegerValue(false); return new DecimalValue(negative, integral, revFractional); }
java
public DecimalValue decodeDecimalValue() throws IOException { boolean negative = decodeBoolean(); IntegerValue integral = decodeUnsignedIntegerValue(false); IntegerValue revFractional = decodeUnsignedIntegerValue(false); return new DecimalValue(negative, integral, revFractional); }
[ "public", "DecimalValue", "decodeDecimalValue", "(", ")", "throws", "IOException", "{", "boolean", "negative", "=", "decodeBoolean", "(", ")", ";", "IntegerValue", "integral", "=", "decodeUnsignedIntegerValue", "(", "false", ")", ";", "IntegerValue", "revFractional", ...
Decode a decimal represented as a Boolean sign followed by two Unsigned Integers. A sign value of zero (0) is used to represent positive Decimal values and a sign value of one (1) is used to represent negative Decimal values The first Integer represents the integral portion of the Decimal value. The second positive integer represents the fractional portion of the decimal with the digits in reverse order to preserve leading zeros.
[ "Decode", "a", "decimal", "represented", "as", "a", "Boolean", "sign", "followed", "by", "two", "Unsigned", "Integers", ".", "A", "sign", "value", "of", "zero", "(", "0", ")", "is", "used", "to", "represent", "positive", "Decimal", "values", "and", "a", ...
train
https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/channel/AbstractDecoderChannel.java#L307-L314
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_boot_bootId_GET
public OvhNetboot serviceName_boot_bootId_GET(String serviceName, Long bootId) throws IOException { String qPath = "/dedicated/server/{serviceName}/boot/{bootId}"; StringBuilder sb = path(qPath, serviceName, bootId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNetboot.class); }
java
public OvhNetboot serviceName_boot_bootId_GET(String serviceName, Long bootId) throws IOException { String qPath = "/dedicated/server/{serviceName}/boot/{bootId}"; StringBuilder sb = path(qPath, serviceName, bootId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNetboot.class); }
[ "public", "OvhNetboot", "serviceName_boot_bootId_GET", "(", "String", "serviceName", ",", "Long", "bootId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/boot/{bootId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPa...
Get this object properties REST: GET /dedicated/server/{serviceName}/boot/{bootId} @param serviceName [required] The internal name of your dedicated server @param bootId [required] boot id
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1829-L1834
TrueNight/Utils
utils/src/main/java/xyz/truenight/utils/Palazzo.java
Palazzo.submitSafe
public synchronized void submitSafe(Object tag, Object subTag, boolean priority, Runnable runnable) { Task task = new Task(tag, subTag, runnable); if (!isContains(task)) { submitInternal(task.mTag, priority, task); } else if (priority) { remove(task); submitInternal(task.mTag, true, task); } if (DEBUG) { System.out.print(TAG + "/ Task NOT added: { TAG: " + tag + ", SUBTAG: " + subTag + " }"); } }
java
public synchronized void submitSafe(Object tag, Object subTag, boolean priority, Runnable runnable) { Task task = new Task(tag, subTag, runnable); if (!isContains(task)) { submitInternal(task.mTag, priority, task); } else if (priority) { remove(task); submitInternal(task.mTag, true, task); } if (DEBUG) { System.out.print(TAG + "/ Task NOT added: { TAG: " + tag + ", SUBTAG: " + subTag + " }"); } }
[ "public", "synchronized", "void", "submitSafe", "(", "Object", "tag", ",", "Object", "subTag", ",", "boolean", "priority", ",", "Runnable", "runnable", ")", "{", "Task", "task", "=", "new", "Task", "(", "tag", ",", "subTag", ",", "runnable", ")", ";", "i...
Same as submit(String tag, String subTag, Runnable runnable) but task will NOT be added to queue IF there is same task in queue @param tag queue tag @param subTag task tag @param runnable task
[ "Same", "as", "submit", "(", "String", "tag", "String", "subTag", "Runnable", "runnable", ")", "but", "task", "will", "NOT", "be", "added", "to", "queue", "IF", "there", "is", "same", "task", "in", "queue" ]
train
https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/utils/src/main/java/xyz/truenight/utils/Palazzo.java#L110-L121
openbase/jul
exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java
ExceptionPrinter.printHistoryAndReturnThrowable
public static <T extends Throwable> T printHistoryAndReturnThrowable(final T th, final PrintStream stream) { printHistory(th, new SystemPrinter(stream)); return th; }
java
public static <T extends Throwable> T printHistoryAndReturnThrowable(final T th, final PrintStream stream) { printHistory(th, new SystemPrinter(stream)); return th; }
[ "public", "static", "<", "T", "extends", "Throwable", ">", "T", "printHistoryAndReturnThrowable", "(", "final", "T", "th", ",", "final", "PrintStream", "stream", ")", "{", "printHistory", "(", "th", ",", "new", "SystemPrinter", "(", "stream", ")", ")", ";", ...
Print Exception messages without stack trace in non debug mode. Method prints recursive all messages of the given exception stack to get a history overview of the causes. In verbose mode (app -v) the stacktrace is printed in the end of history. @param <T> Exception type @param th exception stack to print. @param stream the stream used for printing the message history e.g. System.out or. System.err * @return the related Throwable returned for further exception handling.
[ "Print", "Exception", "messages", "without", "stack", "trace", "in", "non", "debug", "mode", ".", "Method", "prints", "recursive", "all", "messages", "of", "the", "given", "exception", "stack", "to", "get", "a", "history", "overview", "of", "the", "causes", ...
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java#L276-L279
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/ByteArrayUtil.java
ByteArrayUtil.putDoubleLE
public static void putDoubleLE(final byte[] array, final int offset, final double value) { putLongLE(array, offset, Double.doubleToRawLongBits(value)); }
java
public static void putDoubleLE(final byte[] array, final int offset, final double value) { putLongLE(array, offset, Double.doubleToRawLongBits(value)); }
[ "public", "static", "void", "putDoubleLE", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ",", "final", "double", "value", ")", "{", "putLongLE", "(", "array", ",", "offset", ",", "Double", ".", "doubleToRawLongBits", "(", "value",...
Put the source <i>double</i> into the destination byte array starting at the given offset in little endian order. There is no bounds checking. @param array destination byte array @param offset destination offset @param value source <i>double</i>
[ "Put", "the", "source", "<i", ">", "double<", "/", "i", ">", "into", "the", "destination", "byte", "array", "starting", "at", "the", "given", "offset", "in", "little", "endian", "order", ".", "There", "is", "no", "bounds", "checking", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/ByteArrayUtil.java#L261-L263
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java
CopyManager.copyIn
public long copyIn(final String sql, InputStream from, int bufferSize) throws SQLException, IOException { byte[] buf = new byte[bufferSize]; int len; CopyIn cp = copyIn(sql); try { while ((len = from.read(buf)) >= 0) { if (len > 0) { cp.writeToCopy(buf, 0, len); } } return cp.endCopy(); } finally { // see to it that we do not leave the connection locked if (cp.isActive()) { cp.cancelCopy(); } } }
java
public long copyIn(final String sql, InputStream from, int bufferSize) throws SQLException, IOException { byte[] buf = new byte[bufferSize]; int len; CopyIn cp = copyIn(sql); try { while ((len = from.read(buf)) >= 0) { if (len > 0) { cp.writeToCopy(buf, 0, len); } } return cp.endCopy(); } finally { // see to it that we do not leave the connection locked if (cp.isActive()) { cp.cancelCopy(); } } }
[ "public", "long", "copyIn", "(", "final", "String", "sql", ",", "InputStream", "from", ",", "int", "bufferSize", ")", "throws", "SQLException", ",", "IOException", "{", "byte", "[", "]", "buf", "=", "new", "byte", "[", "bufferSize", "]", ";", "int", "len...
Use COPY FROM STDIN for very fast copying from an InputStream into a database table. @param sql COPY FROM STDIN statement @param from a CSV file or such @param bufferSize number of bytes to buffer and push over network to server at once @return number of rows updated for server 8.2 or newer; -1 for older @throws SQLException on database usage issues @throws IOException upon input stream or database connection failure
[ "Use", "COPY", "FROM", "STDIN", "for", "very", "fast", "copying", "from", "an", "InputStream", "into", "a", "database", "table", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java#L212-L229
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/panelGrid/PanelGridRenderer.java
PanelGridRenderer.generateColumnStart
protected void generateColumnStart(UIComponent child, String colStyleClass, ResponseWriter writer) throws IOException { writer.startElement("div", child); writer.writeAttribute("class", colStyleClass, "class"); }
java
protected void generateColumnStart(UIComponent child, String colStyleClass, ResponseWriter writer) throws IOException { writer.startElement("div", child); writer.writeAttribute("class", colStyleClass, "class"); }
[ "protected", "void", "generateColumnStart", "(", "UIComponent", "child", ",", "String", "colStyleClass", ",", "ResponseWriter", "writer", ")", "throws", "IOException", "{", "writer", ".", "startElement", "(", "\"div\"", ",", "child", ")", ";", "writer", ".", "wr...
Generates the start of each Bootstrap column. @param child the child component to be drawn within the column. @param colStyleClass the current CSS style class @param writer the current response writer. @throws IOException if something's wrong with the response writer.
[ "Generates", "the", "start", "of", "each", "Bootstrap", "column", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/panelGrid/PanelGridRenderer.java#L271-L274
intellimate/Izou
src/main/java/org/intellimate/izou/events/EventDistributor.java
EventDistributor.registerEventFinishedListener
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") public void registerEventFinishedListener(List<String> ids, EventListenerModel eventListener) { for(String id : ids) { ArrayList<EventListenerModel> listenersList = finishListeners.get(id); if (listenersList == null) { finishListeners.put(id, new ArrayList<>()); listenersList = finishListeners.get(id); } if (!listenersList.contains(eventListener)) { synchronized (listenersList) { listenersList.add(eventListener); } } } }
java
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") public void registerEventFinishedListener(List<String> ids, EventListenerModel eventListener) { for(String id : ids) { ArrayList<EventListenerModel> listenersList = finishListeners.get(id); if (listenersList == null) { finishListeners.put(id, new ArrayList<>()); listenersList = finishListeners.get(id); } if (!listenersList.contains(eventListener)) { synchronized (listenersList) { listenersList.add(eventListener); } } } }
[ "@", "SuppressWarnings", "(", "\"SynchronizationOnLocalVariableOrMethodParameter\"", ")", "public", "void", "registerEventFinishedListener", "(", "List", "<", "String", ">", "ids", ",", "EventListenerModel", "eventListener", ")", "{", "for", "(", "String", "id", ":", ...
Adds an listener for events that gets called when the event finished processing. <p> It will register for all ids individually! This method will ignore if this listener is already listening to an Event. Method is thread-safe. </p> @param ids this can be type, or descriptors etc. @param eventListener the ActivatorEventListener-interface for receiving activator events
[ "Adds", "an", "listener", "for", "events", "that", "gets", "called", "when", "the", "event", "finished", "processing", ".", "<p", ">", "It", "will", "register", "for", "all", "ids", "individually!", "This", "method", "will", "ignore", "if", "this", "listener...
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/events/EventDistributor.java#L219-L233
castorflex/SmoothProgressBar
library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressDrawable.java
CircularProgressDrawable.initDelegate
private void initDelegate() { boolean powerSaveMode = Utils.isPowerSaveModeEnabled(mPowerManager); if (powerSaveMode) { if (mPBDelegate == null || !(mPBDelegate instanceof PowerSaveModeDelegate)) { if (mPBDelegate != null) mPBDelegate.stop(); mPBDelegate = new PowerSaveModeDelegate(this); } } else { if (mPBDelegate == null || (mPBDelegate instanceof PowerSaveModeDelegate)) { if (mPBDelegate != null) mPBDelegate.stop(); mPBDelegate = new DefaultDelegate(this, mOptions); } } }
java
private void initDelegate() { boolean powerSaveMode = Utils.isPowerSaveModeEnabled(mPowerManager); if (powerSaveMode) { if (mPBDelegate == null || !(mPBDelegate instanceof PowerSaveModeDelegate)) { if (mPBDelegate != null) mPBDelegate.stop(); mPBDelegate = new PowerSaveModeDelegate(this); } } else { if (mPBDelegate == null || (mPBDelegate instanceof PowerSaveModeDelegate)) { if (mPBDelegate != null) mPBDelegate.stop(); mPBDelegate = new DefaultDelegate(this, mOptions); } } }
[ "private", "void", "initDelegate", "(", ")", "{", "boolean", "powerSaveMode", "=", "Utils", ".", "isPowerSaveModeEnabled", "(", "mPowerManager", ")", ";", "if", "(", "powerSaveMode", ")", "{", "if", "(", "mPBDelegate", "==", "null", "||", "!", "(", "mPBDeleg...
Inits the delegate. Create one if the delegate is null or not the right mode
[ "Inits", "the", "delegate", ".", "Create", "one", "if", "the", "delegate", "is", "null", "or", "not", "the", "right", "mode" ]
train
https://github.com/castorflex/SmoothProgressBar/blob/29fe0041f163695510775facdcc8c48114580def/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressDrawable.java#L113-L126
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/World.java
World.registerDefaultSupervisor
@Override public void registerDefaultSupervisor(final String stageName, final String name, final Class<? extends Actor> supervisorClass) { try { final String actualStageName = stageName.equals("default") ? DEFAULT_STAGE : stageName; final Stage stage = stageNamed(actualStageName); defaultSupervisor = stage.actorFor(Supervisor.class, Definition.has(supervisorClass, Definition.NoParameters, name)); } catch (Exception e) { defaultLogger().log("vlingo/actors: World cannot register default supervisor override: " + supervisorClass.getName(), e); e.printStackTrace(); } }
java
@Override public void registerDefaultSupervisor(final String stageName, final String name, final Class<? extends Actor> supervisorClass) { try { final String actualStageName = stageName.equals("default") ? DEFAULT_STAGE : stageName; final Stage stage = stageNamed(actualStageName); defaultSupervisor = stage.actorFor(Supervisor.class, Definition.has(supervisorClass, Definition.NoParameters, name)); } catch (Exception e) { defaultLogger().log("vlingo/actors: World cannot register default supervisor override: " + supervisorClass.getName(), e); e.printStackTrace(); } }
[ "@", "Override", "public", "void", "registerDefaultSupervisor", "(", "final", "String", "stageName", ",", "final", "String", "name", ",", "final", "Class", "<", "?", "extends", "Actor", ">", "supervisorClass", ")", "{", "try", "{", "final", "String", "actualSt...
Registers the {@code supervisorClass} plugin by {@code name} that will serve as the default supervise for all {@code Actors} that are not supervised by a specific supervisor. @param stageName the {@code String} name of the {@code Stage} in which the {@code supervisorClass} is to be registered @param name the {@code String} name of the supervisor to register @param supervisorClass the {@code Class<? extends Actor>} to register as a supervisor
[ "Registers", "the", "{" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/World.java#L329-L339
apache/incubator-atlas
typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
HierarchicalType.validateUpdate
@Override public void validateUpdate(IDataType newType) throws TypeUpdateException { super.validateUpdate(newType); HierarchicalType newHierarchicalType = (HierarchicalType) newType; //validate on supertypes if ((newHierarchicalType.superTypes.size() != superTypes.size()) || !newHierarchicalType.superTypes.containsAll(superTypes)) { throw new TypeUpdateException(newType, "New type cannot modify superTypes"); } //validate on fields try { TypeUtils.validateUpdate(fieldMapping, newHierarchicalType.fieldMapping); } catch (TypeUpdateException e) { throw new TypeUpdateException(newType, e); } }
java
@Override public void validateUpdate(IDataType newType) throws TypeUpdateException { super.validateUpdate(newType); HierarchicalType newHierarchicalType = (HierarchicalType) newType; //validate on supertypes if ((newHierarchicalType.superTypes.size() != superTypes.size()) || !newHierarchicalType.superTypes.containsAll(superTypes)) { throw new TypeUpdateException(newType, "New type cannot modify superTypes"); } //validate on fields try { TypeUtils.validateUpdate(fieldMapping, newHierarchicalType.fieldMapping); } catch (TypeUpdateException e) { throw new TypeUpdateException(newType, e); } }
[ "@", "Override", "public", "void", "validateUpdate", "(", "IDataType", "newType", ")", "throws", "TypeUpdateException", "{", "super", ".", "validateUpdate", "(", "newType", ")", ";", "HierarchicalType", "newHierarchicalType", "=", "(", "HierarchicalType", ")", "newT...
Validate that current definition can be updated with the new definition @param newType @return true if the current definition can be updated with the new definition, else false
[ "Validate", "that", "current", "definition", "can", "be", "updated", "with", "the", "new", "definition" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java#L121-L140
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.convert
public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream, boolean isSrcPng) { try { ImageIO.write(isSrcPng ? copyImage(srcImage, BufferedImage.TYPE_INT_RGB) : toBufferedImage(srcImage), formatName, destImageStream); } catch (IOException e) { throw new IORuntimeException(e); } }
java
public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream, boolean isSrcPng) { try { ImageIO.write(isSrcPng ? copyImage(srcImage, BufferedImage.TYPE_INT_RGB) : toBufferedImage(srcImage), formatName, destImageStream); } catch (IOException e) { throw new IORuntimeException(e); } }
[ "public", "static", "void", "convert", "(", "Image", "srcImage", ",", "String", "formatName", ",", "ImageOutputStream", "destImageStream", ",", "boolean", "isSrcPng", ")", "{", "try", "{", "ImageIO", ".", "write", "(", "isSrcPng", "?", "copyImage", "(", "srcIm...
图像类型转换:GIF=》JPG、GIF=》PNG、PNG=》JPG、PNG=》GIF(X)、BMP=》PNG<br> 此方法并不关闭流 @param srcImage 源图像流 @param formatName 包含格式非正式名称的 String:如JPG、JPEG、GIF等 @param destImageStream 目标图像输出流 @param isSrcPng 源图片是否为PNG格式 @since 4.1.14
[ "图像类型转换:GIF", "=", "》JPG、GIF", "=", "》PNG、PNG", "=", "》JPG、PNG", "=", "》GIF", "(", "X", ")", "、BMP", "=", "》PNG<br", ">", "此方法并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L565-L571
pravega/pravega
common/src/main/java/io/pravega/common/util/btree/BTreePage.java
BTreePage.formatHeaderAndFooter
private void formatHeaderAndFooter(int itemCount, int id) { // Header. this.header.set(VERSION_OFFSET, CURRENT_VERSION); this.header.set(FLAGS_OFFSET, getFlags(this.config.isIndexPage ? FLAG_INDEX_PAGE : FLAG_NONE)); setHeaderId(id); setCount(itemCount); // Matching footer. setFooterId(id); }
java
private void formatHeaderAndFooter(int itemCount, int id) { // Header. this.header.set(VERSION_OFFSET, CURRENT_VERSION); this.header.set(FLAGS_OFFSET, getFlags(this.config.isIndexPage ? FLAG_INDEX_PAGE : FLAG_NONE)); setHeaderId(id); setCount(itemCount); // Matching footer. setFooterId(id); }
[ "private", "void", "formatHeaderAndFooter", "(", "int", "itemCount", ",", "int", "id", ")", "{", "// Header.", "this", ".", "header", ".", "set", "(", "VERSION_OFFSET", ",", "CURRENT_VERSION", ")", ";", "this", ".", "header", ".", "set", "(", "FLAGS_OFFSET",...
Formats the Header and Footer of this BTreePage with the given information. @param itemCount The number of items in this BTreePage. @param id The Id of this BTreePage.
[ "Formats", "the", "Header", "and", "Footer", "of", "this", "BTreePage", "with", "the", "given", "information", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreePage.java#L202-L211
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/PROCLUS.java
PROCLUS.avgDistance
private double avgDistance(double[] centroid, DBIDs objectIDs, Relation<V> database, int dimension) { Mean avg = new Mean(); for(DBIDIter iter = objectIDs.iter(); iter.valid(); iter.advance()) { V o = database.get(iter); avg.put(Math.abs(centroid[dimension] - o.doubleValue(dimension))); } return avg.getMean(); }
java
private double avgDistance(double[] centroid, DBIDs objectIDs, Relation<V> database, int dimension) { Mean avg = new Mean(); for(DBIDIter iter = objectIDs.iter(); iter.valid(); iter.advance()) { V o = database.get(iter); avg.put(Math.abs(centroid[dimension] - o.doubleValue(dimension))); } return avg.getMean(); }
[ "private", "double", "avgDistance", "(", "double", "[", "]", "centroid", ",", "DBIDs", "objectIDs", ",", "Relation", "<", "V", ">", "database", ",", "int", "dimension", ")", "{", "Mean", "avg", "=", "new", "Mean", "(", ")", ";", "for", "(", "DBIDIter",...
Computes the average distance of the objects to the centroid along the specified dimension. @param centroid the centroid @param objectIDs the set of objects ids @param database the database holding the objects @param dimension the dimension for which the average distance is computed @return the average distance of the objects to the centroid along the specified dimension
[ "Computes", "the", "average", "distance", "of", "the", "objects", "to", "the", "centroid", "along", "the", "specified", "dimension", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/PROCLUS.java#L689-L696
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java
BitfinexApiCallbackListeners.onMySubmittedOrderEvent
public Closeable onMySubmittedOrderEvent(final BiConsumer<BitfinexAccountSymbol, Collection<BitfinexSubmittedOrder>> listener) { submittedOrderConsumers.offer(listener); return () -> submittedOrderConsumers.remove(listener); }
java
public Closeable onMySubmittedOrderEvent(final BiConsumer<BitfinexAccountSymbol, Collection<BitfinexSubmittedOrder>> listener) { submittedOrderConsumers.offer(listener); return () -> submittedOrderConsumers.remove(listener); }
[ "public", "Closeable", "onMySubmittedOrderEvent", "(", "final", "BiConsumer", "<", "BitfinexAccountSymbol", ",", "Collection", "<", "BitfinexSubmittedOrder", ">", ">", "listener", ")", "{", "submittedOrderConsumers", ".", "offer", "(", "listener", ")", ";", "return", ...
registers listener for user account related events - submitted order events @param listener of event @return hook of this listener
[ "registers", "listener", "for", "user", "account", "related", "events", "-", "submitted", "order", "events" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L108-L111
structr/structr
structr-core/src/main/java/org/structr/module/JarConfigurationProvider.java
JarConfigurationProvider.registerEntityCreationTransformation
@Override public void registerEntityCreationTransformation(Class type, Transformation<GraphObject> transformation) { final Set<Transformation<GraphObject>> transformations = getEntityCreationTransformationsForType(type); if (!transformations.contains(transformation)) { transformations.add(transformation); } }
java
@Override public void registerEntityCreationTransformation(Class type, Transformation<GraphObject> transformation) { final Set<Transformation<GraphObject>> transformations = getEntityCreationTransformationsForType(type); if (!transformations.contains(transformation)) { transformations.add(transformation); } }
[ "@", "Override", "public", "void", "registerEntityCreationTransformation", "(", "Class", "type", ",", "Transformation", "<", "GraphObject", ">", "transformation", ")", "{", "final", "Set", "<", "Transformation", "<", "GraphObject", ">", ">", "transformations", "=", ...
Register a transformation that will be applied to every newly created entity of a given type. @param type the type of the entities for which the transformation should be applied @param transformation the transformation to apply on every entity
[ "Register", "a", "transformation", "that", "will", "be", "applied", "to", "every", "newly", "created", "entity", "of", "a", "given", "type", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/module/JarConfigurationProvider.java#L649-L657
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java
JBBPUtils.reverseBitsInByte
public static byte reverseBitsInByte(final JBBPBitNumber bitNumber, final byte value) { final byte reversed = reverseBitsInByte(value); return (byte) ((reversed >>> (8 - bitNumber.getBitNumber())) & bitNumber.getMask()); }
java
public static byte reverseBitsInByte(final JBBPBitNumber bitNumber, final byte value) { final byte reversed = reverseBitsInByte(value); return (byte) ((reversed >>> (8 - bitNumber.getBitNumber())) & bitNumber.getMask()); }
[ "public", "static", "byte", "reverseBitsInByte", "(", "final", "JBBPBitNumber", "bitNumber", ",", "final", "byte", "value", ")", "{", "final", "byte", "reversed", "=", "reverseBitsInByte", "(", "value", ")", ";", "return", "(", "byte", ")", "(", "(", "revers...
Reverse lower part of a byte defined by bits number constant. @param bitNumber number of lowest bits to be reversed, must not be null @param value a byte to be processed @return value contains reversed number of lowest bits of the byte
[ "Reverse", "lower", "part", "of", "a", "byte", "defined", "by", "bits", "number", "constant", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L278-L281
mozilla/rhino
src/org/mozilla/javascript/ScriptableObject.java
ScriptableObject.putProperty
public static void putProperty(Scriptable obj, int index, Object value) { Scriptable base = getBase(obj, index); if (base == null) base = obj; base.put(index, obj, value); }
java
public static void putProperty(Scriptable obj, int index, Object value) { Scriptable base = getBase(obj, index); if (base == null) base = obj; base.put(index, obj, value); }
[ "public", "static", "void", "putProperty", "(", "Scriptable", "obj", ",", "int", "index", ",", "Object", "value", ")", "{", "Scriptable", "base", "=", "getBase", "(", "obj", ",", "index", ")", ";", "if", "(", "base", "==", "null", ")", "base", "=", "...
Puts an indexed property in an object or in an object in its prototype chain. <p> Searches for the indexed property in the prototype chain. If it is found, the value of the property in <code>obj</code> is changed through a call to {@link Scriptable#put(int, Scriptable, Object)} on the prototype passing <code>obj</code> as the <code>start</code> argument. This allows the prototype to veto the property setting in case the prototype defines the property with [[ReadOnly]] attribute. If the property is not found, it is added in <code>obj</code>. @param obj a JavaScript object @param index a property index @param value any JavaScript value accepted by Scriptable.put @since 1.5R2
[ "Puts", "an", "indexed", "property", "in", "an", "object", "or", "in", "an", "object", "in", "its", "prototype", "chain", ".", "<p", ">", "Searches", "for", "the", "indexed", "property", "in", "the", "prototype", "chain", ".", "If", "it", "is", "found", ...
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L2560-L2566
UrielCh/ovh-java-sdk
ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java
ApiOvhVrack.serviceName_dedicatedConnect_name_PUT
public void serviceName_dedicatedConnect_name_PUT(String serviceName, String name, OvhDedicatedConnect body) throws IOException { String qPath = "/vrack/{serviceName}/dedicatedConnect/{name}"; StringBuilder sb = path(qPath, serviceName, name); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_dedicatedConnect_name_PUT(String serviceName, String name, OvhDedicatedConnect body) throws IOException { String qPath = "/vrack/{serviceName}/dedicatedConnect/{name}"; StringBuilder sb = path(qPath, serviceName, name); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_dedicatedConnect_name_PUT", "(", "String", "serviceName", ",", "String", "name", ",", "OvhDedicatedConnect", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vrack/{serviceName}/dedicatedConnect/{name}\"", ";", "StringBui...
Alter this object properties REST: PUT /vrack/{serviceName}/dedicatedConnect/{name} @param body [required] New object properties @param serviceName [required] The internal name of your vrack @param name [required] A name for your dedicatedConnect link
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java#L209-L213
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java
JivePropertiesManager.addProperty
public static void addProperty(Stanza packet, String name, Object value) { JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE); if (jpe == null) { jpe = new JivePropertiesExtension(); packet.addExtension(jpe); } jpe.setProperty(name, value); }
java
public static void addProperty(Stanza packet, String name, Object value) { JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE); if (jpe == null) { jpe = new JivePropertiesExtension(); packet.addExtension(jpe); } jpe.setProperty(name, value); }
[ "public", "static", "void", "addProperty", "(", "Stanza", "packet", ",", "String", "name", ",", "Object", "value", ")", "{", "JivePropertiesExtension", "jpe", "=", "(", "JivePropertiesExtension", ")", "packet", ".", "getExtension", "(", "JivePropertiesExtension", ...
Convenience method to add a property to a packet. @param packet the stanza to add the property to. @param name the name of the property to add. @param value the value of the property to add.
[ "Convenience", "method", "to", "add", "a", "property", "to", "a", "packet", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java#L58-L65
infinispan/infinispan
core/src/main/java/org/infinispan/util/DependencyGraph.java
DependencyGraph.addDependency
public void addDependency(T from, T to) { if (from == null || to == null || from.equals(to)) { throw new IllegalArgumentException("Invalid parameters"); } lock.writeLock().lock(); try { if (addOutgoingEdge(from, to)) { addIncomingEdge(to, from); } } finally { lock.writeLock().unlock(); } }
java
public void addDependency(T from, T to) { if (from == null || to == null || from.equals(to)) { throw new IllegalArgumentException("Invalid parameters"); } lock.writeLock().lock(); try { if (addOutgoingEdge(from, to)) { addIncomingEdge(to, from); } } finally { lock.writeLock().unlock(); } }
[ "public", "void", "addDependency", "(", "T", "from", ",", "T", "to", ")", "{", "if", "(", "from", "==", "null", "||", "to", "==", "null", "||", "from", ".", "equals", "(", "to", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Inval...
Add a dependency between two elements @param from From element @param to To element
[ "Add", "a", "dependency", "between", "two", "elements" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/DependencyGraph.java#L83-L95
ggrandes/kvstore
src/main/java/org/javastack/kvstore/structures/hash/IntLinkedHashMap.java
IntLinkedHashMap.put
public V put(final int key, final V value) { int index = (key & 0x7FFFFFFF) % elementData.length; IntLinkedEntry<V> entry = elementData[index]; while (entry != null && key != entry.key) { entry = entry.nextInSlot; } if (entry == null) { // Remove eldest entry if instructed, else grow capacity if appropriate IntLinkedEntry<V> eldest = header.after; ++elementCount; if (removeEldestEntry(eldest)) { remove(eldest.key); } else { if (elementCount > threshold) { rehash(); index = (key & 0x7FFFFFFF) % elementData.length; } } entry = createHashedEntry(key, index); } V result = entry.value; entry.value = value; return result; }
java
public V put(final int key, final V value) { int index = (key & 0x7FFFFFFF) % elementData.length; IntLinkedEntry<V> entry = elementData[index]; while (entry != null && key != entry.key) { entry = entry.nextInSlot; } if (entry == null) { // Remove eldest entry if instructed, else grow capacity if appropriate IntLinkedEntry<V> eldest = header.after; ++elementCount; if (removeEldestEntry(eldest)) { remove(eldest.key); } else { if (elementCount > threshold) { rehash(); index = (key & 0x7FFFFFFF) % elementData.length; } } entry = createHashedEntry(key, index); } V result = entry.value; entry.value = value; return result; }
[ "public", "V", "put", "(", "final", "int", "key", ",", "final", "V", "value", ")", "{", "int", "index", "=", "(", "key", "&", "0x7FFFFFFF", ")", "%", "elementData", ".", "length", ";", "IntLinkedEntry", "<", "V", ">", "entry", "=", "elementData", "["...
Maps the specified key to the specified value. @param key the key. @param value the value. @return the value of any previous mapping with the specified key or {@code null} if there was no such mapping.
[ "Maps", "the", "specified", "key", "to", "the", "specified", "value", "." ]
train
https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/structures/hash/IntLinkedHashMap.java#L173-L199
aws/aws-sdk-java
aws-java-sdk-codedeploy/src/main/java/com/amazonaws/services/codedeploy/model/ListDeploymentTargetsRequest.java
ListDeploymentTargetsRequest.setTargetFilters
public void setTargetFilters(java.util.Map<String, java.util.List<String>> targetFilters) { this.targetFilters = targetFilters; }
java
public void setTargetFilters(java.util.Map<String, java.util.List<String>> targetFilters) { this.targetFilters = targetFilters; }
[ "public", "void", "setTargetFilters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "targetFilters", ")", "{", "this", ".", "targetFilters", "=", "targetFilters", ";", "}" ]
<p> A key used to filter the returned targets. </p> @param targetFilters A key used to filter the returned targets.
[ "<p", ">", "A", "key", "used", "to", "filter", "the", "returned", "targets", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codedeploy/src/main/java/com/amazonaws/services/codedeploy/model/ListDeploymentTargetsRequest.java#L155-L157
h2oai/h2o-3
h2o-core/src/main/java/water/H2O.java
H2O.technote
public static String technote(int[] numbers, String message) { StringBuilder sb = new StringBuilder() .append(message) .append("\n") .append("\n") .append("For more information visit:\n"); for (int number : numbers) { sb.append(" http://jira.h2o.ai/browse/TN-").append(Integer.toString(number)).append("\n"); } return sb.toString(); }
java
public static String technote(int[] numbers, String message) { StringBuilder sb = new StringBuilder() .append(message) .append("\n") .append("\n") .append("For more information visit:\n"); for (int number : numbers) { sb.append(" http://jira.h2o.ai/browse/TN-").append(Integer.toString(number)).append("\n"); } return sb.toString(); }
[ "public", "static", "String", "technote", "(", "int", "[", "]", "numbers", ",", "String", "message", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ".", "append", "(", "message", ")", ".", "append", "(", "\"\\n\"", ")", ".", "a...
Return an error message with an accompanying list of URLs to help the user get more detailed information. @param numbers H2O tech note numbers. @param message Message to present to the user. @return A longer message including a list of URLs.
[ "Return", "an", "error", "message", "with", "an", "accompanying", "list", "of", "URLs", "to", "help", "the", "user", "get", "more", "detailed", "information", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/H2O.java#L1169-L1181
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java
IntentsClient.getIntent
public final Intent getIntent(IntentName name, String languageCode) { GetIntentRequest request = GetIntentRequest.newBuilder() .setName(name == null ? null : name.toString()) .setLanguageCode(languageCode) .build(); return getIntent(request); }
java
public final Intent getIntent(IntentName name, String languageCode) { GetIntentRequest request = GetIntentRequest.newBuilder() .setName(name == null ? null : name.toString()) .setLanguageCode(languageCode) .build(); return getIntent(request); }
[ "public", "final", "Intent", "getIntent", "(", "IntentName", "name", ",", "String", "languageCode", ")", "{", "GetIntentRequest", "request", "=", "GetIntentRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "==", "null", "?", "null", ":", "n...
Retrieves the specified intent. <p>Sample code: <pre><code> try (IntentsClient intentsClient = IntentsClient.create()) { IntentName name = IntentName.of("[PROJECT]", "[INTENT]"); String languageCode = ""; Intent response = intentsClient.getIntent(name, languageCode); } </code></pre> @param name Required. The name of the intent. Format: `projects/&lt;Project ID&gt;/agent/intents/&lt;Intent ID&gt;`. @param languageCode Optional. The language to retrieve training phrases, parameters and rich messages for. If not specified, the agent's default language is used. [Many languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are supported. Note: languages must be enabled in the agent before they can be used. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Retrieves", "the", "specified", "intent", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java#L464-L472
spring-cloud/spring-cloud-contract
spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/util/ContractVerifierUtil.java
ContractVerifierUtil.nodeFromXPath
public static Node nodeFromXPath(Document parsedXml, String path) { XPath xPath = XPathFactory.newInstance().newXPath(); try { return (Node) xPath.evaluate(path, parsedXml.getDocumentElement(), XPathConstants.NODE); } catch (XPathExpressionException exception) { LOG.error("Incorrect xpath provided: " + path, exception); throw new IllegalArgumentException(); } }
java
public static Node nodeFromXPath(Document parsedXml, String path) { XPath xPath = XPathFactory.newInstance().newXPath(); try { return (Node) xPath.evaluate(path, parsedXml.getDocumentElement(), XPathConstants.NODE); } catch (XPathExpressionException exception) { LOG.error("Incorrect xpath provided: " + path, exception); throw new IllegalArgumentException(); } }
[ "public", "static", "Node", "nodeFromXPath", "(", "Document", "parsedXml", ",", "String", "path", ")", "{", "XPath", "xPath", "=", "XPathFactory", ".", "newInstance", "(", ")", ".", "newXPath", "(", ")", ";", "try", "{", "return", "(", "Node", ")", "xPat...
Helper method to retrieve XML {@link Node} with provided xPath. @param parsedXml - a {@link Document} object with parsed XML content @param path - the xPath expression to retrieve the value with @return XML {@link Node} object @since 2.1.0
[ "Helper", "method", "to", "retrieve", "XML", "{" ]
train
https://github.com/spring-cloud/spring-cloud-contract/blob/857da51950a87b393286e3bb1b2208c420c01087/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/util/ContractVerifierUtil.java#L96-L106
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.getAnnotation
public static AnnotationNode getAnnotation(AnnotatedNode node, String name) { List<AnnotationNode> annotations = node.getAnnotations(); for (AnnotationNode annot : annotations) { if (annot.getClassNode().getName().equals(name)) { return annot; } } return null; }
java
public static AnnotationNode getAnnotation(AnnotatedNode node, String name) { List<AnnotationNode> annotations = node.getAnnotations(); for (AnnotationNode annot : annotations) { if (annot.getClassNode().getName().equals(name)) { return annot; } } return null; }
[ "public", "static", "AnnotationNode", "getAnnotation", "(", "AnnotatedNode", "node", ",", "String", "name", ")", "{", "List", "<", "AnnotationNode", ">", "annotations", "=", "node", ".", "getAnnotations", "(", ")", ";", "for", "(", "AnnotationNode", "annot", "...
Return the AnnotationNode for the named annotation, or else null. Supports Groovy 1.5 and Groovy 1.6. @param node - the AnnotatedNode @param name - the name of the annotation @return the AnnotationNode or else null
[ "Return", "the", "AnnotationNode", "for", "the", "named", "annotation", "or", "else", "null", ".", "Supports", "Groovy", "1", ".", "5", "and", "Groovy", "1", ".", "6", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L473-L481
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java
CPMeasurementUnitPersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPMeasurementUnit cpMeasurementUnit : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpMeasurementUnit); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPMeasurementUnit cpMeasurementUnit : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpMeasurementUnit); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CPMeasurementUnit", "cpMeasurementUnit", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",", "Qu...
Removes all the cp measurement units where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "cp", "measurement", "units", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L1405-L1411
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java
JDBCResultSet.getClob
public Clob getClob(int columnIndex) throws SQLException { Object o = getObject(columnIndex); if (o == null) { return null; } if (o instanceof ClobDataID) { return new JDBCClobClient(session, (ClobDataID) o); } else if (o instanceof Clob) { return (Clob) o; } else if (o instanceof String) { return new JDBCClob((String) o); } throw Util.sqlException(ErrorCode.X_42561); }
java
public Clob getClob(int columnIndex) throws SQLException { Object o = getObject(columnIndex); if (o == null) { return null; } if (o instanceof ClobDataID) { return new JDBCClobClient(session, (ClobDataID) o); } else if (o instanceof Clob) { return (Clob) o; } else if (o instanceof String) { return new JDBCClob((String) o); } throw Util.sqlException(ErrorCode.X_42561); }
[ "public", "Clob", "getClob", "(", "int", "columnIndex", ")", "throws", "SQLException", "{", "Object", "o", "=", "getObject", "(", "columnIndex", ")", ";", "if", "(", "o", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "o", "instanceof",...
<!-- start generic documentation --> Retrieves the value of the designated column in the current row of this <code>ResultSet</code> object as a <code>Clob</code> object in the Java programming language. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB 1.9.0 supports this feature for objects of type CLOB and the variations of CHAR. The Clob returned for CHAR objects is a memory object. The Clob return for CLOB objects is not held entirely in memory. Its contents are fetched from the database when its getXXX() methods are called. <p> </div> <!-- end release-specific documentation --> @param columnIndex the first column is 1, the second is 2, ... @return a <code>Clob</code> object representing the SQL <code>CLOB</code> value in the specified column @exception SQLException if a database access error occurs or this method is called on a closed result set @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2
[ "<!", "--", "start", "generic", "documentation", "--", ">", "Retrieves", "the", "value", "of", "the", "designated", "column", "in", "the", "current", "row", "of", "this", "<code", ">", "ResultSet<", "/", "code", ">", "object", "as", "a", "<code", ">", "C...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L4267-L4284
VoltDB/voltdb
src/frontend/org/voltdb/RealVoltDB.java
RealVoltDB.setupDefaultDeployment
static String setupDefaultDeployment(VoltLogger logger) throws IOException { return setupDefaultDeployment(logger, CatalogUtil.getVoltDbRoot(null)); }
java
static String setupDefaultDeployment(VoltLogger logger) throws IOException { return setupDefaultDeployment(logger, CatalogUtil.getVoltDbRoot(null)); }
[ "static", "String", "setupDefaultDeployment", "(", "VoltLogger", "logger", ")", "throws", "IOException", "{", "return", "setupDefaultDeployment", "(", "logger", ",", "CatalogUtil", ".", "getVoltDbRoot", "(", "null", ")", ")", ";", "}" ]
Create default deployment.xml file in voltdbroot if the deployment path is null. @return path to default deployment file @throws IOException
[ "Create", "default", "deployment", ".", "xml", "file", "in", "voltdbroot", "if", "the", "deployment", "path", "is", "null", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/RealVoltDB.java#L4808-L4810
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/LabelsApi.java
LabelsApi.subscribeLabel
public Label subscribeLabel(Object projectIdOrPath, Integer labelId) throws GitLabApiException { Response response = post(Response.Status.NOT_MODIFIED, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "labels", labelId, "subscribe"); return (response.readEntity(Label.class)); }
java
public Label subscribeLabel(Object projectIdOrPath, Integer labelId) throws GitLabApiException { Response response = post(Response.Status.NOT_MODIFIED, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "labels", labelId, "subscribe"); return (response.readEntity(Label.class)); }
[ "public", "Label", "subscribeLabel", "(", "Object", "projectIdOrPath", ",", "Integer", "labelId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "NOT_MODIFIED", ",", "getDefaultPerPageParam", "(", ...
Subscribe a specified label @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param labelId the label ID @return HttpStatusCode 503 @throws GitLabApiException if any exception occurs
[ "Subscribe", "a", "specified", "label" ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/LabelsApi.java#L209-L213
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/access/WSDLServlet.java
WSDLServlet.getWSDL
private void getWSDL(String api, String requestURL, PrintWriter out) throws IOException, ServletException { String wsdlPath = (String) _WSDL_PATHS.get(api); if (wsdlPath != null) { File schemaFile = new File(_serverDir, _XSD_PATH); File sourceWSDL = new File(_serverDir, wsdlPath); String baseURL = getFedoraBaseURL(requestURL); String svcPath = (String) _SERVICE_PATHS.get(api); RuntimeWSDL wsdl = new RuntimeWSDL(schemaFile, sourceWSDL, baseURL + "/" + svcPath); wsdl.serialize(out); } else { throw new ServletException("No such api: '" + api + "'"); } }
java
private void getWSDL(String api, String requestURL, PrintWriter out) throws IOException, ServletException { String wsdlPath = (String) _WSDL_PATHS.get(api); if (wsdlPath != null) { File schemaFile = new File(_serverDir, _XSD_PATH); File sourceWSDL = new File(_serverDir, wsdlPath); String baseURL = getFedoraBaseURL(requestURL); String svcPath = (String) _SERVICE_PATHS.get(api); RuntimeWSDL wsdl = new RuntimeWSDL(schemaFile, sourceWSDL, baseURL + "/" + svcPath); wsdl.serialize(out); } else { throw new ServletException("No such api: '" + api + "'"); } }
[ "private", "void", "getWSDL", "(", "String", "api", ",", "String", "requestURL", ",", "PrintWriter", "out", ")", "throws", "IOException", ",", "ServletException", "{", "String", "wsdlPath", "=", "(", "String", ")", "_WSDL_PATHS", ".", "get", "(", "api", ")",...
Get the self-contained WSDL given the api name and request URL.
[ "Get", "the", "self", "-", "contained", "WSDL", "given", "the", "api", "name", "and", "request", "URL", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/access/WSDLServlet.java#L111-L132
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.computeSize
public static int computeSize(int order, Object o, FieldType type, boolean debug, File path) { return computeSize(order, o, type, false, debug, path); }
java
public static int computeSize(int order, Object o, FieldType type, boolean debug, File path) { return computeSize(order, o, type, false, debug, path); }
[ "public", "static", "int", "computeSize", "(", "int", "order", ",", "Object", "o", ",", "FieldType", "type", ",", "boolean", "debug", ",", "File", "path", ")", "{", "return", "computeSize", "(", "order", ",", "o", ",", "type", ",", "false", ",", "debug...
get object size by {@link FieldType}. @param order the order @param o the o @param type the type @param debug the debug @param path the path @return the int
[ "get", "object", "size", "by", "{", "@link", "FieldType", "}", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L253-L255
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/SessionUtil.java
SessionUtil.federatedFlowStep4
private static String federatedFlowStep4( LoginInput loginInput, String ssoUrl, String oneTimeToken) throws SnowflakeSQLException { String responseHtml = ""; try { final URL url = new URL(ssoUrl); URI oktaGetUri = new URIBuilder() .setScheme(url.getProtocol()) .setHost(url.getHost()) .setPath(url.getPath()) .setParameter("RelayState", "%2Fsome%2Fdeep%2Flink") .setParameter("onetimetoken", oneTimeToken).build(); HttpGet httpGet = new HttpGet(oktaGetUri); HeaderGroup headers = new HeaderGroup(); headers.addHeader(new BasicHeader(HttpHeaders.ACCEPT, "*/*")); httpGet.setHeaders(headers.getAllHeaders()); responseHtml = HttpUtil.executeRequest(httpGet, loginInput.getLoginTimeout(), 0, null); // step 5 String postBackUrl = getPostBackUrlFromHTML(responseHtml); if (!isPrefixEqual(postBackUrl, loginInput.getServerUrl())) { logger.debug("The specified authenticator {} and the destination URL " + "in the SAML assertion {} do not match.", loginInput.getAuthenticator(), postBackUrl); throw new SnowflakeSQLException( SqlState.SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, ErrorCode.IDP_INCORRECT_DESTINATION.getMessageCode()); } } catch (IOException | URISyntaxException ex) { handleFederatedFlowError(loginInput, ex); } return responseHtml; }
java
private static String federatedFlowStep4( LoginInput loginInput, String ssoUrl, String oneTimeToken) throws SnowflakeSQLException { String responseHtml = ""; try { final URL url = new URL(ssoUrl); URI oktaGetUri = new URIBuilder() .setScheme(url.getProtocol()) .setHost(url.getHost()) .setPath(url.getPath()) .setParameter("RelayState", "%2Fsome%2Fdeep%2Flink") .setParameter("onetimetoken", oneTimeToken).build(); HttpGet httpGet = new HttpGet(oktaGetUri); HeaderGroup headers = new HeaderGroup(); headers.addHeader(new BasicHeader(HttpHeaders.ACCEPT, "*/*")); httpGet.setHeaders(headers.getAllHeaders()); responseHtml = HttpUtil.executeRequest(httpGet, loginInput.getLoginTimeout(), 0, null); // step 5 String postBackUrl = getPostBackUrlFromHTML(responseHtml); if (!isPrefixEqual(postBackUrl, loginInput.getServerUrl())) { logger.debug("The specified authenticator {} and the destination URL " + "in the SAML assertion {} do not match.", loginInput.getAuthenticator(), postBackUrl); throw new SnowflakeSQLException( SqlState.SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, ErrorCode.IDP_INCORRECT_DESTINATION.getMessageCode()); } } catch (IOException | URISyntaxException ex) { handleFederatedFlowError(loginInput, ex); } return responseHtml; }
[ "private", "static", "String", "federatedFlowStep4", "(", "LoginInput", "loginInput", ",", "String", "ssoUrl", ",", "String", "oneTimeToken", ")", "throws", "SnowflakeSQLException", "{", "String", "responseHtml", "=", "\"\"", ";", "try", "{", "final", "URL", "url"...
Given access token, query IDP URL snowflake app to get SAML response We also need to perform important client side validation: validate the post back url come back with the SAML response contains the same prefix as the Snowflake's server url, which is the intended destination url to Snowflake. Explanation: This emulates the behavior of IDP initiated login flow in the user browser where the IDP instructs the browser to POST the SAML assertion to the specific SP endpoint. This is critical in preventing a SAML assertion issued to one SP from being sent to another SP. @param loginInput @param ssoUrl @param oneTimeToken @return @throws SnowflakeSQLException
[ "Given", "access", "token", "query", "IDP", "URL", "snowflake", "app", "to", "get", "SAML", "response", "We", "also", "need", "to", "perform", "important", "client", "side", "validation", ":", "validate", "the", "post", "back", "url", "come", "back", "with",...
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1154-L1196