repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
sequencelengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
sequencelengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/StringUtils.java
StringUtils.trimTrailingCharacter
public static String trimTrailingCharacter(String str, char trailingCharacter) { if (!hasLength(str)) { return str; } StringBuilder buf = new StringBuilder(str); while (buf.length() > 0 && buf.charAt(buf.length() - 1) == trailingCharacter) { buf.deleteCharAt(buf.length() - 1); } return buf.toString(); }
java
public static String trimTrailingCharacter(String str, char trailingCharacter) { if (!hasLength(str)) { return str; } StringBuilder buf = new StringBuilder(str); while (buf.length() > 0 && buf.charAt(buf.length() - 1) == trailingCharacter) { buf.deleteCharAt(buf.length() - 1); } return buf.toString(); }
[ "public", "static", "String", "trimTrailingCharacter", "(", "String", "str", ",", "char", "trailingCharacter", ")", "{", "if", "(", "!", "hasLength", "(", "str", ")", ")", "{", "return", "str", ";", "}", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "str", ")", ";", "while", "(", "buf", ".", "length", "(", ")", ">", "0", "&&", "buf", ".", "charAt", "(", "buf", ".", "length", "(", ")", "-", "1", ")", "==", "trailingCharacter", ")", "{", "buf", ".", "deleteCharAt", "(", "buf", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Trim all occurrences of the supplied trailing character from the given {@code String}. @param str the {@code String} to check @param trailingCharacter the trailing character to be trimmed @return the trimmed {@code String}
[ "Trim", "all", "occurrences", "of", "the", "supplied", "trailing", "character", "from", "the", "given", "{", "@code", "String", "}", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/StringUtils.java#L252-L261
netty/netty
common/src/main/java/io/netty/util/internal/PlatformDependent.java
PlatformDependent.hashCodeAsciiCompute
private static int hashCodeAsciiCompute(CharSequence value, int offset, int hash) { if (BIG_ENDIAN_NATIVE_ORDER) { return hash * HASH_CODE_C1 + // Low order int hashCodeAsciiSanitizeInt(value, offset + 4) * HASH_CODE_C2 + // High order int hashCodeAsciiSanitizeInt(value, offset); } return hash * HASH_CODE_C1 + // Low order int hashCodeAsciiSanitizeInt(value, offset) * HASH_CODE_C2 + // High order int hashCodeAsciiSanitizeInt(value, offset + 4); }
java
private static int hashCodeAsciiCompute(CharSequence value, int offset, int hash) { if (BIG_ENDIAN_NATIVE_ORDER) { return hash * HASH_CODE_C1 + // Low order int hashCodeAsciiSanitizeInt(value, offset + 4) * HASH_CODE_C2 + // High order int hashCodeAsciiSanitizeInt(value, offset); } return hash * HASH_CODE_C1 + // Low order int hashCodeAsciiSanitizeInt(value, offset) * HASH_CODE_C2 + // High order int hashCodeAsciiSanitizeInt(value, offset + 4); }
[ "private", "static", "int", "hashCodeAsciiCompute", "(", "CharSequence", "value", ",", "int", "offset", ",", "int", "hash", ")", "{", "if", "(", "BIG_ENDIAN_NATIVE_ORDER", ")", "{", "return", "hash", "*", "HASH_CODE_C1", "+", "// Low order int", "hashCodeAsciiSanitizeInt", "(", "value", ",", "offset", "+", "4", ")", "*", "HASH_CODE_C2", "+", "// High order int", "hashCodeAsciiSanitizeInt", "(", "value", ",", "offset", ")", ";", "}", "return", "hash", "*", "HASH_CODE_C1", "+", "// Low order int", "hashCodeAsciiSanitizeInt", "(", "value", ",", "offset", ")", "*", "HASH_CODE_C2", "+", "// High order int", "hashCodeAsciiSanitizeInt", "(", "value", ",", "offset", "+", "4", ")", ";", "}" ]
Identical to {@link PlatformDependent0#hashCodeAsciiCompute(long, int)} but for {@link CharSequence}.
[ "Identical", "to", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L503-L516
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java
TransformerHandlerImpl.startDTD
public void startDTD(String name, String publicId, String systemId) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#startDTD: " + name + ", " + publicId + ", " + systemId); if (null != m_lexicalHandler) { m_lexicalHandler.startDTD(name, publicId, systemId); } }
java
public void startDTD(String name, String publicId, String systemId) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#startDTD: " + name + ", " + publicId + ", " + systemId); if (null != m_lexicalHandler) { m_lexicalHandler.startDTD(name, publicId, systemId); } }
[ "public", "void", "startDTD", "(", "String", "name", ",", "String", "publicId", ",", "String", "systemId", ")", "throws", "SAXException", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"TransformerHandlerImpl#startDTD: \"", "+", "name", "+", "\", \"", "+", "publicId", "+", "\", \"", "+", "systemId", ")", ";", "if", "(", "null", "!=", "m_lexicalHandler", ")", "{", "m_lexicalHandler", ".", "startDTD", "(", "name", ",", "publicId", ",", "systemId", ")", ";", "}", "}" ]
Report the start of DTD declarations, if any. <p>Any declarations are assumed to be in the internal subset unless otherwise indicated by a {@link #startEntity startEntity} event.</p> <p>Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.</p> @param name The document type name. @param publicId The declared public identifier for the external DTD subset, or null if none was declared. @param systemId The declared system identifier for the external DTD subset, or null if none was declared. @throws SAXException The application may raise an exception. @see #endDTD @see #startEntity
[ "Report", "the", "start", "of", "DTD", "declarations", "if", "any", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L768-L780
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.orthoSymmetric
public Matrix4x3f orthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) { return orthoSymmetric(width, height, zNear, zFar, zZeroToOne, this); }
java
public Matrix4x3f orthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) { return orthoSymmetric(width, height, zNear, zFar, zZeroToOne, this); }
[ "public", "Matrix4x3f", "orthoSymmetric", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "return", "orthoSymmetric", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "zZeroToOne", ",", "this", ")", ";", "}" ]
Apply a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range to this matrix. <p> This method is equivalent to calling {@link #ortho(float, float, float, float, float, float, boolean) ortho()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetric(float, float, float, float, boolean) setOrthoSymmetric()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetric(float, float, float, float, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Apply", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", "to", "this", "matrix", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#ortho", "(", "float", "float", "float", "float", "float", "float", "boolean", ")", "ortho", "()", "}", "with", "<code", ">", "left", "=", "-", "width", "/", "2<", "/", "code", ">", "<code", ">", "right", "=", "+", "width", "/", "2<", "/", "code", ">", "<code", ">", "bottom", "=", "-", "height", "/", "2<", "/", "code", ">", "and", "<code", ">", "top", "=", "+", "height", "/", "2<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "O<", "/", "code", ">", "the", "orthographic", "projection", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "O<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "O", "*", "v<", "/", "code", ">", "the", "orthographic", "projection", "transformation", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "symmetric", "orthographic", "projection", "without", "post", "-", "multiplying", "it", "use", "{", "@link", "#setOrthoSymmetric", "(", "float", "float", "float", "float", "boolean", ")", "setOrthoSymmetric", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "www", ".", "songho", ".", "ca", "/", "opengl", "/", "gl_projectionmatrix", ".", "html#ortho", ">", "http", ":", "//", "www", ".", "songho", ".", "ca<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5323-L5325
tzaeschke/zoodb
src/org/zoodb/internal/GenericObject.java
GenericObject.newEmptyInstance
static GenericObject newEmptyInstance(ZooClassDef def, AbstractCache cache) { long oid = def.getProvidedContext().getNode().getOidBuffer().allocateOid(); return newEmptyInstance(oid, def, cache); }
java
static GenericObject newEmptyInstance(ZooClassDef def, AbstractCache cache) { long oid = def.getProvidedContext().getNode().getOidBuffer().allocateOid(); return newEmptyInstance(oid, def, cache); }
[ "static", "GenericObject", "newEmptyInstance", "(", "ZooClassDef", "def", ",", "AbstractCache", "cache", ")", "{", "long", "oid", "=", "def", ".", "getProvidedContext", "(", ")", ".", "getNode", "(", ")", ".", "getOidBuffer", "(", ")", ".", "allocateOid", "(", ")", ";", "return", "newEmptyInstance", "(", "oid", ",", "def", ",", "cache", ")", ";", "}" ]
Creates new instances. @param def @return A new empty generic object.
[ "Creates", "new", "instances", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/GenericObject.java#L135-L138
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java
CFMLExpressionInterpreter.startElement
private Ref startElement(String name) throws PageException { // check function if (!limited && cfml.isCurrent('(')) { FunctionLibFunction function = fld.getFunction(name); Ref[] arguments = functionArg(name, true, function, ')'); if (function != null) return new BIFCall(function, arguments); Ref ref = new lucee.runtime.interpreter.ref.var.Scope(Scope.SCOPE_UNDEFINED); return new UDFCall(ref, name, arguments); } // check scope return scope(name); }
java
private Ref startElement(String name) throws PageException { // check function if (!limited && cfml.isCurrent('(')) { FunctionLibFunction function = fld.getFunction(name); Ref[] arguments = functionArg(name, true, function, ')'); if (function != null) return new BIFCall(function, arguments); Ref ref = new lucee.runtime.interpreter.ref.var.Scope(Scope.SCOPE_UNDEFINED); return new UDFCall(ref, name, arguments); } // check scope return scope(name); }
[ "private", "Ref", "startElement", "(", "String", "name", ")", "throws", "PageException", "{", "// check function", "if", "(", "!", "limited", "&&", "cfml", ".", "isCurrent", "(", "'", "'", ")", ")", "{", "FunctionLibFunction", "function", "=", "fld", ".", "getFunction", "(", "name", ")", ";", "Ref", "[", "]", "arguments", "=", "functionArg", "(", "name", ",", "true", ",", "function", ",", "'", "'", ")", ";", "if", "(", "function", "!=", "null", ")", "return", "new", "BIFCall", "(", "function", ",", "arguments", ")", ";", "Ref", "ref", "=", "new", "lucee", ".", "runtime", ".", "interpreter", ".", "ref", ".", "var", ".", "Scope", "(", "Scope", ".", "SCOPE_UNDEFINED", ")", ";", "return", "new", "UDFCall", "(", "ref", ",", "name", ",", "arguments", ")", ";", "}", "// check scope", "return", "scope", "(", "name", ")", ";", "}" ]
Extrahiert den Start Element einer Variale, dies ist entweder eine Funktion, eine Scope Definition oder eine undefinierte Variable. <br /> EBNF:<br /> <code>identifier "(" functionArg ")" | scope | identifier;</code> @param name Einstiegsname @return CFXD Element @throws PageException
[ "Extrahiert", "den", "Start", "Element", "einer", "Variale", "dies", "ist", "entweder", "eine", "Funktion", "eine", "Scope", "Definition", "oder", "eine", "undefinierte", "Variable", ".", "<br", "/", ">", "EBNF", ":", "<br", "/", ">", "<code", ">", "identifier", "(", "functionArg", ")", "|", "scope", "|", "identifier", ";", "<", "/", "code", ">" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L1277-L1290
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java
ReplicationsInner.beginCreate
public ReplicationInner beginCreate(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).toBlocking().single().body(); }
java
public ReplicationInner beginCreate(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).toBlocking().single().body(); }
[ "public", "ReplicationInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "replicationName", ",", "ReplicationInner", "replication", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "replicationName", ",", "replication", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a replication for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param replicationName The name of the replication. @param replication The parameters for creating a replication. @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 ReplicationInner object if successful.
[ "Creates", "a", "replication", "for", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java#L294-L296
brianwhu/xillium
data/src/main/java/org/xillium/data/persistence/Persistence.java
Persistence.doReadOnly
public <T, F> T doReadOnly(F facility, Task<T, F> task) { return doTransaction(facility, task, _readonly); }
java
public <T, F> T doReadOnly(F facility, Task<T, F> task) { return doTransaction(facility, task, _readonly); }
[ "public", "<", "T", ",", "F", ">", "T", "doReadOnly", "(", "F", "facility", ",", "Task", "<", "T", ",", "F", ">", "task", ")", "{", "return", "doTransaction", "(", "facility", ",", "task", ",", "_readonly", ")", ";", "}" ]
Executes a task within a read-only transaction. Any exception rolls back the transaction and gets rethrown as a RuntimeException.
[ "Executes", "a", "task", "within", "a", "read", "-", "only", "transaction", ".", "Any", "exception", "rolls", "back", "the", "transaction", "and", "gets", "rethrown", "as", "a", "RuntimeException", "." ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/persistence/Persistence.java#L36-L38
bazaarvoice/emodb
sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStreaming.java
DataStoreStreaming.updateAllForFacade
public static void updateAllForFacade(DataStore dataStore, Iterator<Update> updateIter, Set<String> tags) { // Invoke dataStore.updateAll() with smallish batches so if one batch fails due to server failure, we will // fail over to another server using the Ostrich retry/failover infrastructure and continue from the point // of the failure. // Use time-based partitioning that adjusts batch sizes dynamically in an effort to settle on a batches that // take 500 milliseconds to execute. This should make the TimeLimitedIterator used by the DataStoreClient // unnecessary, but the TimeLimitedIterator is still relevant for clients that don't use DataStoreStreaming. // For now, hard-code initial/min/max/goal values. Iterator<List<Update>> batchIter = new TimePartitioningIterator<>(updateIter, 50, 1, 2500, Duration.ofMillis(500L)); while (batchIter.hasNext()) { // Ostrich will retry each batch as necessary dataStore.updateAllForFacade(batchIter.next(), tags); } }
java
public static void updateAllForFacade(DataStore dataStore, Iterator<Update> updateIter, Set<String> tags) { // Invoke dataStore.updateAll() with smallish batches so if one batch fails due to server failure, we will // fail over to another server using the Ostrich retry/failover infrastructure and continue from the point // of the failure. // Use time-based partitioning that adjusts batch sizes dynamically in an effort to settle on a batches that // take 500 milliseconds to execute. This should make the TimeLimitedIterator used by the DataStoreClient // unnecessary, but the TimeLimitedIterator is still relevant for clients that don't use DataStoreStreaming. // For now, hard-code initial/min/max/goal values. Iterator<List<Update>> batchIter = new TimePartitioningIterator<>(updateIter, 50, 1, 2500, Duration.ofMillis(500L)); while (batchIter.hasNext()) { // Ostrich will retry each batch as necessary dataStore.updateAllForFacade(batchIter.next(), tags); } }
[ "public", "static", "void", "updateAllForFacade", "(", "DataStore", "dataStore", ",", "Iterator", "<", "Update", ">", "updateIter", ",", "Set", "<", "String", ">", "tags", ")", "{", "// Invoke dataStore.updateAll() with smallish batches so if one batch fails due to server failure, we will", "// fail over to another server using the Ostrich retry/failover infrastructure and continue from the point", "// of the failure.", "// Use time-based partitioning that adjusts batch sizes dynamically in an effort to settle on a batches that", "// take 500 milliseconds to execute. This should make the TimeLimitedIterator used by the DataStoreClient", "// unnecessary, but the TimeLimitedIterator is still relevant for clients that don't use DataStoreStreaming.", "// For now, hard-code initial/min/max/goal values.", "Iterator", "<", "List", "<", "Update", ">>", "batchIter", "=", "new", "TimePartitioningIterator", "<>", "(", "updateIter", ",", "50", ",", "1", ",", "2500", ",", "Duration", ".", "ofMillis", "(", "500L", ")", ")", ";", "while", "(", "batchIter", ".", "hasNext", "(", ")", ")", "{", "// Ostrich will retry each batch as necessary", "dataStore", ".", "updateAllForFacade", "(", "batchIter", ".", "next", "(", ")", ",", "tags", ")", ";", "}", "}" ]
Creates, updates or deletes zero or more pieces of content in the data store facades.
[ "Creates", "updates", "or", "deletes", "zero", "or", "more", "pieces", "of", "content", "in", "the", "data", "store", "facades", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStreaming.java#L185-L199
alkacon/opencms-core
src/org/opencms/ade/containerpage/inherited/CmsInheritedContainerState.java
CmsInheritedContainerState.addConfigurations
public void addConfigurations(CmsContainerConfigurationCache cache, String rootPath, String name) { String currentPath = rootPath; List<CmsContainerConfiguration> configurations = new ArrayList<CmsContainerConfiguration>(); CmsContainerConfigurationCacheState state = cache.getState(); while (currentPath != null) { CmsContainerConfiguration configuration = state.getContainerConfiguration(currentPath, name); if (configuration == null) { configuration = CmsContainerConfiguration.emptyConfiguration(); } configuration.setPath(currentPath); configurations.add(configuration); currentPath = CmsResource.getParentFolder(currentPath); } Collections.reverse(configurations); for (CmsContainerConfiguration configuration : configurations) { if (configuration != null) { addConfiguration(configuration); } } }
java
public void addConfigurations(CmsContainerConfigurationCache cache, String rootPath, String name) { String currentPath = rootPath; List<CmsContainerConfiguration> configurations = new ArrayList<CmsContainerConfiguration>(); CmsContainerConfigurationCacheState state = cache.getState(); while (currentPath != null) { CmsContainerConfiguration configuration = state.getContainerConfiguration(currentPath, name); if (configuration == null) { configuration = CmsContainerConfiguration.emptyConfiguration(); } configuration.setPath(currentPath); configurations.add(configuration); currentPath = CmsResource.getParentFolder(currentPath); } Collections.reverse(configurations); for (CmsContainerConfiguration configuration : configurations) { if (configuration != null) { addConfiguration(configuration); } } }
[ "public", "void", "addConfigurations", "(", "CmsContainerConfigurationCache", "cache", ",", "String", "rootPath", ",", "String", "name", ")", "{", "String", "currentPath", "=", "rootPath", ";", "List", "<", "CmsContainerConfiguration", ">", "configurations", "=", "new", "ArrayList", "<", "CmsContainerConfiguration", ">", "(", ")", ";", "CmsContainerConfigurationCacheState", "state", "=", "cache", ".", "getState", "(", ")", ";", "while", "(", "currentPath", "!=", "null", ")", "{", "CmsContainerConfiguration", "configuration", "=", "state", ".", "getContainerConfiguration", "(", "currentPath", ",", "name", ")", ";", "if", "(", "configuration", "==", "null", ")", "{", "configuration", "=", "CmsContainerConfiguration", ".", "emptyConfiguration", "(", ")", ";", "}", "configuration", ".", "setPath", "(", "currentPath", ")", ";", "configurations", ".", "add", "(", "configuration", ")", ";", "currentPath", "=", "CmsResource", ".", "getParentFolder", "(", "currentPath", ")", ";", "}", "Collections", ".", "reverse", "(", "configurations", ")", ";", "for", "(", "CmsContainerConfiguration", "configuration", ":", "configurations", ")", "{", "if", "(", "configuration", "!=", "null", ")", "{", "addConfiguration", "(", "configuration", ")", ";", "}", "}", "}" ]
Reads the configurations for a root path and its parents from a cache instance and adds them to this state.<p> @param cache the cache instance @param rootPath the root path @param name the name of the container configuration
[ "Reads", "the", "configurations", "for", "a", "root", "path", "and", "its", "parents", "from", "a", "cache", "instance", "and", "adds", "them", "to", "this", "state", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/inherited/CmsInheritedContainerState.java#L70-L90
datacleaner/AnalyzerBeans
core/src/main/java/org/eobjects/analyzer/util/SystemProperties.java
SystemProperties.getString
public static String getString(String key, String valueIfNull) { String value = System.getProperty(key); if (Strings.isNullOrEmpty(value)) { return valueIfNull; } return value; }
java
public static String getString(String key, String valueIfNull) { String value = System.getProperty(key); if (Strings.isNullOrEmpty(value)) { return valueIfNull; } return value; }
[ "public", "static", "String", "getString", "(", "String", "key", ",", "String", "valueIfNull", ")", "{", "String", "value", "=", "System", ".", "getProperty", "(", "key", ")", ";", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "value", ")", ")", "{", "return", "valueIfNull", ";", "}", "return", "value", ";", "}" ]
Gets a system property string, or a replacement value if the property is null or blank. @param key @param valueIfNull @return
[ "Gets", "a", "system", "property", "string", "or", "a", "replacement", "value", "if", "the", "property", "is", "null", "or", "blank", "." ]
train
https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/util/SystemProperties.java#L47-L53
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java
PipelineBuilder.addAndExpression
public void addAndExpression(final INodeReadTrx mTransaction) { assert getPipeStack().size() >= 2; final AbsAxis mOperand2 = getPipeStack().pop().getExpr(); final AbsAxis operand1 = getPipeStack().pop().getExpr(); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add(new AndExpr(mTransaction, operand1, mOperand2)); }
java
public void addAndExpression(final INodeReadTrx mTransaction) { assert getPipeStack().size() >= 2; final AbsAxis mOperand2 = getPipeStack().pop().getExpr(); final AbsAxis operand1 = getPipeStack().pop().getExpr(); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add(new AndExpr(mTransaction, operand1, mOperand2)); }
[ "public", "void", "addAndExpression", "(", "final", "INodeReadTrx", "mTransaction", ")", "{", "assert", "getPipeStack", "(", ")", ".", "size", "(", ")", ">=", "2", ";", "final", "AbsAxis", "mOperand2", "=", "getPipeStack", "(", ")", ".", "pop", "(", ")", ".", "getExpr", "(", ")", ";", "final", "AbsAxis", "operand1", "=", "getPipeStack", "(", ")", ".", "pop", "(", ")", ".", "getExpr", "(", ")", ";", "if", "(", "getPipeStack", "(", ")", ".", "empty", "(", ")", "||", "getExpression", "(", ")", ".", "getSize", "(", ")", "!=", "0", ")", "{", "addExpressionSingle", "(", ")", ";", "}", "getExpression", "(", ")", ".", "add", "(", "new", "AndExpr", "(", "mTransaction", ",", "operand1", ",", "mOperand2", ")", ")", ";", "}" ]
Adds a and expression to the pipeline. @param mTransaction Transaction to operate with.
[ "Adds", "a", "and", "expression", "to", "the", "pipeline", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L420-L429
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java
ReUtil.findAll
public static <T extends Collection<String>> T findAll(String regex, CharSequence content, int group, T collection) { if (null == regex) { return collection; } return findAll(Pattern.compile(regex, Pattern.DOTALL), content, group, collection); }
java
public static <T extends Collection<String>> T findAll(String regex, CharSequence content, int group, T collection) { if (null == regex) { return collection; } return findAll(Pattern.compile(regex, Pattern.DOTALL), content, group, collection); }
[ "public", "static", "<", "T", "extends", "Collection", "<", "String", ">", ">", "T", "findAll", "(", "String", "regex", ",", "CharSequence", "content", ",", "int", "group", ",", "T", "collection", ")", "{", "if", "(", "null", "==", "regex", ")", "{", "return", "collection", ";", "}", "return", "findAll", "(", "Pattern", ".", "compile", "(", "regex", ",", "Pattern", ".", "DOTALL", ")", ",", "content", ",", "group", ",", "collection", ")", ";", "}" ]
取得内容中匹配的所有结果 @param <T> 集合类型 @param regex 正则 @param content 被查找的内容 @param group 正则的分组 @param collection 返回的集合类型 @return 结果集
[ "取得内容中匹配的所有结果" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L402-L408
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Project.java
Project.createEpic
public Epic createEpic(String name, Map<String, Object> attributes) { return getInstance().create().epic(name, this, attributes); }
java
public Epic createEpic(String name, Map<String, Object> attributes) { return getInstance().create().epic(name, this, attributes); }
[ "public", "Epic", "createEpic", "(", "String", "name", ",", "Map", "<", "String", ",", "Object", ">", "attributes", ")", "{", "return", "getInstance", "(", ")", ".", "create", "(", ")", ".", "epic", "(", "name", ",", "this", ",", "attributes", ")", ";", "}" ]
Create a new Epic in this Project. @param name The initial name of the Epic. @param attributes additional attributes for the Epic. @return A new Epic.
[ "Create", "a", "new", "Epic", "in", "this", "Project", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Project.java#L195-L197
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java
Deflater.setDictionary
public void setDictionary(byte[] b, int off, int len) { if (b == null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len) { throw new ArrayIndexOutOfBoundsException(); } synchronized (zsRef) { ensureOpen(); setDictionary(zsRef.address(), b, off, len); } }
java
public void setDictionary(byte[] b, int off, int len) { if (b == null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len) { throw new ArrayIndexOutOfBoundsException(); } synchronized (zsRef) { ensureOpen(); setDictionary(zsRef.address(), b, off, len); } }
[ "public", "void", "setDictionary", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "{", "if", "(", "b", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "off", "<", "0", "||", "len", "<", "0", "||", "off", ">", "b", ".", "length", "-", "len", ")", "{", "throw", "new", "ArrayIndexOutOfBoundsException", "(", ")", ";", "}", "synchronized", "(", "zsRef", ")", "{", "ensureOpen", "(", ")", ";", "setDictionary", "(", "zsRef", ".", "address", "(", ")", ",", "b", ",", "off", ",", "len", ")", ";", "}", "}" ]
Sets preset dictionary for compression. A preset dictionary is used when the history buffer can be predetermined. When the data is later uncompressed with Inflater.inflate(), Inflater.getAdler() can be called in order to get the Adler-32 value of the dictionary required for decompression. @param b the dictionary data bytes @param off the start offset of the data @param len the length of the data @see Inflater#inflate @see Inflater#getAdler
[ "Sets", "preset", "dictionary", "for", "compression", ".", "A", "preset", "dictionary", "is", "used", "when", "the", "history", "buffer", "can", "be", "predetermined", ".", "When", "the", "data", "is", "later", "uncompressed", "with", "Inflater", ".", "inflate", "()", "Inflater", ".", "getAdler", "()", "can", "be", "called", "in", "order", "to", "get", "the", "Adler", "-", "32", "value", "of", "the", "dictionary", "required", "for", "decompression", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java#L237-L248
Trilarion/java-vorbis-support
src/main/java/com/github/trilarion/sound/sampled/spi/TAudioFileReader.java
TAudioFileReader.getAudioFileFormat
@Override public AudioFileFormat getAudioFileFormat(InputStream inputStream) throws UnsupportedAudioFileException, IOException { LOG.log(Level.FINE, "TAudioFileReader.getAudioFileFormat(InputStream): begin (class: {0})", getClass().getSimpleName()); long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED; if (!inputStream.markSupported()) { inputStream = new BufferedInputStream(inputStream, getMarkLimit()); } inputStream.mark(getMarkLimit()); AudioFileFormat audioFileFormat; try { audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes); } finally { /* TODO: required semantics is unclear: should reset() be executed only when there is an exception or should it be done always? */ inputStream.reset(); } LOG.log(Level.FINE, "TAudioFileReader.getAudioFileFormat(InputStream): end"); return audioFileFormat; }
java
@Override public AudioFileFormat getAudioFileFormat(InputStream inputStream) throws UnsupportedAudioFileException, IOException { LOG.log(Level.FINE, "TAudioFileReader.getAudioFileFormat(InputStream): begin (class: {0})", getClass().getSimpleName()); long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED; if (!inputStream.markSupported()) { inputStream = new BufferedInputStream(inputStream, getMarkLimit()); } inputStream.mark(getMarkLimit()); AudioFileFormat audioFileFormat; try { audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes); } finally { /* TODO: required semantics is unclear: should reset() be executed only when there is an exception or should it be done always? */ inputStream.reset(); } LOG.log(Level.FINE, "TAudioFileReader.getAudioFileFormat(InputStream): end"); return audioFileFormat; }
[ "@", "Override", "public", "AudioFileFormat", "getAudioFileFormat", "(", "InputStream", "inputStream", ")", "throws", "UnsupportedAudioFileException", ",", "IOException", "{", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"TAudioFileReader.getAudioFileFormat(InputStream): begin (class: {0})\"", ",", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "long", "lFileLengthInBytes", "=", "AudioSystem", ".", "NOT_SPECIFIED", ";", "if", "(", "!", "inputStream", ".", "markSupported", "(", ")", ")", "{", "inputStream", "=", "new", "BufferedInputStream", "(", "inputStream", ",", "getMarkLimit", "(", ")", ")", ";", "}", "inputStream", ".", "mark", "(", "getMarkLimit", "(", ")", ")", ";", "AudioFileFormat", "audioFileFormat", ";", "try", "{", "audioFileFormat", "=", "getAudioFileFormat", "(", "inputStream", ",", "lFileLengthInBytes", ")", ";", "}", "finally", "{", "/* TODO: required semantics is unclear: should reset()\n be executed only when there is an exception or\n should it be done always?\n */", "inputStream", ".", "reset", "(", ")", ";", "}", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"TAudioFileReader.getAudioFileFormat(InputStream): end\"", ")", ";", "return", "audioFileFormat", ";", "}" ]
Get an AudioFileFormat object for an InputStream. This method calls getAudioFileFormat(InputStream, long). Subclasses should not override this method unless there are really severe reasons. Normally, it is sufficient to implement getAudioFileFormat(InputStream, long). @param inputStream the stream to read from. @return an AudioFileFormat instance containing information from the header of the stream passed in. @throws javax.sound.sampled.UnsupportedAudioFileException @throws java.io.IOException
[ "Get", "an", "AudioFileFormat", "object", "for", "an", "InputStream", ".", "This", "method", "calls", "getAudioFileFormat", "(", "InputStream", "long", ")", ".", "Subclasses", "should", "not", "override", "this", "method", "unless", "there", "are", "really", "severe", "reasons", ".", "Normally", "it", "is", "sufficient", "to", "implement", "getAudioFileFormat", "(", "InputStream", "long", ")", "." ]
train
https://github.com/Trilarion/java-vorbis-support/blob/f72aba7d97167fe0ff20b1b719fdb5bb662ff736/src/main/java/com/github/trilarion/sound/sampled/spi/TAudioFileReader.java#L132-L153
poetix/protonpack
src/main/java/com/codepoetics/protonpack/StreamUtils.java
StreamUtils.mergeToList
@SafeVarargs public static <T> Stream<List<T>> mergeToList(Stream<T>...streams) { return merge(ArrayList::new, (l, x) -> { l.add(x); return l; }, streams); }
java
@SafeVarargs public static <T> Stream<List<T>> mergeToList(Stream<T>...streams) { return merge(ArrayList::new, (l, x) -> { l.add(x); return l; }, streams); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "Stream", "<", "List", "<", "T", ">", ">", "mergeToList", "(", "Stream", "<", "T", ">", "...", "streams", ")", "{", "return", "merge", "(", "ArrayList", "::", "new", ",", "(", "l", ",", "x", ")", "->", "{", "l", ".", "add", "(", "x", ")", ";", "return", "l", ";", "}", ",", "streams", ")", ";", "}" ]
Construct a stream which merges together values from the supplied streams into lists of values, somewhat in the manner of the stream constructed by {@link com.codepoetics.protonpack.StreamUtils#zip(java.util.stream.Stream, java.util.stream.Stream, java.util.function.BiFunction)}, but for an arbitrary number of streams. @param streams The streams to merge. @param <T> The type over which the merged streams stream. @return A merging stream of lists of T.
[ "Construct", "a", "stream", "which", "merges", "together", "values", "from", "the", "supplied", "streams", "into", "lists", "of", "values", "somewhat", "in", "the", "manner", "of", "the", "stream", "constructed", "by", "{", "@link", "com", ".", "codepoetics", ".", "protonpack", ".", "StreamUtils#zip", "(", "java", ".", "util", ".", "stream", ".", "Stream", "java", ".", "util", ".", "stream", ".", "Stream", "java", ".", "util", ".", "function", ".", "BiFunction", ")", "}", "but", "for", "an", "arbitrary", "number", "of", "streams", "." ]
train
https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L394-L400
arquillian/arquillian-core
container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java
Validate.notNullOrEmpty
public static void notNullOrEmpty(final String string, final String message) throws IllegalArgumentException { if (string == null || string.length() == 0) { throw new IllegalArgumentException(message); } }
java
public static void notNullOrEmpty(final String string, final String message) throws IllegalArgumentException { if (string == null || string.length() == 0) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "notNullOrEmpty", "(", "final", "String", "string", ",", "final", "String", "message", ")", "throws", "IllegalArgumentException", "{", "if", "(", "string", "==", "null", "||", "string", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Checks that the specified String is not null or empty, throws exception if it is. @param string The object to check @param message The exception message @throws IllegalArgumentException Thrown if obj is null
[ "Checks", "that", "the", "specified", "String", "is", "not", "null", "or", "empty", "throws", "exception", "if", "it", "is", "." ]
train
https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java#L103-L107
GoogleCloudPlatform/bigdata-interop
util-hadoop/src/main/java/com/google/cloud/hadoop/util/ConfigurationUtil.java
ConfigurationUtil.getMandatoryConfig
public static String getMandatoryConfig(Configuration config, String key) throws IOException { String value = config.get(key); if (Strings.isNullOrEmpty(value)) { throw new IOException("Must supply a value for configuration setting: " + key); } return value; }
java
public static String getMandatoryConfig(Configuration config, String key) throws IOException { String value = config.get(key); if (Strings.isNullOrEmpty(value)) { throw new IOException("Must supply a value for configuration setting: " + key); } return value; }
[ "public", "static", "String", "getMandatoryConfig", "(", "Configuration", "config", ",", "String", "key", ")", "throws", "IOException", "{", "String", "value", "=", "config", ".", "get", "(", "key", ")", ";", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "value", ")", ")", "{", "throw", "new", "IOException", "(", "\"Must supply a value for configuration setting: \"", "+", "key", ")", ";", "}", "return", "value", ";", "}" ]
Gets value for the given key or throws if value is not found.
[ "Gets", "value", "for", "the", "given", "key", "or", "throws", "if", "value", "is", "not", "found", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util-hadoop/src/main/java/com/google/cloud/hadoop/util/ConfigurationUtil.java#L35-L42
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.restoreResourceVersion
public void restoreResourceVersion(CmsUUID structureId, int version) throws CmsException { CmsResource resource = readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION); getResourceType(resource).restoreResource(this, m_securityManager, resource, version); }
java
public void restoreResourceVersion(CmsUUID structureId, int version) throws CmsException { CmsResource resource = readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION); getResourceType(resource).restoreResource(this, m_securityManager, resource, version); }
[ "public", "void", "restoreResourceVersion", "(", "CmsUUID", "structureId", ",", "int", "version", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "readResource", "(", "structureId", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ")", ";", "getResourceType", "(", "resource", ")", ".", "restoreResource", "(", "this", ",", "m_securityManager", ",", "resource", ",", "version", ")", ";", "}" ]
Restores a resource in the current project with a version from the historical archive.<p> @param structureId the structure id of the resource to restore from the archive @param version the desired version of the resource to be restored @throws CmsException if something goes wrong @see #readResource(CmsUUID, int)
[ "Restores", "a", "resource", "in", "the", "current", "project", "with", "a", "version", "from", "the", "historical", "archive", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3699-L3703
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.replaceAll
public static String replaceAll(final CharSequence self, final CharSequence regex, final CharSequence replacement) { return self.toString().replaceAll(regex.toString(), replacement.toString()); }
java
public static String replaceAll(final CharSequence self, final CharSequence regex, final CharSequence replacement) { return self.toString().replaceAll(regex.toString(), replacement.toString()); }
[ "public", "static", "String", "replaceAll", "(", "final", "CharSequence", "self", ",", "final", "CharSequence", "regex", ",", "final", "CharSequence", "replacement", ")", "{", "return", "self", ".", "toString", "(", ")", ".", "replaceAll", "(", "regex", ".", "toString", "(", ")", ",", "replacement", ".", "toString", "(", ")", ")", ";", "}" ]
Replaces each substring of this CharSequence that matches the given regular expression with the given replacement. @param self a CharSequence @param regex the capturing regex @param replacement the string to be substituted for each match @return the toString() of the CharSequence with content replaced @throws java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid @see String#replaceAll(String, String) @since 1.8.2
[ "Replaces", "each", "substring", "of", "this", "CharSequence", "that", "matches", "the", "given", "regular", "expression", "with", "the", "given", "replacement", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2468-L2470
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.setDefault
public static synchronized void setDefault(Category category, ULocale newLocale) { Locale newJavaDefault = newLocale.toLocale(); int idx = category.ordinal(); defaultCategoryULocales[idx] = newLocale; defaultCategoryLocales[idx] = newJavaDefault; JDKLocaleHelper.setDefault(category, newJavaDefault); }
java
public static synchronized void setDefault(Category category, ULocale newLocale) { Locale newJavaDefault = newLocale.toLocale(); int idx = category.ordinal(); defaultCategoryULocales[idx] = newLocale; defaultCategoryLocales[idx] = newJavaDefault; JDKLocaleHelper.setDefault(category, newJavaDefault); }
[ "public", "static", "synchronized", "void", "setDefault", "(", "Category", "category", ",", "ULocale", "newLocale", ")", "{", "Locale", "newJavaDefault", "=", "newLocale", ".", "toLocale", "(", ")", ";", "int", "idx", "=", "category", ".", "ordinal", "(", ")", ";", "defaultCategoryULocales", "[", "idx", "]", "=", "newLocale", ";", "defaultCategoryLocales", "[", "idx", "]", "=", "newJavaDefault", ";", "JDKLocaleHelper", ".", "setDefault", "(", "category", ",", "newJavaDefault", ")", ";", "}" ]
Sets the default <code>ULocale</code> for the specified <code>Category</code>. This also sets the default <code>Locale</code> for the specified <code>Category</code> of the JVM. If the caller does not have write permission to the user.language property, a security exception will be thrown, and the default ULocale for the specified Category will remain unchanged. @param category the specified category to set the default locale @param newLocale the new default locale @see SecurityManager#checkPermission(java.security.Permission) @see java.util.PropertyPermission @hide unsupported on Android
[ "Sets", "the", "default", "<code", ">", "ULocale<", "/", "code", ">", "for", "the", "specified", "<code", ">", "Category<", "/", "code", ">", ".", "This", "also", "sets", "the", "default", "<code", ">", "Locale<", "/", "code", ">", "for", "the", "specified", "<code", ">", "Category<", "/", "code", ">", "of", "the", "JVM", ".", "If", "the", "caller", "does", "not", "have", "write", "permission", "to", "the", "user", ".", "language", "property", "a", "security", "exception", "will", "be", "thrown", "and", "the", "default", "ULocale", "for", "the", "specified", "Category", "will", "remain", "unchanged", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L716-L722
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java
ShareResourcesImpl.deleteShare
public void deleteShare(long objectId, String shareId) throws SmartsheetException { this.deleteResource(getMasterResourceType() + "/" + objectId + "/shares/" + shareId, Share.class); }
java
public void deleteShare(long objectId, String shareId) throws SmartsheetException { this.deleteResource(getMasterResourceType() + "/" + objectId + "/shares/" + shareId, Share.class); }
[ "public", "void", "deleteShare", "(", "long", "objectId", ",", "String", "shareId", ")", "throws", "SmartsheetException", "{", "this", ".", "deleteResource", "(", "getMasterResourceType", "(", ")", "+", "\"/\"", "+", "objectId", "+", "\"/shares/\"", "+", "shareId", ",", "Share", ".", "class", ")", ";", "}" ]
Delete a share. It mirrors to the following Smartsheet REST API method: DELETE /workspaces/{workspaceId}/shares/{shareId} DELETE /sheets/{sheetId}/shares/{shareId} DELETE /sights/{sheetId}/shares/{shareId} DELETE /reports/{reportId}/shares/{shareId} Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param objectId the ID of the object to share @param shareId the ID of the share to delete @throws SmartsheetException the smartsheet exception
[ "Delete", "a", "share", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ShareResourcesImpl.java#L199-L201
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java
BlockPlacementPolicyConfigurable.inWindow
private boolean inWindow(DatanodeDescriptor first, DatanodeDescriptor testing) { readLock(); try { RackRingInfo rackInfo = racksMap.get(first.getNetworkLocation()); assert (rackInfo != null); Integer machineId = rackInfo.findNode(first); assert (machineId != null); final int rackWindowStart = rackInfo.index; final RackRingInfo rackTest = racksMap.get(testing.getNetworkLocation()); assert (rackTest != null); final int rackDist = (rackTest.index - rackWindowStart + racks.size()) % racks.size(); if (rackDist < rackWindow + 1 && rackTest.index != rackInfo.index) { // inside rack window final Integer idFirst = rackInfo.findNode(first); assert (idFirst != null); final int sizeFirstRack = rackInfo.rackNodes.size(); final int sizeTestRack = rackTest.rackNodes.size(); final int start = idFirst * sizeTestRack / sizeFirstRack; final Integer idTest = rackTest.findNode(testing); assert (idTest != null); final int dist = (idTest - start + sizeTestRack) % sizeTestRack; if (dist < machineWindow) { // inside machine Window return true; } } return false; } finally { readUnlock(); } }
java
private boolean inWindow(DatanodeDescriptor first, DatanodeDescriptor testing) { readLock(); try { RackRingInfo rackInfo = racksMap.get(first.getNetworkLocation()); assert (rackInfo != null); Integer machineId = rackInfo.findNode(first); assert (machineId != null); final int rackWindowStart = rackInfo.index; final RackRingInfo rackTest = racksMap.get(testing.getNetworkLocation()); assert (rackTest != null); final int rackDist = (rackTest.index - rackWindowStart + racks.size()) % racks.size(); if (rackDist < rackWindow + 1 && rackTest.index != rackInfo.index) { // inside rack window final Integer idFirst = rackInfo.findNode(first); assert (idFirst != null); final int sizeFirstRack = rackInfo.rackNodes.size(); final int sizeTestRack = rackTest.rackNodes.size(); final int start = idFirst * sizeTestRack / sizeFirstRack; final Integer idTest = rackTest.findNode(testing); assert (idTest != null); final int dist = (idTest - start + sizeTestRack) % sizeTestRack; if (dist < machineWindow) { // inside machine Window return true; } } return false; } finally { readUnlock(); } }
[ "private", "boolean", "inWindow", "(", "DatanodeDescriptor", "first", ",", "DatanodeDescriptor", "testing", ")", "{", "readLock", "(", ")", ";", "try", "{", "RackRingInfo", "rackInfo", "=", "racksMap", ".", "get", "(", "first", ".", "getNetworkLocation", "(", ")", ")", ";", "assert", "(", "rackInfo", "!=", "null", ")", ";", "Integer", "machineId", "=", "rackInfo", ".", "findNode", "(", "first", ")", ";", "assert", "(", "machineId", "!=", "null", ")", ";", "final", "int", "rackWindowStart", "=", "rackInfo", ".", "index", ";", "final", "RackRingInfo", "rackTest", "=", "racksMap", ".", "get", "(", "testing", ".", "getNetworkLocation", "(", ")", ")", ";", "assert", "(", "rackTest", "!=", "null", ")", ";", "final", "int", "rackDist", "=", "(", "rackTest", ".", "index", "-", "rackWindowStart", "+", "racks", ".", "size", "(", ")", ")", "%", "racks", ".", "size", "(", ")", ";", "if", "(", "rackDist", "<", "rackWindow", "+", "1", "&&", "rackTest", ".", "index", "!=", "rackInfo", ".", "index", ")", "{", "// inside rack window", "final", "Integer", "idFirst", "=", "rackInfo", ".", "findNode", "(", "first", ")", ";", "assert", "(", "idFirst", "!=", "null", ")", ";", "final", "int", "sizeFirstRack", "=", "rackInfo", ".", "rackNodes", ".", "size", "(", ")", ";", "final", "int", "sizeTestRack", "=", "rackTest", ".", "rackNodes", ".", "size", "(", ")", ";", "final", "int", "start", "=", "idFirst", "*", "sizeTestRack", "/", "sizeFirstRack", ";", "final", "Integer", "idTest", "=", "rackTest", ".", "findNode", "(", "testing", ")", ";", "assert", "(", "idTest", "!=", "null", ")", ";", "final", "int", "dist", "=", "(", "idTest", "-", "start", "+", "sizeTestRack", ")", "%", "sizeTestRack", ";", "if", "(", "dist", "<", "machineWindow", ")", "{", "// inside machine Window", "return", "true", ";", "}", "}", "return", "false", ";", "}", "finally", "{", "readUnlock", "(", ")", ";", "}", "}" ]
Verifies if testing node is within right windows of first node @param first first node being considered @param testing node we are testing to check if it is within window or not @return We return true if it is successful, and not otherwise
[ "Verifies", "if", "testing", "node", "is", "within", "right", "windows", "of", "first", "node" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L448-L489
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java
ConstructState.addConstructState
public void addConstructState(Constructs construct, ConstructState constructState, Optional<String> infix) { addOverwriteProperties(constructState.getOverwritePropertiesMap()); constructState.removeProp(OVERWRITE_PROPS_KEY); for (String key : constructState.getPropertyNames()) { setProp(construct.name() + "." + (infix.isPresent() ? infix.get() + "." : "") + key, constructState.getProp(key)); } addAll(constructState); }
java
public void addConstructState(Constructs construct, ConstructState constructState, Optional<String> infix) { addOverwriteProperties(constructState.getOverwritePropertiesMap()); constructState.removeProp(OVERWRITE_PROPS_KEY); for (String key : constructState.getPropertyNames()) { setProp(construct.name() + "." + (infix.isPresent() ? infix.get() + "." : "") + key, constructState.getProp(key)); } addAll(constructState); }
[ "public", "void", "addConstructState", "(", "Constructs", "construct", ",", "ConstructState", "constructState", ",", "Optional", "<", "String", ">", "infix", ")", "{", "addOverwriteProperties", "(", "constructState", ".", "getOverwritePropertiesMap", "(", ")", ")", ";", "constructState", ".", "removeProp", "(", "OVERWRITE_PROPS_KEY", ")", ";", "for", "(", "String", "key", ":", "constructState", ".", "getPropertyNames", "(", ")", ")", "{", "setProp", "(", "construct", ".", "name", "(", ")", "+", "\".\"", "+", "(", "infix", ".", "isPresent", "(", ")", "?", "infix", ".", "get", "(", ")", "+", "\".\"", ":", "\"\"", ")", "+", "key", ",", "constructState", ".", "getProp", "(", "key", ")", ")", ";", "}", "addAll", "(", "constructState", ")", ";", "}" ]
Merge a {@link ConstructState} for a child construct into this {@link ConstructState}. <p> Non-override property names will be mutated as follows: key -> construct.name() + infix + key </p> @param construct type of the child construct. @param constructState {@link ConstructState} to merge. @param infix infix added to each non-override key (for example converter number if there are multiple converters).
[ "Merge", "a", "{", "@link", "ConstructState", "}", "for", "a", "child", "construct", "into", "this", "{", "@link", "ConstructState", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java#L105-L114
vatbub/common
internet/src/main/java/com/github/vatbub/common/internet/Internet.java
Internet.sendEventToIFTTTMakerChannel
public static String sendEventToIFTTTMakerChannel(String IFTTTMakerChannelApiKey, String eventName, String details1) throws IOException { return sendEventToIFTTTMakerChannel(IFTTTMakerChannelApiKey, eventName, details1, ""); }
java
public static String sendEventToIFTTTMakerChannel(String IFTTTMakerChannelApiKey, String eventName, String details1) throws IOException { return sendEventToIFTTTMakerChannel(IFTTTMakerChannelApiKey, eventName, details1, ""); }
[ "public", "static", "String", "sendEventToIFTTTMakerChannel", "(", "String", "IFTTTMakerChannelApiKey", ",", "String", "eventName", ",", "String", "details1", ")", "throws", "IOException", "{", "return", "sendEventToIFTTTMakerChannel", "(", "IFTTTMakerChannelApiKey", ",", "eventName", ",", "details1", ",", "\"\"", ")", ";", "}" ]
Sends an event to the IFTTT Maker Channel. See <a href="https://maker.ifttt.com/use/">https://maker.ifttt.com/use/</a> for more information. @param IFTTTMakerChannelApiKey Your Maker API Key. Get your one on <a href="https://ifttt.com/maker">https://ifttt.com/maker</a> @param eventName The name of the event to trigger. @param details1 You can send up to three additional fields to the Maker channel which you can use then as IFTTT ingredients. See <a href= "https://maker.ifttt.com/use/">https://maker.ifttt.com/use/</a> for more information. @return The response text from IFTTT @throws IOException Should actually never be thrown but occurs if something is wrong with the connection (e. g. not connected)
[ "Sends", "an", "event", "to", "the", "IFTTT", "Maker", "Channel", ".", "See", "<a", "href", "=", "https", ":", "//", "maker", ".", "ifttt", ".", "com", "/", "use", "/", ">", "https", ":", "//", "maker", ".", "ifttt", ".", "com", "/", "use", "/", "<", "/", "a", ">", "for", "more", "information", "." ]
train
https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/internet/src/main/java/com/github/vatbub/common/internet/Internet.java#L88-L91
looly/hutool
hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java
ComparatorChain.compare
@Override public int compare(final E o1, final E o2) throws UnsupportedOperationException { if (lock == false) { checkChainIntegrity(); lock = true; } final Iterator<Comparator<E>> comparators = chain.iterator(); Comparator<? super E> comparator; int retval; for (int comparatorIndex = 0; comparators.hasNext(); ++comparatorIndex) { comparator = comparators.next(); retval = comparator.compare(o1, o2); if (retval != 0) { // invert the order if it is a reverse sort if (true == orderingBits.get(comparatorIndex)) { retval = (retval > 0) ? -1 : 1; } return retval; } } // if comparators are exhausted, return 0 return 0; }
java
@Override public int compare(final E o1, final E o2) throws UnsupportedOperationException { if (lock == false) { checkChainIntegrity(); lock = true; } final Iterator<Comparator<E>> comparators = chain.iterator(); Comparator<? super E> comparator; int retval; for (int comparatorIndex = 0; comparators.hasNext(); ++comparatorIndex) { comparator = comparators.next(); retval = comparator.compare(o1, o2); if (retval != 0) { // invert the order if it is a reverse sort if (true == orderingBits.get(comparatorIndex)) { retval = (retval > 0) ? -1 : 1; } return retval; } } // if comparators are exhausted, return 0 return 0; }
[ "@", "Override", "public", "int", "compare", "(", "final", "E", "o1", ",", "final", "E", "o2", ")", "throws", "UnsupportedOperationException", "{", "if", "(", "lock", "==", "false", ")", "{", "checkChainIntegrity", "(", ")", ";", "lock", "=", "true", ";", "}", "final", "Iterator", "<", "Comparator", "<", "E", ">", ">", "comparators", "=", "chain", ".", "iterator", "(", ")", ";", "Comparator", "<", "?", "super", "E", ">", "comparator", ";", "int", "retval", ";", "for", "(", "int", "comparatorIndex", "=", "0", ";", "comparators", ".", "hasNext", "(", ")", ";", "++", "comparatorIndex", ")", "{", "comparator", "=", "comparators", ".", "next", "(", ")", ";", "retval", "=", "comparator", ".", "compare", "(", "o1", ",", "o2", ")", ";", "if", "(", "retval", "!=", "0", ")", "{", "// invert the order if it is a reverse sort\r", "if", "(", "true", "==", "orderingBits", ".", "get", "(", "comparatorIndex", ")", ")", "{", "retval", "=", "(", "retval", ">", "0", ")", "?", "-", "1", ":", "1", ";", "}", "return", "retval", ";", "}", "}", "// if comparators are exhausted, return 0\r", "return", "0", ";", "}" ]
执行比较<br> 按照比较器链的顺序分别比较,如果比较出相等则转向下一个比较器,否则直接返回 @param o1 第一个对象 @param o2 第二个对象 @return -1, 0, or 1 @throws UnsupportedOperationException 如果比较器链为空,无法完成比较
[ "执行比较<br", ">", "按照比较器链的顺序分别比较,如果比较出相等则转向下一个比较器,否则直接返回" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java#L203-L227
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/JsonRpcUtils.java
JsonRpcUtils.callHttpGet
public static RequestResponse callHttpGet(String url, Map<String, Object> headers, Map<String, Object> urlParams) { return callHttpGet(httpJsonRpcClient, url, headers, urlParams); }
java
public static RequestResponse callHttpGet(String url, Map<String, Object> headers, Map<String, Object> urlParams) { return callHttpGet(httpJsonRpcClient, url, headers, urlParams); }
[ "public", "static", "RequestResponse", "callHttpGet", "(", "String", "url", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "Map", "<", "String", ",", "Object", ">", "urlParams", ")", "{", "return", "callHttpGet", "(", "httpJsonRpcClient", ",", "url", ",", "headers", ",", "urlParams", ")", ";", "}" ]
Perform a HTTP GET request. @param url @param headers @param urlParams @return
[ "Perform", "a", "HTTP", "GET", "request", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/JsonRpcUtils.java#L90-L93
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseBlock
private Stmt.Block parseBlock(EnclosingScope scope, boolean isLoop) { // First, determine the initial indentation of this block based on the // first statement (or null if there is no statement). Indent indent = getIndent(); // We must clone the environment here, in order to ensure variables // declared within this block are properly scoped. EnclosingScope blockScope = scope.newEnclosingScope(indent, isLoop); // Second, check that this is indeed the initial indentation for this // block (i.e. that it is strictly greater than parent indent). if (indent == null || indent.lessThanEq(scope.getIndent())) { // Initial indent either doesn't exist or is not strictly greater // than parent indent and,therefore, signals an empty block. // return new Stmt.Block(); } else { // Initial indent is valid, so we proceed parsing statements with // the appropriate level of indent. ArrayList<Stmt> stmts = new ArrayList<>(); Indent nextIndent; while ((nextIndent = getIndent()) != null && indent.lessThanEq(nextIndent)) { // At this point, nextIndent contains the indent of the current // statement. However, this still may not be equivalent to this // block's indentation level. // // First, check the indentation matches that for this block. if (!indent.equivalent(nextIndent)) { // No, it's not equivalent so signal an error. syntaxError("unexpected end-of-block", nextIndent); } // Second, parse the actual statement at this point! stmts.add(parseStatement(blockScope)); } // Finally, construct the block return new Stmt.Block(stmts.toArray(new Stmt[stmts.size()])); } }
java
private Stmt.Block parseBlock(EnclosingScope scope, boolean isLoop) { // First, determine the initial indentation of this block based on the // first statement (or null if there is no statement). Indent indent = getIndent(); // We must clone the environment here, in order to ensure variables // declared within this block are properly scoped. EnclosingScope blockScope = scope.newEnclosingScope(indent, isLoop); // Second, check that this is indeed the initial indentation for this // block (i.e. that it is strictly greater than parent indent). if (indent == null || indent.lessThanEq(scope.getIndent())) { // Initial indent either doesn't exist or is not strictly greater // than parent indent and,therefore, signals an empty block. // return new Stmt.Block(); } else { // Initial indent is valid, so we proceed parsing statements with // the appropriate level of indent. ArrayList<Stmt> stmts = new ArrayList<>(); Indent nextIndent; while ((nextIndent = getIndent()) != null && indent.lessThanEq(nextIndent)) { // At this point, nextIndent contains the indent of the current // statement. However, this still may not be equivalent to this // block's indentation level. // // First, check the indentation matches that for this block. if (!indent.equivalent(nextIndent)) { // No, it's not equivalent so signal an error. syntaxError("unexpected end-of-block", nextIndent); } // Second, parse the actual statement at this point! stmts.add(parseStatement(blockScope)); } // Finally, construct the block return new Stmt.Block(stmts.toArray(new Stmt[stmts.size()])); } }
[ "private", "Stmt", ".", "Block", "parseBlock", "(", "EnclosingScope", "scope", ",", "boolean", "isLoop", ")", "{", "// First, determine the initial indentation of this block based on the", "// first statement (or null if there is no statement).", "Indent", "indent", "=", "getIndent", "(", ")", ";", "// We must clone the environment here, in order to ensure variables", "// declared within this block are properly scoped.", "EnclosingScope", "blockScope", "=", "scope", ".", "newEnclosingScope", "(", "indent", ",", "isLoop", ")", ";", "// Second, check that this is indeed the initial indentation for this", "// block (i.e. that it is strictly greater than parent indent).", "if", "(", "indent", "==", "null", "||", "indent", ".", "lessThanEq", "(", "scope", ".", "getIndent", "(", ")", ")", ")", "{", "// Initial indent either doesn't exist or is not strictly greater", "// than parent indent and,therefore, signals an empty block.", "//", "return", "new", "Stmt", ".", "Block", "(", ")", ";", "}", "else", "{", "// Initial indent is valid, so we proceed parsing statements with", "// the appropriate level of indent.", "ArrayList", "<", "Stmt", ">", "stmts", "=", "new", "ArrayList", "<>", "(", ")", ";", "Indent", "nextIndent", ";", "while", "(", "(", "nextIndent", "=", "getIndent", "(", ")", ")", "!=", "null", "&&", "indent", ".", "lessThanEq", "(", "nextIndent", ")", ")", "{", "// At this point, nextIndent contains the indent of the current", "// statement. However, this still may not be equivalent to this", "// block's indentation level.", "//", "// First, check the indentation matches that for this block.", "if", "(", "!", "indent", ".", "equivalent", "(", "nextIndent", ")", ")", "{", "// No, it's not equivalent so signal an error.", "syntaxError", "(", "\"unexpected end-of-block\"", ",", "nextIndent", ")", ";", "}", "// Second, parse the actual statement at this point!", "stmts", ".", "add", "(", "parseStatement", "(", "blockScope", ")", ")", ";", "}", "// Finally, construct the block", "return", "new", "Stmt", ".", "Block", "(", "stmts", ".", "toArray", "(", "new", "Stmt", "[", "stmts", ".", "size", "(", ")", "]", ")", ")", ";", "}", "}" ]
Parse a block of zero or more statements which share the same indentation level. Their indentation level must be strictly greater than that of their parent, otherwise the end of block is signaled. The <i>indentation level</i> for the block is set by the first statement encountered (assuming their is one). An error occurs if a subsequent statement is reached with an indentation level <i>greater</i> than the block's indentation level. @param parentIndent The indentation level of the parent, for which all statements in this block must have a greater indent. May not be <code>null</code>. @param isLoop Indicates whether or not this block represents the body of a loop. This is important in order to setup the scope for this block appropriately. @return
[ "Parse", "a", "block", "of", "zero", "or", "more", "statements", "which", "share", "the", "same", "indentation", "level", ".", "Their", "indentation", "level", "must", "be", "strictly", "greater", "than", "that", "of", "their", "parent", "otherwise", "the", "end", "of", "block", "is", "signaled", ".", "The", "<i", ">", "indentation", "level<", "/", "i", ">", "for", "the", "block", "is", "set", "by", "the", "first", "statement", "encountered", "(", "assuming", "their", "is", "one", ")", ".", "An", "error", "occurs", "if", "a", "subsequent", "statement", "is", "reached", "with", "an", "indentation", "level", "<i", ">", "greater<", "/", "i", ">", "than", "the", "block", "s", "indentation", "level", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L628-L663
JRebirth/JRebirth
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java
AbstractSlideModel.buildHorizontalAnimation
protected Animation buildHorizontalAnimation(final double fromX, final double toX, final double fromY, final double toY) { final double angle = findAngle(fromX, toX, fromY, toY); final MotionBlur mb = MotionBlurBuilder.create().angle(angle).build(); node().setEffect(mb); return ParallelTransitionBuilder.create() .children( TranslateTransitionBuilder.create() .node(node()) .fromX(fromX) .toX(toX) .fromY(fromY) .toY(toY) .duration(Duration.seconds(1)) .build(), TimelineBuilder.create() .keyFrames( new KeyFrame(Duration.millis(0), new KeyValue(mb.radiusProperty(), 0)), new KeyFrame(Duration.millis(100), new KeyValue(mb.radiusProperty(), 50)), new KeyFrame(Duration.millis(500), new KeyValue(mb.radiusProperty(), 63)), new KeyFrame(Duration.millis(900), new KeyValue(mb.radiusProperty(), 50)), new KeyFrame(Duration.millis(1000), new KeyValue(mb.radiusProperty(), 0))) .build()) .build(); }
java
protected Animation buildHorizontalAnimation(final double fromX, final double toX, final double fromY, final double toY) { final double angle = findAngle(fromX, toX, fromY, toY); final MotionBlur mb = MotionBlurBuilder.create().angle(angle).build(); node().setEffect(mb); return ParallelTransitionBuilder.create() .children( TranslateTransitionBuilder.create() .node(node()) .fromX(fromX) .toX(toX) .fromY(fromY) .toY(toY) .duration(Duration.seconds(1)) .build(), TimelineBuilder.create() .keyFrames( new KeyFrame(Duration.millis(0), new KeyValue(mb.radiusProperty(), 0)), new KeyFrame(Duration.millis(100), new KeyValue(mb.radiusProperty(), 50)), new KeyFrame(Duration.millis(500), new KeyValue(mb.radiusProperty(), 63)), new KeyFrame(Duration.millis(900), new KeyValue(mb.radiusProperty(), 50)), new KeyFrame(Duration.millis(1000), new KeyValue(mb.radiusProperty(), 0))) .build()) .build(); }
[ "protected", "Animation", "buildHorizontalAnimation", "(", "final", "double", "fromX", ",", "final", "double", "toX", ",", "final", "double", "fromY", ",", "final", "double", "toY", ")", "{", "final", "double", "angle", "=", "findAngle", "(", "fromX", ",", "toX", ",", "fromY", ",", "toY", ")", ";", "final", "MotionBlur", "mb", "=", "MotionBlurBuilder", ".", "create", "(", ")", ".", "angle", "(", "angle", ")", ".", "build", "(", ")", ";", "node", "(", ")", ".", "setEffect", "(", "mb", ")", ";", "return", "ParallelTransitionBuilder", ".", "create", "(", ")", ".", "children", "(", "TranslateTransitionBuilder", ".", "create", "(", ")", ".", "node", "(", "node", "(", ")", ")", ".", "fromX", "(", "fromX", ")", ".", "toX", "(", "toX", ")", ".", "fromY", "(", "fromY", ")", ".", "toY", "(", "toY", ")", ".", "duration", "(", "Duration", ".", "seconds", "(", "1", ")", ")", ".", "build", "(", ")", ",", "TimelineBuilder", ".", "create", "(", ")", ".", "keyFrames", "(", "new", "KeyFrame", "(", "Duration", ".", "millis", "(", "0", ")", ",", "new", "KeyValue", "(", "mb", ".", "radiusProperty", "(", ")", ",", "0", ")", ")", ",", "new", "KeyFrame", "(", "Duration", ".", "millis", "(", "100", ")", ",", "new", "KeyValue", "(", "mb", ".", "radiusProperty", "(", ")", ",", "50", ")", ")", ",", "new", "KeyFrame", "(", "Duration", ".", "millis", "(", "500", ")", ",", "new", "KeyValue", "(", "mb", ".", "radiusProperty", "(", ")", ",", "63", ")", ")", ",", "new", "KeyFrame", "(", "Duration", ".", "millis", "(", "900", ")", ",", "new", "KeyValue", "(", "mb", ".", "radiusProperty", "(", ")", ",", "50", ")", ")", ",", "new", "KeyFrame", "(", "Duration", ".", "millis", "(", "1000", ")", ",", "new", "KeyValue", "(", "mb", ".", "radiusProperty", "(", ")", ",", "0", ")", ")", ")", ".", "build", "(", ")", ")", ".", "build", "(", ")", ";", "}" ]
Build a scaling animation. @param fromX the x starting point coordinate @param toX the x arrival point coordinate @param fromY the y starting point coordinate @param toY the y arrival point coordinate @return a translate animation
[ "Build", "a", "scaling", "animation", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java#L495-L522
Waikato/moa
moa/src/main/java/moa/classifiers/meta/AccuracyWeightedEnsemble.java
AccuracyWeightedEnsemble.addToStored
protected Classifier addToStored(Classifier newClassifier, double newClassifiersWeight) { Classifier addedClassifier = null; Classifier[] newStored = new Classifier[this.storedLearners.length + 1]; double[][] newStoredWeights = new double[newStored.length][2]; for (int i = 0; i < newStored.length; i++) { if (i < this.storedLearners.length) { newStored[i] = this.storedLearners[i]; newStoredWeights[i][0] = this.storedWeights[i][0]; newStoredWeights[i][1] = this.storedWeights[i][1]; } else { newStored[i] = addedClassifier = newClassifier.copy(); newStoredWeights[i][0] = newClassifiersWeight; newStoredWeights[i][1] = i; } } this.storedLearners = newStored; this.storedWeights = newStoredWeights; return addedClassifier; }
java
protected Classifier addToStored(Classifier newClassifier, double newClassifiersWeight) { Classifier addedClassifier = null; Classifier[] newStored = new Classifier[this.storedLearners.length + 1]; double[][] newStoredWeights = new double[newStored.length][2]; for (int i = 0; i < newStored.length; i++) { if (i < this.storedLearners.length) { newStored[i] = this.storedLearners[i]; newStoredWeights[i][0] = this.storedWeights[i][0]; newStoredWeights[i][1] = this.storedWeights[i][1]; } else { newStored[i] = addedClassifier = newClassifier.copy(); newStoredWeights[i][0] = newClassifiersWeight; newStoredWeights[i][1] = i; } } this.storedLearners = newStored; this.storedWeights = newStoredWeights; return addedClassifier; }
[ "protected", "Classifier", "addToStored", "(", "Classifier", "newClassifier", ",", "double", "newClassifiersWeight", ")", "{", "Classifier", "addedClassifier", "=", "null", ";", "Classifier", "[", "]", "newStored", "=", "new", "Classifier", "[", "this", ".", "storedLearners", ".", "length", "+", "1", "]", ";", "double", "[", "]", "[", "]", "newStoredWeights", "=", "new", "double", "[", "newStored", ".", "length", "]", "[", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "newStored", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", "<", "this", ".", "storedLearners", ".", "length", ")", "{", "newStored", "[", "i", "]", "=", "this", ".", "storedLearners", "[", "i", "]", ";", "newStoredWeights", "[", "i", "]", "[", "0", "]", "=", "this", ".", "storedWeights", "[", "i", "]", "[", "0", "]", ";", "newStoredWeights", "[", "i", "]", "[", "1", "]", "=", "this", ".", "storedWeights", "[", "i", "]", "[", "1", "]", ";", "}", "else", "{", "newStored", "[", "i", "]", "=", "addedClassifier", "=", "newClassifier", ".", "copy", "(", ")", ";", "newStoredWeights", "[", "i", "]", "[", "0", "]", "=", "newClassifiersWeight", ";", "newStoredWeights", "[", "i", "]", "[", "1", "]", "=", "i", ";", "}", "}", "this", ".", "storedLearners", "=", "newStored", ";", "this", ".", "storedWeights", "=", "newStoredWeights", ";", "return", "addedClassifier", ";", "}" ]
Adds a classifier to the storage. @param newClassifier The classifier to add. @param newClassifiersWeight The new classifiers weight.
[ "Adds", "a", "classifier", "to", "the", "storage", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/AccuracyWeightedEnsemble.java#L409-L429
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java
QuadTree.computeNonEdgeForces
public void computeNonEdgeForces(int pointIndex, double theta, INDArray negativeForce, AtomicDouble sumQ) { // Make sure that we spend no time on empty nodes or self-interactions if (cumSize == 0 || (isLeaf() && size == 1 && index[0] == pointIndex)) return; // Compute distance between point and center-of-mass buf.assign(data.slice(pointIndex)).subi(centerOfMass); double D = Nd4j.getBlasWrapper().dot(buf, buf); // Check whether we can use this node as a "summary" if (isLeaf || FastMath.max(boundary.getHh(), boundary.getHw()) / FastMath.sqrt(D) < theta) { // Compute and add t-SNE force between point and current node double Q = 1.0 / (1.0 + D); double mult = cumSize * Q; sumQ.addAndGet(mult); mult *= Q; negativeForce.addi(buf.mul(mult)); } else { // Recursively apply Barnes-Hut to children northWest.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); northEast.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); southWest.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); southEast.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); } }
java
public void computeNonEdgeForces(int pointIndex, double theta, INDArray negativeForce, AtomicDouble sumQ) { // Make sure that we spend no time on empty nodes or self-interactions if (cumSize == 0 || (isLeaf() && size == 1 && index[0] == pointIndex)) return; // Compute distance between point and center-of-mass buf.assign(data.slice(pointIndex)).subi(centerOfMass); double D = Nd4j.getBlasWrapper().dot(buf, buf); // Check whether we can use this node as a "summary" if (isLeaf || FastMath.max(boundary.getHh(), boundary.getHw()) / FastMath.sqrt(D) < theta) { // Compute and add t-SNE force between point and current node double Q = 1.0 / (1.0 + D); double mult = cumSize * Q; sumQ.addAndGet(mult); mult *= Q; negativeForce.addi(buf.mul(mult)); } else { // Recursively apply Barnes-Hut to children northWest.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); northEast.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); southWest.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); southEast.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); } }
[ "public", "void", "computeNonEdgeForces", "(", "int", "pointIndex", ",", "double", "theta", ",", "INDArray", "negativeForce", ",", "AtomicDouble", "sumQ", ")", "{", "// Make sure that we spend no time on empty nodes or self-interactions", "if", "(", "cumSize", "==", "0", "||", "(", "isLeaf", "(", ")", "&&", "size", "==", "1", "&&", "index", "[", "0", "]", "==", "pointIndex", ")", ")", "return", ";", "// Compute distance between point and center-of-mass", "buf", ".", "assign", "(", "data", ".", "slice", "(", "pointIndex", ")", ")", ".", "subi", "(", "centerOfMass", ")", ";", "double", "D", "=", "Nd4j", ".", "getBlasWrapper", "(", ")", ".", "dot", "(", "buf", ",", "buf", ")", ";", "// Check whether we can use this node as a \"summary\"", "if", "(", "isLeaf", "||", "FastMath", ".", "max", "(", "boundary", ".", "getHh", "(", ")", ",", "boundary", ".", "getHw", "(", ")", ")", "/", "FastMath", ".", "sqrt", "(", "D", ")", "<", "theta", ")", "{", "// Compute and add t-SNE force between point and current node", "double", "Q", "=", "1.0", "/", "(", "1.0", "+", "D", ")", ";", "double", "mult", "=", "cumSize", "*", "Q", ";", "sumQ", ".", "addAndGet", "(", "mult", ")", ";", "mult", "*=", "Q", ";", "negativeForce", ".", "addi", "(", "buf", ".", "mul", "(", "mult", ")", ")", ";", "}", "else", "{", "// Recursively apply Barnes-Hut to children", "northWest", ".", "computeNonEdgeForces", "(", "pointIndex", ",", "theta", ",", "negativeForce", ",", "sumQ", ")", ";", "northEast", ".", "computeNonEdgeForces", "(", "pointIndex", ",", "theta", ",", "negativeForce", ",", "sumQ", ")", ";", "southWest", ".", "computeNonEdgeForces", "(", "pointIndex", ",", "theta", ",", "negativeForce", ",", "sumQ", ")", ";", "southEast", ".", "computeNonEdgeForces", "(", "pointIndex", ",", "theta", ",", "negativeForce", ",", "sumQ", ")", ";", "}", "}" ]
Compute non edge forces using barnes hut @param pointIndex @param theta @param negativeForce @param sumQ
[ "Compute", "non", "edge", "forces", "using", "barnes", "hut" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java#L236-L265
casmi/casmi
src/main/java/casmi/graphics/element/Quad.java
Quad.setCorner
public void setCorner(int index, double x, double y) { if (index <= 0) { this.x1 = x; this.y1 = y; } else if (index == 1) { this.x2 = x; this.y2 = y; } else if (index == 2) { this.x3 = x; this.y3 = y; } else if (index >= 3) { this.x4 = x; this.y4 = y; } calcG(); }
java
public void setCorner(int index, double x, double y) { if (index <= 0) { this.x1 = x; this.y1 = y; } else if (index == 1) { this.x2 = x; this.y2 = y; } else if (index == 2) { this.x3 = x; this.y3 = y; } else if (index >= 3) { this.x4 = x; this.y4 = y; } calcG(); }
[ "public", "void", "setCorner", "(", "int", "index", ",", "double", "x", ",", "double", "y", ")", "{", "if", "(", "index", "<=", "0", ")", "{", "this", ".", "x1", "=", "x", ";", "this", ".", "y1", "=", "y", ";", "}", "else", "if", "(", "index", "==", "1", ")", "{", "this", ".", "x2", "=", "x", ";", "this", ".", "y2", "=", "y", ";", "}", "else", "if", "(", "index", "==", "2", ")", "{", "this", ".", "x3", "=", "x", ";", "this", ".", "y3", "=", "y", ";", "}", "else", "if", "(", "index", ">=", "3", ")", "{", "this", ".", "x4", "=", "x", ";", "this", ".", "y4", "=", "y", ";", "}", "calcG", "(", ")", ";", "}" ]
Sets x,y-coordinate of a corner. @param index The index of a corner. @param x The x-coordinate of a corner. @param y The y-coordinate of a corner.
[ "Sets", "x", "y", "-", "coordinate", "of", "a", "corner", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Quad.java#L151-L166
bignerdranch/expandable-recycler-view
expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java
ExpandableRecyclerAdapter.collapseParentRange
@UiThread public void collapseParentRange(int startParentPosition, int parentCount) { int endParentPosition = startParentPosition + parentCount; for (int i = startParentPosition; i < endParentPosition; i++) { collapseParent(i); } }
java
@UiThread public void collapseParentRange(int startParentPosition, int parentCount) { int endParentPosition = startParentPosition + parentCount; for (int i = startParentPosition; i < endParentPosition; i++) { collapseParent(i); } }
[ "@", "UiThread", "public", "void", "collapseParentRange", "(", "int", "startParentPosition", ",", "int", "parentCount", ")", "{", "int", "endParentPosition", "=", "startParentPosition", "+", "parentCount", ";", "for", "(", "int", "i", "=", "startParentPosition", ";", "i", "<", "endParentPosition", ";", "i", "++", ")", "{", "collapseParent", "(", "i", ")", ";", "}", "}" ]
Collapses all parents in a range of indices in the list of parents. @param startParentPosition The index at which to to start collapsing parents @param parentCount The number of parents to collapse
[ "Collapses", "all", "parents", "in", "a", "range", "of", "indices", "in", "the", "list", "of", "parents", "." ]
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L547-L553
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskRunner.java
TaskRunner.getChildJavaOpts
@Deprecated public String getChildJavaOpts(JobConf jobConf, String defaultValue) { if (getTask().isJobSetupTask()) { return jobConf.get(JobConf.MAPRED_JOB_SETUP_TASK_JAVA_OPTS, defaultValue); } else if (getTask().isJobCleanupTask()) { return jobConf.get(JobConf.MAPRED_JOB_CLEANUP_TASK_JAVA_OPTS, defaultValue); } else if (getTask().isTaskCleanupTask()) { return jobConf.get(JobConf.MAPRED_TASK_CLEANUP_TASK_JAVA_OPTS, defaultValue); } else { return jobConf.get(JobConf.MAPRED_TASK_JAVA_OPTS, defaultValue); } }
java
@Deprecated public String getChildJavaOpts(JobConf jobConf, String defaultValue) { if (getTask().isJobSetupTask()) { return jobConf.get(JobConf.MAPRED_JOB_SETUP_TASK_JAVA_OPTS, defaultValue); } else if (getTask().isJobCleanupTask()) { return jobConf.get(JobConf.MAPRED_JOB_CLEANUP_TASK_JAVA_OPTS, defaultValue); } else if (getTask().isTaskCleanupTask()) { return jobConf.get(JobConf.MAPRED_TASK_CLEANUP_TASK_JAVA_OPTS, defaultValue); } else { return jobConf.get(JobConf.MAPRED_TASK_JAVA_OPTS, defaultValue); } }
[ "@", "Deprecated", "public", "String", "getChildJavaOpts", "(", "JobConf", "jobConf", ",", "String", "defaultValue", ")", "{", "if", "(", "getTask", "(", ")", ".", "isJobSetupTask", "(", ")", ")", "{", "return", "jobConf", ".", "get", "(", "JobConf", ".", "MAPRED_JOB_SETUP_TASK_JAVA_OPTS", ",", "defaultValue", ")", ";", "}", "else", "if", "(", "getTask", "(", ")", ".", "isJobCleanupTask", "(", ")", ")", "{", "return", "jobConf", ".", "get", "(", "JobConf", ".", "MAPRED_JOB_CLEANUP_TASK_JAVA_OPTS", ",", "defaultValue", ")", ";", "}", "else", "if", "(", "getTask", "(", ")", ".", "isTaskCleanupTask", "(", ")", ")", "{", "return", "jobConf", ".", "get", "(", "JobConf", ".", "MAPRED_TASK_CLEANUP_TASK_JAVA_OPTS", ",", "defaultValue", ")", ";", "}", "else", "{", "return", "jobConf", ".", "get", "(", "JobConf", ".", "MAPRED_TASK_JAVA_OPTS", ",", "defaultValue", ")", ";", "}", "}" ]
Get the java command line options for the child map/reduce tasks. Overriden by specific launchers. @param jobConf job configuration @param defaultValue default value @return the java command line options for child map/reduce tasks @deprecated Use command line options specific to map or reduce tasks set via {@link JobConf#MAPRED_MAP_TASK_JAVA_OPTS} or {@link JobConf#MAPRED_REDUCE_TASK_JAVA_OPTS}
[ "Get", "the", "java", "command", "line", "options", "for", "the", "child", "map", "/", "reduce", "tasks", ".", "Overriden", "by", "specific", "launchers", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskRunner.java#L135-L149
netceteragroup/valdr-bean-validation
valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java
AnnotationUtils.findAnnotation
public static <A extends Annotation> A findAnnotation(Method method, Class<A> annotationType) { A annotation = getAnnotation(method, annotationType); Class<?> clazz = method.getDeclaringClass(); if (annotation == null) { annotation = searchOnInterfaces(method, annotationType, clazz.getInterfaces()); } while (annotation == null) { clazz = clazz.getSuperclass(); if (clazz == null || clazz.equals(Object.class)) { break; } try { Method equivalentMethod = clazz.getDeclaredMethod(method.getName(), method.getParameterTypes()); annotation = getAnnotation(equivalentMethod, annotationType); } catch (NoSuchMethodException ex) { // No equivalent method found } if (annotation == null) { annotation = searchOnInterfaces(method, annotationType, clazz.getInterfaces()); } } return annotation; }
java
public static <A extends Annotation> A findAnnotation(Method method, Class<A> annotationType) { A annotation = getAnnotation(method, annotationType); Class<?> clazz = method.getDeclaringClass(); if (annotation == null) { annotation = searchOnInterfaces(method, annotationType, clazz.getInterfaces()); } while (annotation == null) { clazz = clazz.getSuperclass(); if (clazz == null || clazz.equals(Object.class)) { break; } try { Method equivalentMethod = clazz.getDeclaredMethod(method.getName(), method.getParameterTypes()); annotation = getAnnotation(equivalentMethod, annotationType); } catch (NoSuchMethodException ex) { // No equivalent method found } if (annotation == null) { annotation = searchOnInterfaces(method, annotationType, clazz.getInterfaces()); } } return annotation; }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "findAnnotation", "(", "Method", "method", ",", "Class", "<", "A", ">", "annotationType", ")", "{", "A", "annotation", "=", "getAnnotation", "(", "method", ",", "annotationType", ")", ";", "Class", "<", "?", ">", "clazz", "=", "method", ".", "getDeclaringClass", "(", ")", ";", "if", "(", "annotation", "==", "null", ")", "{", "annotation", "=", "searchOnInterfaces", "(", "method", ",", "annotationType", ",", "clazz", ".", "getInterfaces", "(", ")", ")", ";", "}", "while", "(", "annotation", "==", "null", ")", "{", "clazz", "=", "clazz", ".", "getSuperclass", "(", ")", ";", "if", "(", "clazz", "==", "null", "||", "clazz", ".", "equals", "(", "Object", ".", "class", ")", ")", "{", "break", ";", "}", "try", "{", "Method", "equivalentMethod", "=", "clazz", ".", "getDeclaredMethod", "(", "method", ".", "getName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ")", ";", "annotation", "=", "getAnnotation", "(", "equivalentMethod", ",", "annotationType", ")", ";", "}", "catch", "(", "NoSuchMethodException", "ex", ")", "{", "// No equivalent method found", "}", "if", "(", "annotation", "==", "null", ")", "{", "annotation", "=", "searchOnInterfaces", "(", "method", ",", "annotationType", ",", "clazz", ".", "getInterfaces", "(", ")", ")", ";", "}", "}", "return", "annotation", ";", "}" ]
Get a single {@link java.lang.annotation.Annotation} of {@code annotationType} from the supplied {@link java.lang.reflect.Method}, traversing its super methods if no annotation can be found on the given method itself. <p>Annotations on methods are not inherited by default, so we need to handle this explicitly. @param method the method to look for annotations on @param annotationType the annotation class to look for @param <A> annotation type @return the annotation found, or {@code null} if none found
[ "Get", "a", "single", "{" ]
train
https://github.com/netceteragroup/valdr-bean-validation/blob/3f49f1357c575a11331be2de867cf47809a83823/valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java#L91-L114
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CreateSyntheticOverheadView.java
CreateSyntheticOverheadView.configure
public void configure( CameraPinholeBrown intrinsic , Se3_F64 planeToCamera , double centerX, double centerY, double cellSize , int overheadWidth , int overheadHeight ) { this.overheadWidth = overheadWidth; this.overheadHeight = overheadHeight; Point2Transform2_F64 normToPixel = LensDistortionFactory.narrow(intrinsic).distort_F64(false, true); // Declare storage for precomputed pixel locations int overheadPixels = overheadHeight*overheadWidth; if( mapPixels == null || mapPixels.length < overheadPixels) { mapPixels = new Point2D_F32[overheadPixels]; } points.reset(); // -------- storage for intermediate results Point2D_F64 pixel = new Point2D_F64(); // coordinate on the plane Point3D_F64 pt_plane = new Point3D_F64(); // coordinate in camera reference frame Point3D_F64 pt_cam = new Point3D_F64(); int indexOut = 0; for( int i = 0; i < overheadHeight; i++ ) { pt_plane.x = -(i*cellSize - centerY); for( int j = 0; j < overheadWidth; j++ , indexOut++ ) { pt_plane.z = j*cellSize - centerX; // plane to camera reference frame SePointOps_F64.transform(planeToCamera, pt_plane, pt_cam); // can't see behind the camera if( pt_cam.z > 0 ) { // compute normalized then convert to pixels normToPixel.compute(pt_cam.x/pt_cam.z,pt_cam.y/pt_cam.z,pixel); float x = (float)pixel.x; float y = (float)pixel.y; // make sure it's in the image if(BoofMiscOps.checkInside(intrinsic.width,intrinsic.height,x,y) ){ Point2D_F32 p = points.grow(); p.set(x,y); mapPixels[ indexOut ]= p; } else { mapPixels[ indexOut ]= null; } } } } }
java
public void configure( CameraPinholeBrown intrinsic , Se3_F64 planeToCamera , double centerX, double centerY, double cellSize , int overheadWidth , int overheadHeight ) { this.overheadWidth = overheadWidth; this.overheadHeight = overheadHeight; Point2Transform2_F64 normToPixel = LensDistortionFactory.narrow(intrinsic).distort_F64(false, true); // Declare storage for precomputed pixel locations int overheadPixels = overheadHeight*overheadWidth; if( mapPixels == null || mapPixels.length < overheadPixels) { mapPixels = new Point2D_F32[overheadPixels]; } points.reset(); // -------- storage for intermediate results Point2D_F64 pixel = new Point2D_F64(); // coordinate on the plane Point3D_F64 pt_plane = new Point3D_F64(); // coordinate in camera reference frame Point3D_F64 pt_cam = new Point3D_F64(); int indexOut = 0; for( int i = 0; i < overheadHeight; i++ ) { pt_plane.x = -(i*cellSize - centerY); for( int j = 0; j < overheadWidth; j++ , indexOut++ ) { pt_plane.z = j*cellSize - centerX; // plane to camera reference frame SePointOps_F64.transform(planeToCamera, pt_plane, pt_cam); // can't see behind the camera if( pt_cam.z > 0 ) { // compute normalized then convert to pixels normToPixel.compute(pt_cam.x/pt_cam.z,pt_cam.y/pt_cam.z,pixel); float x = (float)pixel.x; float y = (float)pixel.y; // make sure it's in the image if(BoofMiscOps.checkInside(intrinsic.width,intrinsic.height,x,y) ){ Point2D_F32 p = points.grow(); p.set(x,y); mapPixels[ indexOut ]= p; } else { mapPixels[ indexOut ]= null; } } } } }
[ "public", "void", "configure", "(", "CameraPinholeBrown", "intrinsic", ",", "Se3_F64", "planeToCamera", ",", "double", "centerX", ",", "double", "centerY", ",", "double", "cellSize", ",", "int", "overheadWidth", ",", "int", "overheadHeight", ")", "{", "this", ".", "overheadWidth", "=", "overheadWidth", ";", "this", ".", "overheadHeight", "=", "overheadHeight", ";", "Point2Transform2_F64", "normToPixel", "=", "LensDistortionFactory", ".", "narrow", "(", "intrinsic", ")", ".", "distort_F64", "(", "false", ",", "true", ")", ";", "// Declare storage for precomputed pixel locations", "int", "overheadPixels", "=", "overheadHeight", "*", "overheadWidth", ";", "if", "(", "mapPixels", "==", "null", "||", "mapPixels", ".", "length", "<", "overheadPixels", ")", "{", "mapPixels", "=", "new", "Point2D_F32", "[", "overheadPixels", "]", ";", "}", "points", ".", "reset", "(", ")", ";", "// -------- storage for intermediate results", "Point2D_F64", "pixel", "=", "new", "Point2D_F64", "(", ")", ";", "// coordinate on the plane", "Point3D_F64", "pt_plane", "=", "new", "Point3D_F64", "(", ")", ";", "// coordinate in camera reference frame", "Point3D_F64", "pt_cam", "=", "new", "Point3D_F64", "(", ")", ";", "int", "indexOut", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "overheadHeight", ";", "i", "++", ")", "{", "pt_plane", ".", "x", "=", "-", "(", "i", "*", "cellSize", "-", "centerY", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "overheadWidth", ";", "j", "++", ",", "indexOut", "++", ")", "{", "pt_plane", ".", "z", "=", "j", "*", "cellSize", "-", "centerX", ";", "// plane to camera reference frame", "SePointOps_F64", ".", "transform", "(", "planeToCamera", ",", "pt_plane", ",", "pt_cam", ")", ";", "// can't see behind the camera", "if", "(", "pt_cam", ".", "z", ">", "0", ")", "{", "// compute normalized then convert to pixels", "normToPixel", ".", "compute", "(", "pt_cam", ".", "x", "/", "pt_cam", ".", "z", ",", "pt_cam", ".", "y", "/", "pt_cam", ".", "z", ",", "pixel", ")", ";", "float", "x", "=", "(", "float", ")", "pixel", ".", "x", ";", "float", "y", "=", "(", "float", ")", "pixel", ".", "y", ";", "// make sure it's in the image", "if", "(", "BoofMiscOps", ".", "checkInside", "(", "intrinsic", ".", "width", ",", "intrinsic", ".", "height", ",", "x", ",", "y", ")", ")", "{", "Point2D_F32", "p", "=", "points", ".", "grow", "(", ")", ";", "p", ".", "set", "(", "x", ",", "y", ")", ";", "mapPixels", "[", "indexOut", "]", "=", "p", ";", "}", "else", "{", "mapPixels", "[", "indexOut", "]", "=", "null", ";", "}", "}", "}", "}", "}" ]
Specifies camera configurations. @param intrinsic Intrinsic camera parameters @param planeToCamera Transform from the plane to the camera. This is the extrinsic parameters. @param centerX X-coordinate of camera center in the overhead image in world units. @param centerY Y-coordinate of camera center in the overhead image in world units. @param cellSize Size of each cell in the overhead image in world units. @param overheadWidth Number of columns in overhead image @param overheadHeight Number of rows in overhead image
[ "Specifies", "camera", "configurations", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CreateSyntheticOverheadView.java#L81-L133
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/Mappings.java
Mappings.toChemObjects
public Iterable<IChemObject> toChemObjects() { return FluentIterable.from(map(new ToAtomBondMap(query, target))) .transformAndConcat(new Function<Map<IChemObject, IChemObject>, Iterable<? extends IChemObject>>() { @Override public Iterable<? extends IChemObject> apply(Map<IChemObject, IChemObject> map) { return map.values(); } }); }
java
public Iterable<IChemObject> toChemObjects() { return FluentIterable.from(map(new ToAtomBondMap(query, target))) .transformAndConcat(new Function<Map<IChemObject, IChemObject>, Iterable<? extends IChemObject>>() { @Override public Iterable<? extends IChemObject> apply(Map<IChemObject, IChemObject> map) { return map.values(); } }); }
[ "public", "Iterable", "<", "IChemObject", ">", "toChemObjects", "(", ")", "{", "return", "FluentIterable", ".", "from", "(", "map", "(", "new", "ToAtomBondMap", "(", "query", ",", "target", ")", ")", ")", ".", "transformAndConcat", "(", "new", "Function", "<", "Map", "<", "IChemObject", ",", "IChemObject", ">", ",", "Iterable", "<", "?", "extends", "IChemObject", ">", ">", "(", ")", "{", "@", "Override", "public", "Iterable", "<", "?", "extends", "IChemObject", ">", "apply", "(", "Map", "<", "IChemObject", ",", "IChemObject", ">", "map", ")", "{", "return", "map", ".", "values", "(", ")", ";", "}", "}", ")", ";", "}" ]
Obtain the chem objects (atoms and bonds) that have 'hit' in the target molecule. <blockquote><pre> for (IChemObject obj : mappings.toChemObjects()) { if (obj instanceof IAtom) { // this atom was 'hit' by the pattern } } </pre></blockquote> @return lazy iterable of chem objects
[ "Obtain", "the", "chem", "objects", "(", "atoms", "and", "bonds", ")", "that", "have", "hit", "in", "the", "target", "molecule", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/Mappings.java#L436-L444
cose-wg/COSE-JAVA
src/main/java/COSE/Attribute.java
Attribute.AddUnprotected
@Deprecated public void AddUnprotected(CBORObject label, CBORObject value) throws CoseException { addAttribute(label, value, UNPROTECTED); }
java
@Deprecated public void AddUnprotected(CBORObject label, CBORObject value) throws CoseException { addAttribute(label, value, UNPROTECTED); }
[ "@", "Deprecated", "public", "void", "AddUnprotected", "(", "CBORObject", "label", ",", "CBORObject", "value", ")", "throws", "CoseException", "{", "addAttribute", "(", "label", ",", "value", ",", "UNPROTECTED", ")", ";", "}" ]
Set an attribute in the unprotected bucket of the COSE object @param label value identifies the attribute in the map @param value value to be associated with the label @deprecated As of COSE 0.9.1, use addAttribute(HeaderKeys, byte[], Attribute.UNPROTECTED); @exception CoseException COSE Package exception
[ "Set", "an", "attribute", "in", "the", "unprotected", "bucket", "of", "the", "COSE", "object" ]
train
https://github.com/cose-wg/COSE-JAVA/blob/f972b11ab4c9a18f911bc49a15225a6951cf6f63/src/main/java/COSE/Attribute.java#L219-L222
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinGenerator.java
CssSkinGenerator.checkRootDirectoryNotOverlap
private void checkRootDirectoryNotOverlap(String dir, Set<String> skinRootDirectories) { String rootDir = removeLocaleSuffixIfExist(dir); for (Iterator<String> itSkinDir = skinRootDirectories.iterator(); itSkinDir.hasNext();) { String skinDir = PathNormalizer.asDirPath(itSkinDir.next()); if (!skinDir.equals(dir)) { skinDir = removeLocaleSuffixIfExist(skinDir); if (skinDir.startsWith(rootDir)) { throw new BundlingProcessException( "There is a misconfiguration. It is not allowed to have a skin root directory containing another one."); } } } }
java
private void checkRootDirectoryNotOverlap(String dir, Set<String> skinRootDirectories) { String rootDir = removeLocaleSuffixIfExist(dir); for (Iterator<String> itSkinDir = skinRootDirectories.iterator(); itSkinDir.hasNext();) { String skinDir = PathNormalizer.asDirPath(itSkinDir.next()); if (!skinDir.equals(dir)) { skinDir = removeLocaleSuffixIfExist(skinDir); if (skinDir.startsWith(rootDir)) { throw new BundlingProcessException( "There is a misconfiguration. It is not allowed to have a skin root directory containing another one."); } } } }
[ "private", "void", "checkRootDirectoryNotOverlap", "(", "String", "dir", ",", "Set", "<", "String", ">", "skinRootDirectories", ")", "{", "String", "rootDir", "=", "removeLocaleSuffixIfExist", "(", "dir", ")", ";", "for", "(", "Iterator", "<", "String", ">", "itSkinDir", "=", "skinRootDirectories", ".", "iterator", "(", ")", ";", "itSkinDir", ".", "hasNext", "(", ")", ";", ")", "{", "String", "skinDir", "=", "PathNormalizer", ".", "asDirPath", "(", "itSkinDir", ".", "next", "(", ")", ")", ";", "if", "(", "!", "skinDir", ".", "equals", "(", "dir", ")", ")", "{", "skinDir", "=", "removeLocaleSuffixIfExist", "(", "skinDir", ")", ";", "if", "(", "skinDir", ".", "startsWith", "(", "rootDir", ")", ")", "{", "throw", "new", "BundlingProcessException", "(", "\"There is a misconfiguration. It is not allowed to have a skin root directory containing another one.\"", ")", ";", "}", "}", "}", "}" ]
Check if there are no directory which is contained in another root directory, @param dir the root directory to check @param skinRootDirectories the root directories
[ "Check", "if", "there", "are", "no", "directory", "which", "is", "contained", "in", "another", "root", "directory" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinGenerator.java#L618-L631
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigList.java
ESigList.indexOf
public int indexOf(IESigType eSigType, String id) { return items.indexOf(new ESigItem(eSigType, id)); }
java
public int indexOf(IESigType eSigType, String id) { return items.indexOf(new ESigItem(eSigType, id)); }
[ "public", "int", "indexOf", "(", "IESigType", "eSigType", ",", "String", "id", ")", "{", "return", "items", ".", "indexOf", "(", "new", "ESigItem", "(", "eSigType", ",", "id", ")", ")", ";", "}" ]
Returns the index of a sig item identified by type and id. @param eSigType The esignature type. @param id The item id. @return Index of item.
[ "Returns", "the", "index", "of", "a", "sig", "item", "identified", "by", "type", "and", "id", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigList.java#L94-L96
lordcodes/SnackbarBuilder
snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/SnackbarBuilder.java
SnackbarBuilder.dismissCallback
@SuppressWarnings("WeakerAccess") public SnackbarBuilder dismissCallback(final SnackbarDismissCallback callback) { callbacks.add(new SnackbarCallback() { public void onSnackbarDismissed(Snackbar snackbar, int dismissEvent) { callback.onSnackbarDismissed(snackbar, dismissEvent); } }); return this; }
java
@SuppressWarnings("WeakerAccess") public SnackbarBuilder dismissCallback(final SnackbarDismissCallback callback) { callbacks.add(new SnackbarCallback() { public void onSnackbarDismissed(Snackbar snackbar, int dismissEvent) { callback.onSnackbarDismissed(snackbar, dismissEvent); } }); return this; }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "SnackbarBuilder", "dismissCallback", "(", "final", "SnackbarDismissCallback", "callback", ")", "{", "callbacks", ".", "add", "(", "new", "SnackbarCallback", "(", ")", "{", "public", "void", "onSnackbarDismissed", "(", "Snackbar", "snackbar", ",", "int", "dismissEvent", ")", "{", "callback", ".", "onSnackbarDismissed", "(", "snackbar", ",", "dismissEvent", ")", ";", "}", "}", ")", ";", "return", "this", ";", "}" ]
Set the callback to be informed of the Snackbar being dismissed through some means. @param callback The callback. @return This instance.
[ "Set", "the", "callback", "to", "be", "informed", "of", "the", "Snackbar", "being", "dismissed", "through", "some", "means", "." ]
train
https://github.com/lordcodes/SnackbarBuilder/blob/a104a753c78ed66940c19d295e141a521cf81d73/snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/SnackbarBuilder.java#L357-L365
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.addOrRemoveCrossGroupMember
public ResponseWrapper addOrRemoveCrossGroupMember(long gid, CrossGroup[] groups) throws APIConnectionException, APIRequestException { return _crossAppClient.addOrRemoveCrossGroupMembers(gid, groups); }
java
public ResponseWrapper addOrRemoveCrossGroupMember(long gid, CrossGroup[] groups) throws APIConnectionException, APIRequestException { return _crossAppClient.addOrRemoveCrossGroupMembers(gid, groups); }
[ "public", "ResponseWrapper", "addOrRemoveCrossGroupMember", "(", "long", "gid", ",", "CrossGroup", "[", "]", "groups", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_crossAppClient", ".", "addOrRemoveCrossGroupMembers", "(", "gid", ",", "groups", ")", ";", "}" ]
Add or remove group members from a given group id. @param gid Necessary, target group id. @param groups Necessary @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Add", "or", "remove", "group", "members", "from", "a", "given", "group", "id", "." ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L594-L597
drewnoakes/metadata-extractor
Source/com/drew/lang/Rational.java
Rational.getSimplifiedInstance
@NotNull public Rational getSimplifiedInstance() { long gcd = GCD(_numerator, _denominator); return new Rational(_numerator / gcd, _denominator / gcd); }
java
@NotNull public Rational getSimplifiedInstance() { long gcd = GCD(_numerator, _denominator); return new Rational(_numerator / gcd, _denominator / gcd); }
[ "@", "NotNull", "public", "Rational", "getSimplifiedInstance", "(", ")", "{", "long", "gcd", "=", "GCD", "(", "_numerator", ",", "_denominator", ")", ";", "return", "new", "Rational", "(", "_numerator", "/", "gcd", ",", "_denominator", "/", "gcd", ")", ";", "}" ]
<p> Simplifies the representation of this {@link Rational} number.</p> <p> For example, 5/10 simplifies to 1/2 because both Numerator and Denominator share a common factor of 5.</p> <p> Uses the Euclidean Algorithm to find the greatest common divisor.</p> @return A simplified instance if one exists, otherwise a copy of the original value.
[ "<p", ">", "Simplifies", "the", "representation", "of", "this", "{", "@link", "Rational", "}", "number", ".", "<", "/", "p", ">", "<p", ">", "For", "example", "5", "/", "10", "simplifies", "to", "1", "/", "2", "because", "both", "Numerator", "and", "Denominator", "share", "a", "common", "factor", "of", "5", ".", "<", "/", "p", ">", "<p", ">", "Uses", "the", "Euclidean", "Algorithm", "to", "find", "the", "greatest", "common", "divisor", ".", "<", "/", "p", ">" ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/lang/Rational.java#L298-L304
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ReComputeTimeOffsetHandler.java
ReComputeTimeOffsetHandler.init
public void init(BaseField field, String targetFieldName, DateTimeField fldOtherDate) { m_fldOtherDate = fldOtherDate; super.init(field, targetFieldName, null); }
java
public void init(BaseField field, String targetFieldName, DateTimeField fldOtherDate) { m_fldOtherDate = fldOtherDate; super.init(field, targetFieldName, null); }
[ "public", "void", "init", "(", "BaseField", "field", ",", "String", "targetFieldName", ",", "DateTimeField", "fldOtherDate", ")", "{", "m_fldOtherDate", "=", "fldOtherDate", ";", "super", ".", "init", "(", "field", ",", "targetFieldName", ",", "null", ")", ";", "}" ]
Constructor. @param field The basefield owner of this listener (usually null and set on setOwner()). @param iTargetFieldSeq The date field sequence in this owner to use to calc the difference. @param fldOtherDate The other date field to use in calculating the date difference. If null, uses the current time.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReComputeTimeOffsetHandler.java#L65-L69
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CProductPersistenceImpl.java
CProductPersistenceImpl.findByGroupId
@Override public List<CProduct> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CProduct> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CProduct", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the c products where groupId = &#63;. @param groupId the group ID @return the matching c products
[ "Returns", "all", "the", "c", "products", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CProductPersistenceImpl.java#L1499-L1502
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.generateInnerSequenceClass
private ClassWriter generateInnerSequenceClass(String typeName, String className, String apiName) { ClassWriter classWriter = generateClass(typeName, JAVA_OBJECT, new String[] {CUSTOM_ATTRIBUTE_GROUP}, getClassSignature(new String[]{CUSTOM_ATTRIBUTE_GROUP}, typeName, apiName), ACC_PUBLIC + ACC_SUPER, apiName); generateClassMethods(classWriter, typeName, className, apiName, false); return classWriter; }
java
private ClassWriter generateInnerSequenceClass(String typeName, String className, String apiName) { ClassWriter classWriter = generateClass(typeName, JAVA_OBJECT, new String[] {CUSTOM_ATTRIBUTE_GROUP}, getClassSignature(new String[]{CUSTOM_ATTRIBUTE_GROUP}, typeName, apiName), ACC_PUBLIC + ACC_SUPER, apiName); generateClassMethods(classWriter, typeName, className, apiName, false); return classWriter; }
[ "private", "ClassWriter", "generateInnerSequenceClass", "(", "String", "typeName", ",", "String", "className", ",", "String", "apiName", ")", "{", "ClassWriter", "classWriter", "=", "generateClass", "(", "typeName", ",", "JAVA_OBJECT", ",", "new", "String", "[", "]", "{", "CUSTOM_ATTRIBUTE_GROUP", "}", ",", "getClassSignature", "(", "new", "String", "[", "]", "{", "CUSTOM_ATTRIBUTE_GROUP", "}", ",", "typeName", ",", "apiName", ")", ",", "ACC_PUBLIC", "+", "ACC_SUPER", ",", "apiName", ")", ";", "generateClassMethods", "(", "classWriter", ",", "typeName", ",", "className", ",", "apiName", ",", "false", ")", ";", "return", "classWriter", ";", "}" ]
Creates the inner classes that are used to support the sequence behaviour. @param typeName The name of the next type to return. @param className The name of the class which contains the sequence. @param apiName The name of the generated fluent interface. @return The {@link ClassWriter} object which represents the inner class created to support sequence behaviour.
[ "Creates", "the", "inner", "classes", "that", "are", "used", "to", "support", "the", "sequence", "behaviour", "." ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L501-L507
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java
CareWebUtil.associateCSH
public static void associateCSH(BaseUIComponent component, String module, String topic, String label) { HelpContext context = new HelpContext(module, topic, label); HelpUtil.associateCSH(component, context, getShell()); }
java
public static void associateCSH(BaseUIComponent component, String module, String topic, String label) { HelpContext context = new HelpContext(module, topic, label); HelpUtil.associateCSH(component, context, getShell()); }
[ "public", "static", "void", "associateCSH", "(", "BaseUIComponent", "component", ",", "String", "module", ",", "String", "topic", ",", "String", "label", ")", "{", "HelpContext", "context", "=", "new", "HelpContext", "(", "module", ",", "topic", ",", "label", ")", ";", "HelpUtil", ".", "associateCSH", "(", "component", ",", "context", ",", "getShell", "(", ")", ")", ";", "}" ]
Associates help context with a component. @param component The component. @param module The help module identifier. @param topic The topic id. @param label The topic label.
[ "Associates", "help", "context", "with", "a", "component", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java#L124-L127
albfernandez/itext2
src/main/java/com/lowagie/text/Utilities.java
Utilities.convertToUtf32
public static int convertToUtf32(String text, int idx) { return (((text.charAt(idx) - 0xd800) * 0x400) + (text.charAt(idx + 1) - 0xdc00)) + 0x10000; }
java
public static int convertToUtf32(String text, int idx) { return (((text.charAt(idx) - 0xd800) * 0x400) + (text.charAt(idx + 1) - 0xdc00)) + 0x10000; }
[ "public", "static", "int", "convertToUtf32", "(", "String", "text", ",", "int", "idx", ")", "{", "return", "(", "(", "(", "text", ".", "charAt", "(", "idx", ")", "-", "0xd800", ")", "*", "0x400", ")", "+", "(", "text", ".", "charAt", "(", "idx", "+", "1", ")", "-", "0xdc00", ")", ")", "+", "0x10000", ";", "}" ]
Converts a unicode character in a String to a UTF32 code point value @param text a String that has the unicode character(s) @param idx the index of the 'high' character @return the codepoint value @since 2.1.2
[ "Converts", "a", "unicode", "character", "in", "a", "String", "to", "a", "UTF32", "code", "point", "value" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Utilities.java#L326-L328
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java
DrawerUtils.addStickyFooterDivider
private static void addStickyFooterDivider(Context ctx, ViewGroup footerView) { LinearLayout divider = new LinearLayout(ctx); LinearLayout.LayoutParams dividerParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); divider.setMinimumHeight((int) UIUtils.convertDpToPixel(1, ctx)); divider.setOrientation(LinearLayout.VERTICAL); divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(ctx, R.attr.material_drawer_divider, R.color.material_drawer_divider)); footerView.addView(divider, dividerParams); }
java
private static void addStickyFooterDivider(Context ctx, ViewGroup footerView) { LinearLayout divider = new LinearLayout(ctx); LinearLayout.LayoutParams dividerParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); divider.setMinimumHeight((int) UIUtils.convertDpToPixel(1, ctx)); divider.setOrientation(LinearLayout.VERTICAL); divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(ctx, R.attr.material_drawer_divider, R.color.material_drawer_divider)); footerView.addView(divider, dividerParams); }
[ "private", "static", "void", "addStickyFooterDivider", "(", "Context", "ctx", ",", "ViewGroup", "footerView", ")", "{", "LinearLayout", "divider", "=", "new", "LinearLayout", "(", "ctx", ")", ";", "LinearLayout", ".", "LayoutParams", "dividerParams", "=", "new", "LinearLayout", ".", "LayoutParams", "(", "ViewGroup", ".", "LayoutParams", ".", "MATCH_PARENT", ",", "ViewGroup", ".", "LayoutParams", ".", "WRAP_CONTENT", ")", ";", "divider", ".", "setMinimumHeight", "(", "(", "int", ")", "UIUtils", ".", "convertDpToPixel", "(", "1", ",", "ctx", ")", ")", ";", "divider", ".", "setOrientation", "(", "LinearLayout", ".", "VERTICAL", ")", ";", "divider", ".", "setBackgroundColor", "(", "UIUtils", ".", "getThemeColorFromAttrOrRes", "(", "ctx", ",", "R", ".", "attr", ".", "material_drawer_divider", ",", "R", ".", "color", ".", "material_drawer_divider", ")", ")", ";", "footerView", ".", "addView", "(", "divider", ",", "dividerParams", ")", ";", "}" ]
adds the shadow to the stickyFooter @param ctx @param footerView
[ "adds", "the", "shadow", "to", "the", "stickyFooter" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java#L381-L388
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getYAsOppositeTileFormat
public static int getYAsOppositeTileFormat(int zoom, int y) { int tilesPerSide = tilesPerSide(zoom); int oppositeY = tilesPerSide - y - 1; return oppositeY; }
java
public static int getYAsOppositeTileFormat(int zoom, int y) { int tilesPerSide = tilesPerSide(zoom); int oppositeY = tilesPerSide - y - 1; return oppositeY; }
[ "public", "static", "int", "getYAsOppositeTileFormat", "(", "int", "zoom", ",", "int", "y", ")", "{", "int", "tilesPerSide", "=", "tilesPerSide", "(", "zoom", ")", ";", "int", "oppositeY", "=", "tilesPerSide", "-", "y", "-", "1", ";", "return", "oppositeY", ";", "}" ]
Get the standard y tile location as TMS or a TMS y location as standard @param zoom zoom level @param y y coordinate @return opposite tile format y
[ "Get", "the", "standard", "y", "tile", "location", "as", "TMS", "or", "a", "TMS", "y", "location", "as", "standard" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L768-L772
netty/netty
codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java
HAProxyMessage.portStringToInt
private static int portStringToInt(String value) { int port; try { port = Integer.parseInt(value); } catch (NumberFormatException e) { throw new HAProxyProtocolException("invalid port: " + value, e); } if (port <= 0 || port > 65535) { throw new HAProxyProtocolException("invalid port: " + value + " (expected: 1 ~ 65535)"); } return port; }
java
private static int portStringToInt(String value) { int port; try { port = Integer.parseInt(value); } catch (NumberFormatException e) { throw new HAProxyProtocolException("invalid port: " + value, e); } if (port <= 0 || port > 65535) { throw new HAProxyProtocolException("invalid port: " + value + " (expected: 1 ~ 65535)"); } return port; }
[ "private", "static", "int", "portStringToInt", "(", "String", "value", ")", "{", "int", "port", ";", "try", "{", "port", "=", "Integer", ".", "parseInt", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "HAProxyProtocolException", "(", "\"invalid port: \"", "+", "value", ",", "e", ")", ";", "}", "if", "(", "port", "<=", "0", "||", "port", ">", "65535", ")", "{", "throw", "new", "HAProxyProtocolException", "(", "\"invalid port: \"", "+", "value", "+", "\" (expected: 1 ~ 65535)\"", ")", ";", "}", "return", "port", ";", "}" ]
Convert port to integer @param value the port @return port as an integer @throws HAProxyProtocolException if port is not a valid integer
[ "Convert", "port", "to", "integer" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java#L396-L409
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/classpath/ClassLoaderOrder.java
ClassLoaderOrder.delegateTo
public void delegateTo(final ClassLoader classLoader, final boolean isParent) { if (classLoader == null) { return; } // Check if this is a parent before checking if the classloader is already in the delegatedTo set, // so that if the classloader is a context classloader but also a parent, it still gets marked as // a parent classloader. if (isParent) { allParentClassLoaders.add(classLoader); } if (delegatedTo.add(classLoader)) { // Find ClassLoaderHandlerRegistryEntry for this classloader final ClassLoaderHandlerRegistryEntry entry = getRegistryEntry(classLoader); // Delegate to this classloader, by recursing to that classloader to get its classloader order entry.findClassLoaderOrder(classLoader, this); } }
java
public void delegateTo(final ClassLoader classLoader, final boolean isParent) { if (classLoader == null) { return; } // Check if this is a parent before checking if the classloader is already in the delegatedTo set, // so that if the classloader is a context classloader but also a parent, it still gets marked as // a parent classloader. if (isParent) { allParentClassLoaders.add(classLoader); } if (delegatedTo.add(classLoader)) { // Find ClassLoaderHandlerRegistryEntry for this classloader final ClassLoaderHandlerRegistryEntry entry = getRegistryEntry(classLoader); // Delegate to this classloader, by recursing to that classloader to get its classloader order entry.findClassLoaderOrder(classLoader, this); } }
[ "public", "void", "delegateTo", "(", "final", "ClassLoader", "classLoader", ",", "final", "boolean", "isParent", ")", "{", "if", "(", "classLoader", "==", "null", ")", "{", "return", ";", "}", "// Check if this is a parent before checking if the classloader is already in the delegatedTo set,", "// so that if the classloader is a context classloader but also a parent, it still gets marked as", "// a parent classloader.", "if", "(", "isParent", ")", "{", "allParentClassLoaders", ".", "add", "(", "classLoader", ")", ";", "}", "if", "(", "delegatedTo", ".", "add", "(", "classLoader", ")", ")", "{", "// Find ClassLoaderHandlerRegistryEntry for this classloader", "final", "ClassLoaderHandlerRegistryEntry", "entry", "=", "getRegistryEntry", "(", "classLoader", ")", ";", "// Delegate to this classloader, by recursing to that classloader to get its classloader order", "entry", ".", "findClassLoaderOrder", "(", "classLoader", ",", "this", ")", ";", "}", "}" ]
Recursively delegate to another {@link ClassLoader}. @param classLoader the class loader
[ "Recursively", "delegate", "to", "another", "{", "@link", "ClassLoader", "}", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/classpath/ClassLoaderOrder.java#L142-L158
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/bind/BindUploader.java
BindUploader.arrayBindValueCount
public static int arrayBindValueCount(Map<String, ParameterBindingDTO> bindValues) { if (!isArrayBind(bindValues)) { return 0; } else { ParameterBindingDTO bindSample = bindValues.values().iterator().next(); List<String> bindSampleValues = (List<String>) bindSample.getValue(); return bindValues.size() * bindSampleValues.size(); } }
java
public static int arrayBindValueCount(Map<String, ParameterBindingDTO> bindValues) { if (!isArrayBind(bindValues)) { return 0; } else { ParameterBindingDTO bindSample = bindValues.values().iterator().next(); List<String> bindSampleValues = (List<String>) bindSample.getValue(); return bindValues.size() * bindSampleValues.size(); } }
[ "public", "static", "int", "arrayBindValueCount", "(", "Map", "<", "String", ",", "ParameterBindingDTO", ">", "bindValues", ")", "{", "if", "(", "!", "isArrayBind", "(", "bindValues", ")", ")", "{", "return", "0", ";", "}", "else", "{", "ParameterBindingDTO", "bindSample", "=", "bindValues", ".", "values", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "List", "<", "String", ">", "bindSampleValues", "=", "(", "List", "<", "String", ">", ")", "bindSample", ".", "getValue", "(", ")", ";", "return", "bindValues", ".", "size", "(", ")", "*", "bindSampleValues", ".", "size", "(", ")", ";", "}", "}" ]
Compute the number of array bind values in the given bind map @param bindValues the bind map @return 0 if bindValues is null, has no binds, or is not an array bind n otherwise, where n is the number of binds in the array bind
[ "Compute", "the", "number", "of", "array", "bind", "values", "in", "the", "given", "bind", "map" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L568-L580
googlegenomics/utils-java
src/main/java/com/google/cloud/genomics/utils/OfflineAuth.java
OfflineAuth.getCredential
public Credential getCredential() { if (hasStoredCredential()) { HttpTransport httpTransport; try { httpTransport = GoogleNetHttpTransport.newTrustedTransport(); } catch (IOException | GeneralSecurityException e) { throw new RuntimeException("Could not create HTTPS transport for use in credential creation", e); } return new GoogleCredential.Builder() .setJsonFactory(JacksonFactory.getDefaultInstance()) .setTransport(httpTransport) .setClientSecrets(getClientId(), getClientSecret()) .build() .setRefreshToken(getRefreshToken()); } return CredentialFactory.getApplicationDefaultCredential(); }
java
public Credential getCredential() { if (hasStoredCredential()) { HttpTransport httpTransport; try { httpTransport = GoogleNetHttpTransport.newTrustedTransport(); } catch (IOException | GeneralSecurityException e) { throw new RuntimeException("Could not create HTTPS transport for use in credential creation", e); } return new GoogleCredential.Builder() .setJsonFactory(JacksonFactory.getDefaultInstance()) .setTransport(httpTransport) .setClientSecrets(getClientId(), getClientSecret()) .build() .setRefreshToken(getRefreshToken()); } return CredentialFactory.getApplicationDefaultCredential(); }
[ "public", "Credential", "getCredential", "(", ")", "{", "if", "(", "hasStoredCredential", "(", ")", ")", "{", "HttpTransport", "httpTransport", ";", "try", "{", "httpTransport", "=", "GoogleNetHttpTransport", ".", "newTrustedTransport", "(", ")", ";", "}", "catch", "(", "IOException", "|", "GeneralSecurityException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Could not create HTTPS transport for use in credential creation\"", ",", "e", ")", ";", "}", "return", "new", "GoogleCredential", ".", "Builder", "(", ")", ".", "setJsonFactory", "(", "JacksonFactory", ".", "getDefaultInstance", "(", ")", ")", ".", "setTransport", "(", "httpTransport", ")", ".", "setClientSecrets", "(", "getClientId", "(", ")", ",", "getClientSecret", "(", ")", ")", ".", "build", "(", ")", ".", "setRefreshToken", "(", "getRefreshToken", "(", ")", ")", ";", "}", "return", "CredentialFactory", ".", "getApplicationDefaultCredential", "(", ")", ";", "}" ]
Return the stored user credential, if applicable, or fall back to the Application Default Credential. @return The com.google.api.client.auth.oauth2.Credential object.
[ "Return", "the", "stored", "user", "credential", "if", "applicable", "or", "fall", "back", "to", "the", "Application", "Default", "Credential", "." ]
train
https://github.com/googlegenomics/utils-java/blob/7205d5b4e4f61fc6b93acb4bdd76b93df5b5f612/src/main/java/com/google/cloud/genomics/utils/OfflineAuth.java#L141-L158
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/util/WebUtils.java
WebUtils.getPoolInfoHtml
public static PoolInfoHtml getPoolInfoHtml( Map<PoolInfo, PoolInfo> redirects, PoolInfo poolInfo) { String redirectAttributes = null; if (redirects != null) { PoolInfo destination = redirects.get(poolInfo); if (destination != null) { redirectAttributes = "Redirected to " + PoolInfo.createStringFromPoolInfo(destination); } } String spanTag = (redirectAttributes != null) ? "<span class=\"ui-state-disabled\" title=\"" + redirectAttributes + "\">" : "<span>"; String groupHtml = spanTag + poolInfo.getPoolGroupName() + "</span>"; String poolHtml = spanTag + (poolInfo.getPoolName() == null ? "-" : poolInfo.getPoolName()) + "</span>"; return new PoolInfoHtml(groupHtml, poolHtml); }
java
public static PoolInfoHtml getPoolInfoHtml( Map<PoolInfo, PoolInfo> redirects, PoolInfo poolInfo) { String redirectAttributes = null; if (redirects != null) { PoolInfo destination = redirects.get(poolInfo); if (destination != null) { redirectAttributes = "Redirected to " + PoolInfo.createStringFromPoolInfo(destination); } } String spanTag = (redirectAttributes != null) ? "<span class=\"ui-state-disabled\" title=\"" + redirectAttributes + "\">" : "<span>"; String groupHtml = spanTag + poolInfo.getPoolGroupName() + "</span>"; String poolHtml = spanTag + (poolInfo.getPoolName() == null ? "-" : poolInfo.getPoolName()) + "</span>"; return new PoolInfoHtml(groupHtml, poolHtml); }
[ "public", "static", "PoolInfoHtml", "getPoolInfoHtml", "(", "Map", "<", "PoolInfo", ",", "PoolInfo", ">", "redirects", ",", "PoolInfo", "poolInfo", ")", "{", "String", "redirectAttributes", "=", "null", ";", "if", "(", "redirects", "!=", "null", ")", "{", "PoolInfo", "destination", "=", "redirects", ".", "get", "(", "poolInfo", ")", ";", "if", "(", "destination", "!=", "null", ")", "{", "redirectAttributes", "=", "\"Redirected to \"", "+", "PoolInfo", ".", "createStringFromPoolInfo", "(", "destination", ")", ";", "}", "}", "String", "spanTag", "=", "(", "redirectAttributes", "!=", "null", ")", "?", "\"<span class=\\\"ui-state-disabled\\\" title=\\\"\"", "+", "redirectAttributes", "+", "\"\\\">\"", ":", "\"<span>\"", ";", "String", "groupHtml", "=", "spanTag", "+", "poolInfo", ".", "getPoolGroupName", "(", ")", "+", "\"</span>\"", ";", "String", "poolHtml", "=", "spanTag", "+", "(", "poolInfo", ".", "getPoolName", "(", ")", "==", "null", "?", "\"-\"", ":", "poolInfo", ".", "getPoolName", "(", ")", ")", "+", "\"</span>\"", ";", "return", "new", "PoolInfoHtml", "(", "groupHtml", ",", "poolHtml", ")", ";", "}" ]
Generate the appropriate HTML for pool name (redirected info if necessary) @param redirects @param poolInfo @return Pair of group and pool html
[ "Generate", "the", "appropriate", "HTML", "for", "pool", "name", "(", "redirected", "info", "if", "necessary", ")" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/util/WebUtils.java#L234-L255
otto-de/edison-microservice
edison-jobs/src/main/java/de/otto/edison/jobs/status/JobStatusCalculator.java
JobStatusCalculator.jobTooOld
protected boolean jobTooOld(final JobInfo jobInfo, final JobDefinition jobDefinition) { final Optional<OffsetDateTime> stopped = jobInfo.getStopped(); if (stopped.isPresent() && jobDefinition.maxAge().isPresent()) { final OffsetDateTime deadlineToRerun = stopped.get().plus(jobDefinition.maxAge().get()); return deadlineToRerun.isBefore(now()); } return false; }
java
protected boolean jobTooOld(final JobInfo jobInfo, final JobDefinition jobDefinition) { final Optional<OffsetDateTime> stopped = jobInfo.getStopped(); if (stopped.isPresent() && jobDefinition.maxAge().isPresent()) { final OffsetDateTime deadlineToRerun = stopped.get().plus(jobDefinition.maxAge().get()); return deadlineToRerun.isBefore(now()); } return false; }
[ "protected", "boolean", "jobTooOld", "(", "final", "JobInfo", "jobInfo", ",", "final", "JobDefinition", "jobDefinition", ")", "{", "final", "Optional", "<", "OffsetDateTime", ">", "stopped", "=", "jobInfo", ".", "getStopped", "(", ")", ";", "if", "(", "stopped", ".", "isPresent", "(", ")", "&&", "jobDefinition", ".", "maxAge", "(", ")", ".", "isPresent", "(", ")", ")", "{", "final", "OffsetDateTime", "deadlineToRerun", "=", "stopped", ".", "get", "(", ")", ".", "plus", "(", "jobDefinition", ".", "maxAge", "(", ")", ".", "get", "(", ")", ")", ";", "return", "deadlineToRerun", ".", "isBefore", "(", "now", "(", ")", ")", ";", "}", "return", "false", ";", "}" ]
Calculates whether or not the last job execution is too old. @param jobInfo job info of the last job execution @param jobDefinition job definition, specifying the max age of jobs @return boolean
[ "Calculates", "whether", "or", "not", "the", "last", "job", "execution", "is", "too", "old", "." ]
train
https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-jobs/src/main/java/de/otto/edison/jobs/status/JobStatusCalculator.java#L314-L322
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/EnumBindTransform.java
EnumBindTransform.generateSerializeOnXml
@Override public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) { XmlType xmlType = property.xmlInfo.xmlType; if (property.isNullable() && !property.isInCollection()) { methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); } switch (xmlType) { case ATTRIBUTE: methodBuilder.addStatement("$L.writeAttribute($S, $T.escapeXml10($L.$L()))", serializerName, BindProperty.xmlName(property), StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; case TAG: methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property)); methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); methodBuilder.addStatement("$L.writeEndElement()", serializerName); break; case VALUE: methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; case VALUE_CDATA: methodBuilder.addStatement("$L.writeCData($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; } if (property.isNullable() && !property.isInCollection()) { methodBuilder.endControlFlow(); } }
java
@Override public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) { XmlType xmlType = property.xmlInfo.xmlType; if (property.isNullable() && !property.isInCollection()) { methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); } switch (xmlType) { case ATTRIBUTE: methodBuilder.addStatement("$L.writeAttribute($S, $T.escapeXml10($L.$L()))", serializerName, BindProperty.xmlName(property), StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; case TAG: methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property)); methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); methodBuilder.addStatement("$L.writeEndElement()", serializerName); break; case VALUE: methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; case VALUE_CDATA: methodBuilder.addStatement("$L.writeCData($T.escapeXml10($L.$L()))", serializerName, StringEscapeUtils.class, getter(beanName, beanClass, property), METHOD_TO_CONVERT); break; } if (property.isNullable() && !property.isInCollection()) { methodBuilder.endControlFlow(); } }
[ "@", "Override", "public", "void", "generateSerializeOnXml", "(", "BindTypeContext", "context", ",", "MethodSpec", ".", "Builder", "methodBuilder", ",", "String", "serializerName", ",", "TypeName", "beanClass", ",", "String", "beanName", ",", "BindProperty", "property", ")", "{", "XmlType", "xmlType", "=", "property", ".", "xmlInfo", ".", "xmlType", ";", "if", "(", "property", ".", "isNullable", "(", ")", "&&", "!", "property", ".", "isInCollection", "(", ")", ")", "{", "methodBuilder", ".", "beginControlFlow", "(", "\"if ($L!=null) \"", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ")", ";", "}", "switch", "(", "xmlType", ")", "{", "case", "ATTRIBUTE", ":", "methodBuilder", ".", "addStatement", "(", "\"$L.writeAttribute($S, $T.escapeXml10($L.$L()))\"", ",", "serializerName", ",", "BindProperty", ".", "xmlName", "(", "property", ")", ",", "StringEscapeUtils", ".", "class", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ",", "METHOD_TO_CONVERT", ")", ";", "break", ";", "case", "TAG", ":", "methodBuilder", ".", "addStatement", "(", "\"$L.writeStartElement($S)\"", ",", "serializerName", ",", "BindProperty", ".", "xmlName", "(", "property", ")", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$L.writeCharacters($T.escapeXml10($L.$L()))\"", ",", "serializerName", ",", "StringEscapeUtils", ".", "class", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ",", "METHOD_TO_CONVERT", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$L.writeEndElement()\"", ",", "serializerName", ")", ";", "break", ";", "case", "VALUE", ":", "methodBuilder", ".", "addStatement", "(", "\"$L.writeCharacters($T.escapeXml10($L.$L()))\"", ",", "serializerName", ",", "StringEscapeUtils", ".", "class", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ",", "METHOD_TO_CONVERT", ")", ";", "break", ";", "case", "VALUE_CDATA", ":", "methodBuilder", ".", "addStatement", "(", "\"$L.writeCData($T.escapeXml10($L.$L()))\"", ",", "serializerName", ",", "StringEscapeUtils", ".", "class", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ",", "METHOD_TO_CONVERT", ")", ";", "break", ";", "}", "if", "(", "property", ".", "isNullable", "(", ")", "&&", "!", "property", ".", "isInCollection", "(", ")", ")", "{", "methodBuilder", ".", "endControlFlow", "(", ")", ";", "}", "}" ]
/* (non-Javadoc) @see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateSerializeOnXml(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/EnumBindTransform.java#L66-L95
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/template/TemplateFactory.java
TemplateFactory.getTemplateInfo
public TemplateInfo getTemplateInfo(String templateId, Integer templateVersion) throws TemplateException { if (templateSet.containsTemplateId(templateId)) { TemplateVersions versionMap = templateSet.getTemplateVersions(templateId); if (versionMap.containsVersion(templateVersion)) return versionMap.getTemplate(templateVersion); throw new TemplateException("No template found with VERSION : " + templateVersion + " and ID: " + templateId); } throw new TemplateException("No template found with ID : " + templateId); }
java
public TemplateInfo getTemplateInfo(String templateId, Integer templateVersion) throws TemplateException { if (templateSet.containsTemplateId(templateId)) { TemplateVersions versionMap = templateSet.getTemplateVersions(templateId); if (versionMap.containsVersion(templateVersion)) return versionMap.getTemplate(templateVersion); throw new TemplateException("No template found with VERSION : " + templateVersion + " and ID: " + templateId); } throw new TemplateException("No template found with ID : " + templateId); }
[ "public", "TemplateInfo", "getTemplateInfo", "(", "String", "templateId", ",", "Integer", "templateVersion", ")", "throws", "TemplateException", "{", "if", "(", "templateSet", ".", "containsTemplateId", "(", "templateId", ")", ")", "{", "TemplateVersions", "versionMap", "=", "templateSet", ".", "getTemplateVersions", "(", "templateId", ")", ";", "if", "(", "versionMap", ".", "containsVersion", "(", "templateVersion", ")", ")", "return", "versionMap", ".", "getTemplate", "(", "templateVersion", ")", ";", "throw", "new", "TemplateException", "(", "\"No template found with VERSION : \"", "+", "templateVersion", "+", "\" and ID: \"", "+", "templateId", ")", ";", "}", "throw", "new", "TemplateException", "(", "\"No template found with ID : \"", "+", "templateId", ")", ";", "}" ]
/* public List<TemplateInfo> getRNALatestIncludedTemplates() { List<TemplateInfo> rnaTemplates = getLatestIncludedTemplatesById(TemplateIDs.RNA_TEMPLATE_IDs); Collections.sort(rnaTemplates, new TemplateOrderComparator<TemplateInfo>(templateOrders)); return rnaTemplates; }
[ "/", "*", "public", "List<TemplateInfo", ">", "getRNALatestIncludedTemplates", "()", "{", "List<TemplateInfo", ">", "rnaTemplates", "=", "getLatestIncludedTemplatesById", "(", "TemplateIDs", ".", "RNA_TEMPLATE_IDs", ")", ";", "Collections", ".", "sort", "(", "rnaTemplates", "new", "TemplateOrderComparator<TemplateInfo", ">", "(", "templateOrders", "))", ";", "return", "rnaTemplates", ";", "}" ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/template/TemplateFactory.java#L134-L142
vkostyukov/la4j
src/main/java/org/la4j/Matrices.java
Matrices.asDivFunction
public static MatrixFunction asDivFunction(final double arg) { return new MatrixFunction() { @Override public double evaluate(int i, int j, double value) { return value / arg; } }; }
java
public static MatrixFunction asDivFunction(final double arg) { return new MatrixFunction() { @Override public double evaluate(int i, int j, double value) { return value / arg; } }; }
[ "public", "static", "MatrixFunction", "asDivFunction", "(", "final", "double", "arg", ")", "{", "return", "new", "MatrixFunction", "(", ")", "{", "@", "Override", "public", "double", "evaluate", "(", "int", "i", ",", "int", "j", ",", "double", "value", ")", "{", "return", "value", "/", "arg", ";", "}", "}", ";", "}" ]
Creates a div function that divides it's argument by given {@code value}. @param arg a divisor value @return a closure that does {@code _ / _}
[ "Creates", "a", "div", "function", "that", "divides", "it", "s", "argument", "by", "given", "{", "@code", "value", "}", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L487-L494
orhanobut/dialogplus
dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java
DialogPlusBuilder.setHeader
public DialogPlusBuilder setHeader(@NonNull View view, boolean fixed) { this.headerView = view; this.fixedHeader = fixed; return this; }
java
public DialogPlusBuilder setHeader(@NonNull View view, boolean fixed) { this.headerView = view; this.fixedHeader = fixed; return this; }
[ "public", "DialogPlusBuilder", "setHeader", "(", "@", "NonNull", "View", "view", ",", "boolean", "fixed", ")", "{", "this", ".", "headerView", "=", "view", ";", "this", ".", "fixedHeader", "=", "fixed", ";", "return", "this", ";", "}" ]
Set the header view using a view @param fixed is used to determine whether header should be fixed or not. Fixed if true, scrollable otherwise
[ "Set", "the", "header", "view", "using", "a", "view" ]
train
https://github.com/orhanobut/dialogplus/blob/291bf4daaa3c81bf5537125f547913beb8ee2c17/dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java#L137-L141
JOML-CI/JOML
src/org/joml/GeometryUtils.java
GeometryUtils.tangentBitangent
public static void tangentBitangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f destTangent, Vector3f destBitangent) { float DeltaV1 = uv2.y() - uv1.y(); float DeltaV2 = uv3.y() - uv1.y(); float DeltaU1 = uv2.x() - uv1.x(); float DeltaU2 = uv3.x() - uv1.x(); float f = 1.0f / (DeltaU1 * DeltaV2 - DeltaU2 * DeltaV1); destTangent.x = f * (DeltaV2 * (v2.x() - v1.x()) - DeltaV1 * (v3.x() - v1.x())); destTangent.y = f * (DeltaV2 * (v2.y() - v1.y()) - DeltaV1 * (v3.y() - v1.y())); destTangent.z = f * (DeltaV2 * (v2.z() - v1.z()) - DeltaV1 * (v3.z() - v1.z())); destTangent.normalize(); destBitangent.x = f * (-DeltaU2 * (v2.x() - v1.x()) - DeltaU1 * (v3.x() - v1.x())); destBitangent.y = f * (-DeltaU2 * (v2.y() - v1.y()) - DeltaU1 * (v3.y() - v1.y())); destBitangent.z = f * (-DeltaU2 * (v2.z() - v1.z()) - DeltaU1 * (v3.z() - v1.z())); destBitangent.normalize(); }
java
public static void tangentBitangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f destTangent, Vector3f destBitangent) { float DeltaV1 = uv2.y() - uv1.y(); float DeltaV2 = uv3.y() - uv1.y(); float DeltaU1 = uv2.x() - uv1.x(); float DeltaU2 = uv3.x() - uv1.x(); float f = 1.0f / (DeltaU1 * DeltaV2 - DeltaU2 * DeltaV1); destTangent.x = f * (DeltaV2 * (v2.x() - v1.x()) - DeltaV1 * (v3.x() - v1.x())); destTangent.y = f * (DeltaV2 * (v2.y() - v1.y()) - DeltaV1 * (v3.y() - v1.y())); destTangent.z = f * (DeltaV2 * (v2.z() - v1.z()) - DeltaV1 * (v3.z() - v1.z())); destTangent.normalize(); destBitangent.x = f * (-DeltaU2 * (v2.x() - v1.x()) - DeltaU1 * (v3.x() - v1.x())); destBitangent.y = f * (-DeltaU2 * (v2.y() - v1.y()) - DeltaU1 * (v3.y() - v1.y())); destBitangent.z = f * (-DeltaU2 * (v2.z() - v1.z()) - DeltaU1 * (v3.z() - v1.z())); destBitangent.normalize(); }
[ "public", "static", "void", "tangentBitangent", "(", "Vector3fc", "v1", ",", "Vector2fc", "uv1", ",", "Vector3fc", "v2", ",", "Vector2fc", "uv2", ",", "Vector3fc", "v3", ",", "Vector2fc", "uv3", ",", "Vector3f", "destTangent", ",", "Vector3f", "destBitangent", ")", "{", "float", "DeltaV1", "=", "uv2", ".", "y", "(", ")", "-", "uv1", ".", "y", "(", ")", ";", "float", "DeltaV2", "=", "uv3", ".", "y", "(", ")", "-", "uv1", ".", "y", "(", ")", ";", "float", "DeltaU1", "=", "uv2", ".", "x", "(", ")", "-", "uv1", ".", "x", "(", ")", ";", "float", "DeltaU2", "=", "uv3", ".", "x", "(", ")", "-", "uv1", ".", "x", "(", ")", ";", "float", "f", "=", "1.0f", "/", "(", "DeltaU1", "*", "DeltaV2", "-", "DeltaU2", "*", "DeltaV1", ")", ";", "destTangent", ".", "x", "=", "f", "*", "(", "DeltaV2", "*", "(", "v2", ".", "x", "(", ")", "-", "v1", ".", "x", "(", ")", ")", "-", "DeltaV1", "*", "(", "v3", ".", "x", "(", ")", "-", "v1", ".", "x", "(", ")", ")", ")", ";", "destTangent", ".", "y", "=", "f", "*", "(", "DeltaV2", "*", "(", "v2", ".", "y", "(", ")", "-", "v1", ".", "y", "(", ")", ")", "-", "DeltaV1", "*", "(", "v3", ".", "y", "(", ")", "-", "v1", ".", "y", "(", ")", ")", ")", ";", "destTangent", ".", "z", "=", "f", "*", "(", "DeltaV2", "*", "(", "v2", ".", "z", "(", ")", "-", "v1", ".", "z", "(", ")", ")", "-", "DeltaV1", "*", "(", "v3", ".", "z", "(", ")", "-", "v1", ".", "z", "(", ")", ")", ")", ";", "destTangent", ".", "normalize", "(", ")", ";", "destBitangent", ".", "x", "=", "f", "*", "(", "-", "DeltaU2", "*", "(", "v2", ".", "x", "(", ")", "-", "v1", ".", "x", "(", ")", ")", "-", "DeltaU1", "*", "(", "v3", ".", "x", "(", ")", "-", "v1", ".", "x", "(", ")", ")", ")", ";", "destBitangent", ".", "y", "=", "f", "*", "(", "-", "DeltaU2", "*", "(", "v2", ".", "y", "(", ")", "-", "v1", ".", "y", "(", ")", ")", "-", "DeltaU1", "*", "(", "v3", ".", "y", "(", ")", "-", "v1", ".", "y", "(", ")", ")", ")", ";", "destBitangent", ".", "z", "=", "f", "*", "(", "-", "DeltaU2", "*", "(", "v2", ".", "z", "(", ")", "-", "v1", ".", "z", "(", ")", ")", "-", "DeltaU1", "*", "(", "v3", ".", "z", "(", ")", "-", "v1", ".", "z", "(", ")", ")", ")", ";", "destBitangent", ".", "normalize", "(", ")", ";", "}" ]
Calculate the surface tangent and bitangent for the three supplied vertices and UV coordinates and store the result in <code>dest</code>. @param v1 XYZ of first vertex @param uv1 UV of first vertex @param v2 XYZ of second vertex @param uv2 UV of second vertex @param v3 XYZ of third vertex @param uv3 UV of third vertex @param destTangent the tangent will be stored here @param destBitangent the bitangent will be stored here
[ "Calculate", "the", "surface", "tangent", "and", "bitangent", "for", "the", "three", "supplied", "vertices", "and", "UV", "coordinates", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/GeometryUtils.java#L228-L245
VoltDB/voltdb
src/frontend/org/voltdb/importer/ChannelDistributer.java
ChannelDistributer.acquireAndRelease
static void acquireAndRelease(Semaphore lock) { try { lock.acquire(); lock.release(); } catch (InterruptedException ex) { throw loggedDistributerException(ex, "interruped while waiting for a semaphare"); } }
java
static void acquireAndRelease(Semaphore lock) { try { lock.acquire(); lock.release(); } catch (InterruptedException ex) { throw loggedDistributerException(ex, "interruped while waiting for a semaphare"); } }
[ "static", "void", "acquireAndRelease", "(", "Semaphore", "lock", ")", "{", "try", "{", "lock", ".", "acquire", "(", ")", ";", "lock", ".", "release", "(", ")", ";", "}", "catch", "(", "InterruptedException", "ex", ")", "{", "throw", "loggedDistributerException", "(", "ex", ",", "\"interruped while waiting for a semaphare\"", ")", ";", "}", "}" ]
Boiler plate method that acquires, and releases a {@link Semaphore} @param lock a {@link Semaphore}
[ "Boiler", "plate", "method", "that", "acquires", "and", "releases", "a", "{" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importer/ChannelDistributer.java#L166-L173
JCTools/JCTools
jctools-build/src/main/java/org/jctools/queues/atomic/JavaParsingAtomicLinkedQueueGenerator.java
JavaParsingAtomicLinkedQueueGenerator.fieldUpdaterGetAndSet
private BlockStmt fieldUpdaterGetAndSet(String fieldUpdaterFieldName, String newValueName) { BlockStmt body = new BlockStmt(); body.addStatement(new ReturnStmt( methodCallExpr(fieldUpdaterFieldName, "getAndSet", new ThisExpr(), new NameExpr(newValueName)))); return body; }
java
private BlockStmt fieldUpdaterGetAndSet(String fieldUpdaterFieldName, String newValueName) { BlockStmt body = new BlockStmt(); body.addStatement(new ReturnStmt( methodCallExpr(fieldUpdaterFieldName, "getAndSet", new ThisExpr(), new NameExpr(newValueName)))); return body; }
[ "private", "BlockStmt", "fieldUpdaterGetAndSet", "(", "String", "fieldUpdaterFieldName", ",", "String", "newValueName", ")", "{", "BlockStmt", "body", "=", "new", "BlockStmt", "(", ")", ";", "body", ".", "addStatement", "(", "new", "ReturnStmt", "(", "methodCallExpr", "(", "fieldUpdaterFieldName", ",", "\"getAndSet\"", ",", "new", "ThisExpr", "(", ")", ",", "new", "NameExpr", "(", "newValueName", ")", ")", ")", ")", ";", "return", "body", ";", "}" ]
Generates something like <code>return P_INDEX_UPDATER.getAndSet(this, newValue)</code> @param fieldUpdaterFieldName @param newValueName @return
[ "Generates", "something", "like", "<code", ">", "return", "P_INDEX_UPDATER", ".", "getAndSet", "(", "this", "newValue", ")", "<", "/", "code", ">" ]
train
https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-build/src/main/java/org/jctools/queues/atomic/JavaParsingAtomicLinkedQueueGenerator.java#L319-L324
Azure/azure-sdk-for-java
eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/RetryPolicy.java
RetryPolicy.getNextRetryInterval
public Duration getNextRetryInterval(String clientId, Exception lastException, Duration remainingTime) { int baseWaitTime = 0; synchronized (this.serverBusySync) { if (lastException != null && (lastException instanceof ServerBusyException || (lastException.getCause() != null && lastException.getCause() instanceof ServerBusyException))) { baseWaitTime += ClientConstants.SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS; } } return this.onGetNextRetryInterval(clientId, lastException, remainingTime, baseWaitTime); }
java
public Duration getNextRetryInterval(String clientId, Exception lastException, Duration remainingTime) { int baseWaitTime = 0; synchronized (this.serverBusySync) { if (lastException != null && (lastException instanceof ServerBusyException || (lastException.getCause() != null && lastException.getCause() instanceof ServerBusyException))) { baseWaitTime += ClientConstants.SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS; } } return this.onGetNextRetryInterval(clientId, lastException, remainingTime, baseWaitTime); }
[ "public", "Duration", "getNextRetryInterval", "(", "String", "clientId", ",", "Exception", "lastException", ",", "Duration", "remainingTime", ")", "{", "int", "baseWaitTime", "=", "0", ";", "synchronized", "(", "this", ".", "serverBusySync", ")", "{", "if", "(", "lastException", "!=", "null", "&&", "(", "lastException", "instanceof", "ServerBusyException", "||", "(", "lastException", ".", "getCause", "(", ")", "!=", "null", "&&", "lastException", ".", "getCause", "(", ")", "instanceof", "ServerBusyException", ")", ")", ")", "{", "baseWaitTime", "+=", "ClientConstants", ".", "SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS", ";", "}", "}", "return", "this", ".", "onGetNextRetryInterval", "(", "clientId", ",", "lastException", ",", "remainingTime", ",", "baseWaitTime", ")", ";", "}" ]
Gets the Interval after which nextRetry should be done. @param clientId clientId @param lastException lastException @param remainingTime remainingTime to retry @return returns 'null' Duration when not Allowed
[ "Gets", "the", "Interval", "after", "which", "nextRetry", "should", "be", "done", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/RetryPolicy.java#L76-L86
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.findBinding
public <S, T> Binding<S, T> findBinding(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier) { return findBinding(new ConverterKey<S,T>(source, target, qualifier == null ? DefaultBinding.class : qualifier)); }
java
public <S, T> Binding<S, T> findBinding(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier) { return findBinding(new ConverterKey<S,T>(source, target, qualifier == null ? DefaultBinding.class : qualifier)); }
[ "public", "<", "S", ",", "T", ">", "Binding", "<", "S", ",", "T", ">", "findBinding", "(", "Class", "<", "S", ">", "source", ",", "Class", "<", "T", ">", "target", ",", "Class", "<", "?", "extends", "Annotation", ">", "qualifier", ")", "{", "return", "findBinding", "(", "new", "ConverterKey", "<", "S", ",", "T", ">", "(", "source", ",", "target", ",", "qualifier", "==", "null", "?", "DefaultBinding", ".", "class", ":", "qualifier", ")", ")", ";", "}" ]
Resolve a Binding with the given source and target class. A binding unifies a marshaller and an unmarshaller and both must be available to resolve a binding. The source class is considered the owning class of the binding. The source can be marshalled into the target class. Similarly, the target can be unmarshalled to produce an instance of the source type. @param source The source (owning) class @param target The target (foreign) class @param qualifier The qualifier for which the binding must be registered
[ "Resolve", "a", "Binding", "with", "the", "given", "source", "and", "target", "class", ".", "A", "binding", "unifies", "a", "marshaller", "and", "an", "unmarshaller", "and", "both", "must", "be", "available", "to", "resolve", "a", "binding", "." ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L891-L893
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.java
FalsePositiveAnalyzer.analyzeDependency
@Override protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException { removeJreEntries(dependency); removeBadMatches(dependency); removeBadSpringMatches(dependency); removeWrongVersionMatches(dependency); removeSpuriousCPE(dependency); removeDuplicativeEntriesFromJar(dependency, engine); addFalseNegativeCPEs(dependency); }
java
@Override protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException { removeJreEntries(dependency); removeBadMatches(dependency); removeBadSpringMatches(dependency); removeWrongVersionMatches(dependency); removeSpuriousCPE(dependency); removeDuplicativeEntriesFromJar(dependency, engine); addFalseNegativeCPEs(dependency); }
[ "@", "Override", "protected", "void", "analyzeDependency", "(", "Dependency", "dependency", ",", "Engine", "engine", ")", "throws", "AnalysisException", "{", "removeJreEntries", "(", "dependency", ")", ";", "removeBadMatches", "(", "dependency", ")", ";", "removeBadSpringMatches", "(", "dependency", ")", ";", "removeWrongVersionMatches", "(", "dependency", ")", ";", "removeSpuriousCPE", "(", "dependency", ")", ";", "removeDuplicativeEntriesFromJar", "(", "dependency", ",", "engine", ")", ";", "addFalseNegativeCPEs", "(", "dependency", ")", ";", "}" ]
Analyzes the dependencies and removes bad/incorrect CPE associations based on various heuristics. @param dependency the dependency to analyze. @param engine the engine that is scanning the dependencies @throws AnalysisException is thrown if there is an error reading the JAR file.
[ "Analyzes", "the", "dependencies", "and", "removes", "bad", "/", "incorrect", "CPE", "associations", "based", "on", "various", "heuristics", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.java#L136-L145
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.processFile
static void processFile(final IdentityPatchContext context, final File file, final PatchingTaskContext.Mode mode) throws IOException { if (mode == PatchingTaskContext.Mode.APPLY) { if (ENABLE_INVALIDATION) { updateJar(file, GOOD_ENDSIG_PATTERN, BAD_BYTE_SKIP, CRIPPLED_ENDSIG, GOOD_ENDSIG); backup(context, file); } } else if (mode == PatchingTaskContext.Mode.ROLLBACK) { updateJar(file, CRIPPLED_ENDSIG_PATTERN, BAD_BYTE_SKIP, GOOD_ENDSIG, CRIPPLED_ENDSIG); restore(context, file); } else { throw new IllegalStateException(); } }
java
static void processFile(final IdentityPatchContext context, final File file, final PatchingTaskContext.Mode mode) throws IOException { if (mode == PatchingTaskContext.Mode.APPLY) { if (ENABLE_INVALIDATION) { updateJar(file, GOOD_ENDSIG_PATTERN, BAD_BYTE_SKIP, CRIPPLED_ENDSIG, GOOD_ENDSIG); backup(context, file); } } else if (mode == PatchingTaskContext.Mode.ROLLBACK) { updateJar(file, CRIPPLED_ENDSIG_PATTERN, BAD_BYTE_SKIP, GOOD_ENDSIG, CRIPPLED_ENDSIG); restore(context, file); } else { throw new IllegalStateException(); } }
[ "static", "void", "processFile", "(", "final", "IdentityPatchContext", "context", ",", "final", "File", "file", ",", "final", "PatchingTaskContext", ".", "Mode", "mode", ")", "throws", "IOException", "{", "if", "(", "mode", "==", "PatchingTaskContext", ".", "Mode", ".", "APPLY", ")", "{", "if", "(", "ENABLE_INVALIDATION", ")", "{", "updateJar", "(", "file", ",", "GOOD_ENDSIG_PATTERN", ",", "BAD_BYTE_SKIP", ",", "CRIPPLED_ENDSIG", ",", "GOOD_ENDSIG", ")", ";", "backup", "(", "context", ",", "file", ")", ";", "}", "}", "else", "if", "(", "mode", "==", "PatchingTaskContext", ".", "Mode", ".", "ROLLBACK", ")", "{", "updateJar", "(", "file", ",", "CRIPPLED_ENDSIG_PATTERN", ",", "BAD_BYTE_SKIP", ",", "GOOD_ENDSIG", ",", "CRIPPLED_ENDSIG", ")", ";", "restore", "(", "context", ",", "file", ")", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "}" ]
Process a file. @param file the file to be processed @param mode the patching mode @throws IOException
[ "Process", "a", "file", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L150-L162
google/closure-templates
java/src/com/google/template/soy/jbcsrc/api/Continuations.java
Continuations.strictContinuation
static Continuation<SanitizedContent> strictContinuation( WriteContinuation delegate, final StringBuilder buffer, final ContentKind kind) { if (delegate.result().isDone()) { return new ResultContinuation<>( UnsafeSanitizedContentOrdainer.ordainAsSafe(buffer.toString(), kind)); } return new AbstractContinuation<SanitizedContent>(delegate) { @Override Continuation<SanitizedContent> nextContinuation(WriteContinuation next) { return strictContinuation(next, buffer, kind); } }; }
java
static Continuation<SanitizedContent> strictContinuation( WriteContinuation delegate, final StringBuilder buffer, final ContentKind kind) { if (delegate.result().isDone()) { return new ResultContinuation<>( UnsafeSanitizedContentOrdainer.ordainAsSafe(buffer.toString(), kind)); } return new AbstractContinuation<SanitizedContent>(delegate) { @Override Continuation<SanitizedContent> nextContinuation(WriteContinuation next) { return strictContinuation(next, buffer, kind); } }; }
[ "static", "Continuation", "<", "SanitizedContent", ">", "strictContinuation", "(", "WriteContinuation", "delegate", ",", "final", "StringBuilder", "buffer", ",", "final", "ContentKind", "kind", ")", "{", "if", "(", "delegate", ".", "result", "(", ")", ".", "isDone", "(", ")", ")", "{", "return", "new", "ResultContinuation", "<>", "(", "UnsafeSanitizedContentOrdainer", ".", "ordainAsSafe", "(", "buffer", ".", "toString", "(", ")", ",", "kind", ")", ")", ";", "}", "return", "new", "AbstractContinuation", "<", "SanitizedContent", ">", "(", "delegate", ")", "{", "@", "Override", "Continuation", "<", "SanitizedContent", ">", "nextContinuation", "(", "WriteContinuation", "next", ")", "{", "return", "strictContinuation", "(", "next", ",", "buffer", ",", "kind", ")", ";", "}", "}", ";", "}" ]
Return a {@link SanitizedContent} valued continuation. Rendering logic is delegated to the {@link WriteContinuation}, but it is assumed that the builder is the render target.
[ "Return", "a", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/api/Continuations.java#L67-L81
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/Drawer.java
Drawer.updateIcon
public void updateIcon(long identifier, ImageHolder image) { IDrawerItem drawerItem = getDrawerItem(identifier); if (drawerItem instanceof Iconable) { Iconable pdi = (Iconable) drawerItem; pdi.withIcon(image); updateItem((IDrawerItem) pdi); } }
java
public void updateIcon(long identifier, ImageHolder image) { IDrawerItem drawerItem = getDrawerItem(identifier); if (drawerItem instanceof Iconable) { Iconable pdi = (Iconable) drawerItem; pdi.withIcon(image); updateItem((IDrawerItem) pdi); } }
[ "public", "void", "updateIcon", "(", "long", "identifier", ",", "ImageHolder", "image", ")", "{", "IDrawerItem", "drawerItem", "=", "getDrawerItem", "(", "identifier", ")", ";", "if", "(", "drawerItem", "instanceof", "Iconable", ")", "{", "Iconable", "pdi", "=", "(", "Iconable", ")", "drawerItem", ";", "pdi", ".", "withIcon", "(", "image", ")", ";", "updateItem", "(", "(", "IDrawerItem", ")", "pdi", ")", ";", "}", "}" ]
update the name for a specific drawerItem identified by its id @param identifier @param image
[ "update", "the", "name", "for", "a", "specific", "drawerItem", "identified", "by", "its", "id" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java#L697-L704
samskivert/samskivert
src/main/java/com/samskivert/util/StringUtil.java
StringUtil.fieldsToString
public static String fieldsToString (Object object, String sep) { StringBuilder buf = new StringBuilder("["); fieldsToString(buf, object, sep); return buf.append("]").toString(); }
java
public static String fieldsToString (Object object, String sep) { StringBuilder buf = new StringBuilder("["); fieldsToString(buf, object, sep); return buf.append("]").toString(); }
[ "public", "static", "String", "fieldsToString", "(", "Object", "object", ",", "String", "sep", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "\"[\"", ")", ";", "fieldsToString", "(", "buf", ",", "object", ",", "sep", ")", ";", "return", "buf", ".", "append", "(", "\"]\"", ")", ".", "toString", "(", ")", ";", "}" ]
Like {@link #fieldsToString(Object)} except that the supplied separator string will be used between fields.
[ "Like", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/StringUtil.java#L525-L530
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toLong
public static Long toLong(Object o, Long defaultValue) { if (o instanceof Long) return (Long) o; if (defaultValue != null) return Long.valueOf(toLongValue(o, defaultValue.longValue())); long res = toLongValue(o, Long.MIN_VALUE); if (res == Long.MIN_VALUE) return defaultValue; return Long.valueOf(res); }
java
public static Long toLong(Object o, Long defaultValue) { if (o instanceof Long) return (Long) o; if (defaultValue != null) return Long.valueOf(toLongValue(o, defaultValue.longValue())); long res = toLongValue(o, Long.MIN_VALUE); if (res == Long.MIN_VALUE) return defaultValue; return Long.valueOf(res); }
[ "public", "static", "Long", "toLong", "(", "Object", "o", ",", "Long", "defaultValue", ")", "{", "if", "(", "o", "instanceof", "Long", ")", "return", "(", "Long", ")", "o", ";", "if", "(", "defaultValue", "!=", "null", ")", "return", "Long", ".", "valueOf", "(", "toLongValue", "(", "o", ",", "defaultValue", ".", "longValue", "(", ")", ")", ")", ";", "long", "res", "=", "toLongValue", "(", "o", ",", "Long", ".", "MIN_VALUE", ")", ";", "if", "(", "res", "==", "Long", ".", "MIN_VALUE", ")", "return", "defaultValue", ";", "return", "Long", ".", "valueOf", "(", "res", ")", ";", "}" ]
cast a Object to a Long Object(reference type) @param o Object to cast @param defaultValue @return casted Long Object
[ "cast", "a", "Object", "to", "a", "Long", "Object", "(", "reference", "type", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L1546-L1553
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/TextUICommandLine.java
TextUICommandLine.addAuxClassPathEntries
private void addAuxClassPathEntries(String argument) { StringTokenizer tok = new StringTokenizer(argument, File.pathSeparator); while (tok.hasMoreTokens()) { project.addAuxClasspathEntry(tok.nextToken()); } }
java
private void addAuxClassPathEntries(String argument) { StringTokenizer tok = new StringTokenizer(argument, File.pathSeparator); while (tok.hasMoreTokens()) { project.addAuxClasspathEntry(tok.nextToken()); } }
[ "private", "void", "addAuxClassPathEntries", "(", "String", "argument", ")", "{", "StringTokenizer", "tok", "=", "new", "StringTokenizer", "(", "argument", ",", "File", ".", "pathSeparator", ")", ";", "while", "(", "tok", ".", "hasMoreTokens", "(", ")", ")", "{", "project", ".", "addAuxClasspathEntry", "(", "tok", ".", "nextToken", "(", ")", ")", ";", "}", "}" ]
Parse the argument as auxclasspath entries and add them @param argument
[ "Parse", "the", "argument", "as", "auxclasspath", "entries", "and", "add", "them" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/TextUICommandLine.java#L569-L574
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java
AbstractRenderer.setZoomToFit
public void setZoomToFit(double drawWidth, double drawHeight, double diagramWidth, double diagramHeight) { double margin = rendererModel.getParameter(Margin.class).getValue(); // determine the zoom needed to fit the diagram to the screen double widthRatio = drawWidth / (diagramWidth + (2 * margin)); double heightRatio = drawHeight / (diagramHeight + (2 * margin)); double zoom = Math.min(widthRatio, heightRatio); this.fontManager.setFontForZoom(zoom); // record the zoom in the model, so that generators can use it rendererModel.getParameter(ZoomFactor.class).setValue(zoom); }
java
public void setZoomToFit(double drawWidth, double drawHeight, double diagramWidth, double diagramHeight) { double margin = rendererModel.getParameter(Margin.class).getValue(); // determine the zoom needed to fit the diagram to the screen double widthRatio = drawWidth / (diagramWidth + (2 * margin)); double heightRatio = drawHeight / (diagramHeight + (2 * margin)); double zoom = Math.min(widthRatio, heightRatio); this.fontManager.setFontForZoom(zoom); // record the zoom in the model, so that generators can use it rendererModel.getParameter(ZoomFactor.class).setValue(zoom); }
[ "public", "void", "setZoomToFit", "(", "double", "drawWidth", ",", "double", "drawHeight", ",", "double", "diagramWidth", ",", "double", "diagramHeight", ")", "{", "double", "margin", "=", "rendererModel", ".", "getParameter", "(", "Margin", ".", "class", ")", ".", "getValue", "(", ")", ";", "// determine the zoom needed to fit the diagram to the screen", "double", "widthRatio", "=", "drawWidth", "/", "(", "diagramWidth", "+", "(", "2", "*", "margin", ")", ")", ";", "double", "heightRatio", "=", "drawHeight", "/", "(", "diagramHeight", "+", "(", "2", "*", "margin", ")", ")", ";", "double", "zoom", "=", "Math", ".", "min", "(", "widthRatio", ",", "heightRatio", ")", ";", "this", ".", "fontManager", ".", "setFontForZoom", "(", "zoom", ")", ";", "// record the zoom in the model, so that generators can use it", "rendererModel", ".", "getParameter", "(", "ZoomFactor", ".", "class", ")", ".", "setValue", "(", "zoom", ")", ";", "}" ]
Calculate and set the zoom factor needed to completely fit the diagram onto the screen bounds. @param drawWidth the width of the area to draw onto @param drawHeight the height of the area to draw onto @param diagramWidth the width of the diagram @param diagramHeight the height of the diagram
[ "Calculate", "and", "set", "the", "zoom", "factor", "needed", "to", "completely", "fit", "the", "diagram", "onto", "the", "screen", "bounds", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java#L292-L307
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.asType
@SuppressWarnings("unchecked") public static <T> T asType(Iterable iterable, Class<T> clazz) { if (Collection.class.isAssignableFrom(clazz)) { return asType((Collection) toList(iterable), clazz); } return asType((Object) iterable, clazz); }
java
@SuppressWarnings("unchecked") public static <T> T asType(Iterable iterable, Class<T> clazz) { if (Collection.class.isAssignableFrom(clazz)) { return asType((Collection) toList(iterable), clazz); } return asType((Object) iterable, clazz); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "asType", "(", "Iterable", "iterable", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "Collection", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", ")", "{", "return", "asType", "(", "(", "Collection", ")", "toList", "(", "iterable", ")", ",", "clazz", ")", ";", "}", "return", "asType", "(", "(", "Object", ")", "iterable", ",", "clazz", ")", ";", "}" ]
Converts the given iterable to another type. @param iterable a Iterable @param clazz the desired class @return the object resulting from this type conversion @see #asType(Collection, Class) @since 2.4.12
[ "Converts", "the", "given", "iterable", "to", "another", "type", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L11659-L11666
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.repeatString
public static String repeatString(String str, int count) { if (count <= 0) return ""; char[] chars = str.toCharArray(); char[] rtn = new char[chars.length * count]; int pos = 0; for (int i = 0; i < count; i++) { for (int y = 0; y < chars.length; y++) rtn[pos++] = chars[y]; // rtn.append(str); } return new String(rtn); }
java
public static String repeatString(String str, int count) { if (count <= 0) return ""; char[] chars = str.toCharArray(); char[] rtn = new char[chars.length * count]; int pos = 0; for (int i = 0; i < count; i++) { for (int y = 0; y < chars.length; y++) rtn[pos++] = chars[y]; // rtn.append(str); } return new String(rtn); }
[ "public", "static", "String", "repeatString", "(", "String", "str", ",", "int", "count", ")", "{", "if", "(", "count", "<=", "0", ")", "return", "\"\"", ";", "char", "[", "]", "chars", "=", "str", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "rtn", "=", "new", "char", "[", "chars", ".", "length", "*", "count", "]", ";", "int", "pos", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "for", "(", "int", "y", "=", "0", ";", "y", "<", "chars", ".", "length", ";", "y", "++", ")", "rtn", "[", "pos", "++", "]", "=", "chars", "[", "y", "]", ";", "// rtn.append(str);", "}", "return", "new", "String", "(", "rtn", ")", ";", "}" ]
reapeats a string @param str string to repeat @param count how many time string will be repeated @return reapted string
[ "reapeats", "a", "string" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L237-L248
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java
XsdAsmUtils.createAttribute
private static void createAttribute(Map<String, List<XsdAttribute>> createdAttributes, XsdAttribute elementAttribute) { if (!createdAttributes.containsKey(elementAttribute.getName())){ List<XsdAttribute> attributes = new ArrayList<>(); attributes.add(elementAttribute); createdAttributes.put(elementAttribute.getName(), attributes); } else { List<XsdAttribute> attributes = createdAttributes.get(elementAttribute.getName()); if (!attributes.contains(elementAttribute)){ attributes.add(elementAttribute); } } }
java
private static void createAttribute(Map<String, List<XsdAttribute>> createdAttributes, XsdAttribute elementAttribute) { if (!createdAttributes.containsKey(elementAttribute.getName())){ List<XsdAttribute> attributes = new ArrayList<>(); attributes.add(elementAttribute); createdAttributes.put(elementAttribute.getName(), attributes); } else { List<XsdAttribute> attributes = createdAttributes.get(elementAttribute.getName()); if (!attributes.contains(elementAttribute)){ attributes.add(elementAttribute); } } }
[ "private", "static", "void", "createAttribute", "(", "Map", "<", "String", ",", "List", "<", "XsdAttribute", ">", ">", "createdAttributes", ",", "XsdAttribute", "elementAttribute", ")", "{", "if", "(", "!", "createdAttributes", ".", "containsKey", "(", "elementAttribute", ".", "getName", "(", ")", ")", ")", "{", "List", "<", "XsdAttribute", ">", "attributes", "=", "new", "ArrayList", "<>", "(", ")", ";", "attributes", ".", "add", "(", "elementAttribute", ")", ";", "createdAttributes", ".", "put", "(", "elementAttribute", ".", "getName", "(", ")", ",", "attributes", ")", ";", "}", "else", "{", "List", "<", "XsdAttribute", ">", "attributes", "=", "createdAttributes", ".", "get", "(", "elementAttribute", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "attributes", ".", "contains", "(", "elementAttribute", ")", ")", "{", "attributes", ".", "add", "(", "elementAttribute", ")", ";", "}", "}", "}" ]
Adds an attribute to createAttributes {@link Map} object. @param createdAttributes The received {@link Map}. Contains the already created attributes. @param elementAttribute The new attribute to add to the {@link Map} object.
[ "Adds", "an", "attribute", "to", "createAttributes", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java#L320-L334
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java
XBasePanel.printXMLHeaderInfo
public void printXMLHeaderInfo(PrintWriter out, ResourceBundle reg) { String strTitle = this.getProperty("title"); // Menu page if ((strTitle == null) || (strTitle.length() == 0)) strTitle = ((BasePanel)this.getScreenField()).getTitle(); out.println(Utility.startTag(XMLTags.TITLE) + strTitle + Utility.endTag(XMLTags.TITLE)); String strKeywords = this.getKeywords(); if ((strKeywords != null) && (strKeywords.length() > 0)) out.println(Utility.startTag(XMLTags.META_KEYWORDS) + strKeywords + Utility.endTag(XMLTags.META_KEYWORDS)); String strDescription = strTitle; out.println(Utility.startTag(XMLTags.META_DESCRIPTION) + strDescription + Utility.endTag(XMLTags.META_DESCRIPTION)); String redirect = this.getMetaRedirect(); if ((redirect != null) && (redirect.length() > 0)) out.println(Utility.startTag(XMLTags.META_REDIRECT) + redirect + Utility.endTag(XMLTags.META_REDIRECT)); }
java
public void printXMLHeaderInfo(PrintWriter out, ResourceBundle reg) { String strTitle = this.getProperty("title"); // Menu page if ((strTitle == null) || (strTitle.length() == 0)) strTitle = ((BasePanel)this.getScreenField()).getTitle(); out.println(Utility.startTag(XMLTags.TITLE) + strTitle + Utility.endTag(XMLTags.TITLE)); String strKeywords = this.getKeywords(); if ((strKeywords != null) && (strKeywords.length() > 0)) out.println(Utility.startTag(XMLTags.META_KEYWORDS) + strKeywords + Utility.endTag(XMLTags.META_KEYWORDS)); String strDescription = strTitle; out.println(Utility.startTag(XMLTags.META_DESCRIPTION) + strDescription + Utility.endTag(XMLTags.META_DESCRIPTION)); String redirect = this.getMetaRedirect(); if ((redirect != null) && (redirect.length() > 0)) out.println(Utility.startTag(XMLTags.META_REDIRECT) + redirect + Utility.endTag(XMLTags.META_REDIRECT)); }
[ "public", "void", "printXMLHeaderInfo", "(", "PrintWriter", "out", ",", "ResourceBundle", "reg", ")", "{", "String", "strTitle", "=", "this", ".", "getProperty", "(", "\"title\"", ")", ";", "// Menu page", "if", "(", "(", "strTitle", "==", "null", ")", "||", "(", "strTitle", ".", "length", "(", ")", "==", "0", ")", ")", "strTitle", "=", "(", "(", "BasePanel", ")", "this", ".", "getScreenField", "(", ")", ")", ".", "getTitle", "(", ")", ";", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "TITLE", ")", "+", "strTitle", "+", "Utility", ".", "endTag", "(", "XMLTags", ".", "TITLE", ")", ")", ";", "String", "strKeywords", "=", "this", ".", "getKeywords", "(", ")", ";", "if", "(", "(", "strKeywords", "!=", "null", ")", "&&", "(", "strKeywords", ".", "length", "(", ")", ">", "0", ")", ")", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "META_KEYWORDS", ")", "+", "strKeywords", "+", "Utility", ".", "endTag", "(", "XMLTags", ".", "META_KEYWORDS", ")", ")", ";", "String", "strDescription", "=", "strTitle", ";", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "META_DESCRIPTION", ")", "+", "strDescription", "+", "Utility", ".", "endTag", "(", "XMLTags", ".", "META_DESCRIPTION", ")", ")", ";", "String", "redirect", "=", "this", ".", "getMetaRedirect", "(", ")", ";", "if", "(", "(", "redirect", "!=", "null", ")", "&&", "(", "redirect", ".", "length", "(", ")", ">", "0", ")", ")", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "META_REDIRECT", ")", "+", "redirect", "+", "Utility", ".", "endTag", "(", "XMLTags", ".", "META_REDIRECT", ")", ")", ";", "}" ]
Print the header info, such as title, keywords and meta-desc. @param out The http output stream. @param reg Local resource bundle.
[ "Print", "the", "header", "info", "such", "as", "title", "keywords", "and", "meta", "-", "desc", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java#L225-L239
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.setBody
@Override protected void setBody(JvmExecutable executable, XExpression expression) { final GenerationContext context = getContext( EcoreUtil2.getContainerOfType(executable, JvmType.class)); this.typeBuilder.removeExistingBody(executable); this.associator.associateLogicalContainer(expression, executable); if (expression != null) { if (context.getParentContext() == null) { context.getPostFinalizationElements().add(() -> { initializeLocalTypes(context, executable, expression); }); } else { initializeLocalTypes(context, executable, expression); } } else { initializeLocalTypes(context, executable, expression); } }
java
@Override protected void setBody(JvmExecutable executable, XExpression expression) { final GenerationContext context = getContext( EcoreUtil2.getContainerOfType(executable, JvmType.class)); this.typeBuilder.removeExistingBody(executable); this.associator.associateLogicalContainer(expression, executable); if (expression != null) { if (context.getParentContext() == null) { context.getPostFinalizationElements().add(() -> { initializeLocalTypes(context, executable, expression); }); } else { initializeLocalTypes(context, executable, expression); } } else { initializeLocalTypes(context, executable, expression); } }
[ "@", "Override", "protected", "void", "setBody", "(", "JvmExecutable", "executable", ",", "XExpression", "expression", ")", "{", "final", "GenerationContext", "context", "=", "getContext", "(", "EcoreUtil2", ".", "getContainerOfType", "(", "executable", ",", "JvmType", ".", "class", ")", ")", ";", "this", ".", "typeBuilder", ".", "removeExistingBody", "(", "executable", ")", ";", "this", ".", "associator", ".", "associateLogicalContainer", "(", "expression", ",", "executable", ")", ";", "if", "(", "expression", "!=", "null", ")", "{", "if", "(", "context", ".", "getParentContext", "(", ")", "==", "null", ")", "{", "context", ".", "getPostFinalizationElements", "(", ")", ".", "add", "(", "(", ")", "->", "{", "initializeLocalTypes", "(", "context", ",", "executable", ",", "expression", ")", ";", "}", ")", ";", "}", "else", "{", "initializeLocalTypes", "(", "context", ",", "executable", ",", "expression", ")", ";", "}", "}", "else", "{", "initializeLocalTypes", "(", "context", ",", "executable", ",", "expression", ")", ";", "}", "}" ]
{@inheritDoc}. <p>Overridden for: removing the existing associated body, and delaying the local type inference.
[ "{", "@inheritDoc", "}", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L477-L494
hawkular/hawkular-inventory
hawkular-inventory-security-parent/hawkular-inventory-security-accounts/src/main/java/org/hawkular/inventory/rest/security/accounts/SecurityIntegration.java
SecurityIntegration.establishOwner
private Persona establishOwner(org.hawkular.accounts.api.model.Resource resource, Persona current) { while (resource != null && resource.getPersona() == null) { resource = resource.getParent(); } if (resource != null && resource.getPersona().equals(current)) { current = null; } return current; }
java
private Persona establishOwner(org.hawkular.accounts.api.model.Resource resource, Persona current) { while (resource != null && resource.getPersona() == null) { resource = resource.getParent(); } if (resource != null && resource.getPersona().equals(current)) { current = null; } return current; }
[ "private", "Persona", "establishOwner", "(", "org", ".", "hawkular", ".", "accounts", ".", "api", ".", "model", ".", "Resource", "resource", ",", "Persona", "current", ")", "{", "while", "(", "resource", "!=", "null", "&&", "resource", ".", "getPersona", "(", ")", "==", "null", ")", "{", "resource", "=", "resource", ".", "getParent", "(", ")", ";", "}", "if", "(", "resource", "!=", "null", "&&", "resource", ".", "getPersona", "(", ")", ".", "equals", "(", "current", ")", ")", "{", "current", "=", "null", ";", "}", "return", "current", ";", "}" ]
Establishes the owner. If the owner of the parent is the same as the current user, then create the resource as being owner-less, inheriting the owner from the parent.
[ "Establishes", "the", "owner", ".", "If", "the", "owner", "of", "the", "parent", "is", "the", "same", "as", "the", "current", "user", "then", "create", "the", "resource", "as", "being", "owner", "-", "less", "inheriting", "the", "owner", "from", "the", "parent", "." ]
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-security-parent/hawkular-inventory-security-accounts/src/main/java/org/hawkular/inventory/rest/security/accounts/SecurityIntegration.java#L131-L141
liferay/com-liferay-commerce
commerce-api/src/main/java/com/liferay/commerce/service/persistence/CPDefinitionInventoryUtil.java
CPDefinitionInventoryUtil.removeByUUID_G
public static CPDefinitionInventory removeByUUID_G(String uuid, long groupId) throws com.liferay.commerce.exception.NoSuchCPDefinitionInventoryException { return getPersistence().removeByUUID_G(uuid, groupId); }
java
public static CPDefinitionInventory removeByUUID_G(String uuid, long groupId) throws com.liferay.commerce.exception.NoSuchCPDefinitionInventoryException { return getPersistence().removeByUUID_G(uuid, groupId); }
[ "public", "static", "CPDefinitionInventory", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "exception", ".", "NoSuchCPDefinitionInventoryException", "{", "return", "getPersistence", "(", ")", ".", "removeByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "}" ]
Removes the cp definition inventory where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the cp definition inventory that was removed
[ "Removes", "the", "cp", "definition", "inventory", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-api/src/main/java/com/liferay/commerce/service/persistence/CPDefinitionInventoryUtil.java#L319-L322
nobuoka/android-lib-ZXingCaptureActivity
src/main/java/info/vividcode/android/zxing/CaptureActivity.java
CaptureActivity.handleDecode
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) { boolean fromLiveScan = barcode != null; if (fromLiveScan) { // Then not from history, so we have an image to draw on drawResultPoints(barcode, scaleFactor, rawResult); } handleDecodeExternally(rawResult, barcode); }
java
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) { boolean fromLiveScan = barcode != null; if (fromLiveScan) { // Then not from history, so we have an image to draw on drawResultPoints(barcode, scaleFactor, rawResult); } handleDecodeExternally(rawResult, barcode); }
[ "public", "void", "handleDecode", "(", "Result", "rawResult", ",", "Bitmap", "barcode", ",", "float", "scaleFactor", ")", "{", "boolean", "fromLiveScan", "=", "barcode", "!=", "null", ";", "if", "(", "fromLiveScan", ")", "{", "// Then not from history, so we have an image to draw on", "drawResultPoints", "(", "barcode", ",", "scaleFactor", ",", "rawResult", ")", ";", "}", "handleDecodeExternally", "(", "rawResult", ",", "barcode", ")", ";", "}" ]
A valid barcode has been found, so give an indication of success and show the results. @param rawResult The contents of the barcode. @param scaleFactor amount by which thumbnail was scaled @param barcode A greyscale bitmap of the camera data which was decoded.
[ "A", "valid", "barcode", "has", "been", "found", "so", "give", "an", "indication", "of", "success", "and", "show", "the", "results", "." ]
train
https://github.com/nobuoka/android-lib-ZXingCaptureActivity/blob/17aaa7cf75520d3f2e03db9796b7e8c1d1f1b1e6/src/main/java/info/vividcode/android/zxing/CaptureActivity.java#L228-L236
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/AVTPartXPath.java
AVTPartXPath.fixupVariables
public void fixupVariables(java.util.Vector vars, int globalsSize) { m_xpath.fixupVariables(vars, globalsSize); }
java
public void fixupVariables(java.util.Vector vars, int globalsSize) { m_xpath.fixupVariables(vars, globalsSize); }
[ "public", "void", "fixupVariables", "(", "java", ".", "util", ".", "Vector", "vars", ",", "int", "globalsSize", ")", "{", "m_xpath", ".", "fixupVariables", "(", "vars", ",", "globalsSize", ")", ";", "}" ]
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. @param vars List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).
[ "This", "function", "is", "used", "to", "fixup", "variables", "from", "QNames", "to", "stack", "frame", "indexes", "at", "stylesheet", "build", "time", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/AVTPartXPath.java#L54-L57
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUEUnit.java
CLIQUEUnit.addFeatureVector
public boolean addFeatureVector(DBIDRef id, NumberVector vector) { if(contains(vector)) { ids.add(id); return true; } return false; }
java
public boolean addFeatureVector(DBIDRef id, NumberVector vector) { if(contains(vector)) { ids.add(id); return true; } return false; }
[ "public", "boolean", "addFeatureVector", "(", "DBIDRef", "id", ",", "NumberVector", "vector", ")", "{", "if", "(", "contains", "(", "vector", ")", ")", "{", "ids", ".", "add", "(", "id", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Adds the id of the specified feature vector to this unit, if this unit contains the feature vector. @param id Vector id @param vector the feature vector to be added @return true, if this unit contains the specified feature vector, false otherwise
[ "Adds", "the", "id", "of", "the", "specified", "feature", "vector", "to", "this", "unit", "if", "this", "unit", "contains", "the", "feature", "vector", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUEUnit.java#L139-L145
lodborg/interval-tree
src/main/java/com/lodborg/intervaltree/Interval.java
Interval.isRightOf
public boolean isRightOf(Interval<T> other){ if (other == null || other.isEmpty()) return false; return isRightOf(other.end, other.isEndInclusive()); }
java
public boolean isRightOf(Interval<T> other){ if (other == null || other.isEmpty()) return false; return isRightOf(other.end, other.isEndInclusive()); }
[ "public", "boolean", "isRightOf", "(", "Interval", "<", "T", ">", "other", ")", "{", "if", "(", "other", "==", "null", "||", "other", ".", "isEmpty", "(", ")", ")", "return", "false", ";", "return", "isRightOf", "(", "other", ".", "end", ",", "other", ".", "isEndInclusive", "(", ")", ")", ";", "}" ]
This method checks, if this current interval is entirely to the right of another interval with no common points. More formally, the method will return true, if for every point {@code x} from the current interval and for every point {@code y} from the {@code other} interval the inequality {@code x} &gt; {@code y} holds. This formal definition implies in particular that if the start point of the current interval is equal to the end point of the {@code other} interval, the method will return {@code false} only if both points are inclusive and {@code true} in all other cases. @param other The reference interval @return {@code true}, if the current interval is entirely to the right of the {@code other} interval, or {@code false} instead.
[ "This", "method", "checks", "if", "this", "current", "interval", "is", "entirely", "to", "the", "right", "of", "another", "interval", "with", "no", "common", "points", ".", "More", "formally", "the", "method", "will", "return", "true", "if", "for", "every", "point", "{", "@code", "x", "}", "from", "the", "current", "interval", "and", "for", "every", "point", "{", "@code", "y", "}", "from", "the", "{", "@code", "other", "}", "interval", "the", "inequality", "{", "@code", "x", "}", "&gt", ";", "{", "@code", "y", "}", "holds", ".", "This", "formal", "definition", "implies", "in", "particular", "that", "if", "the", "start", "point", "of", "the", "current", "interval", "is", "equal", "to", "the", "end", "point", "of", "the", "{", "@code", "other", "}", "interval", "the", "method", "will", "return", "{", "@code", "false", "}", "only", "if", "both", "points", "are", "inclusive", "and", "{", "@code", "true", "}", "in", "all", "other", "cases", "." ]
train
https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/Interval.java#L415-L419
GenesysPureEngage/authentication-client-java
src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java
AuthenticationApi.retrieveTokenAsync
public com.squareup.okhttp.Call retrieveTokenAsync(String grantType, String accept, String authorization, String clientId, String password, String refreshToken, String scope, String username, final ApiCallback<DefaultOAuth2AccessToken> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = retrieveTokenValidateBeforeCall(grantType, accept, authorization, clientId, password, refreshToken, scope, username, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DefaultOAuth2AccessToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call retrieveTokenAsync(String grantType, String accept, String authorization, String clientId, String password, String refreshToken, String scope, String username, final ApiCallback<DefaultOAuth2AccessToken> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = retrieveTokenValidateBeforeCall(grantType, accept, authorization, clientId, password, refreshToken, scope, username, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DefaultOAuth2AccessToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "retrieveTokenAsync", "(", "String", "grantType", ",", "String", "accept", ",", "String", "authorization", ",", "String", "clientId", ",", "String", "password", ",", "String", "refreshToken", ",", "String", "scope", ",", "String", "username", ",", "final", "ApiCallback", "<", "DefaultOAuth2AccessToken", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "retrieveTokenValidateBeforeCall", "(", "grantType", ",", "accept", ",", "authorization", ",", "clientId", ",", "password", ",", "refreshToken", ",", "scope", ",", "username", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "DefaultOAuth2AccessToken", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
Retrieve access token (asynchronously) Retrieve an access token based on the grant type &amp;mdash; Authorization Code Grant, Resource Owner Password Credentials Grant or Client Credentials Grant. For more information, see [Token Endpoint](https://tools.ietf.org/html/rfc6749). **Note:** For the optional **scope** parameter, the Authentication API supports only the &#x60;*&#x60; value. @param grantType The grant type you use to implement authentication. (required) @param accept The media type the Authentication API should should use for the response. For example: &#39;Accept: application/x-www-form-urlencoded&#39; (optional) @param authorization Basic authorization. For example: &#39;Authorization: Basic Y3...MQ&#x3D;&#x3D;&#39; (optional) @param clientId The ID of the application or service that is registered as the client. You&#39;ll need to get this value from your PureEngage Cloud representative. (optional) @param password The agent&#39;s password. (optional) @param refreshToken See [Refresh Token](https://tools.ietf.org/html/rfc6749#section-1.5) for details. (optional) @param scope The scope of the access request. The Authentication API supports only the &#x60;*&#x60; value. (optional) @param username The agent&#39;s username. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Retrieve", "access", "token", "(", "asynchronously", ")", "Retrieve", "an", "access", "token", "based", "on", "the", "grant", "type", "&amp", ";", "mdash", ";", "Authorization", "Code", "Grant", "Resource", "Owner", "Password", "Credentials", "Grant", "or", "Client", "Credentials", "Grant", ".", "For", "more", "information", "see", "[", "Token", "Endpoint", "]", "(", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc6749", ")", ".", "**", "Note", ":", "**", "For", "the", "optional", "**", "scope", "**", "parameter", "the", "Authentication", "API", "supports", "only", "the", "&#x60", ";", "*", "&#x60", ";", "value", "." ]
train
https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L1089-L1114
ineunetOS/knife-commons
knife-commons-utils/src/main/java/com/ineunet/knife/util/DecimalUtils.java
DecimalUtils.isValueEquals
public static boolean isValueEquals(BigDecimal decimal1, BigDecimal decimal2) { if (decimal1 == null && decimal2 == null) return true; if (decimal1 == null && decimal2 != null) return false; if (decimal1 != null && decimal2 == null) return false; return cutInvalidSacle(decimal1).equals(cutInvalidSacle(decimal2)); }
java
public static boolean isValueEquals(BigDecimal decimal1, BigDecimal decimal2) { if (decimal1 == null && decimal2 == null) return true; if (decimal1 == null && decimal2 != null) return false; if (decimal1 != null && decimal2 == null) return false; return cutInvalidSacle(decimal1).equals(cutInvalidSacle(decimal2)); }
[ "public", "static", "boolean", "isValueEquals", "(", "BigDecimal", "decimal1", ",", "BigDecimal", "decimal2", ")", "{", "if", "(", "decimal1", "==", "null", "&&", "decimal2", "==", "null", ")", "return", "true", ";", "if", "(", "decimal1", "==", "null", "&&", "decimal2", "!=", "null", ")", "return", "false", ";", "if", "(", "decimal1", "!=", "null", "&&", "decimal2", "==", "null", ")", "return", "false", ";", "return", "cutInvalidSacle", "(", "decimal1", ")", ".", "equals", "(", "cutInvalidSacle", "(", "decimal2", ")", ")", ";", "}" ]
e.g. 0.30 equals 0.3 && 0.30 equals 0.30 && 0.30 equals 0.300.
[ "e", ".", "g", ".", "0", ".", "30", "equals", "0", ".", "3", "&&", "0", ".", "30", "equals", "0", ".", "30", "&&", "0", ".", "30", "equals", "0", ".", "300", "." ]
train
https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/DecimalUtils.java#L49-L54
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.telephony_billingAccount_line_GET
public OvhOrder telephony_billingAccount_line_GET(String billingAccount, String brand, Boolean[] displayUniversalDirectories, Long[] extraSimultaneousLines, String mondialRelayId, String[] offers, Long[] ownerContactIds, Long quantity, Boolean retractation, Long shippingContactId, OvhLineTypeEnum[] types, String[] zones) throws IOException { String qPath = "/order/telephony/{billingAccount}/line"; StringBuilder sb = path(qPath, billingAccount); query(sb, "brand", brand); query(sb, "displayUniversalDirectories", displayUniversalDirectories); query(sb, "extraSimultaneousLines", extraSimultaneousLines); query(sb, "mondialRelayId", mondialRelayId); query(sb, "offers", offers); query(sb, "ownerContactIds", ownerContactIds); query(sb, "quantity", quantity); query(sb, "retractation", retractation); query(sb, "shippingContactId", shippingContactId); query(sb, "types", types); query(sb, "zones", zones); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder telephony_billingAccount_line_GET(String billingAccount, String brand, Boolean[] displayUniversalDirectories, Long[] extraSimultaneousLines, String mondialRelayId, String[] offers, Long[] ownerContactIds, Long quantity, Boolean retractation, Long shippingContactId, OvhLineTypeEnum[] types, String[] zones) throws IOException { String qPath = "/order/telephony/{billingAccount}/line"; StringBuilder sb = path(qPath, billingAccount); query(sb, "brand", brand); query(sb, "displayUniversalDirectories", displayUniversalDirectories); query(sb, "extraSimultaneousLines", extraSimultaneousLines); query(sb, "mondialRelayId", mondialRelayId); query(sb, "offers", offers); query(sb, "ownerContactIds", ownerContactIds); query(sb, "quantity", quantity); query(sb, "retractation", retractation); query(sb, "shippingContactId", shippingContactId); query(sb, "types", types); query(sb, "zones", zones); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "telephony_billingAccount_line_GET", "(", "String", "billingAccount", ",", "String", "brand", ",", "Boolean", "[", "]", "displayUniversalDirectories", ",", "Long", "[", "]", "extraSimultaneousLines", ",", "String", "mondialRelayId", ",", "String", "[", "]", "offers", ",", "Long", "[", "]", "ownerContactIds", ",", "Long", "quantity", ",", "Boolean", "retractation", ",", "Long", "shippingContactId", ",", "OvhLineTypeEnum", "[", "]", "types", ",", "String", "[", "]", "zones", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/telephony/{billingAccount}/line\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ")", ";", "query", "(", "sb", ",", "\"brand\"", ",", "brand", ")", ";", "query", "(", "sb", ",", "\"displayUniversalDirectories\"", ",", "displayUniversalDirectories", ")", ";", "query", "(", "sb", ",", "\"extraSimultaneousLines\"", ",", "extraSimultaneousLines", ")", ";", "query", "(", "sb", ",", "\"mondialRelayId\"", ",", "mondialRelayId", ")", ";", "query", "(", "sb", ",", "\"offers\"", ",", "offers", ")", ";", "query", "(", "sb", ",", "\"ownerContactIds\"", ",", "ownerContactIds", ")", ";", "query", "(", "sb", ",", "\"quantity\"", ",", "quantity", ")", ";", "query", "(", "sb", ",", "\"retractation\"", ",", "retractation", ")", ";", "query", "(", "sb", ",", "\"shippingContactId\"", ",", "shippingContactId", ")", ";", "query", "(", "sb", ",", "\"types\"", ",", "types", ")", ";", "query", "(", "sb", ",", "\"zones\"", ",", "zones", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/telephony/{billingAccount}/line @param extraSimultaneousLines [required] Additional simultaneous numbers. Set several simultaneous lines for each line per phone @param quantity [required] Quantity of request repetition in this configuration @param retractation [required] Retractation rights if set @param zones [required] Geographic zones. Let empty for nogeographic type. Set several zones for each line per phone @param ownerContactIds [required] Owner contact information id from /me entry point for each line @param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping address information entry. @param brand [required] Phone brands wanted with the offer. Set null for NO phone @param displayUniversalDirectories [required] Publish owner contact informations on universal directories or not @param offers [required] The line offers. Set several offers for each line per phone (Deprecated, use offer method instead) @param shippingContactId [required] Shipping contact information id from /me entry point @param types [required] Number type. Set several types for each line per phone @param billingAccount [required] The name of your billingAccount
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6335-L6351
jhalterman/failsafe
src/main/java/net/jodah/failsafe/PolicyExecutor.java
PolicyExecutor.postExecuteAsync
protected CompletableFuture<ExecutionResult> postExecuteAsync(ExecutionResult result, Scheduler scheduler, FailsafeFuture<Object> future) { if (isFailure(result)) { result = result.with(false, false); return onFailureAsync(result, scheduler, future).whenComplete((postResult, error) -> { callFailureListener(postResult); }); } else { result = result.with(true, true); onSuccess(result); callSuccessListener(result); return CompletableFuture.completedFuture(result); } }
java
protected CompletableFuture<ExecutionResult> postExecuteAsync(ExecutionResult result, Scheduler scheduler, FailsafeFuture<Object> future) { if (isFailure(result)) { result = result.with(false, false); return onFailureAsync(result, scheduler, future).whenComplete((postResult, error) -> { callFailureListener(postResult); }); } else { result = result.with(true, true); onSuccess(result); callSuccessListener(result); return CompletableFuture.completedFuture(result); } }
[ "protected", "CompletableFuture", "<", "ExecutionResult", ">", "postExecuteAsync", "(", "ExecutionResult", "result", ",", "Scheduler", "scheduler", ",", "FailsafeFuture", "<", "Object", ">", "future", ")", "{", "if", "(", "isFailure", "(", "result", ")", ")", "{", "result", "=", "result", ".", "with", "(", "false", ",", "false", ")", ";", "return", "onFailureAsync", "(", "result", ",", "scheduler", ",", "future", ")", ".", "whenComplete", "(", "(", "postResult", ",", "error", ")", "->", "{", "callFailureListener", "(", "postResult", ")", ";", "}", ")", ";", "}", "else", "{", "result", "=", "result", ".", "with", "(", "true", ",", "true", ")", ";", "onSuccess", "(", "result", ")", ";", "callSuccessListener", "(", "result", ")", ";", "return", "CompletableFuture", ".", "completedFuture", "(", "result", ")", ";", "}", "}" ]
Performs potentially asynchronous post-execution handling for a {@code result}.
[ "Performs", "potentially", "asynchronous", "post", "-", "execution", "handling", "for", "a", "{" ]
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/PolicyExecutor.java#L95-L108
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceIndividualGroupService.java
ReferenceIndividualGroupService.updateGroup
@Override public void updateGroup(ILockableEntityGroup group, boolean renewLock) throws GroupsException { throwExceptionIfNotInternallyManaged(); try { if (!group.getLock().isValid()) { throw new GroupsException( "Could not update group " + group.getKey() + " has invalid lock."); } // updateGroup((IEntityGroup)group); getGroupStore().update(group); if (cacheInUse()) { cacheRemove(group); } synchronizeGroupMembersOnUpdate(group); if (renewLock) { group.getLock().renew(); } else { group.getLock().release(); } } catch (LockingException le) { throw new GroupsException("Problem updating group " + group.getKey(), le); } }
java
@Override public void updateGroup(ILockableEntityGroup group, boolean renewLock) throws GroupsException { throwExceptionIfNotInternallyManaged(); try { if (!group.getLock().isValid()) { throw new GroupsException( "Could not update group " + group.getKey() + " has invalid lock."); } // updateGroup((IEntityGroup)group); getGroupStore().update(group); if (cacheInUse()) { cacheRemove(group); } synchronizeGroupMembersOnUpdate(group); if (renewLock) { group.getLock().renew(); } else { group.getLock().release(); } } catch (LockingException le) { throw new GroupsException("Problem updating group " + group.getKey(), le); } }
[ "@", "Override", "public", "void", "updateGroup", "(", "ILockableEntityGroup", "group", ",", "boolean", "renewLock", ")", "throws", "GroupsException", "{", "throwExceptionIfNotInternallyManaged", "(", ")", ";", "try", "{", "if", "(", "!", "group", ".", "getLock", "(", ")", ".", "isValid", "(", ")", ")", "{", "throw", "new", "GroupsException", "(", "\"Could not update group \"", "+", "group", ".", "getKey", "(", ")", "+", "\" has invalid lock.\"", ")", ";", "}", "// updateGroup((IEntityGroup)group);", "getGroupStore", "(", ")", ".", "update", "(", "group", ")", ";", "if", "(", "cacheInUse", "(", ")", ")", "{", "cacheRemove", "(", "group", ")", ";", "}", "synchronizeGroupMembersOnUpdate", "(", "group", ")", ";", "if", "(", "renewLock", ")", "{", "group", ".", "getLock", "(", ")", ".", "renew", "(", ")", ";", "}", "else", "{", "group", ".", "getLock", "(", ")", ".", "release", "(", ")", ";", "}", "}", "catch", "(", "LockingException", "le", ")", "{", "throw", "new", "GroupsException", "(", "\"Problem updating group \"", "+", "group", ".", "getKey", "(", ")", ",", "le", ")", ";", "}", "}" ]
Updates the <code>ILockableEntityGroup</code> in the store and removes it from the cache. @param group ILockableEntityGroup
[ "Updates", "the", "<code", ">", "ILockableEntityGroup<", "/", "code", ">", "in", "the", "store", "and", "removes", "it", "from", "the", "cache", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceIndividualGroupService.java#L613-L639
apache/reef
lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/RunningWorkers.java
RunningWorkers.cancelTasklet
void cancelTasklet(final boolean mayInterruptIfRunning, final int taskletId) { lock.lock(); try { // This is not ideal since we are using a linear time search on all the workers. final String workerId = getWhereTaskletWasScheduledTo(taskletId); if (workerId == null) { // launchTasklet called but not yet running. taskletsToCancel.add(taskletId); return; } if (mayInterruptIfRunning) { LOG.log(Level.FINE, "Cancelling running Tasklet with ID {0}.", taskletId); runningWorkers.get(workerId).cancelTasklet(taskletId); } } finally { lock.unlock(); } }
java
void cancelTasklet(final boolean mayInterruptIfRunning, final int taskletId) { lock.lock(); try { // This is not ideal since we are using a linear time search on all the workers. final String workerId = getWhereTaskletWasScheduledTo(taskletId); if (workerId == null) { // launchTasklet called but not yet running. taskletsToCancel.add(taskletId); return; } if (mayInterruptIfRunning) { LOG.log(Level.FINE, "Cancelling running Tasklet with ID {0}.", taskletId); runningWorkers.get(workerId).cancelTasklet(taskletId); } } finally { lock.unlock(); } }
[ "void", "cancelTasklet", "(", "final", "boolean", "mayInterruptIfRunning", ",", "final", "int", "taskletId", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "// This is not ideal since we are using a linear time search on all the workers.", "final", "String", "workerId", "=", "getWhereTaskletWasScheduledTo", "(", "taskletId", ")", ";", "if", "(", "workerId", "==", "null", ")", "{", "// launchTasklet called but not yet running.", "taskletsToCancel", ".", "add", "(", "taskletId", ")", ";", "return", ";", "}", "if", "(", "mayInterruptIfRunning", ")", "{", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"Cancelling running Tasklet with ID {0}.\"", ",", "taskletId", ")", ";", "runningWorkers", ".", "get", "(", "workerId", ")", ".", "cancelTasklet", "(", "taskletId", ")", ";", "}", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
Concurrency: Called by multiple threads. Parameter: Same taskletId can come in multiple times.
[ "Concurrency", ":", "Called", "by", "multiple", "threads", ".", "Parameter", ":", "Same", "taskletId", "can", "come", "in", "multiple", "times", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/RunningWorkers.java#L186-L204
m-m-m/util
nls/src/main/java/net/sf/mmm/util/nls/base/AbstractNlsBundleFactory.java
AbstractNlsBundleFactory.createHandler
protected InvocationHandler createHandler(Class<? extends NlsBundle> bundleInterface) { String bundleName = NlsBundleHelper.getInstance().getQualifiedLocation(bundleInterface); NlsBundleOptions options = getBundleOptions(bundleInterface); return new NlsBundleInvocationHandler(bundleInterface, bundleName, options); }
java
protected InvocationHandler createHandler(Class<? extends NlsBundle> bundleInterface) { String bundleName = NlsBundleHelper.getInstance().getQualifiedLocation(bundleInterface); NlsBundleOptions options = getBundleOptions(bundleInterface); return new NlsBundleInvocationHandler(bundleInterface, bundleName, options); }
[ "protected", "InvocationHandler", "createHandler", "(", "Class", "<", "?", "extends", "NlsBundle", ">", "bundleInterface", ")", "{", "String", "bundleName", "=", "NlsBundleHelper", ".", "getInstance", "(", ")", ".", "getQualifiedLocation", "(", "bundleInterface", ")", ";", "NlsBundleOptions", "options", "=", "getBundleOptions", "(", "bundleInterface", ")", ";", "return", "new", "NlsBundleInvocationHandler", "(", "bundleInterface", ",", "bundleName", ",", "options", ")", ";", "}" ]
This method creates a new {@link InvocationHandler} for the given {@code bundleInterface}. @param bundleInterface is the {@link Class} reflecting the {@link NlsBundle} interface. @return the {@link InvocationHandler} for the given {@code bundleInterface}.
[ "This", "method", "creates", "a", "new", "{", "@link", "InvocationHandler", "}", "for", "the", "given", "{", "@code", "bundleInterface", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/nls/src/main/java/net/sf/mmm/util/nls/base/AbstractNlsBundleFactory.java#L186-L191
i-net-software/jlessc
src/com/inet/lib/less/UrlUtils.java
UrlUtils.dataUri
static void dataUri( CssFormatter formatter, String relativeUrlStr, final String urlString, String type ) throws IOException { String urlStr = removeQuote( urlString ); InputStream input; try { input = formatter.getReaderFactory().openStream( formatter.getBaseURL(), urlStr, relativeUrlStr ); } catch( Exception e ) { boolean quote = urlString != urlStr; String rewrittenUrl; if( formatter.isRewriteUrl( urlStr ) ) { URL relativeUrl = new URL( relativeUrlStr ); relativeUrl = new URL( relativeUrl, urlStr ); rewrittenUrl = relativeUrl.getPath(); rewrittenUrl = quote ? urlString.charAt( 0 ) + rewrittenUrl + urlString.charAt( 0 ) : rewrittenUrl; } else { rewrittenUrl = urlString; } formatter.append( "url(" ).append( rewrittenUrl ).append( ')' ); return; } ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int count; byte[] data = new byte[16384]; while( (count = input.read( data, 0, data.length )) > 0 ) { buffer.write( data, 0, count ); } input.close(); byte[] bytes = buffer.toByteArray(); if( bytes.length >= 32 * 1024 ) { formatter.append( "url(" ).append( urlString ).append( ')' ); } else { dataUri( formatter, bytes, urlStr, type ); } }
java
static void dataUri( CssFormatter formatter, String relativeUrlStr, final String urlString, String type ) throws IOException { String urlStr = removeQuote( urlString ); InputStream input; try { input = formatter.getReaderFactory().openStream( formatter.getBaseURL(), urlStr, relativeUrlStr ); } catch( Exception e ) { boolean quote = urlString != urlStr; String rewrittenUrl; if( formatter.isRewriteUrl( urlStr ) ) { URL relativeUrl = new URL( relativeUrlStr ); relativeUrl = new URL( relativeUrl, urlStr ); rewrittenUrl = relativeUrl.getPath(); rewrittenUrl = quote ? urlString.charAt( 0 ) + rewrittenUrl + urlString.charAt( 0 ) : rewrittenUrl; } else { rewrittenUrl = urlString; } formatter.append( "url(" ).append( rewrittenUrl ).append( ')' ); return; } ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int count; byte[] data = new byte[16384]; while( (count = input.read( data, 0, data.length )) > 0 ) { buffer.write( data, 0, count ); } input.close(); byte[] bytes = buffer.toByteArray(); if( bytes.length >= 32 * 1024 ) { formatter.append( "url(" ).append( urlString ).append( ')' ); } else { dataUri( formatter, bytes, urlStr, type ); } }
[ "static", "void", "dataUri", "(", "CssFormatter", "formatter", ",", "String", "relativeUrlStr", ",", "final", "String", "urlString", ",", "String", "type", ")", "throws", "IOException", "{", "String", "urlStr", "=", "removeQuote", "(", "urlString", ")", ";", "InputStream", "input", ";", "try", "{", "input", "=", "formatter", ".", "getReaderFactory", "(", ")", ".", "openStream", "(", "formatter", ".", "getBaseURL", "(", ")", ",", "urlStr", ",", "relativeUrlStr", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "boolean", "quote", "=", "urlString", "!=", "urlStr", ";", "String", "rewrittenUrl", ";", "if", "(", "formatter", ".", "isRewriteUrl", "(", "urlStr", ")", ")", "{", "URL", "relativeUrl", "=", "new", "URL", "(", "relativeUrlStr", ")", ";", "relativeUrl", "=", "new", "URL", "(", "relativeUrl", ",", "urlStr", ")", ";", "rewrittenUrl", "=", "relativeUrl", ".", "getPath", "(", ")", ";", "rewrittenUrl", "=", "quote", "?", "urlString", ".", "charAt", "(", "0", ")", "+", "rewrittenUrl", "+", "urlString", ".", "charAt", "(", "0", ")", ":", "rewrittenUrl", ";", "}", "else", "{", "rewrittenUrl", "=", "urlString", ";", "}", "formatter", ".", "append", "(", "\"url(\"", ")", ".", "append", "(", "rewrittenUrl", ")", ".", "append", "(", "'", "'", ")", ";", "return", ";", "}", "ByteArrayOutputStream", "buffer", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "int", "count", ";", "byte", "[", "]", "data", "=", "new", "byte", "[", "16384", "]", ";", "while", "(", "(", "count", "=", "input", ".", "read", "(", "data", ",", "0", ",", "data", ".", "length", ")", ")", ">", "0", ")", "{", "buffer", ".", "write", "(", "data", ",", "0", ",", "count", ")", ";", "}", "input", ".", "close", "(", ")", ";", "byte", "[", "]", "bytes", "=", "buffer", ".", "toByteArray", "(", ")", ";", "if", "(", "bytes", ".", "length", ">=", "32", "*", "1024", ")", "{", "formatter", ".", "append", "(", "\"url(\"", ")", ".", "append", "(", "urlString", ")", ".", "append", "(", "'", "'", ")", ";", "}", "else", "{", "dataUri", "(", "formatter", ",", "bytes", ",", "urlStr", ",", "type", ")", ";", "}", "}" ]
Implementation of the function data-uri. @param formatter current formatter @param relativeUrlStr relative URL of the less script. Is used as base URL @param urlString the url parameter of the function @param type the mime type @throws IOException If any I/O errors occur on reading the content
[ "Implementation", "of", "the", "function", "data", "-", "uri", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/UrlUtils.java#L171-L207
mikepenz/FastAdapter
app/src/main/java/com/mikepenz/fastadapter/app/items/ImageItem.java
ImageItem.animateHeart
public void animateHeart(View imageLovedOn, View imageLovedOff, boolean on) { imageLovedOn.setVisibility(View.VISIBLE); imageLovedOff.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { viewPropertyStartCompat(imageLovedOff.animate().scaleX(on ? 0 : 1).scaleY(on ? 0 : 1).alpha(on ? 0 : 1)); viewPropertyStartCompat(imageLovedOn.animate().scaleX(on ? 1 : 0).scaleY(on ? 1 : 0).alpha(on ? 1 : 0)); } }
java
public void animateHeart(View imageLovedOn, View imageLovedOff, boolean on) { imageLovedOn.setVisibility(View.VISIBLE); imageLovedOff.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { viewPropertyStartCompat(imageLovedOff.animate().scaleX(on ? 0 : 1).scaleY(on ? 0 : 1).alpha(on ? 0 : 1)); viewPropertyStartCompat(imageLovedOn.animate().scaleX(on ? 1 : 0).scaleY(on ? 1 : 0).alpha(on ? 1 : 0)); } }
[ "public", "void", "animateHeart", "(", "View", "imageLovedOn", ",", "View", "imageLovedOff", ",", "boolean", "on", ")", "{", "imageLovedOn", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "imageLovedOff", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB_MR1", ")", "{", "viewPropertyStartCompat", "(", "imageLovedOff", ".", "animate", "(", ")", ".", "scaleX", "(", "on", "?", "0", ":", "1", ")", ".", "scaleY", "(", "on", "?", "0", ":", "1", ")", ".", "alpha", "(", "on", "?", "0", ":", "1", ")", ")", ";", "viewPropertyStartCompat", "(", "imageLovedOn", ".", "animate", "(", ")", ".", "scaleX", "(", "on", "?", "1", ":", "0", ")", ".", "scaleY", "(", "on", "?", "1", ":", "0", ")", ".", "alpha", "(", "on", "?", "1", ":", "0", ")", ")", ";", "}", "}" ]
helper method to animate the heart view @param imageLovedOn @param imageLovedOff @param on
[ "helper", "method", "to", "animate", "the", "heart", "view" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/ImageItem.java#L136-L144
alkacon/opencms-core
src/org/opencms/util/CmsHtmlStripper.java
CmsHtmlStripper.addPreserveTags
public void addPreserveTags(final String tagList, final char separator) { List<String> tags = CmsStringUtil.splitAsList(tagList, separator, true); addPreserveTagList(tags); }
java
public void addPreserveTags(final String tagList, final char separator) { List<String> tags = CmsStringUtil.splitAsList(tagList, separator, true); addPreserveTagList(tags); }
[ "public", "void", "addPreserveTags", "(", "final", "String", "tagList", ",", "final", "char", "separator", ")", "{", "List", "<", "String", ">", "tags", "=", "CmsStringUtil", ".", "splitAsList", "(", "tagList", ",", "separator", ",", "true", ")", ";", "addPreserveTagList", "(", "tags", ")", ";", "}" ]
Convenience method for adding several tags to preserve in form of a delimiter-separated String.<p> The String will be <code>{@link CmsStringUtil#splitAsList(String, char, boolean)}</code> with <code>tagList</code> as the first argument, <code>separator</code> as the second argument and the third argument set to true (trimming - support).<p> @param tagList a delimiter-separated String with case-insensitive tag names to preserve by <code>{@link #stripHtml(String)}</code> @param separator the delimiter that separates tag names in the <code>tagList</code> argument @see #addPreserveTag(String)
[ "Convenience", "method", "for", "adding", "several", "tags", "to", "preserve", "in", "form", "of", "a", "delimiter", "-", "separated", "String", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsHtmlStripper.java#L140-L144
konmik/nucleus
nucleus/src/main/java/nucleus/view/NucleusLayout.java
NucleusLayout.getActivity
public Activity getActivity() { Context context = getContext(); while (!(context instanceof Activity) && context instanceof ContextWrapper) context = ((ContextWrapper) context).getBaseContext(); if (!(context instanceof Activity)) throw new IllegalStateException("Expected an activity context, got " + context.getClass().getSimpleName()); return (Activity) context; }
java
public Activity getActivity() { Context context = getContext(); while (!(context instanceof Activity) && context instanceof ContextWrapper) context = ((ContextWrapper) context).getBaseContext(); if (!(context instanceof Activity)) throw new IllegalStateException("Expected an activity context, got " + context.getClass().getSimpleName()); return (Activity) context; }
[ "public", "Activity", "getActivity", "(", ")", "{", "Context", "context", "=", "getContext", "(", ")", ";", "while", "(", "!", "(", "context", "instanceof", "Activity", ")", "&&", "context", "instanceof", "ContextWrapper", ")", "context", "=", "(", "(", "ContextWrapper", ")", "context", ")", ".", "getBaseContext", "(", ")", ";", "if", "(", "!", "(", "context", "instanceof", "Activity", ")", ")", "throw", "new", "IllegalStateException", "(", "\"Expected an activity context, got \"", "+", "context", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "return", "(", "Activity", ")", "context", ";", "}" ]
Returns the unwrapped activity of the view or throws an exception. @return an unwrapped activity
[ "Returns", "the", "unwrapped", "activity", "of", "the", "view", "or", "throws", "an", "exception", "." ]
train
https://github.com/konmik/nucleus/blob/b161484a2bbf66a7896a8c1f61fa7187856ca5f7/nucleus/src/main/java/nucleus/view/NucleusLayout.java#L76-L83
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/annotation/AnnotationMetadataSupport.java
AnnotationMetadataSupport.registerDefaultValues
static void registerDefaultValues(String annotation, Map<String, Object> defaultValues) { if (StringUtils.isNotEmpty(annotation)) { ANNOTATION_DEFAULTS.put(annotation.intern(), defaultValues); } }
java
static void registerDefaultValues(String annotation, Map<String, Object> defaultValues) { if (StringUtils.isNotEmpty(annotation)) { ANNOTATION_DEFAULTS.put(annotation.intern(), defaultValues); } }
[ "static", "void", "registerDefaultValues", "(", "String", "annotation", ",", "Map", "<", "String", ",", "Object", ">", "defaultValues", ")", "{", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "annotation", ")", ")", "{", "ANNOTATION_DEFAULTS", ".", "put", "(", "annotation", ".", "intern", "(", ")", ",", "defaultValues", ")", ";", "}", "}" ]
Registers default values for the given annotation and values. @param annotation The annotation @param defaultValues The default values
[ "Registers", "default", "values", "for", "the", "given", "annotation", "and", "values", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/annotation/AnnotationMetadataSupport.java#L166-L170
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java
PoolOperations.enableAutoScale
public void enableAutoScale(String poolId, String autoScaleFormula) throws BatchErrorException, IOException { enableAutoScale(poolId, autoScaleFormula, null, null); }
java
public void enableAutoScale(String poolId, String autoScaleFormula) throws BatchErrorException, IOException { enableAutoScale(poolId, autoScaleFormula, null, null); }
[ "public", "void", "enableAutoScale", "(", "String", "poolId", ",", "String", "autoScaleFormula", ")", "throws", "BatchErrorException", ",", "IOException", "{", "enableAutoScale", "(", "poolId", ",", "autoScaleFormula", ",", "null", ",", "null", ")", ";", "}" ]
Enables automatic scaling on the specified pool. @param poolId The ID of the pool. @param autoScaleFormula The formula for the desired number of compute nodes in the pool. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Enables", "automatic", "scaling", "on", "the", "specified", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java#L690-L692
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.writeUtf8String
public static File writeUtf8String(String content, File file) throws IORuntimeException { return writeString(content, file, CharsetUtil.CHARSET_UTF_8); }
java
public static File writeUtf8String(String content, File file) throws IORuntimeException { return writeString(content, file, CharsetUtil.CHARSET_UTF_8); }
[ "public", "static", "File", "writeUtf8String", "(", "String", "content", ",", "File", "file", ")", "throws", "IORuntimeException", "{", "return", "writeString", "(", "content", ",", "file", ",", "CharsetUtil", ".", "CHARSET_UTF_8", ")", ";", "}" ]
将String写入文件,覆盖模式,字符集为UTF-8 @param content 写入的内容 @param file 文件 @return 写入的文件 @throws IORuntimeException IO异常
[ "将String写入文件,覆盖模式,字符集为UTF", "-", "8" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2707-L2709
FudanNLP/fnlp
fnlp-core/src/main/java/org/fnlp/nlp/cn/tag/AbstractTagger.java
AbstractTagger.tagFile
public void tagFile(String input,String output,String sep){ String s = tagFile(input,"\n"); try { OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream( output), "utf-8"); BufferedWriter bw = new BufferedWriter(writer); bw.write(s); bw.close(); } catch (Exception e) { System.out.println("写输出文件错误"); e.printStackTrace(); } }
java
public void tagFile(String input,String output,String sep){ String s = tagFile(input,"\n"); try { OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream( output), "utf-8"); BufferedWriter bw = new BufferedWriter(writer); bw.write(s); bw.close(); } catch (Exception e) { System.out.println("写输出文件错误"); e.printStackTrace(); } }
[ "public", "void", "tagFile", "(", "String", "input", ",", "String", "output", ",", "String", "sep", ")", "{", "String", "s", "=", "tagFile", "(", "input", ",", "\"\\n\"", ")", ";", "try", "{", "OutputStreamWriter", "writer", "=", "new", "OutputStreamWriter", "(", "new", "FileOutputStream", "(", "output", ")", ",", "\"utf-8\"", ")", ";", "BufferedWriter", "bw", "=", "new", "BufferedWriter", "(", "writer", ")", ";", "bw", ".", "write", "(", "s", ")", ";", "bw", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"写输出文件错误\");\r", "", "", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
序列标注方法,输入输出为文件 @param input 输入文件 UTF8编码 @param output 输出文件 UTF8编码
[ "序列标注方法,输入输出为文件" ]
train
https://github.com/FudanNLP/fnlp/blob/ce258f3e4a5add2ba0b5e4cbac7cab2190af6659/fnlp-core/src/main/java/org/fnlp/nlp/cn/tag/AbstractTagger.java#L126-L138