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
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.resizeAsync
public Observable<Void> resizeAsync(String poolId, PoolResizeParameter poolResizeParameter) { return resizeWithServiceResponseAsync(poolId, poolResizeParameter).map(new Func1<ServiceResponseWithHeaders<Void, PoolResizeHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, PoolResizeHeaders> response) { return response.body(); } }); }
java
public Observable<Void> resizeAsync(String poolId, PoolResizeParameter poolResizeParameter) { return resizeWithServiceResponseAsync(poolId, poolResizeParameter).map(new Func1<ServiceResponseWithHeaders<Void, PoolResizeHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, PoolResizeHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "resizeAsync", "(", "String", "poolId", ",", "PoolResizeParameter", "poolResizeParameter", ")", "{", "return", "resizeWithServiceResponseAsync", "(", "poolId", ",", "poolResizeParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Void", ",", "PoolResizeHeaders", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponseWithHeaders", "<", "Void", ",", "PoolResizeHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Changes the number of compute nodes that are assigned to a pool. You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. @param poolId The ID of the pool to resize. @param poolResizeParameter The parameters for the request. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Changes", "the", "number", "of", "compute", "nodes", "that", "are", "assigned", "to", "a", "pool", ".", "You", "can", "only", "resize", "a", "pool", "when", "its", "allocation", "state", "is", "steady", ".", "If", "the", "pool", "is", "already", "resizing", "the", "request", "fails", "with", "status", "code", "409", ".", "When", "you", "resize", "a", "pool", "the", "pool", "s", "allocation", "state", "changes", "from", "steady", "to", "resizing", ".", "You", "cannot", "resize", "pools", "which", "are", "configured", "for", "automatic", "scaling", ".", "If", "you", "try", "to", "do", "this", "the", "Batch", "service", "returns", "an", "error", "409", ".", "If", "you", "resize", "a", "pool", "downwards", "the", "Batch", "service", "chooses", "which", "nodes", "to", "remove", ".", "To", "remove", "specific", "nodes", "use", "the", "pool", "remove", "nodes", "API", "instead", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L2748-L2755
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/service/ArchiveService.java
ArchiveService.createDockerBuildArchive
public File createDockerBuildArchive(ImageConfiguration imageConfig, MojoParameters params, ArchiverCustomizer customizer) throws MojoExecutionException { File ret = createArchive(imageConfig.getName(), imageConfig.getBuildConfiguration(), params, log, customizer); log.info("%s: Created docker source tar %s",imageConfig.getDescription(), ret); return ret; }
java
public File createDockerBuildArchive(ImageConfiguration imageConfig, MojoParameters params, ArchiverCustomizer customizer) throws MojoExecutionException { File ret = createArchive(imageConfig.getName(), imageConfig.getBuildConfiguration(), params, log, customizer); log.info("%s: Created docker source tar %s",imageConfig.getDescription(), ret); return ret; }
[ "public", "File", "createDockerBuildArchive", "(", "ImageConfiguration", "imageConfig", ",", "MojoParameters", "params", ",", "ArchiverCustomizer", "customizer", ")", "throws", "MojoExecutionException", "{", "File", "ret", "=", "createArchive", "(", "imageConfig", ".", "getName", "(", ")", ",", "imageConfig", ".", "getBuildConfiguration", "(", ")", ",", "params", ",", "log", ",", "customizer", ")", ";", "log", ".", "info", "(", "\"%s: Created docker source tar %s\"", ",", "imageConfig", ".", "getDescription", "(", ")", ",", "ret", ")", ";", "return", "ret", ";", "}" ]
Create the tar file container the source for building an image. This tar can be used directly for uploading to a Docker daemon for creating the image @param imageConfig the image configuration @param params mojo params for the project @param customizer final customizer to be applied to the tar before being generated @return file for holding the sources @throws MojoExecutionException if during creation of the tar an error occurs.
[ "Create", "the", "tar", "file", "container", "the", "source", "for", "building", "an", "image", ".", "This", "tar", "can", "be", "used", "directly", "for", "uploading", "to", "a", "Docker", "daemon", "for", "creating", "the", "image" ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/service/ArchiveService.java#L73-L78
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getProperty
public <T> T getProperty(String name, Class<T> type, T defaultValue) { Params.notNullOrEmpty(name, "Property name"); Params.notNull(type, "Property type"); String value = getProperty(name); if(value != null) { return converter.asObject(value, type); } return defaultValue; }
java
public <T> T getProperty(String name, Class<T> type, T defaultValue) { Params.notNullOrEmpty(name, "Property name"); Params.notNull(type, "Property type"); String value = getProperty(name); if(value != null) { return converter.asObject(value, type); } return defaultValue; }
[ "public", "<", "T", ">", "T", "getProperty", "(", "String", "name", ",", "Class", "<", "T", ">", "type", ",", "T", "defaultValue", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Property name\"", ")", ";", "Params", ".", "notNull", "(", "type", ",", "\"Property type\"", ")", ";", "String", "value", "=", "getProperty", "(", "name", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "converter", ".", "asObject", "(", "value", ",", "type", ")", ";", "}", "return", "defaultValue", ";", "}" ]
Get configuration object property converter to requested type or default value if there is no property with given name. @param name property name. @param type type to convert property value to, @param defaultValue default value, possible null or empty. @param <T> value type. @return newly created value object or default value. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>type</code> argument is null. @throws ConverterException if there is no converter registered for value type or value parse fails.
[ "Get", "configuration", "object", "property", "converter", "to", "requested", "type", "or", "default", "value", "if", "there", "is", "no", "property", "with", "given", "name", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L427-L436
soi-toolkit/soi-toolkit-mule
commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/rest/RestClient.java
RestClient.doHttpSendRequest
public MuleMessage doHttpSendRequest(String url, String method, String payload, String contentType) { Map<String, String> properties = new HashMap<String, String>(); properties.put("http.method", method); properties.put("Content-Type", contentType); MuleMessage response = send(url, payload, properties); return response; }
java
public MuleMessage doHttpSendRequest(String url, String method, String payload, String contentType) { Map<String, String> properties = new HashMap<String, String>(); properties.put("http.method", method); properties.put("Content-Type", contentType); MuleMessage response = send(url, payload, properties); return response; }
[ "public", "MuleMessage", "doHttpSendRequest", "(", "String", "url", ",", "String", "method", ",", "String", "payload", ",", "String", "contentType", ")", "{", "Map", "<", "String", ",", "String", ">", "properties", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "properties", ".", "put", "(", "\"http.method\"", ",", "method", ")", ";", "properties", ".", "put", "(", "\"Content-Type\"", ",", "contentType", ")", ";", "MuleMessage", "response", "=", "send", "(", "url", ",", "payload", ",", "properties", ")", ";", "return", "response", ";", "}" ]
Perform a HTTP call sending information to the server using POST or PUT @param url @param method, e.g. "POST" or "PUT" @param payload @param contentType @return @throws MuleException
[ "Perform", "a", "HTTP", "call", "sending", "information", "to", "the", "server", "using", "POST", "or", "PUT" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/rest/RestClient.java#L159-L168
jayantk/jklol
src/com/jayantkrish/jklol/ccg/SyntacticCategory.java
SyntacticCategory.assignAllFeatures
public SyntacticCategory assignAllFeatures(String value) { Set<Integer> featureVars = Sets.newHashSet(); getAllFeatureVariables(featureVars); Map<Integer, String> valueMap = Maps.newHashMap(); for (Integer var : featureVars) { valueMap.put(var, value); } return assignFeatures(valueMap, Collections.<Integer, Integer>emptyMap()); }
java
public SyntacticCategory assignAllFeatures(String value) { Set<Integer> featureVars = Sets.newHashSet(); getAllFeatureVariables(featureVars); Map<Integer, String> valueMap = Maps.newHashMap(); for (Integer var : featureVars) { valueMap.put(var, value); } return assignFeatures(valueMap, Collections.<Integer, Integer>emptyMap()); }
[ "public", "SyntacticCategory", "assignAllFeatures", "(", "String", "value", ")", "{", "Set", "<", "Integer", ">", "featureVars", "=", "Sets", ".", "newHashSet", "(", ")", ";", "getAllFeatureVariables", "(", "featureVars", ")", ";", "Map", "<", "Integer", ",", "String", ">", "valueMap", "=", "Maps", ".", "newHashMap", "(", ")", ";", "for", "(", "Integer", "var", ":", "featureVars", ")", "{", "valueMap", ".", "put", "(", "var", ",", "value", ")", ";", "}", "return", "assignFeatures", "(", "valueMap", ",", "Collections", ".", "<", "Integer", ",", "Integer", ">", "emptyMap", "(", ")", ")", ";", "}" ]
Assigns value to all unfilled feature variables. @param value @return
[ "Assigns", "value", "to", "all", "unfilled", "feature", "variables", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/SyntacticCategory.java#L299-L308
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/service/TechnologyTagService.java
TechnologyTagService.addTagToFileModel
public TechnologyTagModel addTagToFileModel(FileModel fileModel, String tagName, TechnologyTagLevel level) { Traversable<Vertex, Vertex> q = getGraphContext().getQuery(TechnologyTagModel.class) .traverse(g -> g.has(TechnologyTagModel.NAME, tagName)); TechnologyTagModel technologyTag = super.getUnique(q.getRawTraversal()); if (technologyTag == null) { technologyTag = create(); technologyTag.setName(tagName); technologyTag.setLevel(level); } if (level == TechnologyTagLevel.IMPORTANT && fileModel instanceof SourceFileModel) ((SourceFileModel) fileModel).setGenerateSourceReport(true); technologyTag.addFileModel(fileModel); return technologyTag; }
java
public TechnologyTagModel addTagToFileModel(FileModel fileModel, String tagName, TechnologyTagLevel level) { Traversable<Vertex, Vertex> q = getGraphContext().getQuery(TechnologyTagModel.class) .traverse(g -> g.has(TechnologyTagModel.NAME, tagName)); TechnologyTagModel technologyTag = super.getUnique(q.getRawTraversal()); if (technologyTag == null) { technologyTag = create(); technologyTag.setName(tagName); technologyTag.setLevel(level); } if (level == TechnologyTagLevel.IMPORTANT && fileModel instanceof SourceFileModel) ((SourceFileModel) fileModel).setGenerateSourceReport(true); technologyTag.addFileModel(fileModel); return technologyTag; }
[ "public", "TechnologyTagModel", "addTagToFileModel", "(", "FileModel", "fileModel", ",", "String", "tagName", ",", "TechnologyTagLevel", "level", ")", "{", "Traversable", "<", "Vertex", ",", "Vertex", ">", "q", "=", "getGraphContext", "(", ")", ".", "getQuery", "(", "TechnologyTagModel", ".", "class", ")", ".", "traverse", "(", "g", "->", "g", ".", "has", "(", "TechnologyTagModel", ".", "NAME", ",", "tagName", ")", ")", ";", "TechnologyTagModel", "technologyTag", "=", "super", ".", "getUnique", "(", "q", ".", "getRawTraversal", "(", ")", ")", ";", "if", "(", "technologyTag", "==", "null", ")", "{", "technologyTag", "=", "create", "(", ")", ";", "technologyTag", ".", "setName", "(", "tagName", ")", ";", "technologyTag", ".", "setLevel", "(", "level", ")", ";", "}", "if", "(", "level", "==", "TechnologyTagLevel", ".", "IMPORTANT", "&&", "fileModel", "instanceof", "SourceFileModel", ")", "(", "(", "SourceFileModel", ")", "fileModel", ")", ".", "setGenerateSourceReport", "(", "true", ")", ";", "technologyTag", ".", "addFileModel", "(", "fileModel", ")", ";", "return", "technologyTag", ";", "}" ]
Adds the provided tag to the provided {@link FileModel}. If a {@link TechnologyTagModel} cannot be found with the provided name, then one will be created.
[ "Adds", "the", "provided", "tag", "to", "the", "provided", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/TechnologyTagService.java#L44-L60
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java
H2DBLock.readLockFile
private String readLockFile() { String msg = null; try (RandomAccessFile f = new RandomAccessFile(lockFile, "rw")) { msg = f.readLine(); } catch (IOException ex) { LOGGER.debug(String.format("Error reading lock file: %s", lockFile), ex); } return msg; }
java
private String readLockFile() { String msg = null; try (RandomAccessFile f = new RandomAccessFile(lockFile, "rw")) { msg = f.readLine(); } catch (IOException ex) { LOGGER.debug(String.format("Error reading lock file: %s", lockFile), ex); } return msg; }
[ "private", "String", "readLockFile", "(", ")", "{", "String", "msg", "=", "null", ";", "try", "(", "RandomAccessFile", "f", "=", "new", "RandomAccessFile", "(", "lockFile", ",", "\"rw\"", ")", ")", "{", "msg", "=", "f", ".", "readLine", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "LOGGER", ".", "debug", "(", "String", ".", "format", "(", "\"Error reading lock file: %s\"", ",", "lockFile", ")", ",", "ex", ")", ";", "}", "return", "msg", ";", "}" ]
Reads the first line from the lock file and returns the results as a string. @return the first line from the lock file; or null if the contents could not be read
[ "Reads", "the", "first", "line", "from", "the", "lock", "file", "and", "returns", "the", "results", "as", "a", "string", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java#L231-L239
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/config/executor/PooledExecutionServiceConfiguration.java
PooledExecutionServiceConfiguration.addPool
public void addPool(String alias, int minSize, int maxSize) { if (alias == null) { throw new NullPointerException("Pool alias cannot be null"); } if (poolConfigurations.containsKey(alias)) { throw new IllegalArgumentException("A pool with the alias '" + alias + "' is already configured"); } else { poolConfigurations.put(alias, new PoolConfiguration(minSize, maxSize)); } }
java
public void addPool(String alias, int minSize, int maxSize) { if (alias == null) { throw new NullPointerException("Pool alias cannot be null"); } if (poolConfigurations.containsKey(alias)) { throw new IllegalArgumentException("A pool with the alias '" + alias + "' is already configured"); } else { poolConfigurations.put(alias, new PoolConfiguration(minSize, maxSize)); } }
[ "public", "void", "addPool", "(", "String", "alias", ",", "int", "minSize", ",", "int", "maxSize", ")", "{", "if", "(", "alias", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Pool alias cannot be null\"", ")", ";", "}", "if", "(", "poolConfigurations", ".", "containsKey", "(", "alias", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A pool with the alias '\"", "+", "alias", "+", "\"' is already configured\"", ")", ";", "}", "else", "{", "poolConfigurations", ".", "put", "(", "alias", ",", "new", "PoolConfiguration", "(", "minSize", ",", "maxSize", ")", ")", ";", "}", "}" ]
Adds a new pool with the provided minimum and maximum. @param alias the pool alias @param minSize the minimum size @param maxSize the maximum size @throws NullPointerException if alias is null @throws IllegalArgumentException if another pool with the same alias was configured already
[ "Adds", "a", "new", "pool", "with", "the", "provided", "minimum", "and", "maximum", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/config/executor/PooledExecutionServiceConfiguration.java#L82-L91
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java
SparseCpuLevel1.saxpyi
@Override protected void saxpyi(long N, double alpha, INDArray X, DataBuffer pointers, INDArray Y) { cblas_saxpyi((int) N, (float) alpha, (FloatPointer) X.data().addressPointer(), (IntPointer) pointers.addressPointer(), (FloatPointer) Y.data().addressPointer()); }
java
@Override protected void saxpyi(long N, double alpha, INDArray X, DataBuffer pointers, INDArray Y) { cblas_saxpyi((int) N, (float) alpha, (FloatPointer) X.data().addressPointer(), (IntPointer) pointers.addressPointer(), (FloatPointer) Y.data().addressPointer()); }
[ "@", "Override", "protected", "void", "saxpyi", "(", "long", "N", ",", "double", "alpha", ",", "INDArray", "X", ",", "DataBuffer", "pointers", ",", "INDArray", "Y", ")", "{", "cblas_saxpyi", "(", "(", "int", ")", "N", ",", "(", "float", ")", "alpha", ",", "(", "FloatPointer", ")", "X", ".", "data", "(", ")", ".", "addressPointer", "(", ")", ",", "(", "IntPointer", ")", "pointers", ".", "addressPointer", "(", ")", ",", "(", "FloatPointer", ")", "Y", ".", "data", "(", ")", ".", "addressPointer", "(", ")", ")", ";", "}" ]
Adds a scalar multiple of float compressed sparse vector to a full-storage vector. @param N The number of elements in vector X @param alpha @param X a sparse vector @param pointers A DataBuffer that specifies the indices for the elements of x. @param Y a dense vector
[ "Adds", "a", "scalar", "multiple", "of", "float", "compressed", "sparse", "vector", "to", "a", "full", "-", "storage", "vector", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java#L211-L215
Alluxio/alluxio
core/common/src/main/java/alluxio/grpc/GrpcManagedChannelPool.java
GrpcManagedChannelPool.releaseManagedChannel
public void releaseManagedChannel(ChannelKey channelKey, long shutdownTimeoutMs) { boolean shutdownManagedChannel; try (LockResource lockShared = new LockResource(mLock.readLock())) { Verify.verify(mChannels.containsKey(channelKey)); ManagedChannelReference channelRef = mChannels.get(channelKey); channelRef.dereference(); shutdownManagedChannel = channelRef.getRefCount() <= 0; LOG.debug("Released managed channel for: {}. Ref-count: {}", channelKey, channelRef.getRefCount()); } if (shutdownManagedChannel) { try (LockResource lockExclusive = new LockResource(mLock.writeLock())) { if (mChannels.containsKey(channelKey)) { ManagedChannelReference channelRef = mChannels.get(channelKey); if (channelRef.getRefCount() <= 0) { shutdownManagedChannel(channelKey, shutdownTimeoutMs); } } } } }
java
public void releaseManagedChannel(ChannelKey channelKey, long shutdownTimeoutMs) { boolean shutdownManagedChannel; try (LockResource lockShared = new LockResource(mLock.readLock())) { Verify.verify(mChannels.containsKey(channelKey)); ManagedChannelReference channelRef = mChannels.get(channelKey); channelRef.dereference(); shutdownManagedChannel = channelRef.getRefCount() <= 0; LOG.debug("Released managed channel for: {}. Ref-count: {}", channelKey, channelRef.getRefCount()); } if (shutdownManagedChannel) { try (LockResource lockExclusive = new LockResource(mLock.writeLock())) { if (mChannels.containsKey(channelKey)) { ManagedChannelReference channelRef = mChannels.get(channelKey); if (channelRef.getRefCount() <= 0) { shutdownManagedChannel(channelKey, shutdownTimeoutMs); } } } } }
[ "public", "void", "releaseManagedChannel", "(", "ChannelKey", "channelKey", ",", "long", "shutdownTimeoutMs", ")", "{", "boolean", "shutdownManagedChannel", ";", "try", "(", "LockResource", "lockShared", "=", "new", "LockResource", "(", "mLock", ".", "readLock", "(", ")", ")", ")", "{", "Verify", ".", "verify", "(", "mChannels", ".", "containsKey", "(", "channelKey", ")", ")", ";", "ManagedChannelReference", "channelRef", "=", "mChannels", ".", "get", "(", "channelKey", ")", ";", "channelRef", ".", "dereference", "(", ")", ";", "shutdownManagedChannel", "=", "channelRef", ".", "getRefCount", "(", ")", "<=", "0", ";", "LOG", ".", "debug", "(", "\"Released managed channel for: {}. Ref-count: {}\"", ",", "channelKey", ",", "channelRef", ".", "getRefCount", "(", ")", ")", ";", "}", "if", "(", "shutdownManagedChannel", ")", "{", "try", "(", "LockResource", "lockExclusive", "=", "new", "LockResource", "(", "mLock", ".", "writeLock", "(", ")", ")", ")", "{", "if", "(", "mChannels", ".", "containsKey", "(", "channelKey", ")", ")", "{", "ManagedChannelReference", "channelRef", "=", "mChannels", ".", "get", "(", "channelKey", ")", ";", "if", "(", "channelRef", ".", "getRefCount", "(", ")", "<=", "0", ")", "{", "shutdownManagedChannel", "(", "channelKey", ",", "shutdownTimeoutMs", ")", ";", "}", "}", "}", "}", "}" ]
Decreases the ref-count of the {@link ManagedChannel} for the given address. It shuts down and releases the {@link ManagedChannel} if reference count reaches zero. @param channelKey host address @param shutdownTimeoutMs shutdown timeout in milliseconds
[ "Decreases", "the", "ref", "-", "count", "of", "the", "{", "@link", "ManagedChannel", "}", "for", "the", "given", "address", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcManagedChannelPool.java#L192-L212
MenoData/Time4J
base/src/main/java/net/time4j/calendar/astro/SolarTime.java
SolarTime.ofLocation
public static SolarTime ofLocation( double latitude, double longitude, int altitude, String calculator ) { check(latitude, longitude, altitude, calculator); return new SolarTime(latitude, longitude, altitude, calculator, null); }
java
public static SolarTime ofLocation( double latitude, double longitude, int altitude, String calculator ) { check(latitude, longitude, altitude, calculator); return new SolarTime(latitude, longitude, altitude, calculator, null); }
[ "public", "static", "SolarTime", "ofLocation", "(", "double", "latitude", ",", "double", "longitude", ",", "int", "altitude", ",", "String", "calculator", ")", "{", "check", "(", "latitude", ",", "longitude", ",", "altitude", ",", "calculator", ")", ";", "return", "new", "SolarTime", "(", "latitude", ",", "longitude", ",", "altitude", ",", "calculator", ",", "null", ")", ";", "}" ]
/*[deutsch] <p>Liefert die Sonnenzeit zur angegebenen geographischen Position. </p> <p>Diese Methode nimmt geographische Angaben nur in Dezimalgrad entgegen. Wenn diese Daten aber in Grad, Bogenminuten und Bogensekunden vorliegen, sollten Anwender den {@link #ofLocation() Builder-Ansatz} bevorzugen. </p> @param latitude geographical latitude in decimal degrees ({@code -90.0 <= x <= +90.0}) @param longitude geographical longitude in decimal degrees ({@code -180.0 <= x < 180.0}) @param altitude geographical altitude relative to sea level in meters ({@code 0 <= x < 11,0000}) @param calculator name of solar time calculator @return instance of local solar time @throws IllegalArgumentException if the coordinates are out of range or the calculator is unknown @see Calculator#name() @since 3.34/4.29
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Liefert", "die", "Sonnenzeit", "zur", "angegebenen", "geographischen", "Position", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/astro/SolarTime.java#L400-L410
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.beginCreateOrUpdateWorkerPoolAsync
public Observable<WorkerPoolResourceInner> beginCreateOrUpdateWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) { return beginCreateOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() { @Override public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) { return response.body(); } }); }
java
public Observable<WorkerPoolResourceInner> beginCreateOrUpdateWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) { return beginCreateOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() { @Override public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkerPoolResourceInner", ">", "beginCreateOrUpdateWorkerPoolAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "workerPoolName", ",", "WorkerPoolResourceInner", "workerPoolEnvelope", ")", "{", "return", "beginCreateOrUpdateWorkerPoolWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "workerPoolName", ",", "workerPoolEnvelope", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "WorkerPoolResourceInner", ">", ",", "WorkerPoolResourceInner", ">", "(", ")", "{", "@", "Override", "public", "WorkerPoolResourceInner", "call", "(", "ServiceResponse", "<", "WorkerPoolResourceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update a worker pool. Create or update a worker pool. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @param workerPoolEnvelope Properties of the worker pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkerPoolResourceInner object
[ "Create", "or", "update", "a", "worker", "pool", ".", "Create", "or", "update", "a", "worker", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5309-L5316
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RegistriesInner.java
RegistriesInner.scheduleRun
public RunInner scheduleRun(String resourceGroupName, String registryName, RunRequest runRequest) { return scheduleRunWithServiceResponseAsync(resourceGroupName, registryName, runRequest).toBlocking().last().body(); }
java
public RunInner scheduleRun(String resourceGroupName, String registryName, RunRequest runRequest) { return scheduleRunWithServiceResponseAsync(resourceGroupName, registryName, runRequest).toBlocking().last().body(); }
[ "public", "RunInner", "scheduleRun", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "RunRequest", "runRequest", ")", "{", "return", "scheduleRunWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "runRequest", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Schedules a new run based on the request parameters and add it to the run queue. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param runRequest The parameters of a run that needs to scheduled. @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 RunInner object if successful.
[ "Schedules", "a", "new", "run", "based", "on", "the", "request", "parameters", "and", "add", "it", "to", "the", "run", "queue", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RegistriesInner.java#L1727-L1729
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java
DefaultFeatureForm.getValue
@Api public void getValue(String name, StringAttribute attribute) { attribute.setValue((String) formWidget.getValue(name)); }
java
@Api public void getValue(String name, StringAttribute attribute) { attribute.setValue((String) formWidget.getValue(name)); }
[ "@", "Api", "public", "void", "getValue", "(", "String", "name", ",", "StringAttribute", "attribute", ")", "{", "attribute", ".", "setValue", "(", "(", "String", ")", "formWidget", ".", "getValue", "(", "name", ")", ")", ";", "}" ]
Get a string value from the form, and place it in <code>attribute</code>. @param name attribute name @param attribute attribute to put value @since 1.11.1
[ "Get", "a", "string", "value", "from", "the", "form", "and", "place", "it", "in", "<code", ">", "attribute<", "/", "code", ">", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L728-L731
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/EditManager.java
EditManager.getEditSet
private static Element getEditSet(Element node, Document plf, IPerson person, boolean create) throws PortalException { Node child = node.getFirstChild(); while (child != null) { if (child.getNodeName().equals(Constants.ELM_EDIT_SET)) return (Element) child; child = child.getNextSibling(); } if (create == false) return null; String ID = null; try { ID = getDLS().getNextStructDirectiveId(person); } catch (Exception e) { throw new PortalException( "Exception encountered while " + "generating new edit set node " + "Id for userId=" + person.getID(), e); } Element editSet = plf.createElement(Constants.ELM_EDIT_SET); editSet.setAttribute(Constants.ATT_TYPE, Constants.ELM_EDIT_SET); editSet.setAttribute(Constants.ATT_ID, ID); node.appendChild(editSet); return editSet; }
java
private static Element getEditSet(Element node, Document plf, IPerson person, boolean create) throws PortalException { Node child = node.getFirstChild(); while (child != null) { if (child.getNodeName().equals(Constants.ELM_EDIT_SET)) return (Element) child; child = child.getNextSibling(); } if (create == false) return null; String ID = null; try { ID = getDLS().getNextStructDirectiveId(person); } catch (Exception e) { throw new PortalException( "Exception encountered while " + "generating new edit set node " + "Id for userId=" + person.getID(), e); } Element editSet = plf.createElement(Constants.ELM_EDIT_SET); editSet.setAttribute(Constants.ATT_TYPE, Constants.ELM_EDIT_SET); editSet.setAttribute(Constants.ATT_ID, ID); node.appendChild(editSet); return editSet; }
[ "private", "static", "Element", "getEditSet", "(", "Element", "node", ",", "Document", "plf", ",", "IPerson", "person", ",", "boolean", "create", ")", "throws", "PortalException", "{", "Node", "child", "=", "node", ".", "getFirstChild", "(", ")", ";", "while", "(", "child", "!=", "null", ")", "{", "if", "(", "child", ".", "getNodeName", "(", ")", ".", "equals", "(", "Constants", ".", "ELM_EDIT_SET", ")", ")", "return", "(", "Element", ")", "child", ";", "child", "=", "child", ".", "getNextSibling", "(", ")", ";", "}", "if", "(", "create", "==", "false", ")", "return", "null", ";", "String", "ID", "=", "null", ";", "try", "{", "ID", "=", "getDLS", "(", ")", ".", "getNextStructDirectiveId", "(", "person", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "PortalException", "(", "\"Exception encountered while \"", "+", "\"generating new edit set node \"", "+", "\"Id for userId=\"", "+", "person", ".", "getID", "(", ")", ",", "e", ")", ";", "}", "Element", "editSet", "=", "plf", ".", "createElement", "(", "Constants", ".", "ELM_EDIT_SET", ")", ";", "editSet", ".", "setAttribute", "(", "Constants", ".", "ATT_TYPE", ",", "Constants", ".", "ELM_EDIT_SET", ")", ";", "editSet", ".", "setAttribute", "(", "Constants", ".", "ATT_ID", ",", "ID", ")", ";", "node", ".", "appendChild", "(", "editSet", ")", ";", "return", "editSet", ";", "}" ]
Get the edit set if any stored in the passed in node. If not found and if the create flag is true then create a new edit set and add it as a child to the passed in node. Then return it.
[ "Get", "the", "edit", "set", "if", "any", "stored", "in", "the", "passed", "in", "node", ".", "If", "not", "found", "and", "if", "the", "create", "flag", "is", "true", "then", "create", "a", "new", "edit", "set", "and", "add", "it", "as", "a", "child", "to", "the", "passed", "in", "node", ".", "Then", "return", "it", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/EditManager.java#L54-L82
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.readSubProjects
private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex) { while (uniqueIDOffset < filePathOffset) { readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++); uniqueIDOffset += 4; } }
java
private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex) { while (uniqueIDOffset < filePathOffset) { readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++); uniqueIDOffset += 4; } }
[ "private", "void", "readSubProjects", "(", "byte", "[", "]", "data", ",", "int", "uniqueIDOffset", ",", "int", "filePathOffset", ",", "int", "fileNameOffset", ",", "int", "subprojectIndex", ")", "{", "while", "(", "uniqueIDOffset", "<", "filePathOffset", ")", "{", "readSubProject", "(", "data", ",", "uniqueIDOffset", ",", "filePathOffset", ",", "fileNameOffset", ",", "subprojectIndex", "++", ")", ";", "uniqueIDOffset", "+=", "4", ";", "}", "}" ]
Read a list of sub projects. @param data byte array @param uniqueIDOffset offset of unique ID @param filePathOffset offset of file path @param fileNameOffset offset of file name @param subprojectIndex index of the subproject, used to calculate unique id offset
[ "Read", "a", "list", "of", "sub", "projects", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L559-L566
anotheria/moskito
moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java
MonitoringAspect.doProfilingMethod
@Around(value = "execution(* *(..)) && (@annotation(method))") public Object doProfilingMethod(ProceedingJoinPoint pjp, Monitor method) throws Throwable { return doProfiling(pjp, method.producerId(), method.subsystem(), method.category()); }
java
@Around(value = "execution(* *(..)) && (@annotation(method))") public Object doProfilingMethod(ProceedingJoinPoint pjp, Monitor method) throws Throwable { return doProfiling(pjp, method.producerId(), method.subsystem(), method.category()); }
[ "@", "Around", "(", "value", "=", "\"execution(* *(..)) && (@annotation(method))\"", ")", "public", "Object", "doProfilingMethod", "(", "ProceedingJoinPoint", "pjp", ",", "Monitor", "method", ")", "throws", "Throwable", "{", "return", "doProfiling", "(", "pjp", ",", "method", ".", "producerId", "(", ")", ",", "method", ".", "subsystem", "(", ")", ",", "method", ".", "category", "(", ")", ")", ";", "}" ]
Common method profiling entry-point. @param pjp {@link ProceedingJoinPoint} @param method {@link Monitor} @return call result @throws Throwable in case of error during {@link ProceedingJoinPoint#proceed()}
[ "Common", "method", "profiling", "entry", "-", "point", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java#L36-L39
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java
ModelsEngine.sourcesNet
public static boolean sourcesNet( RandomIter flowIterator, int[] colRow, int num, RandomIter netNum ) { int[][] dir = {{0, 0, 0}, {1, 0, 5}, {1, -1, 6}, {0, -1, 7}, {-1, -1, 8}, {-1, 0, 1}, {-1, 1, 2}, {0, 1, 3}, {1, 1, 4}}; if (flowIterator.getSampleDouble(colRow[0], colRow[1], 0) <= 10.0 && flowIterator.getSampleDouble(colRow[0], colRow[1], 0) > 0.0) { for( int k = 1; k <= 8; k++ ) { if (flowIterator.getSampleDouble(colRow[0] + dir[k][0], colRow[1] + dir[k][1], 0) == dir[k][2] && netNum.getSampleDouble(colRow[0] + dir[k][0], colRow[1] + dir[k][1], 0) == num) { return false; } } return true; } else { return false; } }
java
public static boolean sourcesNet( RandomIter flowIterator, int[] colRow, int num, RandomIter netNum ) { int[][] dir = {{0, 0, 0}, {1, 0, 5}, {1, -1, 6}, {0, -1, 7}, {-1, -1, 8}, {-1, 0, 1}, {-1, 1, 2}, {0, 1, 3}, {1, 1, 4}}; if (flowIterator.getSampleDouble(colRow[0], colRow[1], 0) <= 10.0 && flowIterator.getSampleDouble(colRow[0], colRow[1], 0) > 0.0) { for( int k = 1; k <= 8; k++ ) { if (flowIterator.getSampleDouble(colRow[0] + dir[k][0], colRow[1] + dir[k][1], 0) == dir[k][2] && netNum.getSampleDouble(colRow[0] + dir[k][0], colRow[1] + dir[k][1], 0) == num) { return false; } } return true; } else { return false; } }
[ "public", "static", "boolean", "sourcesNet", "(", "RandomIter", "flowIterator", ",", "int", "[", "]", "colRow", ",", "int", "num", ",", "RandomIter", "netNum", ")", "{", "int", "[", "]", "[", "]", "dir", "=", "{", "{", "0", ",", "0", ",", "0", "}", ",", "{", "1", ",", "0", ",", "5", "}", ",", "{", "1", ",", "-", "1", ",", "6", "}", ",", "{", "0", ",", "-", "1", ",", "7", "}", ",", "{", "-", "1", ",", "-", "1", ",", "8", "}", ",", "{", "-", "1", ",", "0", ",", "1", "}", ",", "{", "-", "1", ",", "1", ",", "2", "}", ",", "{", "0", ",", "1", ",", "3", "}", ",", "{", "1", ",", "1", ",", "4", "}", "}", ";", "if", "(", "flowIterator", ".", "getSampleDouble", "(", "colRow", "[", "0", "]", ",", "colRow", "[", "1", "]", ",", "0", ")", "<=", "10.0", "&&", "flowIterator", ".", "getSampleDouble", "(", "colRow", "[", "0", "]", ",", "colRow", "[", "1", "]", ",", "0", ")", ">", "0.0", ")", "{", "for", "(", "int", "k", "=", "1", ";", "k", "<=", "8", ";", "k", "++", ")", "{", "if", "(", "flowIterator", ".", "getSampleDouble", "(", "colRow", "[", "0", "]", "+", "dir", "[", "k", "]", "[", "0", "]", ",", "colRow", "[", "1", "]", "+", "dir", "[", "k", "]", "[", "1", "]", ",", "0", ")", "==", "dir", "[", "k", "]", "[", "2", "]", "&&", "netNum", ".", "getSampleDouble", "(", "colRow", "[", "0", "]", "+", "dir", "[", "k", "]", "[", "0", "]", ",", "colRow", "[", "1", "]", "+", "dir", "[", "k", "]", "[", "1", "]", ",", "0", ")", "==", "num", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Controls if the considered point is a source in the network map. @param flowIterator {@link RandomIter iterator} of flowdirections map @param colRow the col and row of the point to check. @param num channel number @param netNum {@link RandomIter iterator} of the netnumbering map. @return
[ "Controls", "if", "the", "considered", "point", "is", "a", "source", "in", "the", "network", "map", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java#L442-L458
fabiomaffioletti/jsondoc
jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java
AbstractJSONDocScanner.getApiDoc
private ApiDoc getApiDoc(Class<?> controller, MethodDisplay displayMethodAs) { log.debug("Getting JSONDoc for class: " + controller.getName()); ApiDoc apiDoc = initApiDoc(controller); apiDoc.setSupportedversions(JSONDocApiVersionDocBuilder.build(controller)); apiDoc.setAuth(JSONDocApiAuthDocBuilder.getApiAuthDocForController(controller)); apiDoc.setMethods(getApiMethodDocs(controller, displayMethodAs)); if(controller.isAnnotationPresent(Api.class)) { apiDoc = mergeApiDoc(controller, apiDoc); } return apiDoc; }
java
private ApiDoc getApiDoc(Class<?> controller, MethodDisplay displayMethodAs) { log.debug("Getting JSONDoc for class: " + controller.getName()); ApiDoc apiDoc = initApiDoc(controller); apiDoc.setSupportedversions(JSONDocApiVersionDocBuilder.build(controller)); apiDoc.setAuth(JSONDocApiAuthDocBuilder.getApiAuthDocForController(controller)); apiDoc.setMethods(getApiMethodDocs(controller, displayMethodAs)); if(controller.isAnnotationPresent(Api.class)) { apiDoc = mergeApiDoc(controller, apiDoc); } return apiDoc; }
[ "private", "ApiDoc", "getApiDoc", "(", "Class", "<", "?", ">", "controller", ",", "MethodDisplay", "displayMethodAs", ")", "{", "log", ".", "debug", "(", "\"Getting JSONDoc for class: \"", "+", "controller", ".", "getName", "(", ")", ")", ";", "ApiDoc", "apiDoc", "=", "initApiDoc", "(", "controller", ")", ";", "apiDoc", ".", "setSupportedversions", "(", "JSONDocApiVersionDocBuilder", ".", "build", "(", "controller", ")", ")", ";", "apiDoc", ".", "setAuth", "(", "JSONDocApiAuthDocBuilder", ".", "getApiAuthDocForController", "(", "controller", ")", ")", ";", "apiDoc", ".", "setMethods", "(", "getApiMethodDocs", "(", "controller", ",", "displayMethodAs", ")", ")", ";", "if", "(", "controller", ".", "isAnnotationPresent", "(", "Api", ".", "class", ")", ")", "{", "apiDoc", "=", "mergeApiDoc", "(", "controller", ",", "apiDoc", ")", ";", "}", "return", "apiDoc", ";", "}" ]
Gets the API documentation for a single class annotated with @Api and for its methods, annotated with @ApiMethod @param controller @return
[ "Gets", "the", "API", "documentation", "for", "a", "single", "class", "annotated", "with" ]
train
https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java#L135-L148
palatable/lambda
src/main/java/com/jnape/palatable/lambda/adt/Try.java
Try.withResources
public static <A extends AutoCloseable, B extends AutoCloseable, C> Try<Exception, C> withResources( CheckedSupplier<? extends Exception, ? extends A> aSupplier, CheckedFn1<? extends Exception, ? super A, ? extends B> bFn, CheckedFn1<? extends Exception, ? super B, ? extends Try<? extends Exception, ? extends C>> fn) { return withResources(aSupplier, a -> withResources(() -> bFn.apply(a), fn::apply)); }
java
public static <A extends AutoCloseable, B extends AutoCloseable, C> Try<Exception, C> withResources( CheckedSupplier<? extends Exception, ? extends A> aSupplier, CheckedFn1<? extends Exception, ? super A, ? extends B> bFn, CheckedFn1<? extends Exception, ? super B, ? extends Try<? extends Exception, ? extends C>> fn) { return withResources(aSupplier, a -> withResources(() -> bFn.apply(a), fn::apply)); }
[ "public", "static", "<", "A", "extends", "AutoCloseable", ",", "B", "extends", "AutoCloseable", ",", "C", ">", "Try", "<", "Exception", ",", "C", ">", "withResources", "(", "CheckedSupplier", "<", "?", "extends", "Exception", ",", "?", "extends", "A", ">", "aSupplier", ",", "CheckedFn1", "<", "?", "extends", "Exception", ",", "?", "super", "A", ",", "?", "extends", "B", ">", "bFn", ",", "CheckedFn1", "<", "?", "extends", "Exception", ",", "?", "super", "B", ",", "?", "extends", "Try", "<", "?", "extends", "Exception", ",", "?", "extends", "C", ">", ">", "fn", ")", "{", "return", "withResources", "(", "aSupplier", ",", "a", "->", "withResources", "(", "(", ")", "->", "bFn", ".", "apply", "(", "a", ")", ",", "fn", "::", "apply", ")", ")", ";", "}" ]
Convenience overload of {@link Try#withResources(CheckedSupplier, CheckedFn1) withResources} that cascades dependent resource creation via nested calls. @param aSupplier the first resource supplier @param bFn the dependent resource function @param fn the function body @param <A> the first resource type @param <B> the second resource type @param <C> the function return type @return a {@link Try} representing the result of the function's application to the dependent resource
[ "Convenience", "overload", "of", "{", "@link", "Try#withResources", "(", "CheckedSupplier", "CheckedFn1", ")", "withResources", "}", "that", "cascades", "dependent", "resource", "creation", "via", "nested", "calls", "." ]
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Try.java#L342-L347
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java
ModelUtil.setGeneratedUniqueIdentifier
public static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, boolean withReferenceUpdate) { setNewIdentifier(type, modelElementInstance, ModelUtil.getUniqueIdentifier(type), withReferenceUpdate); }
java
public static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, boolean withReferenceUpdate) { setNewIdentifier(type, modelElementInstance, ModelUtil.getUniqueIdentifier(type), withReferenceUpdate); }
[ "public", "static", "void", "setGeneratedUniqueIdentifier", "(", "ModelElementType", "type", ",", "ModelElementInstance", "modelElementInstance", ",", "boolean", "withReferenceUpdate", ")", "{", "setNewIdentifier", "(", "type", ",", "modelElementInstance", ",", "ModelUtil", ".", "getUniqueIdentifier", "(", "type", ")", ",", "withReferenceUpdate", ")", ";", "}" ]
Set unique identifier if the type has a String id attribute @param type the type of the model element @param modelElementInstance the model element instance to set the id @param withReferenceUpdate true to update id references in other elements, false otherwise
[ "Set", "unique", "identifier", "if", "the", "type", "has", "a", "String", "id", "attribute" ]
train
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L263-L265
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java
StandardGenerator.getColorProperty
static Color getColorProperty(IChemObject object, String key) { Object value = object.getProperty(key); if (value instanceof Color) return (Color) value; if (value != null) throw new IllegalArgumentException(key + " property should be a java.awt.Color"); return null; }
java
static Color getColorProperty(IChemObject object, String key) { Object value = object.getProperty(key); if (value instanceof Color) return (Color) value; if (value != null) throw new IllegalArgumentException(key + " property should be a java.awt.Color"); return null; }
[ "static", "Color", "getColorProperty", "(", "IChemObject", "object", ",", "String", "key", ")", "{", "Object", "value", "=", "object", ".", "getProperty", "(", "key", ")", ";", "if", "(", "value", "instanceof", "Color", ")", "return", "(", "Color", ")", "value", ";", "if", "(", "value", "!=", "null", ")", "throw", "new", "IllegalArgumentException", "(", "key", "+", "\" property should be a java.awt.Color\"", ")", ";", "return", "null", ";", "}" ]
Safely access a chem object color property for a chem object. @param object chem object @return the highlight color @throws java.lang.IllegalArgumentException the highlight property was set but was not a {@link Color} instance
[ "Safely", "access", "a", "chem", "object", "color", "property", "for", "a", "chem", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java#L635-L640
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/execution/librarycache/LibraryCacheManager.java
LibraryCacheManager.registerInternal
private void registerInternal(final JobID id, final Path[] clientPaths) throws IOException { final String[] cacheNames = new String[clientPaths.length]; for (int i = 0; i < clientPaths.length; ++i) { final LibraryTranslationKey key = new LibraryTranslationKey(id, clientPaths[i]); cacheNames[i] = this.clientPathToCacheName.get(key); if (cacheNames[i] == null) { throw new IOException("Cannot map" + clientPaths[i].toString() + " to cache name"); } } // Register as regular registerInternal(id, cacheNames); }
java
private void registerInternal(final JobID id, final Path[] clientPaths) throws IOException { final String[] cacheNames = new String[clientPaths.length]; for (int i = 0; i < clientPaths.length; ++i) { final LibraryTranslationKey key = new LibraryTranslationKey(id, clientPaths[i]); cacheNames[i] = this.clientPathToCacheName.get(key); if (cacheNames[i] == null) { throw new IOException("Cannot map" + clientPaths[i].toString() + " to cache name"); } } // Register as regular registerInternal(id, cacheNames); }
[ "private", "void", "registerInternal", "(", "final", "JobID", "id", ",", "final", "Path", "[", "]", "clientPaths", ")", "throws", "IOException", "{", "final", "String", "[", "]", "cacheNames", "=", "new", "String", "[", "clientPaths", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "clientPaths", ".", "length", ";", "++", "i", ")", "{", "final", "LibraryTranslationKey", "key", "=", "new", "LibraryTranslationKey", "(", "id", ",", "clientPaths", "[", "i", "]", ")", ";", "cacheNames", "[", "i", "]", "=", "this", ".", "clientPathToCacheName", ".", "get", "(", "key", ")", ";", "if", "(", "cacheNames", "[", "i", "]", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Cannot map\"", "+", "clientPaths", "[", "i", "]", ".", "toString", "(", ")", "+", "\" to cache name\"", ")", ";", "}", "}", "// Register as regular", "registerInternal", "(", "id", ",", "cacheNames", ")", ";", "}" ]
Registers a job ID with a set of library paths that are required to run the job. The library paths are given in terms of client paths, so the method first translates the client paths into the corresponding internal cache names. For every registered job the library cache manager creates a class loader that is used to instantiate the job's environment later on. @param id the ID of the job to be registered. @param clientPaths the client path's of the required libraries @throws IOException thrown if no mapping between the job ID and a job ID exists or the requested library is not in the cache.
[ "Registers", "a", "job", "ID", "with", "a", "set", "of", "library", "paths", "that", "are", "required", "to", "run", "the", "job", ".", "The", "library", "paths", "are", "given", "in", "terms", "of", "client", "paths", "so", "the", "method", "first", "translates", "the", "client", "paths", "into", "the", "corresponding", "internal", "cache", "names", ".", "For", "every", "registered", "job", "the", "library", "cache", "manager", "creates", "a", "class", "loader", "that", "is", "used", "to", "instantiate", "the", "job", "s", "environment", "later", "on", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/execution/librarycache/LibraryCacheManager.java#L246-L260
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/endpoint/resolver/DynamicEndpointUriResolver.java
DynamicEndpointUriResolver.appendRequestPath
private String appendRequestPath(String uri, Map<String, Object> headers) { if (!headers.containsKey(REQUEST_PATH_HEADER_NAME)) { return uri; } String requestUri = uri; String path = headers.get(REQUEST_PATH_HEADER_NAME).toString(); while (requestUri.endsWith("/")) { requestUri = requestUri.substring(0, requestUri.length() - 1); } while (path.startsWith("/") && path.length() > 0) { path = path.length() == 1 ? "" : path.substring(1); } return requestUri + "/" + path; }
java
private String appendRequestPath(String uri, Map<String, Object> headers) { if (!headers.containsKey(REQUEST_PATH_HEADER_NAME)) { return uri; } String requestUri = uri; String path = headers.get(REQUEST_PATH_HEADER_NAME).toString(); while (requestUri.endsWith("/")) { requestUri = requestUri.substring(0, requestUri.length() - 1); } while (path.startsWith("/") && path.length() > 0) { path = path.length() == 1 ? "" : path.substring(1); } return requestUri + "/" + path; }
[ "private", "String", "appendRequestPath", "(", "String", "uri", ",", "Map", "<", "String", ",", "Object", ">", "headers", ")", "{", "if", "(", "!", "headers", ".", "containsKey", "(", "REQUEST_PATH_HEADER_NAME", ")", ")", "{", "return", "uri", ";", "}", "String", "requestUri", "=", "uri", ";", "String", "path", "=", "headers", ".", "get", "(", "REQUEST_PATH_HEADER_NAME", ")", ".", "toString", "(", ")", ";", "while", "(", "requestUri", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "requestUri", "=", "requestUri", ".", "substring", "(", "0", ",", "requestUri", ".", "length", "(", ")", "-", "1", ")", ";", "}", "while", "(", "path", ".", "startsWith", "(", "\"/\"", ")", "&&", "path", ".", "length", "(", ")", ">", "0", ")", "{", "path", "=", "path", ".", "length", "(", ")", "==", "1", "?", "\"\"", ":", "path", ".", "substring", "(", "1", ")", ";", "}", "return", "requestUri", "+", "\"/\"", "+", "path", ";", "}" ]
Appends optional request path to endpoint uri. @param uri @param headers @return
[ "Appends", "optional", "request", "path", "to", "endpoint", "uri", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/resolver/DynamicEndpointUriResolver.java#L76-L93
lessthanoptimal/ddogleg
src/org/ddogleg/solver/PolynomialSolver.java
PolynomialSolver.cubicDiscriminant
public static double cubicDiscriminant(double a, double b, double c, double d) { return 18.0*d*c*b*a -4*c*c*c*a + c*c*b*b -4*d*b*b*b - 27*d*d*a*a; }
java
public static double cubicDiscriminant(double a, double b, double c, double d) { return 18.0*d*c*b*a -4*c*c*c*a + c*c*b*b -4*d*b*b*b - 27*d*d*a*a; }
[ "public", "static", "double", "cubicDiscriminant", "(", "double", "a", ",", "double", "b", ",", "double", "c", ",", "double", "d", ")", "{", "return", "18.0", "*", "d", "*", "c", "*", "b", "*", "a", "-", "4", "*", "c", "*", "c", "*", "c", "*", "a", "+", "c", "*", "c", "*", "b", "*", "b", "-", "4", "*", "d", "*", "b", "*", "b", "*", "b", "-", "27", "*", "d", "*", "d", "*", "a", "*", "a", ";", "}" ]
<p>The cubic discriminant is used to determine the type of roots.</p> <ul> <li>if d {@code >} 0, then three distinct real roots</li> <li>if d = 0, then it has a multiple root and all will be real</li> <li>if d {@code <} 0, then one real and two non-real complex conjugate roots</li> </ul> <p> From http://en.wikipedia.org/wiki/Cubic_function November 17, 2011 </p> @param a polynomial coefficient. @param b polynomial coefficient. @param c polynomial coefficient. @param d polynomial coefficient. @return Cubic discriminant
[ "<p", ">", "The", "cubic", "discriminant", "is", "used", "to", "determine", "the", "type", "of", "roots", ".", "<", "/", "p", ">", "<ul", ">", "<li", ">", "if", "d", "{", "@code", ">", "}", "0", "then", "three", "distinct", "real", "roots<", "/", "li", ">", "<li", ">", "if", "d", "=", "0", "then", "it", "has", "a", "multiple", "root", "and", "all", "will", "be", "real<", "/", "li", ">", "<li", ">", "if", "d", "{", "@code", "<", "}", "0", "then", "one", "real", "and", "two", "non", "-", "real", "complex", "conjugate", "roots<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/PolynomialSolver.java#L159-L161
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java
PoolablePreparedStatement.setRef
@Override public void setRef(int parameterIndex, Ref x) throws SQLException { internalStmt.setRef(parameterIndex, x); }
java
@Override public void setRef(int parameterIndex, Ref x) throws SQLException { internalStmt.setRef(parameterIndex, x); }
[ "@", "Override", "public", "void", "setRef", "(", "int", "parameterIndex", ",", "Ref", "x", ")", "throws", "SQLException", "{", "internalStmt", ".", "setRef", "(", "parameterIndex", ",", "x", ")", ";", "}" ]
Method setRef. @param parameterIndex @param x @throws SQLException @see java.sql.PreparedStatement#setRef(int, Ref)
[ "Method", "setRef", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L939-L942
sarxos/v4l4j
src/main/java/au/edu/jcu/v4l4j/ImageFormatList.java
ImageFormatList.getFormat
private ImageFormat getFormat(List<ImageFormat> l, String n){ for(ImageFormat f:l) if(f.getName().equals(n)) return f; return null; }
java
private ImageFormat getFormat(List<ImageFormat> l, String n){ for(ImageFormat f:l) if(f.getName().equals(n)) return f; return null; }
[ "private", "ImageFormat", "getFormat", "(", "List", "<", "ImageFormat", ">", "l", ",", "String", "n", ")", "{", "for", "(", "ImageFormat", "f", ":", "l", ")", "if", "(", "f", ".", "getName", "(", ")", ".", "equals", "(", "n", ")", ")", "return", "f", ";", "return", "null", ";", "}" ]
this method returns a format in a list given its name @param l the image format list @param n the name of the format @return the image format with the given name, or null
[ "this", "method", "returns", "a", "format", "in", "a", "list", "given", "its", "name" ]
train
https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/ImageFormatList.java#L208-L213
scireum/parsii
src/main/java/parsii/tokenizer/Tokenizer.java
Tokenizer.handleStringEscape
protected boolean handleStringEscape(char separator, char escapeChar, Token stringToken) { if (input.current().is(separator)) { stringToken.addToContent(separator); stringToken.addToSource(input.consume()); return true; } else if (input.current().is(escapeChar)) { stringToken.silentAddToContent(escapeChar); stringToken.addToSource(input.consume()); return true; } else if (input.current().is('n')) { stringToken.silentAddToContent('\n'); stringToken.addToSource(input.consume()); return true; } else if (input.current().is('r')) { stringToken.silentAddToContent('\r'); stringToken.addToSource(input.consume()); return true; } else { return false; } }
java
protected boolean handleStringEscape(char separator, char escapeChar, Token stringToken) { if (input.current().is(separator)) { stringToken.addToContent(separator); stringToken.addToSource(input.consume()); return true; } else if (input.current().is(escapeChar)) { stringToken.silentAddToContent(escapeChar); stringToken.addToSource(input.consume()); return true; } else if (input.current().is('n')) { stringToken.silentAddToContent('\n'); stringToken.addToSource(input.consume()); return true; } else if (input.current().is('r')) { stringToken.silentAddToContent('\r'); stringToken.addToSource(input.consume()); return true; } else { return false; } }
[ "protected", "boolean", "handleStringEscape", "(", "char", "separator", ",", "char", "escapeChar", ",", "Token", "stringToken", ")", "{", "if", "(", "input", ".", "current", "(", ")", ".", "is", "(", "separator", ")", ")", "{", "stringToken", ".", "addToContent", "(", "separator", ")", ";", "stringToken", ".", "addToSource", "(", "input", ".", "consume", "(", ")", ")", ";", "return", "true", ";", "}", "else", "if", "(", "input", ".", "current", "(", ")", ".", "is", "(", "escapeChar", ")", ")", "{", "stringToken", ".", "silentAddToContent", "(", "escapeChar", ")", ";", "stringToken", ".", "addToSource", "(", "input", ".", "consume", "(", ")", ")", ";", "return", "true", ";", "}", "else", "if", "(", "input", ".", "current", "(", ")", ".", "is", "(", "'", "'", ")", ")", "{", "stringToken", ".", "silentAddToContent", "(", "'", "'", ")", ";", "stringToken", ".", "addToSource", "(", "input", ".", "consume", "(", ")", ")", ";", "return", "true", ";", "}", "else", "if", "(", "input", ".", "current", "(", ")", ".", "is", "(", "'", "'", ")", ")", "{", "stringToken", ".", "silentAddToContent", "(", "'", "'", ")", ";", "stringToken", ".", "addToSource", "(", "input", ".", "consume", "(", ")", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Evaluates an string escape like \n <p> The escape character is already consumed. Therefore the input points at the character to escape. This method must consume all escaped characters. @param separator the delimiter of this string constant @param escapeChar the escape character used @param stringToken the resulting string constant @return <tt>true</tt> if an escape was possible, <tt>false</tt> otherwise
[ "Evaluates", "an", "string", "escape", "like", "\\", "n", "<p", ">", "The", "escape", "character", "is", "already", "consumed", ".", "Therefore", "the", "input", "points", "at", "the", "character", "to", "escape", ".", "This", "method", "must", "consume", "all", "escaped", "characters", "." ]
train
https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Tokenizer.java#L361-L381
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java
ReferenceDataUrl.getBehaviorsUrl
public static MozuUrl getBehaviorsUrl(String responseFields, String userType) { UrlFormatter formatter = new UrlFormatter("/api/platform/reference/behaviors?userType={userType}&responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("userType", userType); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
java
public static MozuUrl getBehaviorsUrl(String responseFields, String userType) { UrlFormatter formatter = new UrlFormatter("/api/platform/reference/behaviors?userType={userType}&responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("userType", userType); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
[ "public", "static", "MozuUrl", "getBehaviorsUrl", "(", "String", "responseFields", ",", "String", "userType", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/reference/behaviors?userType={userType}&responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "formatter", ".", "formatUrl", "(", "\"userType\"", ",", "userType", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "HOME_POD", ")", ";", "}" ]
Get Resource Url for GetBehaviors @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param userType The user type associated with the behaviors to retrieve. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetBehaviors" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java#L88-L94
aoindustries/semanticcms-openfile-servlet
src/main/java/com/semanticcms/openfile/servlet/OpenFile.java
OpenFile.isAllowed
public static boolean isAllowed(ServletContext servletContext, ServletRequest request) { return Boolean.parseBoolean(servletContext.getInitParameter(ENABLE_INIT_PARAM)) && isAllowedAddr(request.getRemoteAddr()) ; }
java
public static boolean isAllowed(ServletContext servletContext, ServletRequest request) { return Boolean.parseBoolean(servletContext.getInitParameter(ENABLE_INIT_PARAM)) && isAllowedAddr(request.getRemoteAddr()) ; }
[ "public", "static", "boolean", "isAllowed", "(", "ServletContext", "servletContext", ",", "ServletRequest", "request", ")", "{", "return", "Boolean", ".", "parseBoolean", "(", "servletContext", ".", "getInitParameter", "(", "ENABLE_INIT_PARAM", ")", ")", "&&", "isAllowedAddr", "(", "request", ".", "getRemoteAddr", "(", ")", ")", ";", "}" ]
Checks if the given request is allowed to open files on the server. The servlet init param must have it enabled, as well as be from an allowed IP.
[ "Checks", "if", "the", "given", "request", "is", "allowed", "to", "open", "files", "on", "the", "server", ".", "The", "servlet", "init", "param", "must", "have", "it", "enabled", "as", "well", "as", "be", "from", "an", "allowed", "IP", "." ]
train
https://github.com/aoindustries/semanticcms-openfile-servlet/blob/d22b2580b57708311949ac1088e3275355774921/src/main/java/com/semanticcms/openfile/servlet/OpenFile.java#L70-L75
contentful/contentful.java
src/main/java/com/contentful/java/cda/rich/RichTextFactory.java
RichTextFactory.resolveRichDocument
private static void resolveRichDocument(CDAEntry entry, CDAField field) { final Map<String, Object> rawValue = (Map<String, Object>) entry.rawFields().get(field.id()); if (rawValue == null) { return; } for (final String locale : rawValue.keySet()) { final Object raw = rawValue.get(locale); if (raw == null || raw instanceof CDARichNode) { // ignore null and already parsed values continue; } final Map<String, Object> map = (Map<String, Object>) rawValue.get(locale); entry.setField(locale, field.id(), RESOLVER_MAP.get("document").resolve(map)); } }
java
private static void resolveRichDocument(CDAEntry entry, CDAField field) { final Map<String, Object> rawValue = (Map<String, Object>) entry.rawFields().get(field.id()); if (rawValue == null) { return; } for (final String locale : rawValue.keySet()) { final Object raw = rawValue.get(locale); if (raw == null || raw instanceof CDARichNode) { // ignore null and already parsed values continue; } final Map<String, Object> map = (Map<String, Object>) rawValue.get(locale); entry.setField(locale, field.id(), RESOLVER_MAP.get("document").resolve(map)); } }
[ "private", "static", "void", "resolveRichDocument", "(", "CDAEntry", "entry", ",", "CDAField", "field", ")", "{", "final", "Map", "<", "String", ",", "Object", ">", "rawValue", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "entry", ".", "rawFields", "(", ")", ".", "get", "(", "field", ".", "id", "(", ")", ")", ";", "if", "(", "rawValue", "==", "null", ")", "{", "return", ";", "}", "for", "(", "final", "String", "locale", ":", "rawValue", ".", "keySet", "(", ")", ")", "{", "final", "Object", "raw", "=", "rawValue", ".", "get", "(", "locale", ")", ";", "if", "(", "raw", "==", "null", "||", "raw", "instanceof", "CDARichNode", ")", "{", "// ignore null and already parsed values", "continue", ";", "}", "final", "Map", "<", "String", ",", "Object", ">", "map", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "rawValue", ".", "get", "(", "locale", ")", ";", "entry", ".", "setField", "(", "locale", ",", "field", ".", "id", "(", ")", ",", "RESOLVER_MAP", ".", "get", "(", "\"document\"", ")", ".", "resolve", "(", "map", ")", ")", ";", "}", "}" ]
Resolve all children of the top most document block. @param entry the entry to contain the field to be walked @param field the id of the field to be walked.
[ "Resolve", "all", "children", "of", "the", "top", "most", "document", "block", "." ]
train
https://github.com/contentful/contentful.java/blob/6ecc2ace454c674b218b99489dc50697b1dbffcb/src/main/java/com/contentful/java/cda/rich/RichTextFactory.java#L285-L301
sahan/IckleBot
icklebot/src/main/java/com/lonepulse/icklebot/injector/IllegalContextException.java
IllegalContextException.createMessage
private static final String createMessage(Object illegalContext, Set<Class<?>> applicableContexts) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("The given context "); stringBuilder.append(illegalContext.getClass().getName()); stringBuilder.append(" is illegal"); if(applicableContexts != null && applicableContexts.size() > 0) { stringBuilder.append(". The only applicable contexts are"); for (Class<?> contextClass : applicableContexts) { stringBuilder.append(", "); stringBuilder.append(contextClass.getName()); } } stringBuilder.append(". "); return stringBuilder.toString(); }
java
private static final String createMessage(Object illegalContext, Set<Class<?>> applicableContexts) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("The given context "); stringBuilder.append(illegalContext.getClass().getName()); stringBuilder.append(" is illegal"); if(applicableContexts != null && applicableContexts.size() > 0) { stringBuilder.append(". The only applicable contexts are"); for (Class<?> contextClass : applicableContexts) { stringBuilder.append(", "); stringBuilder.append(contextClass.getName()); } } stringBuilder.append(". "); return stringBuilder.toString(); }
[ "private", "static", "final", "String", "createMessage", "(", "Object", "illegalContext", ",", "Set", "<", "Class", "<", "?", ">", ">", "applicableContexts", ")", "{", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "stringBuilder", ".", "append", "(", "\"The given context \"", ")", ";", "stringBuilder", ".", "append", "(", "illegalContext", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "stringBuilder", ".", "append", "(", "\" is illegal\"", ")", ";", "if", "(", "applicableContexts", "!=", "null", "&&", "applicableContexts", ".", "size", "(", ")", ">", "0", ")", "{", "stringBuilder", ".", "append", "(", "\". The only applicable contexts are\"", ")", ";", "for", "(", "Class", "<", "?", ">", "contextClass", ":", "applicableContexts", ")", "{", "stringBuilder", ".", "append", "(", "\", \"", ")", ";", "stringBuilder", ".", "append", "(", "contextClass", ".", "getName", "(", ")", ")", ";", "}", "}", "stringBuilder", ".", "append", "(", "\". \"", ")", ";", "return", "stringBuilder", ".", "toString", "(", ")", ";", "}" ]
<p>Creates the message to be used in {@link #IllegalContextException(Object, Set)}. @since 1.0.0
[ "<p", ">", "Creates", "the", "message", "to", "be", "used", "in", "{", "@link", "#IllegalContextException", "(", "Object", "Set", ")", "}", "." ]
train
https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/injector/IllegalContextException.java#L48-L70
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java
TaskManagerService.updateTaskStatus
void updateTaskStatus(Tenant tenant, TaskRecord taskRecord, boolean bDeleteClaimRecord) { String taskID = taskRecord.getTaskID(); DBTransaction dbTran = DBService.instance(tenant).startTransaction(); Map<String, String> propMap = taskRecord.getProperties(); for (String name : propMap.keySet()) { String value = propMap.get(name); if (Utils.isEmpty(value)) { dbTran.deleteColumn(TaskManagerService.TASKS_STORE_NAME, taskID, name); } else { dbTran.addColumn(TaskManagerService.TASKS_STORE_NAME, taskID, name, value); } } if (bDeleteClaimRecord) { dbTran.deleteRow(TaskManagerService.TASKS_STORE_NAME, "_claim/" + taskID); } DBService.instance(tenant).commit(dbTran); }
java
void updateTaskStatus(Tenant tenant, TaskRecord taskRecord, boolean bDeleteClaimRecord) { String taskID = taskRecord.getTaskID(); DBTransaction dbTran = DBService.instance(tenant).startTransaction(); Map<String, String> propMap = taskRecord.getProperties(); for (String name : propMap.keySet()) { String value = propMap.get(name); if (Utils.isEmpty(value)) { dbTran.deleteColumn(TaskManagerService.TASKS_STORE_NAME, taskID, name); } else { dbTran.addColumn(TaskManagerService.TASKS_STORE_NAME, taskID, name, value); } } if (bDeleteClaimRecord) { dbTran.deleteRow(TaskManagerService.TASKS_STORE_NAME, "_claim/" + taskID); } DBService.instance(tenant).commit(dbTran); }
[ "void", "updateTaskStatus", "(", "Tenant", "tenant", ",", "TaskRecord", "taskRecord", ",", "boolean", "bDeleteClaimRecord", ")", "{", "String", "taskID", "=", "taskRecord", ".", "getTaskID", "(", ")", ";", "DBTransaction", "dbTran", "=", "DBService", ".", "instance", "(", "tenant", ")", ".", "startTransaction", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "propMap", "=", "taskRecord", ".", "getProperties", "(", ")", ";", "for", "(", "String", "name", ":", "propMap", ".", "keySet", "(", ")", ")", "{", "String", "value", "=", "propMap", ".", "get", "(", "name", ")", ";", "if", "(", "Utils", ".", "isEmpty", "(", "value", ")", ")", "{", "dbTran", ".", "deleteColumn", "(", "TaskManagerService", ".", "TASKS_STORE_NAME", ",", "taskID", ",", "name", ")", ";", "}", "else", "{", "dbTran", ".", "addColumn", "(", "TaskManagerService", ".", "TASKS_STORE_NAME", ",", "taskID", ",", "name", ",", "value", ")", ";", "}", "}", "if", "(", "bDeleteClaimRecord", ")", "{", "dbTran", ".", "deleteRow", "(", "TaskManagerService", ".", "TASKS_STORE_NAME", ",", "\"_claim/\"", "+", "taskID", ")", ";", "}", "DBService", ".", "instance", "(", "tenant", ")", ".", "commit", "(", "dbTran", ")", ";", "}" ]
Add or update a task status record and optionally delete the task's claim record at the same time. @param tenant {@link Tenant} that owns the task's application. @param taskRecord {@link TaskRecord} containing task properties to be written to the database. A null/empty property value causes the corresponding column to be deleted. @param bDeleteClaimRecord True to delete the task's claim record in the same transaction.
[ "Add", "or", "update", "a", "task", "status", "record", "and", "optionally", "delete", "the", "task", "s", "claim", "record", "at", "the", "same", "time", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java#L263-L279
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/JUnit3FloatingPointComparisonWithoutDelta.java
JUnit3FloatingPointComparisonWithoutDelta.isDouble
private boolean isDouble(VisitorState state, Type type) { Type trueType = unboxedTypeOrType(state, type); return trueType.getKind() == TypeKind.DOUBLE; }
java
private boolean isDouble(VisitorState state, Type type) { Type trueType = unboxedTypeOrType(state, type); return trueType.getKind() == TypeKind.DOUBLE; }
[ "private", "boolean", "isDouble", "(", "VisitorState", "state", ",", "Type", "type", ")", "{", "Type", "trueType", "=", "unboxedTypeOrType", "(", "state", ",", "type", ")", ";", "return", "trueType", ".", "getKind", "(", ")", "==", "TypeKind", ".", "DOUBLE", ";", "}" ]
Determines if the type is a double, including reference types.
[ "Determines", "if", "the", "type", "is", "a", "double", "including", "reference", "types", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/JUnit3FloatingPointComparisonWithoutDelta.java#L170-L173
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiViewRobust.java
FactoryMultiViewRobust.trifocalRansac
public static Ransac<TrifocalTensor, AssociatedTriple> trifocalRansac( @Nullable ConfigTrifocal trifocal , @Nullable ConfigTrifocalError error, @Nonnull ConfigRansac ransac ) { if( trifocal == null ) trifocal = new ConfigTrifocal(); if( error == null ) error = new ConfigTrifocalError(); trifocal.checkValidity(); double ransacTol; DistanceFromModel<TrifocalTensor,AssociatedTriple> distance; switch( error.model) { case REPROJECTION: { ransacTol = 3.0*ransac.inlierThreshold*ransac.inlierThreshold; distance = new DistanceTrifocalReprojectionSq(); } break; case REPROJECTION_REFINE: ransacTol = 3.0*ransac.inlierThreshold*ransac.inlierThreshold; distance = new DistanceTrifocalReprojectionSq(error.converge.gtol,error.converge.maxIterations); break; case POINT_TRANSFER: ransacTol = 2.0*ransac.inlierThreshold*ransac.inlierThreshold; distance = new DistanceTrifocalTransferSq(); break; default: throw new IllegalArgumentException("Unknown error model "+error.model); } Estimate1ofTrifocalTensor estimator = FactoryMultiView.trifocal_1(trifocal); ModelManager<TrifocalTensor> manager = new ManagerTrifocalTensor(); ModelGenerator<TrifocalTensor,AssociatedTriple> generator = new GenerateTrifocalTensor(estimator); return new Ransac<>(ransac.randSeed, manager, generator, distance, ransac.maxIterations, ransacTol); }
java
public static Ransac<TrifocalTensor, AssociatedTriple> trifocalRansac( @Nullable ConfigTrifocal trifocal , @Nullable ConfigTrifocalError error, @Nonnull ConfigRansac ransac ) { if( trifocal == null ) trifocal = new ConfigTrifocal(); if( error == null ) error = new ConfigTrifocalError(); trifocal.checkValidity(); double ransacTol; DistanceFromModel<TrifocalTensor,AssociatedTriple> distance; switch( error.model) { case REPROJECTION: { ransacTol = 3.0*ransac.inlierThreshold*ransac.inlierThreshold; distance = new DistanceTrifocalReprojectionSq(); } break; case REPROJECTION_REFINE: ransacTol = 3.0*ransac.inlierThreshold*ransac.inlierThreshold; distance = new DistanceTrifocalReprojectionSq(error.converge.gtol,error.converge.maxIterations); break; case POINT_TRANSFER: ransacTol = 2.0*ransac.inlierThreshold*ransac.inlierThreshold; distance = new DistanceTrifocalTransferSq(); break; default: throw new IllegalArgumentException("Unknown error model "+error.model); } Estimate1ofTrifocalTensor estimator = FactoryMultiView.trifocal_1(trifocal); ModelManager<TrifocalTensor> manager = new ManagerTrifocalTensor(); ModelGenerator<TrifocalTensor,AssociatedTriple> generator = new GenerateTrifocalTensor(estimator); return new Ransac<>(ransac.randSeed, manager, generator, distance, ransac.maxIterations, ransacTol); }
[ "public", "static", "Ransac", "<", "TrifocalTensor", ",", "AssociatedTriple", ">", "trifocalRansac", "(", "@", "Nullable", "ConfigTrifocal", "trifocal", ",", "@", "Nullable", "ConfigTrifocalError", "error", ",", "@", "Nonnull", "ConfigRansac", "ransac", ")", "{", "if", "(", "trifocal", "==", "null", ")", "trifocal", "=", "new", "ConfigTrifocal", "(", ")", ";", "if", "(", "error", "==", "null", ")", "error", "=", "new", "ConfigTrifocalError", "(", ")", ";", "trifocal", ".", "checkValidity", "(", ")", ";", "double", "ransacTol", ";", "DistanceFromModel", "<", "TrifocalTensor", ",", "AssociatedTriple", ">", "distance", ";", "switch", "(", "error", ".", "model", ")", "{", "case", "REPROJECTION", ":", "{", "ransacTol", "=", "3.0", "*", "ransac", ".", "inlierThreshold", "*", "ransac", ".", "inlierThreshold", ";", "distance", "=", "new", "DistanceTrifocalReprojectionSq", "(", ")", ";", "}", "break", ";", "case", "REPROJECTION_REFINE", ":", "ransacTol", "=", "3.0", "*", "ransac", ".", "inlierThreshold", "*", "ransac", ".", "inlierThreshold", ";", "distance", "=", "new", "DistanceTrifocalReprojectionSq", "(", "error", ".", "converge", ".", "gtol", ",", "error", ".", "converge", ".", "maxIterations", ")", ";", "break", ";", "case", "POINT_TRANSFER", ":", "ransacTol", "=", "2.0", "*", "ransac", ".", "inlierThreshold", "*", "ransac", ".", "inlierThreshold", ";", "distance", "=", "new", "DistanceTrifocalTransferSq", "(", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unknown error model \"", "+", "error", ".", "model", ")", ";", "}", "Estimate1ofTrifocalTensor", "estimator", "=", "FactoryMultiView", ".", "trifocal_1", "(", "trifocal", ")", ";", "ModelManager", "<", "TrifocalTensor", ">", "manager", "=", "new", "ManagerTrifocalTensor", "(", ")", ";", "ModelGenerator", "<", "TrifocalTensor", ",", "AssociatedTriple", ">", "generator", "=", "new", "GenerateTrifocalTensor", "(", "estimator", ")", ";", "return", "new", "Ransac", "<>", "(", "ransac", ".", "randSeed", ",", "manager", ",", "generator", ",", "distance", ",", "ransac", ".", "maxIterations", ",", "ransacTol", ")", ";", "}" ]
Robust RANSAC based estimator for @see FactoryMultiView#trifocal_1 @param trifocal Configuration for trifocal tensor calculation @param error Configuration for how trifocal error is computed @param ransac Configuration for RANSAC @return RANSAC
[ "Robust", "RANSAC", "based", "estimator", "for" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiViewRobust.java#L399-L435
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.createCompositeEntityRoleWithServiceResponseAsync
public Observable<ServiceResponse<UUID>> createCompositeEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, CreateCompositeEntityRoleOptionalParameter createCompositeEntityRoleOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (cEntityId == null) { throw new IllegalArgumentException("Parameter cEntityId is required and cannot be null."); } final String name = createCompositeEntityRoleOptionalParameter != null ? createCompositeEntityRoleOptionalParameter.name() : null; return createCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, name); }
java
public Observable<ServiceResponse<UUID>> createCompositeEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, CreateCompositeEntityRoleOptionalParameter createCompositeEntityRoleOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (cEntityId == null) { throw new IllegalArgumentException("Parameter cEntityId is required and cannot be null."); } final String name = createCompositeEntityRoleOptionalParameter != null ? createCompositeEntityRoleOptionalParameter.name() : null; return createCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, name); }
[ "public", "Observable", "<", "ServiceResponse", "<", "UUID", ">", ">", "createCompositeEntityRoleWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ",", "CreateCompositeEntityRoleOptionalParameter", "createCompositeEntityRoleOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoint", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.endpoint() is required and cannot be null.\"", ")", ";", "}", "if", "(", "appId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter appId is required and cannot be null.\"", ")", ";", "}", "if", "(", "versionId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter versionId is required and cannot be null.\"", ")", ";", "}", "if", "(", "cEntityId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter cEntityId is required and cannot be null.\"", ")", ";", "}", "final", "String", "name", "=", "createCompositeEntityRoleOptionalParameter", "!=", "null", "?", "createCompositeEntityRoleOptionalParameter", ".", "name", "(", ")", ":", "null", ";", "return", "createCompositeEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "cEntityId", ",", "name", ")", ";", "}" ]
Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param createCompositeEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object
[ "Create", "an", "entity", "role", "for", "an", "entity", "in", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L8920-L8936
GoogleCloudPlatform/appengine-mapreduce
java/src/main/java/com/google/appengine/tools/mapreduce/impl/GoogleCloudStorageReduceInput.java
GoogleCloudStorageReduceInput.createReaderForShard
private MergingReader<K, V> createReaderForShard( Marshaller<KeyValue<ByteBuffer, ? extends Iterable<V>>> marshaller, GoogleCloudStorageFileSet reducerInputFileSet) { ArrayList<PeekingInputReader<KeyValue<ByteBuffer, ? extends Iterable<V>>>> inputFiles = new ArrayList<>(); GoogleCloudStorageLevelDbInput reducerInput = new GoogleCloudStorageLevelDbInput(reducerInputFileSet, DEFAULT_IO_BUFFER_SIZE); for (InputReader<ByteBuffer> in : reducerInput.createReaders()) { inputFiles.add(new PeekingInputReader<>(in, marshaller)); } return new MergingReader<>(inputFiles, keyMarshaller, true); }
java
private MergingReader<K, V> createReaderForShard( Marshaller<KeyValue<ByteBuffer, ? extends Iterable<V>>> marshaller, GoogleCloudStorageFileSet reducerInputFileSet) { ArrayList<PeekingInputReader<KeyValue<ByteBuffer, ? extends Iterable<V>>>> inputFiles = new ArrayList<>(); GoogleCloudStorageLevelDbInput reducerInput = new GoogleCloudStorageLevelDbInput(reducerInputFileSet, DEFAULT_IO_BUFFER_SIZE); for (InputReader<ByteBuffer> in : reducerInput.createReaders()) { inputFiles.add(new PeekingInputReader<>(in, marshaller)); } return new MergingReader<>(inputFiles, keyMarshaller, true); }
[ "private", "MergingReader", "<", "K", ",", "V", ">", "createReaderForShard", "(", "Marshaller", "<", "KeyValue", "<", "ByteBuffer", ",", "?", "extends", "Iterable", "<", "V", ">", ">", ">", "marshaller", ",", "GoogleCloudStorageFileSet", "reducerInputFileSet", ")", "{", "ArrayList", "<", "PeekingInputReader", "<", "KeyValue", "<", "ByteBuffer", ",", "?", "extends", "Iterable", "<", "V", ">", ">", ">", ">", "inputFiles", "=", "new", "ArrayList", "<>", "(", ")", ";", "GoogleCloudStorageLevelDbInput", "reducerInput", "=", "new", "GoogleCloudStorageLevelDbInput", "(", "reducerInputFileSet", ",", "DEFAULT_IO_BUFFER_SIZE", ")", ";", "for", "(", "InputReader", "<", "ByteBuffer", ">", "in", ":", "reducerInput", ".", "createReaders", "(", ")", ")", "{", "inputFiles", ".", "add", "(", "new", "PeekingInputReader", "<>", "(", "in", ",", "marshaller", ")", ")", ";", "}", "return", "new", "MergingReader", "<>", "(", "inputFiles", ",", "keyMarshaller", ",", "true", ")", ";", "}" ]
Create a {@link MergingReader} that combines all the input files the reducer to provide a global sort over all data for the shard. (There are multiple input files in the event that the data didn't fit into the sorter's memory) A {@link MergingReader} is used to combine contents while maintaining key-order. This requires a {@link PeekingInputReader}s to preview the next item of input. @returns a reader producing key-sorted input for a shard.
[ "Create", "a", "{", "@link", "MergingReader", "}", "that", "combines", "all", "the", "input", "files", "the", "reducer", "to", "provide", "a", "global", "sort", "over", "all", "data", "for", "the", "shard", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/impl/GoogleCloudStorageReduceInput.java#L71-L82
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/canvas/CanvasRenderer.java
CanvasRenderer.encodeBegin
@Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } Canvas canvas = (Canvas) component; ResponseWriter rw = context.getResponseWriter(); String clientId = canvas.getClientId(); rw.startElement("canvas", canvas); Tooltip.generateTooltip(context, canvas, rw); // rw.writeAttribute("initial-drawing", canvas.getInitial-drawing(), "initial-drawing"); rw.writeAttribute("id", clientId, "id"); writeAttribute(rw, "style", canvas.getStyle(), "style"); String styleClass = canvas.getStyleClass(); if (null != styleClass) styleClass += Responsive.getResponsiveStyleClass(canvas, false); else styleClass = Responsive.getResponsiveStyleClass(canvas, false); writeAttribute(rw, "class", styleClass, "class"); writeAttribute(rw, "width", canvas.getWidth(), "width"); writeAttribute(rw, "height", canvas.getHeight(), "height"); rw.endElement("canvas"); Tooltip.activateTooltips(context, canvas); Drawing drawing = canvas.getDrawing(); if (null != drawing) { String script = ((Drawing) drawing).getJavaScript(); rw.startElement("script", component); rw.write("\nnew function(){\n"); rw.write(" var canvas=document.getElementById('" + clientId + "');\n"); rw.write(" var ctx = canvas.getContext('2d');\n"); rw.write(script); rw.write("\n}();\n"); rw.endElement("script"); } }
java
@Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } Canvas canvas = (Canvas) component; ResponseWriter rw = context.getResponseWriter(); String clientId = canvas.getClientId(); rw.startElement("canvas", canvas); Tooltip.generateTooltip(context, canvas, rw); // rw.writeAttribute("initial-drawing", canvas.getInitial-drawing(), "initial-drawing"); rw.writeAttribute("id", clientId, "id"); writeAttribute(rw, "style", canvas.getStyle(), "style"); String styleClass = canvas.getStyleClass(); if (null != styleClass) styleClass += Responsive.getResponsiveStyleClass(canvas, false); else styleClass = Responsive.getResponsiveStyleClass(canvas, false); writeAttribute(rw, "class", styleClass, "class"); writeAttribute(rw, "width", canvas.getWidth(), "width"); writeAttribute(rw, "height", canvas.getHeight(), "height"); rw.endElement("canvas"); Tooltip.activateTooltips(context, canvas); Drawing drawing = canvas.getDrawing(); if (null != drawing) { String script = ((Drawing) drawing).getJavaScript(); rw.startElement("script", component); rw.write("\nnew function(){\n"); rw.write(" var canvas=document.getElementById('" + clientId + "');\n"); rw.write(" var ctx = canvas.getContext('2d');\n"); rw.write(script); rw.write("\n}();\n"); rw.endElement("script"); } }
[ "@", "Override", "public", "void", "encodeBegin", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "if", "(", "!", "component", ".", "isRendered", "(", ")", ")", "{", "return", ";", "}", "Canvas", "canvas", "=", "(", "Canvas", ")", "component", ";", "ResponseWriter", "rw", "=", "context", ".", "getResponseWriter", "(", ")", ";", "String", "clientId", "=", "canvas", ".", "getClientId", "(", ")", ";", "rw", ".", "startElement", "(", "\"canvas\"", ",", "canvas", ")", ";", "Tooltip", ".", "generateTooltip", "(", "context", ",", "canvas", ",", "rw", ")", ";", "//\t rw.writeAttribute(\"initial-drawing\", canvas.getInitial-drawing(), \"initial-drawing\");", "rw", ".", "writeAttribute", "(", "\"id\"", ",", "clientId", ",", "\"id\"", ")", ";", "writeAttribute", "(", "rw", ",", "\"style\"", ",", "canvas", ".", "getStyle", "(", ")", ",", "\"style\"", ")", ";", "String", "styleClass", "=", "canvas", ".", "getStyleClass", "(", ")", ";", "if", "(", "null", "!=", "styleClass", ")", "styleClass", "+=", "Responsive", ".", "getResponsiveStyleClass", "(", "canvas", ",", "false", ")", ";", "else", "styleClass", "=", "Responsive", ".", "getResponsiveStyleClass", "(", "canvas", ",", "false", ")", ";", "writeAttribute", "(", "rw", ",", "\"class\"", ",", "styleClass", ",", "\"class\"", ")", ";", "writeAttribute", "(", "rw", ",", "\"width\"", ",", "canvas", ".", "getWidth", "(", ")", ",", "\"width\"", ")", ";", "writeAttribute", "(", "rw", ",", "\"height\"", ",", "canvas", ".", "getHeight", "(", ")", ",", "\"height\"", ")", ";", "rw", ".", "endElement", "(", "\"canvas\"", ")", ";", "Tooltip", ".", "activateTooltips", "(", "context", ",", "canvas", ")", ";", "Drawing", "drawing", "=", "canvas", ".", "getDrawing", "(", ")", ";", "if", "(", "null", "!=", "drawing", ")", "{", "String", "script", "=", "(", "(", "Drawing", ")", "drawing", ")", ".", "getJavaScript", "(", ")", ";", "rw", ".", "startElement", "(", "\"script\"", ",", "component", ")", ";", "rw", ".", "write", "(", "\"\\nnew function(){\\n\"", ")", ";", "rw", ".", "write", "(", "\" var canvas=document.getElementById('\"", "+", "clientId", "+", "\"');\\n\"", ")", ";", "rw", ".", "write", "(", "\" var ctx = canvas.getContext('2d');\\n\"", ")", ";", "rw", ".", "write", "(", "script", ")", ";", "rw", ".", "write", "(", "\"\\n}();\\n\"", ")", ";", "rw", ".", "endElement", "(", "\"script\"", ")", ";", "}", "}" ]
This methods generates the HTML code of the current b:canvas. @param context the FacesContext. @param component the current b:canvas. @throws IOException thrown if something goes wrong when writing the HTML code.
[ "This", "methods", "generates", "the", "HTML", "code", "of", "the", "current", "b", ":", "canvas", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/canvas/CanvasRenderer.java#L42-L79
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/SecurityUtils.java
SecurityUtils.getPrivateKey
public static PrivateKey getPrivateKey(KeyStore keyStore, String alias, String keyPass) throws GeneralSecurityException { return (PrivateKey) keyStore.getKey(alias, keyPass.toCharArray()); }
java
public static PrivateKey getPrivateKey(KeyStore keyStore, String alias, String keyPass) throws GeneralSecurityException { return (PrivateKey) keyStore.getKey(alias, keyPass.toCharArray()); }
[ "public", "static", "PrivateKey", "getPrivateKey", "(", "KeyStore", "keyStore", ",", "String", "alias", ",", "String", "keyPass", ")", "throws", "GeneralSecurityException", "{", "return", "(", "PrivateKey", ")", "keyStore", ".", "getKey", "(", "alias", ",", "keyPass", ".", "toCharArray", "(", ")", ")", ";", "}" ]
Returns the private key from the key store. @param keyStore key store @param alias alias under which the key is stored @param keyPass password protecting the key @return private key
[ "Returns", "the", "private", "key", "from", "the", "key", "store", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/SecurityUtils.java#L92-L95
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.loadBalancing_serviceName_backend_backend_GET
public OvhLoadBalancingBackendIp loadBalancing_serviceName_backend_backend_GET(String serviceName, String backend) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/backend/{backend}"; StringBuilder sb = path(qPath, serviceName, backend); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhLoadBalancingBackendIp.class); }
java
public OvhLoadBalancingBackendIp loadBalancing_serviceName_backend_backend_GET(String serviceName, String backend) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/backend/{backend}"; StringBuilder sb = path(qPath, serviceName, backend); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhLoadBalancingBackendIp.class); }
[ "public", "OvhLoadBalancingBackendIp", "loadBalancing_serviceName_backend_backend_GET", "(", "String", "serviceName", ",", "String", "backend", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/loadBalancing/{serviceName}/backend/{backend}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "backend", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhLoadBalancingBackendIp", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /ip/loadBalancing/{serviceName}/backend/{backend} @param serviceName [required] The internal name of your IP load balancing @param backend [required] IP of your backend
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1398-L1403
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilderLegacy.java
SearchBuilderLegacy.fromJson
static SearchBuilder fromJson(String json) { try { return JsonSerializer.fromString(json, SearchBuilderLegacy.class).builder; } catch (IOException e) { throw new IndexException(e, "Unparseable JSON search: {}", json); } }
java
static SearchBuilder fromJson(String json) { try { return JsonSerializer.fromString(json, SearchBuilderLegacy.class).builder; } catch (IOException e) { throw new IndexException(e, "Unparseable JSON search: {}", json); } }
[ "static", "SearchBuilder", "fromJson", "(", "String", "json", ")", "{", "try", "{", "return", "JsonSerializer", ".", "fromString", "(", "json", ",", "SearchBuilderLegacy", ".", "class", ")", ".", "builder", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IndexException", "(", "e", ",", "\"Unparseable JSON search: {}\"", ",", "json", ")", ";", "}", "}" ]
Returns the {@link SearchBuilder} represented by the specified JSON {@code String}. @param json the JSON {@code String} representing a {@link SearchBuilder} @return the {@link SearchBuilder} represented by the specified JSON {@code String}
[ "Returns", "the", "{", "@link", "SearchBuilder", "}", "represented", "by", "the", "specified", "JSON", "{", "@code", "String", "}", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilderLegacy.java#L97-L103
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.resumeAsync
public Observable<Page<SiteInner>> resumeAsync(final String resourceGroupName, final String name) { return resumeWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() { @Override public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) { return response.body(); } }); }
java
public Observable<Page<SiteInner>> resumeAsync(final String resourceGroupName, final String name) { return resumeWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() { @Override public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "SiteInner", ">", ">", "resumeAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "resumeWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "SiteInner", ">", ">", ",", "Page", "<", "SiteInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "SiteInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "SiteInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Resume an App Service Environment. Resume an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SiteInner&gt; object
[ "Resume", "an", "App", "Service", "Environment", ".", "Resume", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3850-L3858
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.openTagHtmlContent
public static String openTagHtmlContent(String tag, String clazz, String style, String... content) { return openTag(tag, clazz, style, true, content); }
java
public static String openTagHtmlContent(String tag, String clazz, String style, String... content) { return openTag(tag, clazz, style, true, content); }
[ "public", "static", "String", "openTagHtmlContent", "(", "String", "tag", ",", "String", "clazz", ",", "String", "style", ",", "String", "...", "content", ")", "{", "return", "openTag", "(", "tag", ",", "clazz", ",", "style", ",", "true", ",", "content", ")", ";", "}" ]
Build a String containing a HTML opening tag with given CSS class and/or style and concatenates the given HTML content. @param tag String name of HTML tag @param clazz CSS class of the tag @param style style for tag (plain CSS) @param content content string @return HTML tag element as string
[ "Build", "a", "String", "containing", "a", "HTML", "opening", "tag", "with", "given", "CSS", "class", "and", "/", "or", "style", "and", "concatenates", "the", "given", "HTML", "content", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L404-L406
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SubsystemSuspensionLevels.java
SubsystemSuspensionLevels.setLevels
public void setLevels(Map<Integer, Long> levels) { SystemAssert.requireArgument(levels != null, "Levels cannot be null"); this.levels.clear(); this.levels.putAll(levels); }
java
public void setLevels(Map<Integer, Long> levels) { SystemAssert.requireArgument(levels != null, "Levels cannot be null"); this.levels.clear(); this.levels.putAll(levels); }
[ "public", "void", "setLevels", "(", "Map", "<", "Integer", ",", "Long", ">", "levels", ")", "{", "SystemAssert", ".", "requireArgument", "(", "levels", "!=", "null", ",", "\"Levels cannot be null\"", ")", ";", "this", ".", "levels", ".", "clear", "(", ")", ";", "this", ".", "levels", ".", "putAll", "(", "levels", ")", ";", "}" ]
Sets the suspension time in milliseconds for the corresponding infraction count. @param levels The map of infraction counts to suspension times.
[ "Sets", "the", "suspension", "time", "in", "milliseconds", "for", "the", "corresponding", "infraction", "count", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SubsystemSuspensionLevels.java#L195-L199
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmModelCompleter.java
JvmModelCompleter.replaceVariables
protected String replaceVariables(String commentForGenerated, JvmDeclaredType jvmType) { String result = commentForGenerated; if (result.contains(GENERATED_COMMENT_VAR_SOURCE_FILE)) { Resource resource = jvmType.eResource(); if (resource != null) { URI uri = resource.getURI(); if (uri != null) { String sourceFile = uri.lastSegment(); if (sourceFile == null) sourceFile = uri.toString(); result = result.replace(GENERATED_COMMENT_VAR_SOURCE_FILE, sourceFile); } } } return result; }
java
protected String replaceVariables(String commentForGenerated, JvmDeclaredType jvmType) { String result = commentForGenerated; if (result.contains(GENERATED_COMMENT_VAR_SOURCE_FILE)) { Resource resource = jvmType.eResource(); if (resource != null) { URI uri = resource.getURI(); if (uri != null) { String sourceFile = uri.lastSegment(); if (sourceFile == null) sourceFile = uri.toString(); result = result.replace(GENERATED_COMMENT_VAR_SOURCE_FILE, sourceFile); } } } return result; }
[ "protected", "String", "replaceVariables", "(", "String", "commentForGenerated", ",", "JvmDeclaredType", "jvmType", ")", "{", "String", "result", "=", "commentForGenerated", ";", "if", "(", "result", ".", "contains", "(", "GENERATED_COMMENT_VAR_SOURCE_FILE", ")", ")", "{", "Resource", "resource", "=", "jvmType", ".", "eResource", "(", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "URI", "uri", "=", "resource", ".", "getURI", "(", ")", ";", "if", "(", "uri", "!=", "null", ")", "{", "String", "sourceFile", "=", "uri", ".", "lastSegment", "(", ")", ";", "if", "(", "sourceFile", "==", "null", ")", "sourceFile", "=", "uri", ".", "toString", "(", ")", ";", "result", "=", "result", ".", "replace", "(", "GENERATED_COMMENT_VAR_SOURCE_FILE", ",", "sourceFile", ")", ";", "}", "}", "}", "return", "result", ";", "}" ]
Replace the variables contained in the comment to be written to the <code>@Generated</code> annotation.
[ "Replace", "the", "variables", "contained", "in", "the", "comment", "to", "be", "written", "to", "the", "<code", ">" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmModelCompleter.java#L275-L290
stripe/stripe-android
stripe/src/main/java/com/stripe/android/view/DateUtils.java
DateUtils.convertTwoDigitYearToFour
@IntRange(from = 1000, to = 9999) static int convertTwoDigitYearToFour(@IntRange(from = 0, to = 99) int inputYear) { return convertTwoDigitYearToFour(inputYear, Calendar.getInstance()); }
java
@IntRange(from = 1000, to = 9999) static int convertTwoDigitYearToFour(@IntRange(from = 0, to = 99) int inputYear) { return convertTwoDigitYearToFour(inputYear, Calendar.getInstance()); }
[ "@", "IntRange", "(", "from", "=", "1000", ",", "to", "=", "9999", ")", "static", "int", "convertTwoDigitYearToFour", "(", "@", "IntRange", "(", "from", "=", "0", ",", "to", "=", "99", ")", "int", "inputYear", ")", "{", "return", "convertTwoDigitYearToFour", "(", "inputYear", ",", "Calendar", ".", "getInstance", "(", ")", ")", ";", "}" ]
Converts a two-digit input year to a four-digit year. As the current calendar year approaches a century, we assume small values to mean the next century. For instance, if the current year is 2090, and the input value is "18", the user probably means 2118, not 2018. However, in 2017, the input "18" probably means 2018. This code should be updated before the year 9981. @param inputYear a two-digit integer, between 0 and 99, inclusive @return a four-digit year
[ "Converts", "a", "two", "-", "digit", "input", "year", "to", "a", "four", "-", "digit", "year", ".", "As", "the", "current", "calendar", "year", "approaches", "a", "century", "we", "assume", "small", "values", "to", "mean", "the", "next", "century", ".", "For", "instance", "if", "the", "current", "year", "is", "2090", "and", "the", "input", "value", "is", "18", "the", "user", "probably", "means", "2118", "not", "2018", ".", "However", "in", "2017", "the", "input", "18", "probably", "means", "2018", ".", "This", "code", "should", "be", "updated", "before", "the", "year", "9981", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/view/DateUtils.java#L143-L146
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java
KeyValueFeatureHandler.helloRequest
private FullBinaryMemcacheRequest helloRequest(int connId) throws Exception { byte[] key = generateAgentJson( ctx.environment().userAgent(), ctx.coreId(), connId ); short keyLength = (short) key.length; ByteBuf wanted = Unpooled.buffer(features.size() * 2); for (ServerFeatures feature : features) { wanted.writeShort(feature.value()); } LOGGER.debug("Requesting supported features: {}", features); FullBinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest(key, Unpooled.EMPTY_BUFFER, wanted); request.setOpcode(HELLO_CMD); request.setKeyLength(keyLength); request.setTotalBodyLength(keyLength + wanted.readableBytes()); return request; }
java
private FullBinaryMemcacheRequest helloRequest(int connId) throws Exception { byte[] key = generateAgentJson( ctx.environment().userAgent(), ctx.coreId(), connId ); short keyLength = (short) key.length; ByteBuf wanted = Unpooled.buffer(features.size() * 2); for (ServerFeatures feature : features) { wanted.writeShort(feature.value()); } LOGGER.debug("Requesting supported features: {}", features); FullBinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest(key, Unpooled.EMPTY_BUFFER, wanted); request.setOpcode(HELLO_CMD); request.setKeyLength(keyLength); request.setTotalBodyLength(keyLength + wanted.readableBytes()); return request; }
[ "private", "FullBinaryMemcacheRequest", "helloRequest", "(", "int", "connId", ")", "throws", "Exception", "{", "byte", "[", "]", "key", "=", "generateAgentJson", "(", "ctx", ".", "environment", "(", ")", ".", "userAgent", "(", ")", ",", "ctx", ".", "coreId", "(", ")", ",", "connId", ")", ";", "short", "keyLength", "=", "(", "short", ")", "key", ".", "length", ";", "ByteBuf", "wanted", "=", "Unpooled", ".", "buffer", "(", "features", ".", "size", "(", ")", "*", "2", ")", ";", "for", "(", "ServerFeatures", "feature", ":", "features", ")", "{", "wanted", ".", "writeShort", "(", "feature", ".", "value", "(", ")", ")", ";", "}", "LOGGER", ".", "debug", "(", "\"Requesting supported features: {}\"", ",", "features", ")", ";", "FullBinaryMemcacheRequest", "request", "=", "new", "DefaultFullBinaryMemcacheRequest", "(", "key", ",", "Unpooled", ".", "EMPTY_BUFFER", ",", "wanted", ")", ";", "request", ".", "setOpcode", "(", "HELLO_CMD", ")", ";", "request", ".", "setKeyLength", "(", "keyLength", ")", ";", "request", ".", "setTotalBodyLength", "(", "keyLength", "+", "wanted", ".", "readableBytes", "(", ")", ")", ";", "return", "request", ";", "}" ]
Creates the HELLO request to ask for certain supported features. @param connId the connection id @return the request to send over the wire
[ "Creates", "the", "HELLO", "request", "to", "ask", "for", "certain", "supported", "features", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java#L130-L149
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/volatilities/AbstractVolatilitySurfaceParametric.java
AbstractVolatilitySurfaceParametric.getCloneCalibrated
public AbstractVolatilitySurfaceParametric getCloneCalibrated(final AnalyticModel calibrationModel, final Vector<AnalyticProduct> calibrationProducts, final List<Double> calibrationTargetValues, Map<String,Object> calibrationParameters, final ParameterTransformation parameterTransformation, OptimizerFactory optimizerFactory) throws SolverException { if(calibrationParameters == null) { calibrationParameters = new HashMap<>(); } Integer maxIterationsParameter = (Integer)calibrationParameters.get("maxIterations"); Double accuracyParameter = (Double)calibrationParameters.get("accuracy"); Double evaluationTimeParameter = (Double)calibrationParameters.get("evaluationTime"); // @TODO currently ignored, we use the setting form the OptimizerFactory int maxIterations = maxIterationsParameter != null ? maxIterationsParameter.intValue() : 600; double accuracy = accuracyParameter != null ? accuracyParameter.doubleValue() : 1E-8; double evaluationTime = evaluationTimeParameter != null ? evaluationTimeParameter.doubleValue() : 0.0; AnalyticModel model = calibrationModel.addVolatilitySurfaces(this); Solver solver = new Solver(model, calibrationProducts, calibrationTargetValues, parameterTransformation, evaluationTime, optimizerFactory); Set<ParameterObject> objectsToCalibrate = new HashSet<>(); objectsToCalibrate.add(this); AnalyticModel modelCalibrated = solver.getCalibratedModel(objectsToCalibrate); // Diagnostic output if (logger.isLoggable(Level.FINE)) { double lastAccuracy = solver.getAccuracy(); int lastIterations = solver.getIterations(); logger.fine("The solver achieved an accuracy of " + lastAccuracy + " in " + lastIterations + "."); } return (AbstractVolatilitySurfaceParametric)modelCalibrated.getVolatilitySurface(this.getName()); }
java
public AbstractVolatilitySurfaceParametric getCloneCalibrated(final AnalyticModel calibrationModel, final Vector<AnalyticProduct> calibrationProducts, final List<Double> calibrationTargetValues, Map<String,Object> calibrationParameters, final ParameterTransformation parameterTransformation, OptimizerFactory optimizerFactory) throws SolverException { if(calibrationParameters == null) { calibrationParameters = new HashMap<>(); } Integer maxIterationsParameter = (Integer)calibrationParameters.get("maxIterations"); Double accuracyParameter = (Double)calibrationParameters.get("accuracy"); Double evaluationTimeParameter = (Double)calibrationParameters.get("evaluationTime"); // @TODO currently ignored, we use the setting form the OptimizerFactory int maxIterations = maxIterationsParameter != null ? maxIterationsParameter.intValue() : 600; double accuracy = accuracyParameter != null ? accuracyParameter.doubleValue() : 1E-8; double evaluationTime = evaluationTimeParameter != null ? evaluationTimeParameter.doubleValue() : 0.0; AnalyticModel model = calibrationModel.addVolatilitySurfaces(this); Solver solver = new Solver(model, calibrationProducts, calibrationTargetValues, parameterTransformation, evaluationTime, optimizerFactory); Set<ParameterObject> objectsToCalibrate = new HashSet<>(); objectsToCalibrate.add(this); AnalyticModel modelCalibrated = solver.getCalibratedModel(objectsToCalibrate); // Diagnostic output if (logger.isLoggable(Level.FINE)) { double lastAccuracy = solver.getAccuracy(); int lastIterations = solver.getIterations(); logger.fine("The solver achieved an accuracy of " + lastAccuracy + " in " + lastIterations + "."); } return (AbstractVolatilitySurfaceParametric)modelCalibrated.getVolatilitySurface(this.getName()); }
[ "public", "AbstractVolatilitySurfaceParametric", "getCloneCalibrated", "(", "final", "AnalyticModel", "calibrationModel", ",", "final", "Vector", "<", "AnalyticProduct", ">", "calibrationProducts", ",", "final", "List", "<", "Double", ">", "calibrationTargetValues", ",", "Map", "<", "String", ",", "Object", ">", "calibrationParameters", ",", "final", "ParameterTransformation", "parameterTransformation", ",", "OptimizerFactory", "optimizerFactory", ")", "throws", "SolverException", "{", "if", "(", "calibrationParameters", "==", "null", ")", "{", "calibrationParameters", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "Integer", "maxIterationsParameter", "=", "(", "Integer", ")", "calibrationParameters", ".", "get", "(", "\"maxIterations\"", ")", ";", "Double", "accuracyParameter", "=", "(", "Double", ")", "calibrationParameters", ".", "get", "(", "\"accuracy\"", ")", ";", "Double", "evaluationTimeParameter", "=", "(", "Double", ")", "calibrationParameters", ".", "get", "(", "\"evaluationTime\"", ")", ";", "// @TODO currently ignored, we use the setting form the OptimizerFactory", "int", "maxIterations", "=", "maxIterationsParameter", "!=", "null", "?", "maxIterationsParameter", ".", "intValue", "(", ")", ":", "600", ";", "double", "accuracy", "=", "accuracyParameter", "!=", "null", "?", "accuracyParameter", ".", "doubleValue", "(", ")", ":", "1E-8", ";", "double", "evaluationTime", "=", "evaluationTimeParameter", "!=", "null", "?", "evaluationTimeParameter", ".", "doubleValue", "(", ")", ":", "0.0", ";", "AnalyticModel", "model", "=", "calibrationModel", ".", "addVolatilitySurfaces", "(", "this", ")", ";", "Solver", "solver", "=", "new", "Solver", "(", "model", ",", "calibrationProducts", ",", "calibrationTargetValues", ",", "parameterTransformation", ",", "evaluationTime", ",", "optimizerFactory", ")", ";", "Set", "<", "ParameterObject", ">", "objectsToCalibrate", "=", "new", "HashSet", "<>", "(", ")", ";", "objectsToCalibrate", ".", "add", "(", "this", ")", ";", "AnalyticModel", "modelCalibrated", "=", "solver", ".", "getCalibratedModel", "(", "objectsToCalibrate", ")", ";", "// Diagnostic output", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "double", "lastAccuracy", "=", "solver", ".", "getAccuracy", "(", ")", ";", "int", "lastIterations", "=", "solver", ".", "getIterations", "(", ")", ";", "logger", ".", "fine", "(", "\"The solver achieved an accuracy of \"", "+", "lastAccuracy", "+", "\" in \"", "+", "lastIterations", "+", "\".\"", ")", ";", "}", "return", "(", "AbstractVolatilitySurfaceParametric", ")", "modelCalibrated", ".", "getVolatilitySurface", "(", "this", ".", "getName", "(", ")", ")", ";", "}" ]
Create a clone of this volatility surface using a generic calibration of its parameters to given market data. @param calibrationModel The model used during calibration (contains additional objects required during valuation, e.g. curves). @param calibrationProducts The calibration products. @param calibrationTargetValues The target values of the calibration products. @param calibrationParameters A map containing additional settings like "evaluationTime" (Double). @param parameterTransformation An optional parameter transformation. @param optimizerFactory The factory providing the optimizer to be used during calibration. @return An object having the same type as this one, using (hopefully) calibrated parameters. @throws SolverException Exception thrown when solver fails.
[ "Create", "a", "clone", "of", "this", "volatility", "surface", "using", "a", "generic", "calibration", "of", "its", "parameters", "to", "given", "market", "data", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/AbstractVolatilitySurfaceParametric.java#L81-L110
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java
ProcessUtils.processObject
public static <T, R> void processObject(R r, T src) { processObject(r, src, (r1, src1) -> { }); }
java
public static <T, R> void processObject(R r, T src) { processObject(r, src, (r1, src1) -> { }); }
[ "public", "static", "<", "T", ",", "R", ">", "void", "processObject", "(", "R", "r", ",", "T", "src", ")", "{", "processObject", "(", "r", ",", "src", ",", "(", "r1", ",", "src1", ")", "->", "{", "}", ")", ";", "}" ]
拷贝单个对象 @param r 目标对象 @param src 原对象 @param <T> 原数据类型 @param <R> 目标数据类型
[ "拷贝单个对象" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java#L115-L118
elki-project/elki
elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/scaling/LinearScaling.java
LinearScaling.fromMinMax
public static LinearScaling fromMinMax(double min, double max) { double zoom = 1.0 / (max - min); return new LinearScaling(zoom, -min * zoom); }
java
public static LinearScaling fromMinMax(double min, double max) { double zoom = 1.0 / (max - min); return new LinearScaling(zoom, -min * zoom); }
[ "public", "static", "LinearScaling", "fromMinMax", "(", "double", "min", ",", "double", "max", ")", "{", "double", "zoom", "=", "1.0", "/", "(", "max", "-", "min", ")", ";", "return", "new", "LinearScaling", "(", "zoom", ",", "-", "min", "*", "zoom", ")", ";", "}" ]
Make a linear scaling from a given minimum and maximum. The minimum will be mapped to zero, the maximum to one. @param min Minimum @param max Maximum @return New linear scaling.
[ "Make", "a", "linear", "scaling", "from", "a", "given", "minimum", "and", "maximum", ".", "The", "minimum", "will", "be", "mapped", "to", "zero", "the", "maximum", "to", "one", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/scaling/LinearScaling.java#L102-L105
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/SequenceFile.java
SequenceFile.createWriter
private static Writer createWriter(Configuration conf, FSDataOutputStream out, Class keyClass, Class valClass, boolean compress, boolean blockCompress, CompressionCodec codec, Metadata metadata) throws IOException { if (codec != null && (codec instanceof GzipCodec) && !NativeCodeLoader.isNativeCodeLoaded() && !ZlibFactory.isNativeZlibLoaded(conf)) { throw new IllegalArgumentException("SequenceFile doesn't work with " + "GzipCodec without native-hadoop code!"); } Writer writer = null; if (!compress) { writer = new Writer(conf, out, keyClass, valClass, metadata); } else if (compress && !blockCompress) { writer = new RecordCompressWriter(conf, out, keyClass, valClass, codec, metadata); } else { writer = new BlockCompressWriter(conf, out, keyClass, valClass, codec, metadata); } return writer; }
java
private static Writer createWriter(Configuration conf, FSDataOutputStream out, Class keyClass, Class valClass, boolean compress, boolean blockCompress, CompressionCodec codec, Metadata metadata) throws IOException { if (codec != null && (codec instanceof GzipCodec) && !NativeCodeLoader.isNativeCodeLoaded() && !ZlibFactory.isNativeZlibLoaded(conf)) { throw new IllegalArgumentException("SequenceFile doesn't work with " + "GzipCodec without native-hadoop code!"); } Writer writer = null; if (!compress) { writer = new Writer(conf, out, keyClass, valClass, metadata); } else if (compress && !blockCompress) { writer = new RecordCompressWriter(conf, out, keyClass, valClass, codec, metadata); } else { writer = new BlockCompressWriter(conf, out, keyClass, valClass, codec, metadata); } return writer; }
[ "private", "static", "Writer", "createWriter", "(", "Configuration", "conf", ",", "FSDataOutputStream", "out", ",", "Class", "keyClass", ",", "Class", "valClass", ",", "boolean", "compress", ",", "boolean", "blockCompress", ",", "CompressionCodec", "codec", ",", "Metadata", "metadata", ")", "throws", "IOException", "{", "if", "(", "codec", "!=", "null", "&&", "(", "codec", "instanceof", "GzipCodec", ")", "&&", "!", "NativeCodeLoader", ".", "isNativeCodeLoaded", "(", ")", "&&", "!", "ZlibFactory", ".", "isNativeZlibLoaded", "(", "conf", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"SequenceFile doesn't work with \"", "+", "\"GzipCodec without native-hadoop code!\"", ")", ";", "}", "Writer", "writer", "=", "null", ";", "if", "(", "!", "compress", ")", "{", "writer", "=", "new", "Writer", "(", "conf", ",", "out", ",", "keyClass", ",", "valClass", ",", "metadata", ")", ";", "}", "else", "if", "(", "compress", "&&", "!", "blockCompress", ")", "{", "writer", "=", "new", "RecordCompressWriter", "(", "conf", ",", "out", ",", "keyClass", ",", "valClass", ",", "codec", ",", "metadata", ")", ";", "}", "else", "{", "writer", "=", "new", "BlockCompressWriter", "(", "conf", ",", "out", ",", "keyClass", ",", "valClass", ",", "codec", ",", "metadata", ")", ";", "}", "return", "writer", ";", "}" ]
Construct the preferred type of 'raw' SequenceFile Writer. @param out The stream on top which the writer is to be constructed. @param keyClass The 'key' type. @param valClass The 'value' type. @param compress Compress data? @param blockCompress Compress blocks? @param metadata The metadata of the file. @return Returns the handle to the constructed SequenceFile Writer. @throws IOException
[ "Construct", "the", "preferred", "type", "of", "raw", "SequenceFile", "Writer", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/SequenceFile.java#L571-L594
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java
CPFriendlyURLEntryPersistenceImpl.countByG_C_U
@Override public int countByG_C_U(long groupId, long classNameId, String urlTitle) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C_U; Object[] finderArgs = new Object[] { groupId, classNameId, urlTitle }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_CPFRIENDLYURLENTRY_WHERE); query.append(_FINDER_COLUMN_G_C_U_GROUPID_2); query.append(_FINDER_COLUMN_G_C_U_CLASSNAMEID_2); boolean bindUrlTitle = false; if (urlTitle == null) { query.append(_FINDER_COLUMN_G_C_U_URLTITLE_1); } else if (urlTitle.equals("")) { query.append(_FINDER_COLUMN_G_C_U_URLTITLE_3); } else { bindUrlTitle = true; query.append(_FINDER_COLUMN_G_C_U_URLTITLE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(classNameId); if (bindUrlTitle) { qPos.add(urlTitle); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_C_U(long groupId, long classNameId, String urlTitle) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C_U; Object[] finderArgs = new Object[] { groupId, classNameId, urlTitle }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_CPFRIENDLYURLENTRY_WHERE); query.append(_FINDER_COLUMN_G_C_U_GROUPID_2); query.append(_FINDER_COLUMN_G_C_U_CLASSNAMEID_2); boolean bindUrlTitle = false; if (urlTitle == null) { query.append(_FINDER_COLUMN_G_C_U_URLTITLE_1); } else if (urlTitle.equals("")) { query.append(_FINDER_COLUMN_G_C_U_URLTITLE_3); } else { bindUrlTitle = true; query.append(_FINDER_COLUMN_G_C_U_URLTITLE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(classNameId); if (bindUrlTitle) { qPos.add(urlTitle); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_C_U", "(", "long", "groupId", ",", "long", "classNameId", ",", "String", "urlTitle", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_C_U", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "groupId", ",", "classNameId", ",", "urlTitle", "}", ";", "Long", "count", "=", "(", "Long", ")", "finderCache", ".", "getResult", "(", "finderPath", ",", "finderArgs", ",", "this", ")", ";", "if", "(", "count", "==", "null", ")", "{", "StringBundler", "query", "=", "new", "StringBundler", "(", "4", ")", ";", "query", ".", "append", "(", "_SQL_COUNT_CPFRIENDLYURLENTRY_WHERE", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_GROUPID_2", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_CLASSNAMEID_2", ")", ";", "boolean", "bindUrlTitle", "=", "false", ";", "if", "(", "urlTitle", "==", "null", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_URLTITLE_1", ")", ";", "}", "else", "if", "(", "urlTitle", ".", "equals", "(", "\"\"", ")", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_URLTITLE_3", ")", ";", "}", "else", "{", "bindUrlTitle", "=", "true", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_URLTITLE_2", ")", ";", "}", "String", "sql", "=", "query", ".", "toString", "(", ")", ";", "Session", "session", "=", "null", ";", "try", "{", "session", "=", "openSession", "(", ")", ";", "Query", "q", "=", "session", ".", "createQuery", "(", "sql", ")", ";", "QueryPos", "qPos", "=", "QueryPos", ".", "getInstance", "(", "q", ")", ";", "qPos", ".", "add", "(", "groupId", ")", ";", "qPos", ".", "add", "(", "classNameId", ")", ";", "if", "(", "bindUrlTitle", ")", "{", "qPos", ".", "add", "(", "urlTitle", ")", ";", "}", "count", "=", "(", "Long", ")", "q", ".", "uniqueResult", "(", ")", ";", "finderCache", ".", "putResult", "(", "finderPath", ",", "finderArgs", ",", "count", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "finderCache", ".", "removeResult", "(", "finderPath", ",", "finderArgs", ")", ";", "throw", "processException", "(", "e", ")", ";", "}", "finally", "{", "closeSession", "(", "session", ")", ";", "}", "}", "return", "count", ".", "intValue", "(", ")", ";", "}" ]
Returns the number of cp friendly url entries where groupId = &#63; and classNameId = &#63; and urlTitle = &#63;. @param groupId the group ID @param classNameId the class name ID @param urlTitle the url title @return the number of matching cp friendly url entries
[ "Returns", "the", "number", "of", "cp", "friendly", "url", "entries", "where", "groupId", "=", "&#63", ";", "and", "classNameId", "=", "&#63", ";", "and", "urlTitle", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L3191-L3256
molgenis/molgenis
molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/importer/repository/OntologyRepositoryCollection.java
OntologyRepositoryCollection.createNodePaths
private void createNodePaths() { TreeTraverser<OWLClassContainer> traverser = new TreeTraverser<OWLClassContainer>() { @Override public Iterable<OWLClassContainer> children(OWLClassContainer container) { int count = 0; List<OWLClassContainer> containers = new ArrayList<>(); for (OWLClass childClass : loader.getChildClass(container.getOwlClass())) { containers.add( new OWLClassContainer( childClass, constructNodePath(container.getNodePath(), count), false)); count++; } return containers; } }; OWLClass pseudoRootClass = loader.createClass(PSEUDO_ROOT_CLASS_LABEL, loader.getRootClasses()); for (OWLClassContainer container : traverser.preOrderTraversal( new OWLClassContainer(pseudoRootClass, PSEUDO_ROOT_CLASS_NODEPATH, true))) { OWLClass ontologyTerm = container.getOwlClass(); String ontologyTermNodePath = container.getNodePath(); String ontologyTermIRI = ontologyTerm.getIRI().toString(); OntologyTermNodePath nodePathEntity = createNodePathEntity(container, ontologyTermNodePath); nodePathsPerOntologyTerm.put(ontologyTermIRI, nodePathEntity); } }
java
private void createNodePaths() { TreeTraverser<OWLClassContainer> traverser = new TreeTraverser<OWLClassContainer>() { @Override public Iterable<OWLClassContainer> children(OWLClassContainer container) { int count = 0; List<OWLClassContainer> containers = new ArrayList<>(); for (OWLClass childClass : loader.getChildClass(container.getOwlClass())) { containers.add( new OWLClassContainer( childClass, constructNodePath(container.getNodePath(), count), false)); count++; } return containers; } }; OWLClass pseudoRootClass = loader.createClass(PSEUDO_ROOT_CLASS_LABEL, loader.getRootClasses()); for (OWLClassContainer container : traverser.preOrderTraversal( new OWLClassContainer(pseudoRootClass, PSEUDO_ROOT_CLASS_NODEPATH, true))) { OWLClass ontologyTerm = container.getOwlClass(); String ontologyTermNodePath = container.getNodePath(); String ontologyTermIRI = ontologyTerm.getIRI().toString(); OntologyTermNodePath nodePathEntity = createNodePathEntity(container, ontologyTermNodePath); nodePathsPerOntologyTerm.put(ontologyTermIRI, nodePathEntity); } }
[ "private", "void", "createNodePaths", "(", ")", "{", "TreeTraverser", "<", "OWLClassContainer", ">", "traverser", "=", "new", "TreeTraverser", "<", "OWLClassContainer", ">", "(", ")", "{", "@", "Override", "public", "Iterable", "<", "OWLClassContainer", ">", "children", "(", "OWLClassContainer", "container", ")", "{", "int", "count", "=", "0", ";", "List", "<", "OWLClassContainer", ">", "containers", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "OWLClass", "childClass", ":", "loader", ".", "getChildClass", "(", "container", ".", "getOwlClass", "(", ")", ")", ")", "{", "containers", ".", "add", "(", "new", "OWLClassContainer", "(", "childClass", ",", "constructNodePath", "(", "container", ".", "getNodePath", "(", ")", ",", "count", ")", ",", "false", ")", ")", ";", "count", "++", ";", "}", "return", "containers", ";", "}", "}", ";", "OWLClass", "pseudoRootClass", "=", "loader", ".", "createClass", "(", "PSEUDO_ROOT_CLASS_LABEL", ",", "loader", ".", "getRootClasses", "(", ")", ")", ";", "for", "(", "OWLClassContainer", "container", ":", "traverser", ".", "preOrderTraversal", "(", "new", "OWLClassContainer", "(", "pseudoRootClass", ",", "PSEUDO_ROOT_CLASS_NODEPATH", ",", "true", ")", ")", ")", "{", "OWLClass", "ontologyTerm", "=", "container", ".", "getOwlClass", "(", ")", ";", "String", "ontologyTermNodePath", "=", "container", ".", "getNodePath", "(", ")", ";", "String", "ontologyTermIRI", "=", "ontologyTerm", ".", "getIRI", "(", ")", ".", "toString", "(", ")", ";", "OntologyTermNodePath", "nodePathEntity", "=", "createNodePathEntity", "(", "container", ",", "ontologyTermNodePath", ")", ";", "nodePathsPerOntologyTerm", ".", "put", "(", "ontologyTermIRI", ",", "nodePathEntity", ")", ";", "}", "}" ]
Creates {@link OntologyTermNodePathMetadata} {@link Entity}s for an entire ontology tree and writes them to the {@link #nodePathsPerOntologyTerm} {@link Multimap}.
[ "Creates", "{" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/importer/repository/OntologyRepositoryCollection.java#L166-L194
jsurfer/JsonSurfer
jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java
JsonSurfer.collectAll
public Collection<Object> collectAll(InputStream inputStream, String... paths) { return collectAll(inputStream, compile(paths)); }
java
public Collection<Object> collectAll(InputStream inputStream, String... paths) { return collectAll(inputStream, compile(paths)); }
[ "public", "Collection", "<", "Object", ">", "collectAll", "(", "InputStream", "inputStream", ",", "String", "...", "paths", ")", "{", "return", "collectAll", "(", "inputStream", ",", "compile", "(", "paths", ")", ")", ";", "}" ]
Collect all matched value into a collection @param inputStream Json reader @param paths JsonPath @return values
[ "Collect", "all", "matched", "value", "into", "a", "collection" ]
train
https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L347-L349
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTextFieldRenderer.java
WTextFieldRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WTextField textField = (WTextField) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = textField.isReadOnly(); xml.appendTagOpen("ui:textfield"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { int cols = textField.getColumns(); int minLength = textField.getMinLength(); int maxLength = textField.getMaxLength(); String pattern = textField.getPattern(); WSuggestions suggestions = textField.getSuggestions(); String suggestionsId = suggestions == null ? null : suggestions.getId(); WComponent submitControl = textField.getDefaultSubmitButton(); String submitControlId = submitControl == null ? null : submitControl.getId(); xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true"); xml.appendOptionalAttribute("required", textField.isMandatory(), "true"); xml.appendOptionalAttribute("minLength", minLength > 0, minLength); xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength); xml.appendOptionalAttribute("toolTip", textField.getToolTip()); xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText()); xml.appendOptionalAttribute("size", cols > 0, cols); xml.appendOptionalAttribute("buttonId", submitControlId); xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern); xml.appendOptionalAttribute("list", suggestionsId); String placeholder = textField.getPlaceholder(); xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder); String autocomplete = textField.getAutocomplete(); xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete); } xml.appendClose(); xml.appendEscaped(textField.getText()); if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(textField, renderContext); } xml.appendEndTag("ui:textfield"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WTextField textField = (WTextField) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = textField.isReadOnly(); xml.appendTagOpen("ui:textfield"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { int cols = textField.getColumns(); int minLength = textField.getMinLength(); int maxLength = textField.getMaxLength(); String pattern = textField.getPattern(); WSuggestions suggestions = textField.getSuggestions(); String suggestionsId = suggestions == null ? null : suggestions.getId(); WComponent submitControl = textField.getDefaultSubmitButton(); String submitControlId = submitControl == null ? null : submitControl.getId(); xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true"); xml.appendOptionalAttribute("required", textField.isMandatory(), "true"); xml.appendOptionalAttribute("minLength", minLength > 0, minLength); xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength); xml.appendOptionalAttribute("toolTip", textField.getToolTip()); xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText()); xml.appendOptionalAttribute("size", cols > 0, cols); xml.appendOptionalAttribute("buttonId", submitControlId); xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern); xml.appendOptionalAttribute("list", suggestionsId); String placeholder = textField.getPlaceholder(); xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder); String autocomplete = textField.getAutocomplete(); xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete); } xml.appendClose(); xml.appendEscaped(textField.getText()); if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(textField, renderContext); } xml.appendEndTag("ui:textfield"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WTextField", "textField", "=", "(", "WTextField", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "boolean", "readOnly", "=", "textField", ".", "isReadOnly", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:textfield\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hidden\"", ",", "component", ".", "isHidden", "(", ")", ",", "\"true\"", ")", ";", "if", "(", "readOnly", ")", "{", "xml", ".", "appendAttribute", "(", "\"readOnly\"", ",", "\"true\"", ")", ";", "}", "else", "{", "int", "cols", "=", "textField", ".", "getColumns", "(", ")", ";", "int", "minLength", "=", "textField", ".", "getMinLength", "(", ")", ";", "int", "maxLength", "=", "textField", ".", "getMaxLength", "(", ")", ";", "String", "pattern", "=", "textField", ".", "getPattern", "(", ")", ";", "WSuggestions", "suggestions", "=", "textField", ".", "getSuggestions", "(", ")", ";", "String", "suggestionsId", "=", "suggestions", "==", "null", "?", "null", ":", "suggestions", ".", "getId", "(", ")", ";", "WComponent", "submitControl", "=", "textField", ".", "getDefaultSubmitButton", "(", ")", ";", "String", "submitControlId", "=", "submitControl", "==", "null", "?", "null", ":", "submitControl", ".", "getId", "(", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"disabled\"", ",", "textField", ".", "isDisabled", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"required\"", ",", "textField", ".", "isMandatory", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"minLength\"", ",", "minLength", ">", "0", ",", "minLength", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"maxLength\"", ",", "maxLength", ">", "0", ",", "maxLength", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"toolTip\"", ",", "textField", ".", "getToolTip", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"accessibleText\"", ",", "textField", ".", "getAccessibleText", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"size\"", ",", "cols", ">", "0", ",", "cols", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"buttonId\"", ",", "submitControlId", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"pattern\"", ",", "!", "Util", ".", "empty", "(", "pattern", ")", ",", "pattern", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"list\"", ",", "suggestionsId", ")", ";", "String", "placeholder", "=", "textField", ".", "getPlaceholder", "(", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"placeholder\"", ",", "!", "Util", ".", "empty", "(", "placeholder", ")", ",", "placeholder", ")", ";", "String", "autocomplete", "=", "textField", ".", "getAutocomplete", "(", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"autocomplete\"", ",", "!", "Util", ".", "empty", "(", "autocomplete", ")", ",", "autocomplete", ")", ";", "}", "xml", ".", "appendClose", "(", ")", ";", "xml", ".", "appendEscaped", "(", "textField", ".", "getText", "(", ")", ")", ";", "if", "(", "!", "readOnly", ")", "{", "DiagnosticRenderUtil", ".", "renderDiagnostics", "(", "textField", ",", "renderContext", ")", ";", "}", "xml", ".", "appendEndTag", "(", "\"ui:textfield\"", ")", ";", "}" ]
Paints the given WTextField. @param component the WTextField to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WTextField", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTextFieldRenderer.java#L25-L73
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolableConnection.java
PoolableConnection.prepareStatement
@Override public PoolablePreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { return new PoolablePreparedStatement(internalConn.prepareStatement(sql, columnIndexes), this, null); }
java
@Override public PoolablePreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { return new PoolablePreparedStatement(internalConn.prepareStatement(sql, columnIndexes), this, null); }
[ "@", "Override", "public", "PoolablePreparedStatement", "prepareStatement", "(", "String", "sql", ",", "int", "[", "]", "columnIndexes", ")", "throws", "SQLException", "{", "return", "new", "PoolablePreparedStatement", "(", "internalConn", ".", "prepareStatement", "(", "sql", ",", "columnIndexes", ")", ",", "this", ",", "null", ")", ";", "}" ]
Method prepareStatement. @param sql @param columnIndexes @return PreparedStatement @throws SQLException @see java.sql.Connection#prepareStatement(String, int[])
[ "Method", "prepareStatement", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolableConnection.java#L522-L525
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java
PipelineBuilder.addUnionExpression
public void addUnionExpression(final INodeReadTrx mTransaction) { assert getPipeStack().size() >= 2; final AbsAxis mOperand2 = getPipeStack().pop().getExpr(); final AbsAxis mOperand1 = getPipeStack().pop().getExpr(); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add( new DupFilterAxis(mTransaction, new UnionAxis(mTransaction, mOperand1, mOperand2))); }
java
public void addUnionExpression(final INodeReadTrx mTransaction) { assert getPipeStack().size() >= 2; final AbsAxis mOperand2 = getPipeStack().pop().getExpr(); final AbsAxis mOperand1 = getPipeStack().pop().getExpr(); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add( new DupFilterAxis(mTransaction, new UnionAxis(mTransaction, mOperand1, mOperand2))); }
[ "public", "void", "addUnionExpression", "(", "final", "INodeReadTrx", "mTransaction", ")", "{", "assert", "getPipeStack", "(", ")", ".", "size", "(", ")", ">=", "2", ";", "final", "AbsAxis", "mOperand2", "=", "getPipeStack", "(", ")", ".", "pop", "(", ")", ".", "getExpr", "(", ")", ";", "final", "AbsAxis", "mOperand1", "=", "getPipeStack", "(", ")", ".", "pop", "(", ")", ".", "getExpr", "(", ")", ";", "if", "(", "getPipeStack", "(", ")", ".", "empty", "(", ")", "||", "getExpression", "(", ")", ".", "getSize", "(", ")", "!=", "0", ")", "{", "addExpressionSingle", "(", ")", ";", "}", "getExpression", "(", ")", ".", "add", "(", "new", "DupFilterAxis", "(", "mTransaction", ",", "new", "UnionAxis", "(", "mTransaction", ",", "mOperand1", ",", "mOperand2", ")", ")", ")", ";", "}" ]
Adds a union expression to the pipeline. @param mTransaction Transaction to operate with.
[ "Adds", "a", "union", "expression", "to", "the", "pipeline", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L401-L412
box/box-java-sdk
src/main/java/com/box/sdk/BoxJSONObject.java
BoxJSONObject.addPendingChange
private void addPendingChange(String key, JsonValue value) { if (this.pendingChanges == null) { this.pendingChanges = new JsonObject(); } this.pendingChanges.set(key, value); }
java
private void addPendingChange(String key, JsonValue value) { if (this.pendingChanges == null) { this.pendingChanges = new JsonObject(); } this.pendingChanges.set(key, value); }
[ "private", "void", "addPendingChange", "(", "String", "key", ",", "JsonValue", "value", ")", "{", "if", "(", "this", ".", "pendingChanges", "==", "null", ")", "{", "this", ".", "pendingChanges", "=", "new", "JsonObject", "(", ")", ";", "}", "this", ".", "pendingChanges", ".", "set", "(", "key", ",", "value", ")", ";", "}" ]
Adds a pending field change that needs to be sent to the API. It will be included in the JSON string the next time {@link #getPendingChanges} is called. @param key the name of the field. @param value the JsonValue of the field.
[ "Adds", "a", "pending", "field", "change", "that", "needs", "to", "be", "sent", "to", "the", "API", ".", "It", "will", "be", "included", "in", "the", "JSON", "string", "the", "next", "time", "{" ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxJSONObject.java#L169-L175
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/ServiceTaskBase.java
ServiceTaskBase.sendReturnWave
@SuppressWarnings("unchecked") private void sendReturnWave(final T res) throws CoreException { Wave returnWave = null; // Try to retrieve the return Wave type, could be null final WaveType responseWaveType = this.wave.waveType().returnWaveType(); final Class<? extends Command> responseCommandClass = this.wave.waveType().returnCommandClass(); if (responseWaveType != null) { final WaveItemBase<T> resultWaveItem; // No service result type defined into a WaveItem if (responseWaveType != JRebirthWaves.RETURN_VOID_WT && responseWaveType.items().isEmpty()) { LOGGER.log(NO_RETURNED_WAVE_ITEM); throw new CoreException(NO_RETURNED_WAVE_ITEM); } else { // Get the first (and unique) WaveItem used to define the service result type resultWaveItem = (WaveItemBase<T>) responseWaveType.items().get(0); } // Try to retrieve the command class, could be null // final Class<? extends Command> responseCommandClass = this.service.getReturnCommand(this.wave.waveType()); if (responseCommandClass != null) { // If a Command Class is provided, call it with the right WaveItem to get the real result type returnWave = WBuilder.wave() .waveGroup(WaveGroup.CALL_COMMAND) .fromClass(this.service.getClass()) .componentClass(responseCommandClass); } else { // Otherwise send a generic wave that can be handled by any component returnWave = WBuilder.wave() .waveType(responseWaveType) .fromClass(this.service.getClass()); } // Add the result wrapped into a WaveData with the right WaveItem if (resultWaveItem != null) { returnWave.addDatas(WBuilder.waveData(resultWaveItem, res)); } // Don't add data when method has returned VOID returnWave.relatedWave(this.wave); returnWave.addWaveListener(new RelatedWaveListener()); // Send the return wave to interested components this.service.sendWave(returnWave); } else { // No service return wave Type defined LOGGER.log(NO_RETURNED_WAVE_TYPE_DEFINED, this.wave.waveType()); throw new CoreException(NO_RETURNED_WAVE_ITEM, this.wave.waveType()); } }
java
@SuppressWarnings("unchecked") private void sendReturnWave(final T res) throws CoreException { Wave returnWave = null; // Try to retrieve the return Wave type, could be null final WaveType responseWaveType = this.wave.waveType().returnWaveType(); final Class<? extends Command> responseCommandClass = this.wave.waveType().returnCommandClass(); if (responseWaveType != null) { final WaveItemBase<T> resultWaveItem; // No service result type defined into a WaveItem if (responseWaveType != JRebirthWaves.RETURN_VOID_WT && responseWaveType.items().isEmpty()) { LOGGER.log(NO_RETURNED_WAVE_ITEM); throw new CoreException(NO_RETURNED_WAVE_ITEM); } else { // Get the first (and unique) WaveItem used to define the service result type resultWaveItem = (WaveItemBase<T>) responseWaveType.items().get(0); } // Try to retrieve the command class, could be null // final Class<? extends Command> responseCommandClass = this.service.getReturnCommand(this.wave.waveType()); if (responseCommandClass != null) { // If a Command Class is provided, call it with the right WaveItem to get the real result type returnWave = WBuilder.wave() .waveGroup(WaveGroup.CALL_COMMAND) .fromClass(this.service.getClass()) .componentClass(responseCommandClass); } else { // Otherwise send a generic wave that can be handled by any component returnWave = WBuilder.wave() .waveType(responseWaveType) .fromClass(this.service.getClass()); } // Add the result wrapped into a WaveData with the right WaveItem if (resultWaveItem != null) { returnWave.addDatas(WBuilder.waveData(resultWaveItem, res)); } // Don't add data when method has returned VOID returnWave.relatedWave(this.wave); returnWave.addWaveListener(new RelatedWaveListener()); // Send the return wave to interested components this.service.sendWave(returnWave); } else { // No service return wave Type defined LOGGER.log(NO_RETURNED_WAVE_TYPE_DEFINED, this.wave.waveType()); throw new CoreException(NO_RETURNED_WAVE_ITEM, this.wave.waveType()); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "sendReturnWave", "(", "final", "T", "res", ")", "throws", "CoreException", "{", "Wave", "returnWave", "=", "null", ";", "// Try to retrieve the return Wave type, could be null", "final", "WaveType", "responseWaveType", "=", "this", ".", "wave", ".", "waveType", "(", ")", ".", "returnWaveType", "(", ")", ";", "final", "Class", "<", "?", "extends", "Command", ">", "responseCommandClass", "=", "this", ".", "wave", ".", "waveType", "(", ")", ".", "returnCommandClass", "(", ")", ";", "if", "(", "responseWaveType", "!=", "null", ")", "{", "final", "WaveItemBase", "<", "T", ">", "resultWaveItem", ";", "// No service result type defined into a WaveItem", "if", "(", "responseWaveType", "!=", "JRebirthWaves", ".", "RETURN_VOID_WT", "&&", "responseWaveType", ".", "items", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ".", "log", "(", "NO_RETURNED_WAVE_ITEM", ")", ";", "throw", "new", "CoreException", "(", "NO_RETURNED_WAVE_ITEM", ")", ";", "}", "else", "{", "// Get the first (and unique) WaveItem used to define the service result type", "resultWaveItem", "=", "(", "WaveItemBase", "<", "T", ">", ")", "responseWaveType", ".", "items", "(", ")", ".", "get", "(", "0", ")", ";", "}", "// Try to retrieve the command class, could be null", "// final Class<? extends Command> responseCommandClass = this.service.getReturnCommand(this.wave.waveType());", "if", "(", "responseCommandClass", "!=", "null", ")", "{", "// If a Command Class is provided, call it with the right WaveItem to get the real result type", "returnWave", "=", "WBuilder", ".", "wave", "(", ")", ".", "waveGroup", "(", "WaveGroup", ".", "CALL_COMMAND", ")", ".", "fromClass", "(", "this", ".", "service", ".", "getClass", "(", ")", ")", ".", "componentClass", "(", "responseCommandClass", ")", ";", "}", "else", "{", "// Otherwise send a generic wave that can be handled by any component", "returnWave", "=", "WBuilder", ".", "wave", "(", ")", ".", "waveType", "(", "responseWaveType", ")", ".", "fromClass", "(", "this", ".", "service", ".", "getClass", "(", ")", ")", ";", "}", "// Add the result wrapped into a WaveData with the right WaveItem", "if", "(", "resultWaveItem", "!=", "null", ")", "{", "returnWave", ".", "addDatas", "(", "WBuilder", ".", "waveData", "(", "resultWaveItem", ",", "res", ")", ")", ";", "}", "// Don't add data when method has returned VOID", "returnWave", ".", "relatedWave", "(", "this", ".", "wave", ")", ";", "returnWave", ".", "addWaveListener", "(", "new", "RelatedWaveListener", "(", ")", ")", ";", "// Send the return wave to interested components", "this", ".", "service", ".", "sendWave", "(", "returnWave", ")", ";", "}", "else", "{", "// No service return wave Type defined", "LOGGER", ".", "log", "(", "NO_RETURNED_WAVE_TYPE_DEFINED", ",", "this", ".", "wave", ".", "waveType", "(", ")", ")", ";", "throw", "new", "CoreException", "(", "NO_RETURNED_WAVE_ITEM", ",", "this", ".", "wave", ".", "waveType", "(", ")", ")", ";", "}", "}" ]
Send a wave that will carry the service result. 2 Kinds of wave can be sent according to service configuration @param res the service result @throws CoreException if the wave generation has failed
[ "Send", "a", "wave", "that", "will", "carry", "the", "service", "result", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/ServiceTaskBase.java#L239-L297
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java
CommonsOJBLockManager.mapLockLevelDependendOnIsolationLevel
int mapLockLevelDependendOnIsolationLevel(Integer isolationId, int lockLevel) { int result = 0; switch(isolationId.intValue()) { case LockManager.IL_READ_UNCOMMITTED: result = ReadUncommittedLock.mapLockLevel(lockLevel); break; case LockManager.IL_READ_COMMITTED: result = ReadCommitedLock.mapLockLevel(lockLevel); break; case LockManager.IL_REPEATABLE_READ: result = RepeadableReadsLock.mapLockLevel(lockLevel); break; case LockManager.IL_SERIALIZABLE: result = SerializeableLock.mapLockLevel(lockLevel); break; case LockManager.IL_OPTIMISTIC: throw new LockRuntimeException("Optimistic locking must be handled on top of this class"); default: throw new LockRuntimeException("Unknown lock isolation level specified"); } return result; }
java
int mapLockLevelDependendOnIsolationLevel(Integer isolationId, int lockLevel) { int result = 0; switch(isolationId.intValue()) { case LockManager.IL_READ_UNCOMMITTED: result = ReadUncommittedLock.mapLockLevel(lockLevel); break; case LockManager.IL_READ_COMMITTED: result = ReadCommitedLock.mapLockLevel(lockLevel); break; case LockManager.IL_REPEATABLE_READ: result = RepeadableReadsLock.mapLockLevel(lockLevel); break; case LockManager.IL_SERIALIZABLE: result = SerializeableLock.mapLockLevel(lockLevel); break; case LockManager.IL_OPTIMISTIC: throw new LockRuntimeException("Optimistic locking must be handled on top of this class"); default: throw new LockRuntimeException("Unknown lock isolation level specified"); } return result; }
[ "int", "mapLockLevelDependendOnIsolationLevel", "(", "Integer", "isolationId", ",", "int", "lockLevel", ")", "{", "int", "result", "=", "0", ";", "switch", "(", "isolationId", ".", "intValue", "(", ")", ")", "{", "case", "LockManager", ".", "IL_READ_UNCOMMITTED", ":", "result", "=", "ReadUncommittedLock", ".", "mapLockLevel", "(", "lockLevel", ")", ";", "break", ";", "case", "LockManager", ".", "IL_READ_COMMITTED", ":", "result", "=", "ReadCommitedLock", ".", "mapLockLevel", "(", "lockLevel", ")", ";", "break", ";", "case", "LockManager", ".", "IL_REPEATABLE_READ", ":", "result", "=", "RepeadableReadsLock", ".", "mapLockLevel", "(", "lockLevel", ")", ";", "break", ";", "case", "LockManager", ".", "IL_SERIALIZABLE", ":", "result", "=", "SerializeableLock", ".", "mapLockLevel", "(", "lockLevel", ")", ";", "break", ";", "case", "LockManager", ".", "IL_OPTIMISTIC", ":", "throw", "new", "LockRuntimeException", "(", "\"Optimistic locking must be handled on top of this class\"", ")", ";", "default", ":", "throw", "new", "LockRuntimeException", "(", "\"Unknown lock isolation level specified\"", ")", ";", "}", "return", "result", ";", "}" ]
Helper method to map the specified common lock level (e.g like {@link #COMMON_READ_LOCK}, {@link #COMMON_UPGRADE_LOCK, ...}) based on the isolation level to the internal used lock level value by the {@link org.apache.commons.transaction.locking.MultiLevelLock2} implementation. @param isolationId @param lockLevel @return
[ "Helper", "method", "to", "map", "the", "specified", "common", "lock", "level", "(", "e", ".", "g", "like", "{", "@link", "#COMMON_READ_LOCK", "}", "{", "@link", "#COMMON_UPGRADE_LOCK", "...", "}", ")", "based", "on", "the", "isolation", "level", "to", "the", "internal", "used", "lock", "level", "value", "by", "the", "{", "@link", "org", ".", "apache", ".", "commons", ".", "transaction", ".", "locking", ".", "MultiLevelLock2", "}", "implementation", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java#L228-L251
jbundle/jbundle
base/db/physical/src/main/java/org/jbundle/base/db/physical/PhysicalDatabase.java
PhysicalDatabase.doMakeTable
public BaseTable doMakeTable(Record record) { BaseTable table = null; boolean bIsQueryRecord = record.isQueryRecord(); if (m_pDatabase == null) { try { this.open(); } catch (DBException ex) { return null; // No database } } if (bIsQueryRecord) { // Physical Tables cannot process SQL queries, so use QueryTable! PassThruTable passThruTable = new QueryTable(this, record); passThruTable.addTable(record.getRecordlistAt(0).getTable()); return passThruTable; } table = this.makePhysicalTable(record); return table; }
java
public BaseTable doMakeTable(Record record) { BaseTable table = null; boolean bIsQueryRecord = record.isQueryRecord(); if (m_pDatabase == null) { try { this.open(); } catch (DBException ex) { return null; // No database } } if (bIsQueryRecord) { // Physical Tables cannot process SQL queries, so use QueryTable! PassThruTable passThruTable = new QueryTable(this, record); passThruTable.addTable(record.getRecordlistAt(0).getTable()); return passThruTable; } table = this.makePhysicalTable(record); return table; }
[ "public", "BaseTable", "doMakeTable", "(", "Record", "record", ")", "{", "BaseTable", "table", "=", "null", ";", "boolean", "bIsQueryRecord", "=", "record", ".", "isQueryRecord", "(", ")", ";", "if", "(", "m_pDatabase", "==", "null", ")", "{", "try", "{", "this", ".", "open", "(", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "return", "null", ";", "// No database", "}", "}", "if", "(", "bIsQueryRecord", ")", "{", "// Physical Tables cannot process SQL queries, so use QueryTable!", "PassThruTable", "passThruTable", "=", "new", "QueryTable", "(", "this", ",", "record", ")", ";", "passThruTable", ".", "addTable", "(", "record", ".", "getRecordlistAt", "(", "0", ")", ".", "getTable", "(", ")", ")", ";", "return", "passThruTable", ";", "}", "table", "=", "this", ".", "makePhysicalTable", "(", "record", ")", ";", "return", "table", ";", "}" ]
Make a table for this database. @param record The record to make a table for. @return BaseTable The new table.
[ "Make", "a", "table", "for", "this", "database", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/physical/src/main/java/org/jbundle/base/db/physical/PhysicalDatabase.java#L143-L163
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java
ODataRendererUtils.getContextURL
public static String getContextURL(ODataUri oDataUri, EntityDataModel entityDataModel, boolean isPrimitive) throws ODataRenderException { if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { return buildContextUrlFromOperationCall(oDataUri, entityDataModel, isPrimitive); } Option<String> contextOption = getContextUrl(oDataUri); if (contextOption.isEmpty()) { throw new ODataRenderException("Could not construct context"); } return contextOption.get(); }
java
public static String getContextURL(ODataUri oDataUri, EntityDataModel entityDataModel, boolean isPrimitive) throws ODataRenderException { if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { return buildContextUrlFromOperationCall(oDataUri, entityDataModel, isPrimitive); } Option<String> contextOption = getContextUrl(oDataUri); if (contextOption.isEmpty()) { throw new ODataRenderException("Could not construct context"); } return contextOption.get(); }
[ "public", "static", "String", "getContextURL", "(", "ODataUri", "oDataUri", ",", "EntityDataModel", "entityDataModel", ",", "boolean", "isPrimitive", ")", "throws", "ODataRenderException", "{", "if", "(", "ODataUriUtil", ".", "isActionCallUri", "(", "oDataUri", ")", "||", "ODataUriUtil", ".", "isFunctionCallUri", "(", "oDataUri", ")", ")", "{", "return", "buildContextUrlFromOperationCall", "(", "oDataUri", ",", "entityDataModel", ",", "isPrimitive", ")", ";", "}", "Option", "<", "String", ">", "contextOption", "=", "getContextUrl", "(", "oDataUri", ")", ";", "if", "(", "contextOption", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "ODataRenderException", "(", "\"Could not construct context\"", ")", ";", "}", "return", "contextOption", ".", "get", "(", ")", ";", "}" ]
This method returns odata context based on oDataUri. Throws ODataRenderException in case context is not defined. @param entityDataModel The entity data model. @param oDataUri is object which is the root of an abstract syntax tree that describes @param isPrimitive True if the context URL is for primitive. @return string that represents context @throws ODataRenderException if unable to get context from url
[ "This", "method", "returns", "odata", "context", "based", "on", "oDataUri", ".", "Throws", "ODataRenderException", "in", "case", "context", "is", "not", "defined", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java#L65-L77
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java
ContentNegotiationFilter.adjustQuality
private static void adjustQuality(Map<String, Float> pFormatQuality, String pFormat, float pFactor) { Float oldValue = pFormatQuality.get(pFormat); if (oldValue != null) { pFormatQuality.put(pFormat, oldValue * pFactor); //System.out.println("New vallue after multiplying with " + pFactor + " is " + pFormatQuality.get(pFormat)); } }
java
private static void adjustQuality(Map<String, Float> pFormatQuality, String pFormat, float pFactor) { Float oldValue = pFormatQuality.get(pFormat); if (oldValue != null) { pFormatQuality.put(pFormat, oldValue * pFactor); //System.out.println("New vallue after multiplying with " + pFactor + " is " + pFormatQuality.get(pFormat)); } }
[ "private", "static", "void", "adjustQuality", "(", "Map", "<", "String", ",", "Float", ">", "pFormatQuality", ",", "String", "pFormat", ",", "float", "pFactor", ")", "{", "Float", "oldValue", "=", "pFormatQuality", ".", "get", "(", "pFormat", ")", ";", "if", "(", "oldValue", "!=", "null", ")", "{", "pFormatQuality", ".", "put", "(", "pFormat", ",", "oldValue", "*", "pFactor", ")", ";", "//System.out.println(\"New vallue after multiplying with \" + pFactor + \" is \" + pFormatQuality.get(pFormat));\r", "}", "}" ]
Updates the quality in the map. @param pFormatQuality Map<String,Float> @param pFormat the format @param pFactor the quality factor
[ "Updates", "the", "quality", "in", "the", "map", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L419-L425
VoltDB/voltdb
src/frontend/org/voltcore/messaging/HostMessenger.java
HostMessenger.waitForJoiningHostsToBeReady
public void waitForJoiningHostsToBeReady(int expectedHosts, int localHostId) { try { //register this host as joining. The host registration will be deleted after joining is completed. m_zk.create(ZKUtil.joinZKPath(CoreZK.readyjoininghosts, Integer.toString(localHostId)) , null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); while (true) { ZKUtil.FutureWatcher fw = new ZKUtil.FutureWatcher(); int readyHosts = m_zk.getChildren(CoreZK.readyjoininghosts, fw).size(); if ( readyHosts == expectedHosts) { break; } fw.get(); } } catch (KeeperException | InterruptedException e) { org.voltdb.VoltDB.crashLocalVoltDB("Error waiting for hosts to be ready", false, e); } }
java
public void waitForJoiningHostsToBeReady(int expectedHosts, int localHostId) { try { //register this host as joining. The host registration will be deleted after joining is completed. m_zk.create(ZKUtil.joinZKPath(CoreZK.readyjoininghosts, Integer.toString(localHostId)) , null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); while (true) { ZKUtil.FutureWatcher fw = new ZKUtil.FutureWatcher(); int readyHosts = m_zk.getChildren(CoreZK.readyjoininghosts, fw).size(); if ( readyHosts == expectedHosts) { break; } fw.get(); } } catch (KeeperException | InterruptedException e) { org.voltdb.VoltDB.crashLocalVoltDB("Error waiting for hosts to be ready", false, e); } }
[ "public", "void", "waitForJoiningHostsToBeReady", "(", "int", "expectedHosts", ",", "int", "localHostId", ")", "{", "try", "{", "//register this host as joining. The host registration will be deleted after joining is completed.", "m_zk", ".", "create", "(", "ZKUtil", ".", "joinZKPath", "(", "CoreZK", ".", "readyjoininghosts", ",", "Integer", ".", "toString", "(", "localHostId", ")", ")", ",", "null", ",", "Ids", ".", "OPEN_ACL_UNSAFE", ",", "CreateMode", ".", "PERSISTENT", ")", ";", "while", "(", "true", ")", "{", "ZKUtil", ".", "FutureWatcher", "fw", "=", "new", "ZKUtil", ".", "FutureWatcher", "(", ")", ";", "int", "readyHosts", "=", "m_zk", ".", "getChildren", "(", "CoreZK", ".", "readyjoininghosts", ",", "fw", ")", ".", "size", "(", ")", ";", "if", "(", "readyHosts", "==", "expectedHosts", ")", "{", "break", ";", "}", "fw", ".", "get", "(", ")", ";", "}", "}", "catch", "(", "KeeperException", "|", "InterruptedException", "e", ")", "{", "org", ".", "voltdb", ".", "VoltDB", ".", "crashLocalVoltDB", "(", "\"Error waiting for hosts to be ready\"", ",", "false", ",", "e", ")", ";", "}", "}" ]
For elastic join. Block on this call until the number of ready hosts is equal to the number of expected joining hosts.
[ "For", "elastic", "join", ".", "Block", "on", "this", "call", "until", "the", "number", "of", "ready", "hosts", "is", "equal", "to", "the", "number", "of", "expected", "joining", "hosts", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/messaging/HostMessenger.java#L1675-L1690
roboconf/roboconf-platform
core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/factory/MessagingClientFactoryRegistry.java
MessagingClientFactoryRegistry.notifyListeners
private void notifyListeners(IMessagingClientFactory factory, boolean isAdded) { for (MessagingClientFactoryListener listener : this.listeners) { try { if (isAdded) listener.addMessagingClientFactory(factory); else listener.removeMessagingClientFactory(factory); } catch (Throwable t) { // Log the exception, but *do not* interrupt the notification of the other listeners. this.logger.warning("Messaging client factory listener has thrown an exception: " + listener); Utils.logException(this.logger, new RuntimeException(t)); } } }
java
private void notifyListeners(IMessagingClientFactory factory, boolean isAdded) { for (MessagingClientFactoryListener listener : this.listeners) { try { if (isAdded) listener.addMessagingClientFactory(factory); else listener.removeMessagingClientFactory(factory); } catch (Throwable t) { // Log the exception, but *do not* interrupt the notification of the other listeners. this.logger.warning("Messaging client factory listener has thrown an exception: " + listener); Utils.logException(this.logger, new RuntimeException(t)); } } }
[ "private", "void", "notifyListeners", "(", "IMessagingClientFactory", "factory", ",", "boolean", "isAdded", ")", "{", "for", "(", "MessagingClientFactoryListener", "listener", ":", "this", ".", "listeners", ")", "{", "try", "{", "if", "(", "isAdded", ")", "listener", ".", "addMessagingClientFactory", "(", "factory", ")", ";", "else", "listener", ".", "removeMessagingClientFactory", "(", "factory", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// Log the exception, but *do not* interrupt the notification of the other listeners.", "this", ".", "logger", ".", "warning", "(", "\"Messaging client factory listener has thrown an exception: \"", "+", "listener", ")", ";", "Utils", ".", "logException", "(", "this", ".", "logger", ",", "new", "RuntimeException", "(", "t", ")", ")", ";", "}", "}", "}" ]
Notifies the messaging client factory listeners that a factory has been added/removed. @param factory the incoming/outgoing messaging client factory. @param isAdded flag indicating whether the factory has been added or removed.
[ "Notifies", "the", "messaging", "client", "factory", "listeners", "that", "a", "factory", "has", "been", "added", "/", "removed", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/factory/MessagingClientFactoryRegistry.java#L137-L152
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/CompileStack.java
CompileStack.defineVariable
public BytecodeVariable defineVariable(Variable v, boolean initFromStack) { return defineVariable(v, v.getOriginType(), initFromStack); }
java
public BytecodeVariable defineVariable(Variable v, boolean initFromStack) { return defineVariable(v, v.getOriginType(), initFromStack); }
[ "public", "BytecodeVariable", "defineVariable", "(", "Variable", "v", ",", "boolean", "initFromStack", ")", "{", "return", "defineVariable", "(", "v", ",", "v", ".", "getOriginType", "(", ")", ",", "initFromStack", ")", ";", "}" ]
Defines a new Variable using an AST variable. @param initFromStack if true the last element of the stack will be used to initialize the new variable. If false null will be used.
[ "Defines", "a", "new", "Variable", "using", "an", "AST", "variable", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/CompileStack.java#L662-L664
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Strings.java
Strings.splitToLong
public static Long[] splitToLong(final String ids) { if (isEmpty(ids)) { return new Long[0]; } else { return transformToLong(split(ids, ',')); } }
java
public static Long[] splitToLong(final String ids) { if (isEmpty(ids)) { return new Long[0]; } else { return transformToLong(split(ids, ',')); } }
[ "public", "static", "Long", "[", "]", "splitToLong", "(", "final", "String", "ids", ")", "{", "if", "(", "isEmpty", "(", "ids", ")", ")", "{", "return", "new", "Long", "[", "0", "]", ";", "}", "else", "{", "return", "transformToLong", "(", "split", "(", "ids", ",", "'", "'", ")", ")", ";", "}", "}" ]
<p> splitToLong. </p> @param ids a {@link java.lang.String} object. @return an array of {@link java.lang.Long} objects.
[ "<p", ">", "splitToLong", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L954-L960
phax/ph-datetime
ph-holiday/src/main/java/com/helger/holiday/parser/AbstractHolidayParser.java
AbstractHolidayParser.moveDate
protected static final LocalDate moveDate (final MoveableHoliday aMoveableHoliday, final LocalDate aFixed) { for (final MovingCondition aMoveCond : aMoveableHoliday.getMovingCondition ()) if (shallBeMoved (aFixed, aMoveCond)) return _moveDate (aMoveCond, aFixed); return aFixed; }
java
protected static final LocalDate moveDate (final MoveableHoliday aMoveableHoliday, final LocalDate aFixed) { for (final MovingCondition aMoveCond : aMoveableHoliday.getMovingCondition ()) if (shallBeMoved (aFixed, aMoveCond)) return _moveDate (aMoveCond, aFixed); return aFixed; }
[ "protected", "static", "final", "LocalDate", "moveDate", "(", "final", "MoveableHoliday", "aMoveableHoliday", ",", "final", "LocalDate", "aFixed", ")", "{", "for", "(", "final", "MovingCondition", "aMoveCond", ":", "aMoveableHoliday", ".", "getMovingCondition", "(", ")", ")", "if", "(", "shallBeMoved", "(", "aFixed", ",", "aMoveCond", ")", ")", "return", "_moveDate", "(", "aMoveCond", ",", "aFixed", ")", ";", "return", "aFixed", ";", "}" ]
Moves a date if there are any moving conditions for this holiday and any of them fit. @param aMoveableHoliday Date @param aFixed Optional fixed date @return the moved date
[ "Moves", "a", "date", "if", "there", "are", "any", "moving", "conditions", "for", "this", "holiday", "and", "any", "of", "them", "fit", "." ]
train
https://github.com/phax/ph-datetime/blob/cfaff01cb76d9affb934800ff55734b5a7d8983e/ph-holiday/src/main/java/com/helger/holiday/parser/AbstractHolidayParser.java#L162-L168
web3j/web3j
core/src/main/java/org/web3j/ens/EnsResolver.java
EnsResolver.obtainPublicResolver
public PublicResolver obtainPublicResolver(String ensName) { if (isValidEnsName(ensName)) { try { if (!isSynced()) { throw new EnsResolutionException("Node is not currently synced"); } else { return lookupResolver(ensName); } } catch (Exception e) { throw new EnsResolutionException("Unable to determine sync status of node", e); } } else { throw new EnsResolutionException("EnsName is invalid: " + ensName); } }
java
public PublicResolver obtainPublicResolver(String ensName) { if (isValidEnsName(ensName)) { try { if (!isSynced()) { throw new EnsResolutionException("Node is not currently synced"); } else { return lookupResolver(ensName); } } catch (Exception e) { throw new EnsResolutionException("Unable to determine sync status of node", e); } } else { throw new EnsResolutionException("EnsName is invalid: " + ensName); } }
[ "public", "PublicResolver", "obtainPublicResolver", "(", "String", "ensName", ")", "{", "if", "(", "isValidEnsName", "(", "ensName", ")", ")", "{", "try", "{", "if", "(", "!", "isSynced", "(", ")", ")", "{", "throw", "new", "EnsResolutionException", "(", "\"Node is not currently synced\"", ")", ";", "}", "else", "{", "return", "lookupResolver", "(", "ensName", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "EnsResolutionException", "(", "\"Unable to determine sync status of node\"", ",", "e", ")", ";", "}", "}", "else", "{", "throw", "new", "EnsResolutionException", "(", "\"EnsName is invalid: \"", "+", "ensName", ")", ";", "}", "}" ]
Provides an access to a valid public resolver in order to access other API methods. @param ensName our user input ENS name @return PublicResolver
[ "Provides", "an", "access", "to", "a", "valid", "public", "resolver", "in", "order", "to", "access", "other", "API", "methods", "." ]
train
https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/ens/EnsResolver.java#L52-L67
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RepositoryApi.java
RepositoryApi.getBranch
public Branch getBranch(Object projectIdOrPath, String branchName) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "branches", urlEncode(branchName)); return (response.readEntity(Branch.class)); }
java
public Branch getBranch(Object projectIdOrPath, String branchName) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "branches", urlEncode(branchName)); return (response.readEntity(Branch.class)); }
[ "public", "Branch", "getBranch", "(", "Object", "projectIdOrPath", ",", "String", "branchName", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"repository\"", ",", "\"branches\"", ",", "urlEncode", "(", "branchName", ")", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Branch", ".", "class", ")", ")", ";", "}" ]
Get a single project repository branch. <pre><code>GitLab Endpoint: GET /projects/:id/repository/branches/:branch</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param branchName the name of the branch to get @return the branch info for the specified project ID/branch name pair @throws GitLabApiException if any exception occurs
[ "Get", "a", "single", "project", "repository", "branch", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryApi.java#L104-L108
jboss/jboss-el-api_spec
src/main/java/javax/el/ELContext.java
ELContext.notifyPropertyResolved
public void notifyPropertyResolved(Object base, Object property) { if (getEvaluationListeners() == null) return; for (EvaluationListener listener: getEvaluationListeners()) { listener.propertyResolved(this, base, property); } }
java
public void notifyPropertyResolved(Object base, Object property) { if (getEvaluationListeners() == null) return; for (EvaluationListener listener: getEvaluationListeners()) { listener.propertyResolved(this, base, property); } }
[ "public", "void", "notifyPropertyResolved", "(", "Object", "base", ",", "Object", "property", ")", "{", "if", "(", "getEvaluationListeners", "(", ")", "==", "null", ")", "return", ";", "for", "(", "EvaluationListener", "listener", ":", "getEvaluationListeners", "(", ")", ")", "{", "listener", ".", "propertyResolved", "(", "this", ",", "base", ",", "property", ")", ";", "}", "}" ]
Notifies the listeners when the (base, property) pair is resolved @param base The base object @param property The property Object
[ "Notifies", "the", "listeners", "when", "the", "(", "base", "property", ")", "pair", "is", "resolved" ]
train
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELContext.java#L361-L367
sangupta/jerry-services
src/main/java/com/sangupta/jerry/quartz/service/impl/DefaultQuartzServiceImpl.java
DefaultQuartzServiceImpl.executeJob
public boolean executeJob(String jobName, String jobGroupName) { try { this.scheduler.triggerJob(new JobKey(jobName, jobGroupName)); return true; } catch (SchedulerException e) { logger.error("error executing job: " + jobName + " in group: " + jobGroupName, e); } return false; }
java
public boolean executeJob(String jobName, String jobGroupName) { try { this.scheduler.triggerJob(new JobKey(jobName, jobGroupName)); return true; } catch (SchedulerException e) { logger.error("error executing job: " + jobName + " in group: " + jobGroupName, e); } return false; }
[ "public", "boolean", "executeJob", "(", "String", "jobName", ",", "String", "jobGroupName", ")", "{", "try", "{", "this", ".", "scheduler", ".", "triggerJob", "(", "new", "JobKey", "(", "jobName", ",", "jobGroupName", ")", ")", ";", "return", "true", ";", "}", "catch", "(", "SchedulerException", "e", ")", "{", "logger", ".", "error", "(", "\"error executing job: \"", "+", "jobName", "+", "\" in group: \"", "+", "jobGroupName", ",", "e", ")", ";", "}", "return", "false", ";", "}" ]
Fire the given job in given group. @param jobName the name of the job @param jobGroupName the group name of the job @return <code>true</code> if job was fired, <code>false</code> otherwise @see QuartzService#executeJob(String, String)
[ "Fire", "the", "given", "job", "in", "given", "group", "." ]
train
https://github.com/sangupta/jerry-services/blob/25ff6577445850916425c72068d654c08eba9bcc/src/main/java/com/sangupta/jerry/quartz/service/impl/DefaultQuartzServiceImpl.java#L197-L205
mguymon/naether
src/main/java/com/tobedevoured/naether/maven/Project.java
Project.loadPOM
public static Model loadPOM(String pomPath, String localRepo, Collection<RemoteRepository> repositories) throws ProjectException { RepositoryClient repoClient = new RepositoryClient(localRepo); NaetherModelResolver resolver = new NaetherModelResolver(repoClient, repositories); ModelBuildingRequest req = new DefaultModelBuildingRequest(); req.setProcessPlugins( false ); req.setPomFile( new File(pomPath) ); req.setModelResolver( resolver ); req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); DefaultModelBuilder builder = (new DefaultModelBuilderFactory()).newInstance(); try { return builder.build( req ).getEffectiveModel(); } catch ( ModelBuildingException e ) { throw new ProjectException("Failed to build project from pom", e); } }
java
public static Model loadPOM(String pomPath, String localRepo, Collection<RemoteRepository> repositories) throws ProjectException { RepositoryClient repoClient = new RepositoryClient(localRepo); NaetherModelResolver resolver = new NaetherModelResolver(repoClient, repositories); ModelBuildingRequest req = new DefaultModelBuildingRequest(); req.setProcessPlugins( false ); req.setPomFile( new File(pomPath) ); req.setModelResolver( resolver ); req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); DefaultModelBuilder builder = (new DefaultModelBuilderFactory()).newInstance(); try { return builder.build( req ).getEffectiveModel(); } catch ( ModelBuildingException e ) { throw new ProjectException("Failed to build project from pom", e); } }
[ "public", "static", "Model", "loadPOM", "(", "String", "pomPath", ",", "String", "localRepo", ",", "Collection", "<", "RemoteRepository", ">", "repositories", ")", "throws", "ProjectException", "{", "RepositoryClient", "repoClient", "=", "new", "RepositoryClient", "(", "localRepo", ")", ";", "NaetherModelResolver", "resolver", "=", "new", "NaetherModelResolver", "(", "repoClient", ",", "repositories", ")", ";", "ModelBuildingRequest", "req", "=", "new", "DefaultModelBuildingRequest", "(", ")", ";", "req", ".", "setProcessPlugins", "(", "false", ")", ";", "req", ".", "setPomFile", "(", "new", "File", "(", "pomPath", ")", ")", ";", "req", ".", "setModelResolver", "(", "resolver", ")", ";", "req", ".", "setValidationLevel", "(", "ModelBuildingRequest", ".", "VALIDATION_LEVEL_MINIMAL", ")", ";", "DefaultModelBuilder", "builder", "=", "(", "new", "DefaultModelBuilderFactory", "(", ")", ")", ".", "newInstance", "(", ")", ";", "try", "{", "return", "builder", ".", "build", "(", "req", ")", ".", "getEffectiveModel", "(", ")", ";", "}", "catch", "(", "ModelBuildingException", "e", ")", "{", "throw", "new", "ProjectException", "(", "\"Failed to build project from pom\"", ",", "e", ")", ";", "}", "}" ]
Load Maven pom @param pomPath String path @param localRepo String @param repositories {@link Collection} @return {@link Model} @throws ProjectException if fails to open, read, or parse the POM
[ "Load", "Maven", "pom" ]
train
https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/java/com/tobedevoured/naether/maven/Project.java#L132-L148
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/Projection.java
Projection.rotateAndScalePoint
public Point rotateAndScalePoint(int x, int y, Point reuse) { return applyMatrixToPoint(x, y, reuse, mRotateAndScaleMatrix, mOrientation != 0); }
java
public Point rotateAndScalePoint(int x, int y, Point reuse) { return applyMatrixToPoint(x, y, reuse, mRotateAndScaleMatrix, mOrientation != 0); }
[ "public", "Point", "rotateAndScalePoint", "(", "int", "x", ",", "int", "y", ",", "Point", "reuse", ")", "{", "return", "applyMatrixToPoint", "(", "x", ",", "y", ",", "reuse", ",", "mRotateAndScaleMatrix", ",", "mOrientation", "!=", "0", ")", ";", "}" ]
This will apply the current map's scaling and rotation for a point. This can be useful when converting MotionEvents to a screen point.
[ "This", "will", "apply", "the", "current", "map", "s", "scaling", "and", "rotation", "for", "a", "point", ".", "This", "can", "be", "useful", "when", "converting", "MotionEvents", "to", "a", "screen", "point", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/Projection.java#L374-L376
yannrichet/rsession
src/main/java/org/math/R/RserverConf.java
RserverConf.newLocalInstance
public static RserverConf newLocalInstance(Properties p) { RserverConf server = null; if (RserveDaemon.isWindows() || !UNIX_OPTIMIZE) { while (!isPortAvailable(RserverPort)) { RserverPort++; } server = new RserverConf(null, RserverPort, null, null, p); } else { // Unix supports multi-sessions natively, so no need to open a different Rserve on a new port server = new RserverConf(null, -1, null, null, p); } return server; }
java
public static RserverConf newLocalInstance(Properties p) { RserverConf server = null; if (RserveDaemon.isWindows() || !UNIX_OPTIMIZE) { while (!isPortAvailable(RserverPort)) { RserverPort++; } server = new RserverConf(null, RserverPort, null, null, p); } else { // Unix supports multi-sessions natively, so no need to open a different Rserve on a new port server = new RserverConf(null, -1, null, null, p); } return server; }
[ "public", "static", "RserverConf", "newLocalInstance", "(", "Properties", "p", ")", "{", "RserverConf", "server", "=", "null", ";", "if", "(", "RserveDaemon", ".", "isWindows", "(", ")", "||", "!", "UNIX_OPTIMIZE", ")", "{", "while", "(", "!", "isPortAvailable", "(", "RserverPort", ")", ")", "{", "RserverPort", "++", ";", "}", "server", "=", "new", "RserverConf", "(", "null", ",", "RserverPort", ",", "null", ",", "null", ",", "p", ")", ";", "}", "else", "{", "// Unix supports multi-sessions natively, so no need to open a different Rserve on a new port", "server", "=", "new", "RserverConf", "(", "null", ",", "-", "1", ",", "null", ",", "null", ",", "p", ")", ";", "}", "return", "server", ";", "}" ]
if we want to re-use older sessions. May wrongly fil if older session is already stucked...
[ "if", "we", "want", "to", "re", "-", "use", "older", "sessions", ".", "May", "wrongly", "fil", "if", "older", "session", "is", "already", "stucked", "..." ]
train
https://github.com/yannrichet/rsession/blob/acaa47f4da1644e0d067634130c0e88e38cb9035/src/main/java/org/math/R/RserverConf.java#L216-L227
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteProjectBadge
public void deleteProjectBadge(Serializable projectId, Integer badgeId) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBadge.URL + "/" + badgeId; retrieve().method(DELETE).to(tailUrl, Void.class); }
java
public void deleteProjectBadge(Serializable projectId, Integer badgeId) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBadge.URL + "/" + badgeId; retrieve().method(DELETE).to(tailUrl, Void.class); }
[ "public", "void", "deleteProjectBadge", "(", "Serializable", "projectId", ",", "Integer", "badgeId", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "sanitizeProjectId", "(", "projectId", ")", "+", "GitlabBadge", ".", "URL", "+", "\"/\"", "+", "badgeId", ";", "retrieve", "(", ")", ".", "method", "(", "DELETE", ")", ".", "to", "(", "tailUrl", ",", "Void", ".", "class", ")", ";", "}" ]
Delete project badge @param projectId The id of the project for which the badge should be deleted @param badgeId The id of the badge that should be deleted @throws IOException on GitLab API call error
[ "Delete", "project", "badge" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2667-L2671
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java
IndexChangeAdapters.forPrimaryType
public static IndexChangeAdapter forPrimaryType( ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index ) { return new PrimaryTypeChangeAdapter(context, matcher, workspaceName, index); }
java
public static IndexChangeAdapter forPrimaryType( ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index ) { return new PrimaryTypeChangeAdapter(context, matcher, workspaceName, index); }
[ "public", "static", "IndexChangeAdapter", "forPrimaryType", "(", "ExecutionContext", "context", ",", "NodeTypePredicate", "matcher", ",", "String", "workspaceName", ",", "ProvidedIndex", "<", "?", ">", "index", ")", "{", "return", "new", "PrimaryTypeChangeAdapter", "(", "context", ",", "matcher", ",", "workspaceName", ",", "index", ")", ";", "}" ]
Create an {@link IndexChangeAdapter} implementation that handles the "jcr:primaryType" property. @param context the execution context; may not be null @param matcher the node type matcher used to determine which nodes should be included in the index; may not be null @param workspaceName the name of the workspace; may not be null @param index the local index that should be used; may not be null @return the new {@link IndexChangeAdapter}; never null
[ "Create", "an", "{", "@link", "IndexChangeAdapter", "}", "implementation", "that", "handles", "the", "jcr", ":", "primaryType", "property", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java#L144-L149
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java
ReviewsImpl.createVideoReviews
public List<String> createVideoReviews(String teamName, String contentType, List<CreateVideoReviewsBodyItem> createVideoReviewsBody, CreateVideoReviewsOptionalParameter createVideoReviewsOptionalParameter) { return createVideoReviewsWithServiceResponseAsync(teamName, contentType, createVideoReviewsBody, createVideoReviewsOptionalParameter).toBlocking().single().body(); }
java
public List<String> createVideoReviews(String teamName, String contentType, List<CreateVideoReviewsBodyItem> createVideoReviewsBody, CreateVideoReviewsOptionalParameter createVideoReviewsOptionalParameter) { return createVideoReviewsWithServiceResponseAsync(teamName, contentType, createVideoReviewsBody, createVideoReviewsOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "String", ">", "createVideoReviews", "(", "String", "teamName", ",", "String", "contentType", ",", "List", "<", "CreateVideoReviewsBodyItem", ">", "createVideoReviewsBody", ",", "CreateVideoReviewsOptionalParameter", "createVideoReviewsOptionalParameter", ")", "{", "return", "createVideoReviewsWithServiceResponseAsync", "(", "teamName", ",", "contentType", ",", "createVideoReviewsBody", ",", "createVideoReviewsOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
The reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint. &lt;h3&gt;CallBack Schemas &lt;/h3&gt; &lt;h4&gt;Review Completion CallBack Sample&lt;/h4&gt; &lt;p&gt; {&lt;br/&gt; "ReviewId": "&lt;Review Id&gt;",&lt;br/&gt; "ModifiedOn": "2016-10-11T22:36:32.9934851Z",&lt;br/&gt; "ModifiedBy": "&lt;Name of the Reviewer&gt;",&lt;br/&gt; "CallBackType": "Review",&lt;br/&gt; "ContentId": "&lt;The ContentId that was specified input&gt;",&lt;br/&gt; "Metadata": {&lt;br/&gt; "adultscore": "0.xxx",&lt;br/&gt; "a": "False",&lt;br/&gt; "racyscore": "0.xxx",&lt;br/&gt; "r": "True"&lt;br/&gt; },&lt;br/&gt; "ReviewerResultTags": {&lt;br/&gt; "a": "False",&lt;br/&gt; "r": "True"&lt;br/&gt; }&lt;br/&gt; }&lt;br/&gt; &lt;/p&gt;. @param teamName Your team name. @param contentType The content type. @param createVideoReviewsBody Body for create reviews API @param createVideoReviewsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;String&gt; object if successful.
[ "The", "reviews", "created", "would", "show", "up", "for", "Reviewers", "on", "your", "team", ".", "As", "Reviewers", "complete", "reviewing", "results", "of", "the", "Review", "would", "be", "POSTED", "(", "i", ".", "e", ".", "HTTP", "POST", ")", "on", "the", "specified", "CallBackEndpoint", ".", "&lt", ";", "h3&gt", ";", "CallBack", "Schemas", "&lt", ";", "/", "h3&gt", ";", "&lt", ";", "h4&gt", ";", "Review", "Completion", "CallBack", "Sample&lt", ";", "/", "h4&gt", ";", "&lt", ";", "p&gt", ";", "{", "&lt", ";", "br", "/", "&gt", ";", "ReviewId", ":", "&lt", ";", "Review", "Id&gt", ";", "&lt", ";", "br", "/", "&gt", ";", "ModifiedOn", ":", "2016", "-", "10", "-", "11T22", ":", "36", ":", "32", ".", "9934851Z", "&lt", ";", "br", "/", "&gt", ";", "ModifiedBy", ":", "&lt", ";", "Name", "of", "the", "Reviewer&gt", ";", "&lt", ";", "br", "/", "&gt", ";", "CallBackType", ":", "Review", "&lt", ";", "br", "/", "&gt", ";", "ContentId", ":", "&lt", ";", "The", "ContentId", "that", "was", "specified", "input&gt", ";", "&lt", ";", "br", "/", "&gt", ";", "Metadata", ":", "{", "&lt", ";", "br", "/", "&gt", ";", "adultscore", ":", "0", ".", "xxx", "&lt", ";", "br", "/", "&gt", ";", "a", ":", "False", "&lt", ";", "br", "/", "&gt", ";", "racyscore", ":", "0", ".", "xxx", "&lt", ";", "br", "/", "&gt", ";", "r", ":", "True", "&lt", ";", "br", "/", "&gt", ";", "}", "&lt", ";", "br", "/", "&gt", ";", "ReviewerResultTags", ":", "{", "&lt", ";", "br", "/", "&gt", ";", "a", ":", "False", "&lt", ";", "br", "/", "&gt", ";", "r", ":", "True", "&lt", ";", "br", "/", "&gt", ";", "}", "&lt", ";", "br", "/", "&gt", ";", "}", "&lt", ";", "br", "/", "&gt", ";", "&lt", ";", "/", "p&gt", ";", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L1908-L1910
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java
DateFunctions.dateDiffStr
public static Expression dateDiffStr(Expression expression1, Expression expression2, DatePart part) { return x("DATE_DIFF_STR(" + expression1.toString() + ", " + expression2.toString() + ", \"" + part.toString() + "\")"); }
java
public static Expression dateDiffStr(Expression expression1, Expression expression2, DatePart part) { return x("DATE_DIFF_STR(" + expression1.toString() + ", " + expression2.toString() + ", \"" + part.toString() + "\")"); }
[ "public", "static", "Expression", "dateDiffStr", "(", "Expression", "expression1", ",", "Expression", "expression2", ",", "DatePart", "part", ")", "{", "return", "x", "(", "\"DATE_DIFF_STR(\"", "+", "expression1", ".", "toString", "(", ")", "+", "\", \"", "+", "expression2", ".", "toString", "(", ")", "+", "\", \\\"\"", "+", "part", ".", "toString", "(", ")", "+", "\"\\\")\"", ")", ";", "}" ]
Returned expression results in Performs Date arithmetic. Returns the elapsed time between two date strings in a supported format, as an integer whose unit is part.
[ "Returned", "expression", "results", "in", "Performs", "Date", "arithmetic", ".", "Returns", "the", "elapsed", "time", "between", "two", "date", "strings", "in", "a", "supported", "format", "as", "an", "integer", "whose", "unit", "is", "part", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L123-L126
playn/playn
html/src/playn/html/HtmlGraphics.java
HtmlGraphics.setSize
public void setSize (int width, int height) { rootElement.getStyle().setWidth(width, Unit.PX); rootElement.getStyle().setHeight(height, Unit.PX); // the frame buffer may be larger (or smaller) than the logical size, depending on whether // we're on a HiDPI display, or how the game has configured things (maybe they're scaling down // from native resolution to improve performance) Scale fbScale = new Scale(frameBufferPixelRatio); canvas.setWidth(fbScale.scaledCeil(width)); canvas.setHeight(fbScale.scaledCeil(height)); // set the canvas's CSS size to the logical size; the browser works in logical pixels canvas.getStyle().setWidth(width, Style.Unit.PX); canvas.getStyle().setHeight(height, Style.Unit.PX); viewportChanged(canvas.getWidth(), canvas.getHeight()); }
java
public void setSize (int width, int height) { rootElement.getStyle().setWidth(width, Unit.PX); rootElement.getStyle().setHeight(height, Unit.PX); // the frame buffer may be larger (or smaller) than the logical size, depending on whether // we're on a HiDPI display, or how the game has configured things (maybe they're scaling down // from native resolution to improve performance) Scale fbScale = new Scale(frameBufferPixelRatio); canvas.setWidth(fbScale.scaledCeil(width)); canvas.setHeight(fbScale.scaledCeil(height)); // set the canvas's CSS size to the logical size; the browser works in logical pixels canvas.getStyle().setWidth(width, Style.Unit.PX); canvas.getStyle().setHeight(height, Style.Unit.PX); viewportChanged(canvas.getWidth(), canvas.getHeight()); }
[ "public", "void", "setSize", "(", "int", "width", ",", "int", "height", ")", "{", "rootElement", ".", "getStyle", "(", ")", ".", "setWidth", "(", "width", ",", "Unit", ".", "PX", ")", ";", "rootElement", ".", "getStyle", "(", ")", ".", "setHeight", "(", "height", ",", "Unit", ".", "PX", ")", ";", "// the frame buffer may be larger (or smaller) than the logical size, depending on whether", "// we're on a HiDPI display, or how the game has configured things (maybe they're scaling down", "// from native resolution to improve performance)", "Scale", "fbScale", "=", "new", "Scale", "(", "frameBufferPixelRatio", ")", ";", "canvas", ".", "setWidth", "(", "fbScale", ".", "scaledCeil", "(", "width", ")", ")", ";", "canvas", ".", "setHeight", "(", "fbScale", ".", "scaledCeil", "(", "height", ")", ")", ";", "// set the canvas's CSS size to the logical size; the browser works in logical pixels", "canvas", ".", "getStyle", "(", ")", ".", "setWidth", "(", "width", ",", "Style", ".", "Unit", ".", "PX", ")", ";", "canvas", ".", "getStyle", "(", ")", ".", "setHeight", "(", "height", ",", "Style", ".", "Unit", ".", "PX", ")", ";", "viewportChanged", "(", "canvas", ".", "getWidth", "(", ")", ",", "canvas", ".", "getHeight", "(", ")", ")", ";", "}" ]
Sizes or resizes the root element that contains the game view. This is specified in pixels as understood by page elements. If the page is actually being dispalyed on a HiDPI (Retina) device, the actual framebuffer may be 2x (or larger) the specified size.
[ "Sizes", "or", "resizes", "the", "root", "element", "that", "contains", "the", "game", "view", ".", "This", "is", "specified", "in", "pixels", "as", "understood", "by", "page", "elements", ".", "If", "the", "page", "is", "actually", "being", "dispalyed", "on", "a", "HiDPI", "(", "Retina", ")", "device", "the", "actual", "framebuffer", "may", "be", "2x", "(", "or", "larger", ")", "the", "specified", "size", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/html/HtmlGraphics.java#L145-L158
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.getMultiTilePolygon
public static Polygon getMultiTilePolygon (MisoSceneMetrics metrics, Point sp1, Point sp2) { int x = Math.min(sp1.x, sp2.x), y = Math.min(sp1.y, sp2.y); int width = Math.abs(sp1.x-sp2.x)+1, height = Math.abs(sp1.y-sp2.y)+1; return getFootprintPolygon(metrics, x, y, width, height); }
java
public static Polygon getMultiTilePolygon (MisoSceneMetrics metrics, Point sp1, Point sp2) { int x = Math.min(sp1.x, sp2.x), y = Math.min(sp1.y, sp2.y); int width = Math.abs(sp1.x-sp2.x)+1, height = Math.abs(sp1.y-sp2.y)+1; return getFootprintPolygon(metrics, x, y, width, height); }
[ "public", "static", "Polygon", "getMultiTilePolygon", "(", "MisoSceneMetrics", "metrics", ",", "Point", "sp1", ",", "Point", "sp2", ")", "{", "int", "x", "=", "Math", ".", "min", "(", "sp1", ".", "x", ",", "sp2", ".", "x", ")", ",", "y", "=", "Math", ".", "min", "(", "sp1", ".", "y", ",", "sp2", ".", "y", ")", ";", "int", "width", "=", "Math", ".", "abs", "(", "sp1", ".", "x", "-", "sp2", ".", "x", ")", "+", "1", ",", "height", "=", "Math", ".", "abs", "(", "sp1", ".", "y", "-", "sp2", ".", "y", ")", "+", "1", ";", "return", "getFootprintPolygon", "(", "metrics", ",", "x", ",", "y", ",", "width", ",", "height", ")", ";", "}" ]
Return a screen-coordinates polygon framing the two specified tile-coordinate points.
[ "Return", "a", "screen", "-", "coordinates", "polygon", "framing", "the", "two", "specified", "tile", "-", "coordinate", "points", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L417-L423
lucee/Lucee
core/src/main/java/lucee/runtime/converter/JSONConverter.java
JSONConverter._serializeDateTime
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) { sb.append(StringUtil.escapeJS(JSONDateFormat.format(dateTime, null), '"', charsetEncoder)); /* * try { sb.append(goIn()); sb.append("createDateTime("); * sb.append(DateFormat.call(null,dateTime,"yyyy,m,d")); sb.append(' '); * sb.append(TimeFormat.call(null,dateTime,"HH:mm:ss")); sb.append(')'); } catch (PageException e) { * throw new ConverterException(e); } */ // Januar, 01 2000 01:01:01 }
java
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) { sb.append(StringUtil.escapeJS(JSONDateFormat.format(dateTime, null), '"', charsetEncoder)); /* * try { sb.append(goIn()); sb.append("createDateTime("); * sb.append(DateFormat.call(null,dateTime,"yyyy,m,d")); sb.append(' '); * sb.append(TimeFormat.call(null,dateTime,"HH:mm:ss")); sb.append(')'); } catch (PageException e) { * throw new ConverterException(e); } */ // Januar, 01 2000 01:01:01 }
[ "private", "void", "_serializeDateTime", "(", "DateTime", "dateTime", ",", "StringBuilder", "sb", ")", "{", "sb", ".", "append", "(", "StringUtil", ".", "escapeJS", "(", "JSONDateFormat", ".", "format", "(", "dateTime", ",", "null", ")", ",", "'", "'", ",", "charsetEncoder", ")", ")", ";", "/*\n\t * try { sb.append(goIn()); sb.append(\"createDateTime(\");\n\t * sb.append(DateFormat.call(null,dateTime,\"yyyy,m,d\")); sb.append(' ');\n\t * sb.append(TimeFormat.call(null,dateTime,\"HH:mm:ss\")); sb.append(')'); } catch (PageException e) {\n\t * throw new ConverterException(e); }\n\t */", "// Januar, 01 2000 01:01:01", "}" ]
serialize a DateTime @param dateTime DateTime to serialize @param sb @throws ConverterException
[ "serialize", "a", "DateTime" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/JSONConverter.java#L179-L190
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/util/BridgeMethodResolver.java
BridgeMethodResolver.searchForMatch
private static Method searchForMatch(Class<?> type, Method bridgeMethod) { return ReflectionUtils.findMethod(type, bridgeMethod.getName(), bridgeMethod.getParameterTypes()); }
java
private static Method searchForMatch(Class<?> type, Method bridgeMethod) { return ReflectionUtils.findMethod(type, bridgeMethod.getName(), bridgeMethod.getParameterTypes()); }
[ "private", "static", "Method", "searchForMatch", "(", "Class", "<", "?", ">", "type", ",", "Method", "bridgeMethod", ")", "{", "return", "ReflectionUtils", ".", "findMethod", "(", "type", ",", "bridgeMethod", ".", "getName", "(", ")", ",", "bridgeMethod", ".", "getParameterTypes", "(", ")", ")", ";", "}" ]
If the supplied {@link Class} has a declared {@link Method} whose signature matches that of the supplied {@link Method}, then this matching {@link Method} is returned, otherwise {@code null} is returned.
[ "If", "the", "supplied", "{" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/util/BridgeMethodResolver.java#L198-L200
alkacon/opencms-core
src/org/opencms/i18n/CmsEncoder.java
CmsEncoder.lookupEncoding
public static String lookupEncoding(String encoding, String fallback) { String result = m_encodingCache.get(encoding); if (result != null) { return result; } try { result = Charset.forName(encoding).name(); m_encodingCache.put(encoding, result); return result; } catch (Throwable t) { // we will use the default value as fallback } return fallback; }
java
public static String lookupEncoding(String encoding, String fallback) { String result = m_encodingCache.get(encoding); if (result != null) { return result; } try { result = Charset.forName(encoding).name(); m_encodingCache.put(encoding, result); return result; } catch (Throwable t) { // we will use the default value as fallback } return fallback; }
[ "public", "static", "String", "lookupEncoding", "(", "String", "encoding", ",", "String", "fallback", ")", "{", "String", "result", "=", "m_encodingCache", ".", "get", "(", "encoding", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "try", "{", "result", "=", "Charset", ".", "forName", "(", "encoding", ")", ".", "name", "(", ")", ";", "m_encodingCache", ".", "put", "(", "encoding", ",", "result", ")", ";", "return", "result", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// we will use the default value as fallback", "}", "return", "fallback", ";", "}" ]
Checks if a given encoding name is actually supported, and if so resolves it to it's canonical name, if not it returns the given fallback value.<p> Charsets have a set of aliases. For example, valid aliases for "UTF-8" are "UTF8", "utf-8" or "utf8". This method resolves any given valid charset name to it's "canonical" form, so that simple String comparison can be used when checking charset names internally later.<p> Please see <a href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a> for a list of valid charset alias names.<p> @param encoding the encoding to check and resolve @param fallback the fallback encoding scheme @return the resolved encoding name, or the fallback value
[ "Checks", "if", "a", "given", "encoding", "name", "is", "actually", "supported", "and", "if", "so", "resolves", "it", "to", "it", "s", "canonical", "name", "if", "not", "it", "returns", "the", "given", "fallback", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L821-L837
geomajas/geomajas-project-client-gwt2
common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/Dom.java
Dom.createElement
public static Element createElement(String tagName, String id) { return IMPL.createElement(tagName, id); }
java
public static Element createElement(String tagName, String id) { return IMPL.createElement(tagName, id); }
[ "public", "static", "Element", "createElement", "(", "String", "tagName", ",", "String", "id", ")", "{", "return", "IMPL", ".", "createElement", "(", "tagName", ",", "id", ")", ";", "}" ]
Creates an HTML element with the given id. @param tagName the HTML tag of the element to be created @return the newly-created element
[ "Creates", "an", "HTML", "element", "with", "the", "given", "id", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/Dom.java#L126-L128
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java
NominatimSearchRequest.setViewBox
public void setViewBox(final int westE6, final int northE6, final int eastE6, final int southE6) { this.viewBox = new BoundingBox(); this.viewBox.setWestE6(westE6); this.viewBox.setNorthE6(northE6); this.viewBox.setEastE6(eastE6); this.viewBox.setSouthE6(southE6); }
java
public void setViewBox(final int westE6, final int northE6, final int eastE6, final int southE6) { this.viewBox = new BoundingBox(); this.viewBox.setWestE6(westE6); this.viewBox.setNorthE6(northE6); this.viewBox.setEastE6(eastE6); this.viewBox.setSouthE6(southE6); }
[ "public", "void", "setViewBox", "(", "final", "int", "westE6", ",", "final", "int", "northE6", ",", "final", "int", "eastE6", ",", "final", "int", "southE6", ")", "{", "this", ".", "viewBox", "=", "new", "BoundingBox", "(", ")", ";", "this", ".", "viewBox", ".", "setWestE6", "(", "westE6", ")", ";", "this", ".", "viewBox", ".", "setNorthE6", "(", "northE6", ")", ";", "this", ".", "viewBox", ".", "setEastE6", "(", "eastE6", ")", ";", "this", ".", "viewBox", ".", "setSouthE6", "(", "southE6", ")", ";", "}" ]
Sets the preferred area to find search results; @param westE6 the west bound @param northE6 the north bound @param eastE6 the east bound @param southE6 the south bound
[ "Sets", "the", "preferred", "area", "to", "find", "search", "results", ";" ]
train
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java#L235-L241
mozilla/rhino
toolsrc/org/mozilla/javascript/tools/debugger/Main.java
Main.mainEmbedded
public static Main mainEmbedded(ContextFactory factory, ScopeProvider scopeProvider, String title) { return mainEmbeddedImpl(factory, scopeProvider, title); }
java
public static Main mainEmbedded(ContextFactory factory, ScopeProvider scopeProvider, String title) { return mainEmbeddedImpl(factory, scopeProvider, title); }
[ "public", "static", "Main", "mainEmbedded", "(", "ContextFactory", "factory", ",", "ScopeProvider", "scopeProvider", ",", "String", "title", ")", "{", "return", "mainEmbeddedImpl", "(", "factory", ",", "scopeProvider", ",", "title", ")", ";", "}" ]
Entry point for embedded applications. This method attaches to the given {@link ContextFactory} with the given scope. No I/O redirection is performed as with {@link #main(String[])}.
[ "Entry", "point", "for", "embedded", "applications", ".", "This", "method", "attaches", "to", "the", "given", "{" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/debugger/Main.java#L262-L266
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java
ProxyDataSourceBuilder.logSlowQueryByJUL
public ProxyDataSourceBuilder logSlowQueryByJUL(long thresholdTime, TimeUnit timeUnit, String loggerName) { return logSlowQueryByJUL(thresholdTime, timeUnit, null, loggerName); }
java
public ProxyDataSourceBuilder logSlowQueryByJUL(long thresholdTime, TimeUnit timeUnit, String loggerName) { return logSlowQueryByJUL(thresholdTime, timeUnit, null, loggerName); }
[ "public", "ProxyDataSourceBuilder", "logSlowQueryByJUL", "(", "long", "thresholdTime", ",", "TimeUnit", "timeUnit", ",", "String", "loggerName", ")", "{", "return", "logSlowQueryByJUL", "(", "thresholdTime", ",", "timeUnit", ",", "null", ",", "loggerName", ")", ";", "}" ]
Register {@link JULSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @param loggerName JUL logger name @return builder @since 1.4.1
[ "Register", "{", "@link", "JULSlowQueryListener", "}", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L465-L467
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java
DateTimePatternGenerator.getCanonicalChar
private static char getCanonicalChar(int field, char reference) { // Special case: distinguish between 12-hour and 24-hour if (reference == 'h' || reference == 'K') { return 'h'; } // Linear search over types (return the top entry for each field) for (int i = 0; i < types.length; ++i) { int[] row = types[i]; if (row[1] == field) { return (char) row[0]; } } throw new IllegalArgumentException("Could not find field " + field); }
java
private static char getCanonicalChar(int field, char reference) { // Special case: distinguish between 12-hour and 24-hour if (reference == 'h' || reference == 'K') { return 'h'; } // Linear search over types (return the top entry for each field) for (int i = 0; i < types.length; ++i) { int[] row = types[i]; if (row[1] == field) { return (char) row[0]; } } throw new IllegalArgumentException("Could not find field " + field); }
[ "private", "static", "char", "getCanonicalChar", "(", "int", "field", ",", "char", "reference", ")", "{", "// Special case: distinguish between 12-hour and 24-hour", "if", "(", "reference", "==", "'", "'", "||", "reference", "==", "'", "'", ")", "{", "return", "'", "'", ";", "}", "// Linear search over types (return the top entry for each field)", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "++", "i", ")", "{", "int", "[", "]", "row", "=", "types", "[", "i", "]", ";", "if", "(", "row", "[", "1", "]", "==", "field", ")", "{", "return", "(", "char", ")", "row", "[", "0", "]", ";", "}", "}", "throw", "new", "IllegalArgumentException", "(", "\"Could not find field \"", "+", "field", ")", ";", "}" ]
Gets the canonical character associated with the specified field (ERA, YEAR, etc).
[ "Gets", "the", "canonical", "character", "associated", "with", "the", "specified", "field", "(", "ERA", "YEAR", "etc", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L2112-L2126
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java
DwgUtil.getDefaultDouble
public static Vector getDefaultDouble(int[] data, int offset, double defVal) throws Exception { int flags = ((Integer)getBits(data, 2, offset)).intValue(); int read = 2; double val; if (flags==0x0) { val = defVal; } else { int _offset = offset + 2; String dstr; if (flags==0x3) { byte[] bytes = (byte[])getBits(data, 64, _offset); ByteBuffer bb = ByteBuffer.wrap(bytes); bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getDouble(); read = 66; } else { byte[] dstrArrayAux = new byte[8]; int[] doubleOffset = new int[]{0}; ByteUtils.doubleToBytes(defVal, dstrArrayAux, doubleOffset); byte[] dstrArrayAuxx = new byte[8]; dstrArrayAuxx[0] = dstrArrayAux[7]; dstrArrayAuxx[1] = dstrArrayAux[6]; dstrArrayAuxx[2] = dstrArrayAux[5]; dstrArrayAuxx[3] = dstrArrayAux[4]; dstrArrayAuxx[4] = dstrArrayAux[3]; dstrArrayAuxx[5] = dstrArrayAux[2]; dstrArrayAuxx[6] = dstrArrayAux[1]; dstrArrayAuxx[7] = dstrArrayAux[0]; int[] dstrArrayAuxxx = new int[8]; for (int i=0;i<dstrArrayAuxxx.length;i++) { dstrArrayAuxxx[i] = ByteUtils.getUnsigned(dstrArrayAuxx[i]); } byte[] dstrArray = new byte[8]; for (int i=0;i<dstrArray.length;i++) { dstrArray[i] = (byte)dstrArrayAuxxx[i]; } if (flags==0x1) { byte[] ddArray = (byte[])getBits(data, 32, _offset); dstrArray[0] = ddArray[0]; dstrArray[1] = ddArray[1]; dstrArray[2] = ddArray[2]; dstrArray[3] = ddArray[3]; read = 34; } else { byte[] ddArray = (byte[])getBits(data, 48, _offset); dstrArray[4] = ddArray[0]; dstrArray[5] = ddArray[1]; dstrArray[0] = ddArray[2]; dstrArray[1] = ddArray[3]; dstrArray[2] = ddArray[4]; dstrArray[3] = ddArray[5]; read = 50; } ByteBuffer bb = ByteBuffer.wrap(dstrArray); bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getDouble(); } } Vector v = new Vector(); v.add(new Integer(offset+read)); v.add(new Double(val)); return v; }
java
public static Vector getDefaultDouble(int[] data, int offset, double defVal) throws Exception { int flags = ((Integer)getBits(data, 2, offset)).intValue(); int read = 2; double val; if (flags==0x0) { val = defVal; } else { int _offset = offset + 2; String dstr; if (flags==0x3) { byte[] bytes = (byte[])getBits(data, 64, _offset); ByteBuffer bb = ByteBuffer.wrap(bytes); bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getDouble(); read = 66; } else { byte[] dstrArrayAux = new byte[8]; int[] doubleOffset = new int[]{0}; ByteUtils.doubleToBytes(defVal, dstrArrayAux, doubleOffset); byte[] dstrArrayAuxx = new byte[8]; dstrArrayAuxx[0] = dstrArrayAux[7]; dstrArrayAuxx[1] = dstrArrayAux[6]; dstrArrayAuxx[2] = dstrArrayAux[5]; dstrArrayAuxx[3] = dstrArrayAux[4]; dstrArrayAuxx[4] = dstrArrayAux[3]; dstrArrayAuxx[5] = dstrArrayAux[2]; dstrArrayAuxx[6] = dstrArrayAux[1]; dstrArrayAuxx[7] = dstrArrayAux[0]; int[] dstrArrayAuxxx = new int[8]; for (int i=0;i<dstrArrayAuxxx.length;i++) { dstrArrayAuxxx[i] = ByteUtils.getUnsigned(dstrArrayAuxx[i]); } byte[] dstrArray = new byte[8]; for (int i=0;i<dstrArray.length;i++) { dstrArray[i] = (byte)dstrArrayAuxxx[i]; } if (flags==0x1) { byte[] ddArray = (byte[])getBits(data, 32, _offset); dstrArray[0] = ddArray[0]; dstrArray[1] = ddArray[1]; dstrArray[2] = ddArray[2]; dstrArray[3] = ddArray[3]; read = 34; } else { byte[] ddArray = (byte[])getBits(data, 48, _offset); dstrArray[4] = ddArray[0]; dstrArray[5] = ddArray[1]; dstrArray[0] = ddArray[2]; dstrArray[1] = ddArray[3]; dstrArray[2] = ddArray[4]; dstrArray[3] = ddArray[5]; read = 50; } ByteBuffer bb = ByteBuffer.wrap(dstrArray); bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getDouble(); } } Vector v = new Vector(); v.add(new Integer(offset+read)); v.add(new Double(val)); return v; }
[ "public", "static", "Vector", "getDefaultDouble", "(", "int", "[", "]", "data", ",", "int", "offset", ",", "double", "defVal", ")", "throws", "Exception", "{", "int", "flags", "=", "(", "(", "Integer", ")", "getBits", "(", "data", ",", "2", ",", "offset", ")", ")", ".", "intValue", "(", ")", ";", "int", "read", "=", "2", ";", "double", "val", ";", "if", "(", "flags", "==", "0x0", ")", "{", "val", "=", "defVal", ";", "}", "else", "{", "int", "_offset", "=", "offset", "+", "2", ";", "String", "dstr", ";", "if", "(", "flags", "==", "0x3", ")", "{", "byte", "[", "]", "bytes", "=", "(", "byte", "[", "]", ")", "getBits", "(", "data", ",", "64", ",", "_offset", ")", ";", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "wrap", "(", "bytes", ")", ";", "bb", ".", "order", "(", "ByteOrder", ".", "LITTLE_ENDIAN", ")", ";", "val", "=", "bb", ".", "getDouble", "(", ")", ";", "read", "=", "66", ";", "}", "else", "{", "byte", "[", "]", "dstrArrayAux", "=", "new", "byte", "[", "8", "]", ";", "int", "[", "]", "doubleOffset", "=", "new", "int", "[", "]", "{", "0", "}", ";", "ByteUtils", ".", "doubleToBytes", "(", "defVal", ",", "dstrArrayAux", ",", "doubleOffset", ")", ";", "byte", "[", "]", "dstrArrayAuxx", "=", "new", "byte", "[", "8", "]", ";", "dstrArrayAuxx", "[", "0", "]", "=", "dstrArrayAux", "[", "7", "]", ";", "dstrArrayAuxx", "[", "1", "]", "=", "dstrArrayAux", "[", "6", "]", ";", "dstrArrayAuxx", "[", "2", "]", "=", "dstrArrayAux", "[", "5", "]", ";", "dstrArrayAuxx", "[", "3", "]", "=", "dstrArrayAux", "[", "4", "]", ";", "dstrArrayAuxx", "[", "4", "]", "=", "dstrArrayAux", "[", "3", "]", ";", "dstrArrayAuxx", "[", "5", "]", "=", "dstrArrayAux", "[", "2", "]", ";", "dstrArrayAuxx", "[", "6", "]", "=", "dstrArrayAux", "[", "1", "]", ";", "dstrArrayAuxx", "[", "7", "]", "=", "dstrArrayAux", "[", "0", "]", ";", "int", "[", "]", "dstrArrayAuxxx", "=", "new", "int", "[", "8", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dstrArrayAuxxx", ".", "length", ";", "i", "++", ")", "{", "dstrArrayAuxxx", "[", "i", "]", "=", "ByteUtils", ".", "getUnsigned", "(", "dstrArrayAuxx", "[", "i", "]", ")", ";", "}", "byte", "[", "]", "dstrArray", "=", "new", "byte", "[", "8", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dstrArray", ".", "length", ";", "i", "++", ")", "{", "dstrArray", "[", "i", "]", "=", "(", "byte", ")", "dstrArrayAuxxx", "[", "i", "]", ";", "}", "if", "(", "flags", "==", "0x1", ")", "{", "byte", "[", "]", "ddArray", "=", "(", "byte", "[", "]", ")", "getBits", "(", "data", ",", "32", ",", "_offset", ")", ";", "dstrArray", "[", "0", "]", "=", "ddArray", "[", "0", "]", ";", "dstrArray", "[", "1", "]", "=", "ddArray", "[", "1", "]", ";", "dstrArray", "[", "2", "]", "=", "ddArray", "[", "2", "]", ";", "dstrArray", "[", "3", "]", "=", "ddArray", "[", "3", "]", ";", "read", "=", "34", ";", "}", "else", "{", "byte", "[", "]", "ddArray", "=", "(", "byte", "[", "]", ")", "getBits", "(", "data", ",", "48", ",", "_offset", ")", ";", "dstrArray", "[", "4", "]", "=", "ddArray", "[", "0", "]", ";", "dstrArray", "[", "5", "]", "=", "ddArray", "[", "1", "]", ";", "dstrArray", "[", "0", "]", "=", "ddArray", "[", "2", "]", ";", "dstrArray", "[", "1", "]", "=", "ddArray", "[", "3", "]", ";", "dstrArray", "[", "2", "]", "=", "ddArray", "[", "4", "]", ";", "dstrArray", "[", "3", "]", "=", "ddArray", "[", "5", "]", ";", "read", "=", "50", ";", "}", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "wrap", "(", "dstrArray", ")", ";", "bb", ".", "order", "(", "ByteOrder", ".", "LITTLE_ENDIAN", ")", ";", "val", "=", "bb", ".", "getDouble", "(", ")", ";", "}", "}", "Vector", "v", "=", "new", "Vector", "(", ")", ";", "v", ".", "add", "(", "new", "Integer", "(", "offset", "+", "read", ")", ")", ";", "v", ".", "add", "(", "new", "Double", "(", "val", ")", ")", ";", "return", "v", ";", "}" ]
Read a double value from a group of unsigned bytes and a default double @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @param defVal Default double value @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines. @return Vector This vector has two parts. First is an int value that represents the new offset, and second is the double value
[ "Read", "a", "double", "value", "from", "a", "group", "of", "unsigned", "bytes", "and", "a", "default", "double" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java#L177-L239
classgraph/classgraph
src/main/java/io/github/classgraph/ClassGraphException.java
ClassGraphException.newClassGraphException
public static ClassGraphException newClassGraphException(final String message, final Throwable cause) throws ClassGraphException { return new ClassGraphException(message, cause); }
java
public static ClassGraphException newClassGraphException(final String message, final Throwable cause) throws ClassGraphException { return new ClassGraphException(message, cause); }
[ "public", "static", "ClassGraphException", "newClassGraphException", "(", "final", "String", "message", ",", "final", "Throwable", "cause", ")", "throws", "ClassGraphException", "{", "return", "new", "ClassGraphException", "(", "message", ",", "cause", ")", ";", "}" ]
Static factory method to stop IDEs from auto-completing ClassGraphException after "new ClassGraph". @param message the message @param cause the cause @return the ClassGraphException @throws ClassGraphException the class graph exception
[ "Static", "factory", "method", "to", "stop", "IDEs", "from", "auto", "-", "completing", "ClassGraphException", "after", "new", "ClassGraph", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassGraphException.java#L87-L90
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/StringUtils.java
StringUtils.printToFileLn
public static void printToFileLn(String filename, String message, boolean append) { printToFileLn(new File(filename), message, append); }
java
public static void printToFileLn(String filename, String message, boolean append) { printToFileLn(new File(filename), message, append); }
[ "public", "static", "void", "printToFileLn", "(", "String", "filename", ",", "String", "message", ",", "boolean", "append", ")", "{", "printToFileLn", "(", "new", "File", "(", "filename", ")", ",", "message", ",", "append", ")", ";", "}" ]
Prints to a file. If the file already exists, appends if <code>append=true</code>, and overwrites if <code>append=false</code>
[ "Prints", "to", "a", "file", ".", "If", "the", "file", "already", "exists", "appends", "if", "<code", ">", "append", "=", "true<", "/", "code", ">", "and", "overwrites", "if", "<code", ">", "append", "=", "false<", "/", "code", ">" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/StringUtils.java#L968-L970
bazaarvoice/emodb
mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/LocationUtil.java
LocationUtil.getStashLocation
public static StashLocation getStashLocation(URI location) { checkArgument(getLocationType(location) == LocationType.STASH, "Not a stash location"); String host, path; boolean useLatestDirectory; Matcher matcher = getLocatorMatcher(location); if (matcher.matches()) { // Stash is only available for the default group. Make sure that's the case here String group = Objects.firstNonNull(matcher.group("group"), DEFAULT_GROUP); checkArgument(DEFAULT_GROUP.equals(group), "Stash not available for group: %s", group); // Stash it not available for local String universe = matcher.group("universe"); checkArgument(universe != null, "Stash not available for local"); Region region = getRegion(Objects.firstNonNull(matcher.group("region"), DEFAULT_REGION)); host = getS3BucketForRegion(region); path = getS3PathForUniverse(universe); useLatestDirectory = true; } else { // The location refers to the actual S3 bucket and path host = location.getHost(); path = location.getPath(); // Stash paths don't have a leading slash if (path != null && path.startsWith("/")) { path = path.substring(1); } useLatestDirectory = false; } return new StashLocation(host, path, useLatestDirectory); }
java
public static StashLocation getStashLocation(URI location) { checkArgument(getLocationType(location) == LocationType.STASH, "Not a stash location"); String host, path; boolean useLatestDirectory; Matcher matcher = getLocatorMatcher(location); if (matcher.matches()) { // Stash is only available for the default group. Make sure that's the case here String group = Objects.firstNonNull(matcher.group("group"), DEFAULT_GROUP); checkArgument(DEFAULT_GROUP.equals(group), "Stash not available for group: %s", group); // Stash it not available for local String universe = matcher.group("universe"); checkArgument(universe != null, "Stash not available for local"); Region region = getRegion(Objects.firstNonNull(matcher.group("region"), DEFAULT_REGION)); host = getS3BucketForRegion(region); path = getS3PathForUniverse(universe); useLatestDirectory = true; } else { // The location refers to the actual S3 bucket and path host = location.getHost(); path = location.getPath(); // Stash paths don't have a leading slash if (path != null && path.startsWith("/")) { path = path.substring(1); } useLatestDirectory = false; } return new StashLocation(host, path, useLatestDirectory); }
[ "public", "static", "StashLocation", "getStashLocation", "(", "URI", "location", ")", "{", "checkArgument", "(", "getLocationType", "(", "location", ")", "==", "LocationType", ".", "STASH", ",", "\"Not a stash location\"", ")", ";", "String", "host", ",", "path", ";", "boolean", "useLatestDirectory", ";", "Matcher", "matcher", "=", "getLocatorMatcher", "(", "location", ")", ";", "if", "(", "matcher", ".", "matches", "(", ")", ")", "{", "// Stash is only available for the default group. Make sure that's the case here", "String", "group", "=", "Objects", ".", "firstNonNull", "(", "matcher", ".", "group", "(", "\"group\"", ")", ",", "DEFAULT_GROUP", ")", ";", "checkArgument", "(", "DEFAULT_GROUP", ".", "equals", "(", "group", ")", ",", "\"Stash not available for group: %s\"", ",", "group", ")", ";", "// Stash it not available for local", "String", "universe", "=", "matcher", ".", "group", "(", "\"universe\"", ")", ";", "checkArgument", "(", "universe", "!=", "null", ",", "\"Stash not available for local\"", ")", ";", "Region", "region", "=", "getRegion", "(", "Objects", ".", "firstNonNull", "(", "matcher", ".", "group", "(", "\"region\"", ")", ",", "DEFAULT_REGION", ")", ")", ";", "host", "=", "getS3BucketForRegion", "(", "region", ")", ";", "path", "=", "getS3PathForUniverse", "(", "universe", ")", ";", "useLatestDirectory", "=", "true", ";", "}", "else", "{", "// The location refers to the actual S3 bucket and path", "host", "=", "location", ".", "getHost", "(", ")", ";", "path", "=", "location", ".", "getPath", "(", ")", ";", "// Stash paths don't have a leading slash", "if", "(", "path", "!=", "null", "&&", "path", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "path", "=", "path", ".", "substring", "(", "1", ")", ";", "}", "useLatestDirectory", "=", "false", ";", "}", "return", "new", "StashLocation", "(", "host", ",", "path", ",", "useLatestDirectory", ")", ";", "}" ]
Returns location information for a given location of type {@link LocationType#STASH}.
[ "Returns", "location", "information", "for", "a", "given", "location", "of", "type", "{" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/LocationUtil.java#L317-L350
GoSimpleLLC/nbvcxz
src/main/java/me/gosimple/nbvcxz/resources/Generator.java
Generator.generatePassphrase
public static String generatePassphrase(final String delimiter, final int words, final Dictionary dictionary) { String result = ""; final SecureRandom rnd = new SecureRandom(); final int high = dictionary.getSortedDictionary().size(); for (int i = 1; i <= words; i++) { result += dictionary.getSortedDictionary().get(rnd.nextInt(high)); if (i < words) { result += delimiter; } } return result; }
java
public static String generatePassphrase(final String delimiter, final int words, final Dictionary dictionary) { String result = ""; final SecureRandom rnd = new SecureRandom(); final int high = dictionary.getSortedDictionary().size(); for (int i = 1; i <= words; i++) { result += dictionary.getSortedDictionary().get(rnd.nextInt(high)); if (i < words) { result += delimiter; } } return result; }
[ "public", "static", "String", "generatePassphrase", "(", "final", "String", "delimiter", ",", "final", "int", "words", ",", "final", "Dictionary", "dictionary", ")", "{", "String", "result", "=", "\"\"", ";", "final", "SecureRandom", "rnd", "=", "new", "SecureRandom", "(", ")", ";", "final", "int", "high", "=", "dictionary", ".", "getSortedDictionary", "(", ")", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "words", ";", "i", "++", ")", "{", "result", "+=", "dictionary", ".", "getSortedDictionary", "(", ")", ".", "get", "(", "rnd", ".", "nextInt", "(", "high", ")", ")", ";", "if", "(", "i", "<", "words", ")", "{", "result", "+=", "delimiter", ";", "}", "}", "return", "result", ";", "}" ]
Generates a passphrase from the supplied dictionary with the requested word count. @param delimiter delimiter to place between words @param words the count of words you want in your passphrase @param dictionary the dictionary to use for generating this passphrase @return the passphrase
[ "Generates", "a", "passphrase", "from", "the", "supplied", "dictionary", "with", "the", "requested", "word", "count", "." ]
train
https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/resources/Generator.java#L32-L46
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java
DatatypeConverter.getInt
public static final int getInt(InputStream is) throws IOException { byte[] data = new byte[4]; is.read(data); return getInt(data, 0); }
java
public static final int getInt(InputStream is) throws IOException { byte[] data = new byte[4]; is.read(data); return getInt(data, 0); }
[ "public", "static", "final", "int", "getInt", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "4", "]", ";", "is", ".", "read", "(", "data", ")", ";", "return", "getInt", "(", "data", ",", "0", ")", ";", "}" ]
Read an int from an input stream. @param is input stream @return int value
[ "Read", "an", "int", "from", "an", "input", "stream", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L132-L137
biezhi/anima
src/main/java/io/github/biezhi/anima/Anima.java
Anima.deleteBatch
public static <T extends Model, S extends Serializable> void deleteBatch(Class<T> model, List<S> idList) { deleteBatch(model, AnimaUtils.toArray(idList)); }
java
public static <T extends Model, S extends Serializable> void deleteBatch(Class<T> model, List<S> idList) { deleteBatch(model, AnimaUtils.toArray(idList)); }
[ "public", "static", "<", "T", "extends", "Model", ",", "S", "extends", "Serializable", ">", "void", "deleteBatch", "(", "Class", "<", "T", ">", "model", ",", "List", "<", "S", ">", "idList", ")", "{", "deleteBatch", "(", "model", ",", "AnimaUtils", ".", "toArray", "(", "idList", ")", ")", ";", "}" ]
Batch delete model with List @param model model class type @param idList mode primary id list @param <T> @param <S>
[ "Batch", "delete", "model", "with", "List" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/Anima.java#L432-L434
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/util/ProcessUtil.java
ProcessUtil.onProcessExited
public static void onProcessExited(Process process, Listener<Integer> exitValueListener) { Application app = LCCore.getApplication(); Mutable<Thread> mt = new Mutable<>(null); Thread t = app.getThreadFactory().newThread(() -> { try { exitValueListener.fire(Integer.valueOf(process.waitFor())); } catch (InterruptedException e) { /* ignore and quit */ } app.interrupted(mt.get()); }); mt.set(t); t.setName("Waiting for process to exit"); t.start(); app.toInterruptOnShutdown(t); }
java
public static void onProcessExited(Process process, Listener<Integer> exitValueListener) { Application app = LCCore.getApplication(); Mutable<Thread> mt = new Mutable<>(null); Thread t = app.getThreadFactory().newThread(() -> { try { exitValueListener.fire(Integer.valueOf(process.waitFor())); } catch (InterruptedException e) { /* ignore and quit */ } app.interrupted(mt.get()); }); mt.set(t); t.setName("Waiting for process to exit"); t.start(); app.toInterruptOnShutdown(t); }
[ "public", "static", "void", "onProcessExited", "(", "Process", "process", ",", "Listener", "<", "Integer", ">", "exitValueListener", ")", "{", "Application", "app", "=", "LCCore", ".", "getApplication", "(", ")", ";", "Mutable", "<", "Thread", ">", "mt", "=", "new", "Mutable", "<>", "(", "null", ")", ";", "Thread", "t", "=", "app", ".", "getThreadFactory", "(", ")", ".", "newThread", "(", "(", ")", "->", "{", "try", "{", "exitValueListener", ".", "fire", "(", "Integer", ".", "valueOf", "(", "process", ".", "waitFor", "(", ")", ")", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "/* ignore and quit */", "}", "app", ".", "interrupted", "(", "mt", ".", "get", "(", ")", ")", ";", "}", ")", ";", "mt", ".", "set", "(", "t", ")", ";", "t", ".", "setName", "(", "\"Waiting for process to exit\"", ")", ";", "t", ".", "start", "(", ")", ";", "app", ".", "toInterruptOnShutdown", "(", "t", ")", ";", "}" ]
Create a thread that wait for the given process to end, and call the given listener.
[ "Create", "a", "thread", "that", "wait", "for", "the", "given", "process", "to", "end", "and", "call", "the", "given", "listener", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/ProcessUtil.java#L22-L34
eurekaclinical/eurekaclinical-standard-apis
src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java
GenericDao.getUniqueByAttribute
protected <Y> T getUniqueByAttribute(String attributeName, Y value) { try { return getDatabaseSupport().getUniqueByAttribute(getEntityClass(), attributeName, value); } catch (NoResultException ex) { return null; } }
java
protected <Y> T getUniqueByAttribute(String attributeName, Y value) { try { return getDatabaseSupport().getUniqueByAttribute(getEntityClass(), attributeName, value); } catch (NoResultException ex) { return null; } }
[ "protected", "<", "Y", ">", "T", "getUniqueByAttribute", "(", "String", "attributeName", ",", "Y", "value", ")", "{", "try", "{", "return", "getDatabaseSupport", "(", ")", ".", "getUniqueByAttribute", "(", "getEntityClass", "(", ")", ",", "attributeName", ",", "value", ")", ";", "}", "catch", "(", "NoResultException", "ex", ")", "{", "return", "null", ";", "}", "}" ]
Gets the entity that has the target value of the specified attribute. @param <Y> the type of the attribute and target value. @param attributeName the name of the attribute. @param value the target value of the given attribute. @return the matching entity, or <code>null</code> if there is none.
[ "Gets", "the", "entity", "that", "has", "the", "target", "value", "of", "the", "specified", "attribute", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-standard-apis/blob/690036dde82a4f2c2106d32403cdf1c713429377/src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java#L237-L243
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.createCipher
private static Cipher createCipher(final String algorithm, final int mode, final char[] password, final byte[] salt, final int count) throws GeneralSecurityException { final SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(algorithm); final PBEKeySpec keySpec = new PBEKeySpec(password); final SecretKey key = keyFactory.generateSecret(keySpec); final Cipher cipher = Cipher.getInstance(algorithm); final PBEParameterSpec params = new PBEParameterSpec(salt, count); cipher.init(mode, key, params); return cipher; }
java
private static Cipher createCipher(final String algorithm, final int mode, final char[] password, final byte[] salt, final int count) throws GeneralSecurityException { final SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(algorithm); final PBEKeySpec keySpec = new PBEKeySpec(password); final SecretKey key = keyFactory.generateSecret(keySpec); final Cipher cipher = Cipher.getInstance(algorithm); final PBEParameterSpec params = new PBEParameterSpec(salt, count); cipher.init(mode, key, params); return cipher; }
[ "private", "static", "Cipher", "createCipher", "(", "final", "String", "algorithm", ",", "final", "int", "mode", ",", "final", "char", "[", "]", "password", ",", "final", "byte", "[", "]", "salt", ",", "final", "int", "count", ")", "throws", "GeneralSecurityException", "{", "final", "SecretKeyFactory", "keyFactory", "=", "SecretKeyFactory", ".", "getInstance", "(", "algorithm", ")", ";", "final", "PBEKeySpec", "keySpec", "=", "new", "PBEKeySpec", "(", "password", ")", ";", "final", "SecretKey", "key", "=", "keyFactory", ".", "generateSecret", "(", "keySpec", ")", ";", "final", "Cipher", "cipher", "=", "Cipher", ".", "getInstance", "(", "algorithm", ")", ";", "final", "PBEParameterSpec", "params", "=", "new", "PBEParameterSpec", "(", "salt", ",", "count", ")", ";", "cipher", ".", "init", "(", "mode", ",", "key", ",", "params", ")", ";", "return", "cipher", ";", "}" ]
Creates a cipher for encryption or decryption. @param algorithm PBE algorithm like "PBEWithMD5AndDES" or "PBEWithMD5AndTripleDES". @param mode Encyrption or decyrption. @param password Password. @param salt Salt usable with algorithm. @param count Iterations. @return Ready initialized cipher. @throws GeneralSecurityException Error creating the cipher.
[ "Creates", "a", "cipher", "for", "encryption", "or", "decryption", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L383-L394
Axway/Grapes
server/src/main/java/org/axway/grapes/server/webapp/views/LicenseListView.java
LicenseListView.getTable
public Table getTable(){ final Table table = new Table("Name", "Long Name", "URL", "Comment"); // Create row(s) per dependency for(final License license: licenses){ table.addRow(license.getName(), license.getLongName(), license.getUrl(), license.getComments()); } return table; }
java
public Table getTable(){ final Table table = new Table("Name", "Long Name", "URL", "Comment"); // Create row(s) per dependency for(final License license: licenses){ table.addRow(license.getName(), license.getLongName(), license.getUrl(), license.getComments()); } return table; }
[ "public", "Table", "getTable", "(", ")", "{", "final", "Table", "table", "=", "new", "Table", "(", "\"Name\"", ",", "\"Long Name\"", ",", "\"URL\"", ",", "\"Comment\"", ")", ";", "// Create row(s) per dependency", "for", "(", "final", "License", "license", ":", "licenses", ")", "{", "table", ".", "addRow", "(", "license", ".", "getName", "(", ")", ",", "license", ".", "getLongName", "(", ")", ",", "license", ".", "getUrl", "(", ")", ",", "license", ".", "getComments", "(", ")", ")", ";", "}", "return", "table", ";", "}" ]
Generate a table that contains the dependencies information with the column that match the configured filters @return Table
[ "Generate", "a", "table", "that", "contains", "the", "dependencies", "information", "with", "the", "column", "that", "match", "the", "configured", "filters" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/views/LicenseListView.java#L58-L67