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
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
simbiose/Encryption
Encryption/main/se/simbio/encryption/Encryption.java
Encryption.encryptAsync
public void encryptAsync(final String data, final Callback callback) { if (callback == null) return; new Thread(new Runnable() { @Override public void run() { try { String encrypt = encrypt(data); if (encrypt == null) { callback.onError(new Exception("Encrypt return null, it normally occurs when you send a null data")); } callback.onSuccess(encrypt); } catch (Exception e) { callback.onError(e); } } }).start(); }
java
public void encryptAsync(final String data, final Callback callback) { if (callback == null) return; new Thread(new Runnable() { @Override public void run() { try { String encrypt = encrypt(data); if (encrypt == null) { callback.onError(new Exception("Encrypt return null, it normally occurs when you send a null data")); } callback.onSuccess(encrypt); } catch (Exception e) { callback.onError(e); } } }).start(); }
[ "public", "void", "encryptAsync", "(", "final", "String", "data", ",", "final", "Callback", "callback", ")", "{", "if", "(", "callback", "==", "null", ")", "return", ";", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", ...
This is a sugar method that calls encrypt method in background, it is a good idea to use this one instead the default method because encryption can take several time and with this method the process occurs in a AsyncTask, other advantage is the Callback with separated methods, one for success and other for the exception @param data the String to be encrypted @param callback the Callback to handle the results
[ "This", "is", "a", "sugar", "method", "that", "calls", "encrypt", "method", "in", "background", "it", "is", "a", "good", "idea", "to", "use", "this", "one", "instead", "the", "default", "method", "because", "encryption", "can", "take", "several", "time", "...
train
https://github.com/simbiose/Encryption/blob/a344761a10add131cbe9962f895b416e5217d0e9/Encryption/main/se/simbio/encryption/Encryption.java#L123-L139
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/msdos/MSDOSHeader.java
MSDOSHeader.newInstance
public static MSDOSHeader newInstance(byte[] headerbytes, long peSigOffset) throws IOException { MSDOSHeader header = new MSDOSHeader(headerbytes, peSigOffset); header.read(); return header; }
java
public static MSDOSHeader newInstance(byte[] headerbytes, long peSigOffset) throws IOException { MSDOSHeader header = new MSDOSHeader(headerbytes, peSigOffset); header.read(); return header; }
[ "public", "static", "MSDOSHeader", "newInstance", "(", "byte", "[", "]", "headerbytes", ",", "long", "peSigOffset", ")", "throws", "IOException", "{", "MSDOSHeader", "header", "=", "new", "MSDOSHeader", "(", "headerbytes", ",", "peSigOffset", ")", ";", "header",...
Creates and returns an instance of the MSDOSHeader with the given bytes and the file offset of the PE signature. @param headerbytes the bytes that make up the MSDOSHeader @param peSigOffset file offset to the PE signature @return MSDOSHeader instance @throws IOException if header can not be read.
[ "Creates", "and", "returns", "an", "instance", "of", "the", "MSDOSHeader", "with", "the", "given", "bytes", "and", "the", "file", "offset", "of", "the", "PE", "signature", "." ]
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/msdos/MSDOSHeader.java#L205-L210
graphhopper/graphhopper
core/src/main/java/com/graphhopper/routing/util/BikeCommonFlagEncoder.java
BikeCommonFlagEncoder.applyMaxSpeed
@Override protected double applyMaxSpeed(ReaderWay way, double speed) { double maxSpeed = getMaxSpeed(way); if (maxSpeed >= 0) { // We strictly obey speed limits, see #600 if (speed > maxSpeed) return maxSpeed; } if (speed > maxPossibleSpeed) return maxPossibleSpeed; return speed; }
java
@Override protected double applyMaxSpeed(ReaderWay way, double speed) { double maxSpeed = getMaxSpeed(way); if (maxSpeed >= 0) { // We strictly obey speed limits, see #600 if (speed > maxSpeed) return maxSpeed; } if (speed > maxPossibleSpeed) return maxPossibleSpeed; return speed; }
[ "@", "Override", "protected", "double", "applyMaxSpeed", "(", "ReaderWay", "way", ",", "double", "speed", ")", "{", "double", "maxSpeed", "=", "getMaxSpeed", "(", "way", ")", ";", "if", "(", "maxSpeed", ">=", "0", ")", "{", "// We strictly obey speed limits, s...
Apply maxspeed: In contrast to the implementation of the AbstractFlagEncoder, we assume that we can reach the maxspeed for bicycles in case that the road type speed is higher and not just only 90%. @param way needed to retrieve tags @param speed speed guessed e.g. from the road type or other tags @return The assumed average speed.
[ "Apply", "maxspeed", ":", "In", "contrast", "to", "the", "implementation", "of", "the", "AbstractFlagEncoder", "we", "assume", "that", "we", "can", "reach", "the", "maxspeed", "for", "bicycles", "in", "case", "that", "the", "road", "type", "speed", "is", "hi...
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/util/BikeCommonFlagEncoder.java#L328-L339
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.getPixelRelative
public static Point getPixelRelative(LatLong latLong, long mapSize, Point origin) { return getPixelRelative(latLong, mapSize, origin.x, origin.y); }
java
public static Point getPixelRelative(LatLong latLong, long mapSize, Point origin) { return getPixelRelative(latLong, mapSize, origin.x, origin.y); }
[ "public", "static", "Point", "getPixelRelative", "(", "LatLong", "latLong", ",", "long", "mapSize", ",", "Point", "origin", ")", "{", "return", "getPixelRelative", "(", "latLong", ",", "mapSize", ",", "origin", ".", "x", ",", "origin", ".", "y", ")", ";", ...
Calculates the absolute pixel position for a map size and tile size relative to origin @param latLong the geographic position. @param mapSize precomputed size of map. @return the relative pixel position to the origin values (e.g. for a tile)
[ "Calculates", "the", "absolute", "pixel", "position", "for", "a", "map", "size", "and", "tile", "size", "relative", "to", "origin" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L164-L166
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java
RegistriesInner.updatePoliciesAsync
public Observable<RegistryPoliciesInner> updatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { return updatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).map(new Func1<ServiceResponse<RegistryPoliciesInner>, RegistryPoliciesInner>() { @Override public RegistryPoliciesInner call(ServiceResponse<RegistryPoliciesInner> response) { return response.body(); } }); }
java
public Observable<RegistryPoliciesInner> updatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { return updatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).map(new Func1<ServiceResponse<RegistryPoliciesInner>, RegistryPoliciesInner>() { @Override public RegistryPoliciesInner call(ServiceResponse<RegistryPoliciesInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RegistryPoliciesInner", ">", "updatePoliciesAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "RegistryPoliciesInner", "registryPoliciesUpdateParameters", ")", "{", "return", "updatePoliciesWithServiceResponseAsync", "...
Updates the policies for the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "the", "policies", "for", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L1605-L1612
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java
DependencyBundlingAnalyzer.ecoSystemIs
private boolean ecoSystemIs(String ecoSystem, Dependency dependency, Dependency nextDependency) { return ecoSystem.equals(dependency.getEcosystem()) && ecoSystem.equals(nextDependency.getEcosystem()); }
java
private boolean ecoSystemIs(String ecoSystem, Dependency dependency, Dependency nextDependency) { return ecoSystem.equals(dependency.getEcosystem()) && ecoSystem.equals(nextDependency.getEcosystem()); }
[ "private", "boolean", "ecoSystemIs", "(", "String", "ecoSystem", ",", "Dependency", "dependency", ",", "Dependency", "nextDependency", ")", "{", "return", "ecoSystem", ".", "equals", "(", "dependency", ".", "getEcosystem", "(", ")", ")", "&&", "ecoSystem", ".", ...
Determine if the dependency ecosystem is equal in the given dependencies. @param ecoSystem the ecosystem to validate against @param dependency a dependency to compare @param nextDependency a dependency to compare @return true if the ecosystem is equal in both dependencies; otherwise false
[ "Determine", "if", "the", "dependency", "ecosystem", "is", "equal", "in", "the", "given", "dependencies", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java#L485-L487
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.findConfiguredToolPath
private File findConfiguredToolPath( String toolName, File pomValue, String prop, String envvar ) { String systemPropertyValue = System.getProperty( prop ); if ( systemPropertyValue != null && !systemPropertyValue.isEmpty() ) { getLog().debug( toolName + " found in " + prop + " system property" ); return new File( systemPropertyValue ); } // No system property, we'll use the pom configured value if provided File result = pomValue; if ( result == null ) { // Try project property ... String projectPropertyValue = mavenProject.getProperties().getProperty( prop ); if ( projectPropertyValue != null && !projectPropertyValue.isEmpty() ) { getLog().debug( toolName + " found in " + prop + " property" ); result = new File( projectPropertyValue ); } else { // Try environment variable ... String envValue = System.getenv( envvar ); if ( envValue != null && !envValue.isEmpty() ) { getLog().debug( toolName + " found in environment variable " + envvar ); result = new File( envValue ); } } } return result; }
java
private File findConfiguredToolPath( String toolName, File pomValue, String prop, String envvar ) { String systemPropertyValue = System.getProperty( prop ); if ( systemPropertyValue != null && !systemPropertyValue.isEmpty() ) { getLog().debug( toolName + " found in " + prop + " system property" ); return new File( systemPropertyValue ); } // No system property, we'll use the pom configured value if provided File result = pomValue; if ( result == null ) { // Try project property ... String projectPropertyValue = mavenProject.getProperties().getProperty( prop ); if ( projectPropertyValue != null && !projectPropertyValue.isEmpty() ) { getLog().debug( toolName + " found in " + prop + " property" ); result = new File( projectPropertyValue ); } else { // Try environment variable ... String envValue = System.getenv( envvar ); if ( envValue != null && !envValue.isEmpty() ) { getLog().debug( toolName + " found in environment variable " + envvar ); result = new File( envValue ); } } } return result; }
[ "private", "File", "findConfiguredToolPath", "(", "String", "toolName", ",", "File", "pomValue", ",", "String", "prop", ",", "String", "envvar", ")", "{", "String", "systemPropertyValue", "=", "System", ".", "getProperty", "(", "prop", ")", ";", "if", "(", "...
Find a configuration for the specified tool path. The following precedence is observed: System property, POM value, Project property, Environment variable @param toolName the name of the tool being sought, used for logging @param pomValue the value found in the POM @param prop the property name @param envvar the environment variable name @return the value determined or null if not found
[ "Find", "a", "configuration", "for", "the", "specified", "tool", "path", ".", "The", "following", "precedence", "is", "observed", ":", "System", "property", "POM", "value", "Project", "property", "Environment", "variable" ]
train
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L112-L146
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/linkbuilder/StandardLinkBuilder.java
StandardLinkBuilder.processLink
protected String processLink(final IExpressionContext context, final String link) { if (!(context instanceof IWebContext)) { return link; } final HttpServletResponse response = ((IWebContext)context).getResponse(); return (response != null? response.encodeURL(link) : link); }
java
protected String processLink(final IExpressionContext context, final String link) { if (!(context instanceof IWebContext)) { return link; } final HttpServletResponse response = ((IWebContext)context).getResponse(); return (response != null? response.encodeURL(link) : link); }
[ "protected", "String", "processLink", "(", "final", "IExpressionContext", "context", ",", "final", "String", "link", ")", "{", "if", "(", "!", "(", "context", "instanceof", "IWebContext", ")", ")", "{", "return", "link", ";", "}", "final", "HttpServletResponse...
<p> Process an already-built URL just before returning it. </p> <p> By default, this method will apply the {@code HttpServletResponse.encodeURL(url)} mechanism, as standard when using the Java Servlet API. Note however that this will only be applied if {@code context} is an implementation of {@code IWebContext} (i.e. the Servlet API will only be applied in web environments). </p> <p> This method can be overridden by any subclasses that want to change this behaviour (e.g. in order to avoid using the Servlet API). </p> @param context the execution context. @param link the already-built URL. @return the processed URL, ready to be used.
[ "<p", ">", "Process", "an", "already", "-", "built", "URL", "just", "before", "returning", "it", ".", "<", "/", "p", ">", "<p", ">", "By", "default", "this", "method", "will", "apply", "the", "{", "@code", "HttpServletResponse", ".", "encodeURL", "(", ...
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/linkbuilder/StandardLinkBuilder.java#L521-L530
casmi/casmi
src/main/java/casmi/graphics/element/Lines.java
Lines.vertex
public void vertex(double x, double y, double z) { MODE = LINES_3D; this.x.add(x); this.y.add(y); this.z.add(z); colors.add(this.strokeColor); calcG(); }
java
public void vertex(double x, double y, double z) { MODE = LINES_3D; this.x.add(x); this.y.add(y); this.z.add(z); colors.add(this.strokeColor); calcG(); }
[ "public", "void", "vertex", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "MODE", "=", "LINES_3D", ";", "this", ".", "x", ".", "add", "(", "x", ")", ";", "this", ".", "y", ".", "add", "(", "y", ")", ";", "this", ".", ...
Adds the point to Lines. @param x The x-coordinate of a new added point. @param y The y-coordinate of a new added point. @param z The z-coordinate of a new added point.
[ "Adds", "the", "point", "to", "Lines", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L93-L100
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/apidiff/ApiDiffChecker.java
ApiDiffChecker.getReceiver
private ClassSymbol getReceiver(ExpressionTree tree, Symbol sym) { if (sym.isStatic() || sym instanceof ClassSymbol) { return sym.enclClass(); } switch (tree.getKind()) { case MEMBER_SELECT: case METHOD_INVOCATION: Type receiver = ASTHelpers.getType(ASTHelpers.getReceiver(tree)); if (receiver == null) { return null; } return receiver.tsym.enclClass(); case IDENTIFIER: // Simple names are implicitly qualified by an enclosing instance, so if we get here // we're inside the compilation unit that declares the receiver, and the diff doesn't // contain accurate information. return null; default: return null; } }
java
private ClassSymbol getReceiver(ExpressionTree tree, Symbol sym) { if (sym.isStatic() || sym instanceof ClassSymbol) { return sym.enclClass(); } switch (tree.getKind()) { case MEMBER_SELECT: case METHOD_INVOCATION: Type receiver = ASTHelpers.getType(ASTHelpers.getReceiver(tree)); if (receiver == null) { return null; } return receiver.tsym.enclClass(); case IDENTIFIER: // Simple names are implicitly qualified by an enclosing instance, so if we get here // we're inside the compilation unit that declares the receiver, and the diff doesn't // contain accurate information. return null; default: return null; } }
[ "private", "ClassSymbol", "getReceiver", "(", "ExpressionTree", "tree", ",", "Symbol", "sym", ")", "{", "if", "(", "sym", ".", "isStatic", "(", ")", "||", "sym", "instanceof", "ClassSymbol", ")", "{", "return", "sym", ".", "enclClass", "(", ")", ";", "}"...
Finds the class of the expression's receiver: the declaring class of a static member access, or the type that an instance member is accessed on.
[ "Finds", "the", "class", "of", "the", "expression", "s", "receiver", ":", "the", "declaring", "class", "of", "a", "static", "member", "access", "or", "the", "type", "that", "an", "instance", "member", "is", "accessed", "on", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/apidiff/ApiDiffChecker.java#L128-L148
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java
PubSubManager.createNode
public Node createNode(String nodeId, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = PubSub.createPubsubPacket(pubSubService, Type.set, new NodeExtension(PubSubElementType.CREATE, nodeId)); boolean isLeafNode = true; if (config != null) { request.addExtension(new FormNode(FormNodeType.CONFIGURE, config)); FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName()); if (nodeTypeField != null) isLeafNode = nodeTypeField.getValues().get(0).toString().equals(NodeType.leaf.toString()); } // Errors will cause exceptions in getReply, so it only returns // on success. sendPubsubPacket(request); Node newNode = isLeafNode ? new LeafNode(this, nodeId) : new CollectionNode(this, nodeId); nodeMap.put(newNode.getId(), newNode); return newNode; }
java
public Node createNode(String nodeId, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = PubSub.createPubsubPacket(pubSubService, Type.set, new NodeExtension(PubSubElementType.CREATE, nodeId)); boolean isLeafNode = true; if (config != null) { request.addExtension(new FormNode(FormNodeType.CONFIGURE, config)); FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName()); if (nodeTypeField != null) isLeafNode = nodeTypeField.getValues().get(0).toString().equals(NodeType.leaf.toString()); } // Errors will cause exceptions in getReply, so it only returns // on success. sendPubsubPacket(request); Node newNode = isLeafNode ? new LeafNode(this, nodeId) : new CollectionNode(this, nodeId); nodeMap.put(newNode.getId(), newNode); return newNode; }
[ "public", "Node", "createNode", "(", "String", "nodeId", ",", "Form", "config", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "PubSub", "request", "=", "PubSub", ".", "createPubsubPacke...
Creates a node with specified configuration. Note: This is the only way to create a collection node. @param nodeId The name of the node, which must be unique within the pubsub service @param config The configuration for the node @return The node that was created @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Creates", "a", "node", "with", "specified", "configuration", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java#L236-L255
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.notEmpty
public static <T> Collection<T> notEmpty(Collection<T> collection) throws IllegalArgumentException { return notEmpty(collection, "[Assertion failed] - this collection must not be empty: it must contain at least 1 element"); }
java
public static <T> Collection<T> notEmpty(Collection<T> collection) throws IllegalArgumentException { return notEmpty(collection, "[Assertion failed] - this collection must not be empty: it must contain at least 1 element"); }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "notEmpty", "(", "Collection", "<", "T", ">", "collection", ")", "throws", "IllegalArgumentException", "{", "return", "notEmpty", "(", "collection", ",", "\"[Assertion failed] - this collection must not...
断言给定集合非空 <pre class="code"> Assert.notEmpty(collection); </pre> @param <T> 集合元素类型 @param collection 被检查的集合 @return 被检查集合 @throws IllegalArgumentException if the collection is {@code null} or has no elements
[ "断言给定集合非空" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L370-L372
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java
IPAddressRange.aboveRange
public boolean aboveRange(InetAddress ip) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "aboveRange, ip is " + ip); Tr.debug(tc, "aboveRange, ip is " + ip); } return greaterThan(ip, ipHigher); }
java
public boolean aboveRange(InetAddress ip) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "aboveRange, ip is " + ip); Tr.debug(tc, "aboveRange, ip is " + ip); } return greaterThan(ip, ipHigher); }
[ "public", "boolean", "aboveRange", "(", "InetAddress", "ip", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"aboveRange, ip is \"", "...
Is the given ip address numericaly above the address range? Is it above ipHigher?
[ "Is", "the", "given", "ip", "address", "numericaly", "above", "the", "address", "range?", "Is", "it", "above", "ipHigher?" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java#L233-L239
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/IOUtil.java
IOUtil.dumpLocationToFile
public static void dumpLocationToFile(PhysicalLocation loc, File inFile, File outFile) throws IOException { Preconditions.checkArgument(!outFile.exists()); Preconditions.checkArgument(inFile.exists(), inFile.isFile()); final int BUFFER_SIZE = 2048; try (RandomAccessFile raf = new RandomAccessFile(inFile, "r"); FileOutputStream out = new FileOutputStream(outFile)) { byte[] buffer; long remainingBytes = loc.size(); long offset = loc.from(); while (remainingBytes >= BUFFER_SIZE) { buffer = loadBytesSafely(offset, BUFFER_SIZE, raf); out.write(buffer); remainingBytes -= BUFFER_SIZE; offset += BUFFER_SIZE; } if (remainingBytes > 0) { buffer = loadBytesSafely(offset, (int) remainingBytes, raf); out.write(buffer); } } }
java
public static void dumpLocationToFile(PhysicalLocation loc, File inFile, File outFile) throws IOException { Preconditions.checkArgument(!outFile.exists()); Preconditions.checkArgument(inFile.exists(), inFile.isFile()); final int BUFFER_SIZE = 2048; try (RandomAccessFile raf = new RandomAccessFile(inFile, "r"); FileOutputStream out = new FileOutputStream(outFile)) { byte[] buffer; long remainingBytes = loc.size(); long offset = loc.from(); while (remainingBytes >= BUFFER_SIZE) { buffer = loadBytesSafely(offset, BUFFER_SIZE, raf); out.write(buffer); remainingBytes -= BUFFER_SIZE; offset += BUFFER_SIZE; } if (remainingBytes > 0) { buffer = loadBytesSafely(offset, (int) remainingBytes, raf); out.write(buffer); } } }
[ "public", "static", "void", "dumpLocationToFile", "(", "PhysicalLocation", "loc", ",", "File", "inFile", ",", "File", "outFile", ")", "throws", "IOException", "{", "Preconditions", ".", "checkArgument", "(", "!", "outFile", ".", "exists", "(", ")", ")", ";", ...
Dumps the given part of the inFile to outFile. The part to dump is represented by loc. This will read safely from inFile which means locations outside of inFile are written as zero bytes to outFile. outFile must not exist yet. inFile must exist and must not be a directory. @param loc @param file @throws IOException
[ "Dumps", "the", "given", "part", "of", "the", "inFile", "to", "outFile", ".", "The", "part", "to", "dump", "is", "represented", "by", "loc", ".", "This", "will", "read", "safely", "from", "inFile", "which", "means", "locations", "outside", "of", "inFile", ...
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/IOUtil.java#L91-L115
NessComputing/components-ness-jdbi
src/main/java/com/nesscomputing/jdbi/JdbiMappers.java
JdbiMappers.getEnum
public static <T extends Enum<T>> T getEnum(final ResultSet rs, final Class<T> enumType, final String columnName) throws SQLException { final String str = rs.getString(columnName); return (str == null) ? null : Enum.valueOf(enumType, str); }
java
public static <T extends Enum<T>> T getEnum(final ResultSet rs, final Class<T> enumType, final String columnName) throws SQLException { final String str = rs.getString(columnName); return (str == null) ? null : Enum.valueOf(enumType, str); }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "getEnum", "(", "final", "ResultSet", "rs", ",", "final", "Class", "<", "T", ">", "enumType", ",", "final", "String", "columnName", ")", "throws", "SQLException", "{", "final", "...
Returns an Enum representing the data or null if the input is null.
[ "Returns", "an", "Enum", "representing", "the", "data", "or", "null", "if", "the", "input", "is", "null", "." ]
train
https://github.com/NessComputing/components-ness-jdbi/blob/d446217b6f29b5409e55c5e72172cf0dbeacfec3/src/main/java/com/nesscomputing/jdbi/JdbiMappers.java#L108-L113
jenkinsci/jenkins
core/src/main/java/hudson/scm/SCM.java
SCM.calcRevisionsFromBuild
public @CheckForNull SCMRevisionState calcRevisionsFromBuild(@Nonnull Run<?,?> build, @Nullable FilePath workspace, @Nullable Launcher launcher, @Nonnull TaskListener listener) throws IOException, InterruptedException { if (build instanceof AbstractBuild && Util.isOverridden(SCM.class, getClass(), "calcRevisionsFromBuild", AbstractBuild.class, Launcher.class, TaskListener.class)) { return calcRevisionsFromBuild((AbstractBuild) build, launcher, listener); } else { throw new AbstractMethodError("you must override the new calcRevisionsFromBuild overload"); } }
java
public @CheckForNull SCMRevisionState calcRevisionsFromBuild(@Nonnull Run<?,?> build, @Nullable FilePath workspace, @Nullable Launcher launcher, @Nonnull TaskListener listener) throws IOException, InterruptedException { if (build instanceof AbstractBuild && Util.isOverridden(SCM.class, getClass(), "calcRevisionsFromBuild", AbstractBuild.class, Launcher.class, TaskListener.class)) { return calcRevisionsFromBuild((AbstractBuild) build, launcher, listener); } else { throw new AbstractMethodError("you must override the new calcRevisionsFromBuild overload"); } }
[ "public", "@", "CheckForNull", "SCMRevisionState", "calcRevisionsFromBuild", "(", "@", "Nonnull", "Run", "<", "?", ",", "?", ">", "build", ",", "@", "Nullable", "FilePath", "workspace", ",", "@", "Nullable", "Launcher", "launcher", ",", "@", "Nonnull", "TaskLi...
Calculates the {@link SCMRevisionState} that represents the state of the workspace of the given build. <p> The returned object is then fed into the {@link #compareRemoteRevisionWith(AbstractProject, Launcher, FilePath, TaskListener, SCMRevisionState)} method as the baseline {@link SCMRevisionState} to determine if the build is necessary. <p> This method is called after source code is checked out for the given build (that is, after {@link SCM#checkout(Run, Launcher, FilePath, TaskListener, File, SCMRevisionState)} has finished successfully.) <p> The obtained object is added to the build as an {@link Action} for later retrieval. As an optimization, {@link SCM} implementation can choose to compute {@link SCMRevisionState} and add it as an action during check out, in which case this method will not called. @param build The calculated {@link SCMRevisionState} is for the files checked out in this build. If {@link #requiresWorkspaceForPolling()} returns true, Hudson makes sure that the workspace of this build is available and accessible by the callee. @param workspace the location of the checkout; normally not null, since this will normally be called immediately after checkout, though could be null if data is being loaded from a very old version of Jenkins and the SCM declares that it does not require a workspace for polling @param launcher Abstraction of the machine where the polling will take place. Nullness matches that of {@code workspace}. @param listener Logs during the polling should be sent here. @throws InterruptedException interruption is usually caused by the user aborting the computation. this exception should be simply propagated all the way up. @since 1.568
[ "Calculates", "the", "{", "@link", "SCMRevisionState", "}", "that", "represents", "the", "state", "of", "the", "workspace", "of", "the", "given", "build", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/scm/SCM.java#L331-L337
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java
PersonGroupPersonsImpl.addPersonFaceFromUrlWithServiceResponseAsync
public Observable<ServiceResponse<PersistedFace>> addPersonFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url, AddPersonFaceFromUrlOptionalParameter addPersonFaceFromUrlOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (personGroupId == null) { throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null."); } if (personId == null) { throw new IllegalArgumentException("Parameter personId is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final String userData = addPersonFaceFromUrlOptionalParameter != null ? addPersonFaceFromUrlOptionalParameter.userData() : null; final List<Integer> targetFace = addPersonFaceFromUrlOptionalParameter != null ? addPersonFaceFromUrlOptionalParameter.targetFace() : null; return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace); }
java
public Observable<ServiceResponse<PersistedFace>> addPersonFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url, AddPersonFaceFromUrlOptionalParameter addPersonFaceFromUrlOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (personGroupId == null) { throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null."); } if (personId == null) { throw new IllegalArgumentException("Parameter personId is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final String userData = addPersonFaceFromUrlOptionalParameter != null ? addPersonFaceFromUrlOptionalParameter.userData() : null; final List<Integer> targetFace = addPersonFaceFromUrlOptionalParameter != null ? addPersonFaceFromUrlOptionalParameter.targetFace() : null; return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace); }
[ "public", "Observable", "<", "ServiceResponse", "<", "PersistedFace", ">", ">", "addPersonFaceFromUrlWithServiceResponseAsync", "(", "String", "personGroupId", ",", "UUID", "personId", ",", "String", "url", ",", "AddPersonFaceFromUrlOptionalParameter", "addPersonFaceFromUrlOp...
Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @param personGroupId Id referencing a particular person group. @param personId Id referencing a particular person. @param url Publicly reachable URL of an image @param addPersonFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PersistedFace object
[ "Add", "a", "representative", "face", "to", "a", "person", "for", "identification", ".", "The", "input", "face", "is", "specified", "as", "an", "image", "with", "a", "targetFace", "rectangle", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java#L1219-L1236
AzureAD/azure-activedirectory-library-for-java
src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java
AuthenticationContext.acquireToken
public Future<AuthenticationResult> acquireToken(final String resource, final String clientId, final String username, final String password, final AuthenticationCallback callback) { if (StringHelper.isBlank(resource)) { throw new IllegalArgumentException("resource is null or empty"); } if (StringHelper.isBlank(clientId)) { throw new IllegalArgumentException("clientId is null or empty"); } if (StringHelper.isBlank(username)) { throw new IllegalArgumentException("username is null or empty"); } ClientAuthenticationPost clientAuth = new ClientAuthenticationPost(ClientAuthenticationMethod.NONE, new ClientID(clientId)); if (password != null) { return this.acquireToken(new AdalOAuthAuthorizationGrant( new ResourceOwnerPasswordCredentialsGrant(username, new Secret( password)), resource), clientAuth, callback); } else { return this.acquireToken(new AdalIntegratedAuthorizationGrant(username, resource), clientAuth, callback); } }
java
public Future<AuthenticationResult> acquireToken(final String resource, final String clientId, final String username, final String password, final AuthenticationCallback callback) { if (StringHelper.isBlank(resource)) { throw new IllegalArgumentException("resource is null or empty"); } if (StringHelper.isBlank(clientId)) { throw new IllegalArgumentException("clientId is null or empty"); } if (StringHelper.isBlank(username)) { throw new IllegalArgumentException("username is null or empty"); } ClientAuthenticationPost clientAuth = new ClientAuthenticationPost(ClientAuthenticationMethod.NONE, new ClientID(clientId)); if (password != null) { return this.acquireToken(new AdalOAuthAuthorizationGrant( new ResourceOwnerPasswordCredentialsGrant(username, new Secret( password)), resource), clientAuth, callback); } else { return this.acquireToken(new AdalIntegratedAuthorizationGrant(username, resource), clientAuth, callback); } }
[ "public", "Future", "<", "AuthenticationResult", ">", "acquireToken", "(", "final", "String", "resource", ",", "final", "String", "clientId", ",", "final", "String", "username", ",", "final", "String", "password", ",", "final", "AuthenticationCallback", "callback", ...
Acquires a security token from the authority using a username/password flow. @param clientId Name or ID of the client requesting the token. @param resource Identifier of the target resource that is the recipient of the requested token. @param username Username of the managed or federated user. @param password Password of the managed or federated user. If null, integrated authentication will be used. @param callback optional callback object for non-blocking execution. @return A {@link Future} object representing the {@link AuthenticationResult} of the call. It contains Access Token, Refresh Token and the Access Token's expiration time.
[ "Acquires", "a", "security", "token", "from", "the", "authority", "using", "a", "username", "/", "password", "flow", "." ]
train
https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java#L195-L219
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/CollectionsUtil.java
CollectionsUtil.addAll
public static <T> void addAll(Collection<T> col, Enumeration<T> e) { while (e.hasMoreElements()) col.add(e.nextElement()); }
java
public static <T> void addAll(Collection<T> col, Enumeration<T> e) { while (e.hasMoreElements()) col.add(e.nextElement()); }
[ "public", "static", "<", "T", ">", "void", "addAll", "(", "Collection", "<", "T", ">", "col", ",", "Enumeration", "<", "T", ">", "e", ")", "{", "while", "(", "e", ".", "hasMoreElements", "(", ")", ")", "col", ".", "add", "(", "e", ".", "nextEleme...
Add all elements of the given enumeration into the given collection.
[ "Add", "all", "elements", "of", "the", "given", "enumeration", "into", "the", "given", "collection", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/CollectionsUtil.java#L86-L89
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/render/Renderer.java
Renderer.encodeChildren
public void encodeChildren(FacesContext context, UIComponent component) throws IOException { if (context == null || component == null) { throw new NullPointerException(); } if (component.getChildCount() > 0) { Iterator<UIComponent> kids = component.getChildren().iterator(); while (kids.hasNext()) { UIComponent kid = kids.next(); kid.encodeAll(context); } } }
java
public void encodeChildren(FacesContext context, UIComponent component) throws IOException { if (context == null || component == null) { throw new NullPointerException(); } if (component.getChildCount() > 0) { Iterator<UIComponent> kids = component.getChildren().iterator(); while (kids.hasNext()) { UIComponent kid = kids.next(); kid.encodeAll(context); } } }
[ "public", "void", "encodeChildren", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "if", "(", "context", "==", "null", "||", "component", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ...
<p>Render the child components of this {@link UIComponent}, following the rules described for <code>encodeBegin()</code> to acquire the appropriate value to be rendered. This method will only be called if the <code>rendersChildren</code> property of this component is <code>true</code>.</p> @param context {@link FacesContext} for the response we are creating @param component {@link UIComponent} whose children are to be rendered @throws IOException if an input/output error occurs while rendering @throws NullPointerException if <code>context</code> or <code>component</code> is <code>null</code>
[ "<p", ">", "Render", "the", "child", "components", "of", "this", "{", "@link", "UIComponent", "}", "following", "the", "rules", "described", "for", "<code", ">", "encodeBegin", "()", "<", "/", "code", ">", "to", "acquire", "the", "appropriate", "value", "t...
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/render/Renderer.java#L167-L179
podio/podio-java
src/main/java/com/podio/calendar/CalendarAPI.java
CalendarAPI.getSpace
public List<Event> getSpace(int spaceId, LocalDate dateFrom, LocalDate dateTo, ReferenceType... types) { return getCalendar("space/" + spaceId, dateFrom, dateTo, null, types); }
java
public List<Event> getSpace(int spaceId, LocalDate dateFrom, LocalDate dateTo, ReferenceType... types) { return getCalendar("space/" + spaceId, dateFrom, dateTo, null, types); }
[ "public", "List", "<", "Event", ">", "getSpace", "(", "int", "spaceId", ",", "LocalDate", "dateFrom", ",", "LocalDate", "dateTo", ",", "ReferenceType", "...", "types", ")", "{", "return", "getCalendar", "(", "\"space/\"", "+", "spaceId", ",", "dateFrom", ","...
Returns all items and tasks that the user have access to in the given space. Tasks with reference to other spaces are not returned or tasks with no reference. @param spaceId The id of the space @param dateFrom The from date @param dateTo The to date @param types The types of events that should be returned. Leave out to get all types of events. @return The events in the calendar
[ "Returns", "all", "items", "and", "tasks", "that", "the", "user", "have", "access", "to", "in", "the", "given", "space", ".", "Tasks", "with", "reference", "to", "other", "spaces", "are", "not", "returned", "or", "tasks", "with", "no", "reference", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/calendar/CalendarAPI.java#L84-L87
forge/core
javaee/impl/src/main/java/org/jboss/forge/addon/javaee/rest/generator/dto/DTOCollection.java
DTOCollection.getDTOFor
public JavaClassSource getDTOFor(JavaClass<?> entity, boolean root) { if (dtos.get(entity) == null) { return null; } return root ? (dtos.get(entity).rootDTO) : (dtos.get(entity).nestedDTO); }
java
public JavaClassSource getDTOFor(JavaClass<?> entity, boolean root) { if (dtos.get(entity) == null) { return null; } return root ? (dtos.get(entity).rootDTO) : (dtos.get(entity).nestedDTO); }
[ "public", "JavaClassSource", "getDTOFor", "(", "JavaClass", "<", "?", ">", "entity", ",", "boolean", "root", ")", "{", "if", "(", "dtos", ".", "get", "(", "entity", ")", "==", "null", ")", "{", "return", "null", ";", "}", "return", "root", "?", "(", ...
Retrieves the DTO created for the JPA entity, depending on whether a top level or nested DTO was requested as the return value. @param entity The JPA entity for which the DTOs may have been created @param root True, if the root/toplevel DTO should be returned. False if nested DTOs are to be returned. @return The root or nested DTO created for the JPA entity. <code>null</code> if no DTO was found.
[ "Retrieves", "the", "DTO", "created", "for", "the", "JPA", "entity", "depending", "on", "whether", "a", "top", "level", "or", "nested", "DTO", "was", "requested", "as", "the", "return", "value", "." ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/impl/src/main/java/org/jboss/forge/addon/javaee/rest/generator/dto/DTOCollection.java#L101-L108
weld/core
impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java
WeldConfiguration.processKeyValue
private void processKeyValue(Map<ConfigurationKey, Object> properties, String stringKey, Object value) { processKeyValue(properties, stringKey, value, false); }
java
private void processKeyValue(Map<ConfigurationKey, Object> properties, String stringKey, Object value) { processKeyValue(properties, stringKey, value, false); }
[ "private", "void", "processKeyValue", "(", "Map", "<", "ConfigurationKey", ",", "Object", ">", "properties", ",", "String", "stringKey", ",", "Object", "value", ")", "{", "processKeyValue", "(", "properties", ",", "stringKey", ",", "value", ",", "false", ")", ...
Process the given string key and value. First try to convert the <code>stringKey</code> - unsupported keys are ignored. Then delegate to {@link #processKeyValue(Map, ConfigurationKey, Object)}. @param properties @param stringKey @param value
[ "Process", "the", "given", "string", "key", "and", "value", ".", "First", "try", "to", "convert", "the", "<code", ">", "stringKey<", "/", "code", ">", "-", "unsupported", "keys", "are", "ignored", ".", "Then", "delegate", "to", "{", "@link", "#processKeyVa...
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L449-L451
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/icon/provider/IconProviderBuilder.java
IconProviderBuilder.withSide
public IconProviderBuilder withSide(EnumFacing side, String iconName) { return withSide(side, icon(iconName)); }
java
public IconProviderBuilder withSide(EnumFacing side, String iconName) { return withSide(side, icon(iconName)); }
[ "public", "IconProviderBuilder", "withSide", "(", "EnumFacing", "side", ",", "String", "iconName", ")", "{", "return", "withSide", "(", "side", ",", "icon", "(", "iconName", ")", ")", ";", "}" ]
Sets the {@link Icon} to use for specific side. @param side the side @param iconName the name @return the icon provider builder
[ "Sets", "the", "{", "@link", "Icon", "}", "to", "use", "for", "specific", "side", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/icon/provider/IconProviderBuilder.java#L149-L152
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.getDefaultState
private EditorState getDefaultState() { List<TableProperty> cols = new ArrayList<TableProperty>(1); cols.add(TableProperty.TRANSLATION); return new EditorState(cols, false); }
java
private EditorState getDefaultState() { List<TableProperty> cols = new ArrayList<TableProperty>(1); cols.add(TableProperty.TRANSLATION); return new EditorState(cols, false); }
[ "private", "EditorState", "getDefaultState", "(", ")", "{", "List", "<", "TableProperty", ">", "cols", "=", "new", "ArrayList", "<", "TableProperty", ">", "(", "1", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "TRANSLATION", ")", ";", "return",...
Creates the default editor state for editing a bundle with descriptor. @return the default editor state for editing a bundle with descriptor.
[ "Creates", "the", "default", "editor", "state", "for", "editing", "a", "bundle", "with", "descriptor", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1243-L1249
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.getNextHop
public NextHopResultInner getNextHop(String resourceGroupName, String networkWatcherName, NextHopParameters parameters) { return getNextHopWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body(); }
java
public NextHopResultInner getNextHop(String resourceGroupName, String networkWatcherName, NextHopParameters parameters) { return getNextHopWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body(); }
[ "public", "NextHopResultInner", "getNextHop", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "NextHopParameters", "parameters", ")", "{", "return", "getNextHopWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName", ",", ...
Gets the next hop from the specified VM. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param parameters Parameters that define the source and destination endpoint. @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 NextHopResultInner object if successful.
[ "Gets", "the", "next", "hop", "from", "the", "specified", "VM", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1126-L1128
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java
ResponseBuilder.getContent
private String getContent(String url) throws RottenTomatoesException { LOG.trace("Requesting: {}", url); try { final HttpGet httpGet = new HttpGet(url); httpGet.addHeader("accept", "application/json"); final DigestedResponse response = DigestedResponseReader.requestContent(httpClient, httpGet, charset); if (response.getStatusCode() >= HTTP_STATUS_500) { throw new RottenTomatoesException(ApiExceptionType.HTTP_503_ERROR, response.getContent(), response.getStatusCode(), url); } else if (response.getStatusCode() >= HTTP_STATUS_300) { throw new RottenTomatoesException(ApiExceptionType.HTTP_404_ERROR, response.getContent(), response.getStatusCode(), url); } return response.getContent(); } catch (IOException ex) { throw new RottenTomatoesException(ApiExceptionType.CONNECTION_ERROR, "Error retrieving URL", url, ex); } }
java
private String getContent(String url) throws RottenTomatoesException { LOG.trace("Requesting: {}", url); try { final HttpGet httpGet = new HttpGet(url); httpGet.addHeader("accept", "application/json"); final DigestedResponse response = DigestedResponseReader.requestContent(httpClient, httpGet, charset); if (response.getStatusCode() >= HTTP_STATUS_500) { throw new RottenTomatoesException(ApiExceptionType.HTTP_503_ERROR, response.getContent(), response.getStatusCode(), url); } else if (response.getStatusCode() >= HTTP_STATUS_300) { throw new RottenTomatoesException(ApiExceptionType.HTTP_404_ERROR, response.getContent(), response.getStatusCode(), url); } return response.getContent(); } catch (IOException ex) { throw new RottenTomatoesException(ApiExceptionType.CONNECTION_ERROR, "Error retrieving URL", url, ex); } }
[ "private", "String", "getContent", "(", "String", "url", ")", "throws", "RottenTomatoesException", "{", "LOG", ".", "trace", "(", "\"Requesting: {}\"", ",", "url", ")", ";", "try", "{", "final", "HttpGet", "httpGet", "=", "new", "HttpGet", "(", "url", ")", ...
Get the content from a string, decoding it if it is in GZIP format @param urlString @return @throws RottenTomatoesException
[ "Get", "the", "content", "from", "a", "string", "decoding", "it", "if", "it", "is", "in", "GZIP", "format" ]
train
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java#L136-L153
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.Short
public JBBPDslBuilder Short(final String name) { final Item item = new Item(BinType.SHORT, name, this.byteOrder); this.addItem(item); return this; }
java
public JBBPDslBuilder Short(final String name) { final Item item = new Item(BinType.SHORT, name, this.byteOrder); this.addItem(item); return this; }
[ "public", "JBBPDslBuilder", "Short", "(", "final", "String", "name", ")", "{", "final", "Item", "item", "=", "new", "Item", "(", "BinType", ".", "SHORT", ",", "name", ",", "this", ".", "byteOrder", ")", ";", "this", ".", "addItem", "(", "item", ")", ...
Add named signed short field. @param name name of the field, can be null for anonymous one @return the builder instance, must not be null
[ "Add", "named", "signed", "short", "field", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L959-L963
xwiki/xwiki-commons
xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/AbstractXARMojo.java
AbstractXARMojo.unpackXARToOutputDirectory
protected void unpackXARToOutputDirectory(Artifact artifact, String[] includes, String[] excludes) throws MojoExecutionException { if (!this.outputBuildDirectory.exists()) { this.outputBuildDirectory.mkdirs(); } File file = artifact.getFile(); unpack(file, this.outputBuildDirectory, "XAR Plugin", false, includes, excludes); }
java
protected void unpackXARToOutputDirectory(Artifact artifact, String[] includes, String[] excludes) throws MojoExecutionException { if (!this.outputBuildDirectory.exists()) { this.outputBuildDirectory.mkdirs(); } File file = artifact.getFile(); unpack(file, this.outputBuildDirectory, "XAR Plugin", false, includes, excludes); }
[ "protected", "void", "unpackXARToOutputDirectory", "(", "Artifact", "artifact", ",", "String", "[", "]", "includes", ",", "String", "[", "]", "excludes", ")", "throws", "MojoExecutionException", "{", "if", "(", "!", "this", ".", "outputBuildDirectory", ".", "exi...
Unpacks A XAR artifacts into the build output directory, along with the project's XAR files. @param artifact the XAR artifact to unpack. @throws MojoExecutionException in case of unpack error
[ "Unpacks", "A", "XAR", "artifacts", "into", "the", "build", "output", "directory", "along", "with", "the", "project", "s", "XAR", "files", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/AbstractXARMojo.java#L256-L265
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getTransactions
public Transactions getTransactions(final TransactionState state, final TransactionType type, final QueryParams params) { if (state != null) params.put("state", state.getType()); if (type != null) params.put("type", type.getType()); return doGET(Transactions.TRANSACTIONS_RESOURCE, Transactions.class, params); }
java
public Transactions getTransactions(final TransactionState state, final TransactionType type, final QueryParams params) { if (state != null) params.put("state", state.getType()); if (type != null) params.put("type", type.getType()); return doGET(Transactions.TRANSACTIONS_RESOURCE, Transactions.class, params); }
[ "public", "Transactions", "getTransactions", "(", "final", "TransactionState", "state", ",", "final", "TransactionType", "type", ",", "final", "QueryParams", "params", ")", "{", "if", "(", "state", "!=", "null", ")", "params", ".", "put", "(", "\"state\"", ","...
Get site's transaction history <p> All transactions on the site @param state {@link TransactionState} @param type {@link TransactionType} @param params {@link QueryParams} @return the transaction history of the site on success, null otherwise
[ "Get", "site", "s", "transaction", "history", "<p", ">", "All", "transactions", "on", "the", "site" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L908-L913
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.checkLock
public void checkLock(String resource, CmsLockType type) throws CmsException { CmsResource res = getCms().readResource(resource, CmsResourceFilter.ALL); CmsLock lock = getCms().getLock(res); boolean lockable = lock.isLockableBy(getCms().getRequestContext().getCurrentUser()); if (OpenCms.getWorkplaceManager().autoLockResources()) { // autolock is enabled, check the lock state of the resource if (lockable) { // resource is lockable, so lock it automatically if (type == CmsLockType.TEMPORARY) { getCms().lockResourceTemporary(resource); } else { getCms().lockResource(resource); } } else { throw new CmsException(Messages.get().container(Messages.ERR_WORKPLACE_LOCK_RESOURCE_1, resource)); } } else { if (!lockable) { throw new CmsException(Messages.get().container(Messages.ERR_WORKPLACE_LOCK_RESOURCE_1, resource)); } } }
java
public void checkLock(String resource, CmsLockType type) throws CmsException { CmsResource res = getCms().readResource(resource, CmsResourceFilter.ALL); CmsLock lock = getCms().getLock(res); boolean lockable = lock.isLockableBy(getCms().getRequestContext().getCurrentUser()); if (OpenCms.getWorkplaceManager().autoLockResources()) { // autolock is enabled, check the lock state of the resource if (lockable) { // resource is lockable, so lock it automatically if (type == CmsLockType.TEMPORARY) { getCms().lockResourceTemporary(resource); } else { getCms().lockResource(resource); } } else { throw new CmsException(Messages.get().container(Messages.ERR_WORKPLACE_LOCK_RESOURCE_1, resource)); } } else { if (!lockable) { throw new CmsException(Messages.get().container(Messages.ERR_WORKPLACE_LOCK_RESOURCE_1, resource)); } } }
[ "public", "void", "checkLock", "(", "String", "resource", ",", "CmsLockType", "type", ")", "throws", "CmsException", "{", "CmsResource", "res", "=", "getCms", "(", ")", ".", "readResource", "(", "resource", ",", "CmsResourceFilter", ".", "ALL", ")", ";", "Cm...
Checks the lock state of the resource and locks it if the autolock feature is enabled.<p> @param resource the resource name which is checked @param type indicates the mode {@link CmsLockType#EXCLUSIVE} or {@link CmsLockType#TEMPORARY} @throws CmsException if reading or locking the resource fails
[ "Checks", "the", "lock", "state", "of", "the", "resource", "and", "locks", "it", "if", "the", "autolock", "feature", "is", "enabled", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L1446-L1469
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraDefs.java
CassandraDefs.slicePredicateStartEndCol
static SlicePredicate slicePredicateStartEndCol(byte[] startColName, byte[] endColName, boolean reversed) { if(startColName == null) startColName = EMPTY_BYTES; if(endColName == null) endColName = EMPTY_BYTES; SliceRange sliceRange = new SliceRange( ByteBuffer.wrap(startColName), ByteBuffer.wrap(endColName), reversed, CassandraDefs.MAX_COLS_BATCH_SIZE); SlicePredicate slicePred = new SlicePredicate(); slicePred.setSlice_range(sliceRange); return slicePred; }
java
static SlicePredicate slicePredicateStartEndCol(byte[] startColName, byte[] endColName, boolean reversed) { if(startColName == null) startColName = EMPTY_BYTES; if(endColName == null) endColName = EMPTY_BYTES; SliceRange sliceRange = new SliceRange( ByteBuffer.wrap(startColName), ByteBuffer.wrap(endColName), reversed, CassandraDefs.MAX_COLS_BATCH_SIZE); SlicePredicate slicePred = new SlicePredicate(); slicePred.setSlice_range(sliceRange); return slicePred; }
[ "static", "SlicePredicate", "slicePredicateStartEndCol", "(", "byte", "[", "]", "startColName", ",", "byte", "[", "]", "endColName", ",", "boolean", "reversed", ")", "{", "if", "(", "startColName", "==", "null", ")", "startColName", "=", "EMPTY_BYTES", ";", "i...
Create a SlicePredicate that starts at the given column name, selecting up to {@link #MAX_COLS_BATCH_SIZE} columns. @param startColName Starting column name as a byte[]. @param endColName Ending column name as a byte[] @return SlicePredicate that starts at the given starting column name, ends at the given ending column name, selecting up to {@link #MAX_COLS_BATCH_SIZE} columns.
[ "Create", "a", "SlicePredicate", "that", "starts", "at", "the", "given", "column", "name", "selecting", "up", "to", "{", "@link", "#MAX_COLS_BATCH_SIZE", "}", "columns", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraDefs.java#L193-L203
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.getColorRecord
public ColorRecord getColorRecord (String className, String colorName) { ClassRecord record = getClassRecord(className); if (record == null) { log.warning("Requested unknown color class", "className", className, "colorName", colorName, new Exception()); return null; } int colorId = 0; try { colorId = record.getColorId(colorName); } catch (ParseException pe) { log.info("Error getting color record by name", "error", pe); return null; } return record.colors.get(colorId); }
java
public ColorRecord getColorRecord (String className, String colorName) { ClassRecord record = getClassRecord(className); if (record == null) { log.warning("Requested unknown color class", "className", className, "colorName", colorName, new Exception()); return null; } int colorId = 0; try { colorId = record.getColorId(colorName); } catch (ParseException pe) { log.info("Error getting color record by name", "error", pe); return null; } return record.colors.get(colorId); }
[ "public", "ColorRecord", "getColorRecord", "(", "String", "className", ",", "String", "colorName", ")", "{", "ClassRecord", "record", "=", "getClassRecord", "(", "className", ")", ";", "if", "(", "record", "==", "null", ")", "{", "log", ".", "warning", "(", ...
Looks up the requested color record by class and color names.
[ "Looks", "up", "the", "requested", "color", "record", "by", "class", "and", "color", "names", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L453-L471
haifengl/smile
core/src/main/java/smile/clustering/BBDTree.java
BBDTree.prune
private boolean prune(double[] center, double[] radius, double[][] centroids, int bestIndex, int testIndex) { if (bestIndex == testIndex) { return false; } int d = centroids[0].length; double[] best = centroids[bestIndex]; double[] test = centroids[testIndex]; double lhs = 0.0, rhs = 0.0; for (int i = 0; i < d; i++) { double diff = test[i] - best[i]; lhs += diff * diff; if (diff > 0) { rhs += (center[i] + radius[i] - best[i]) * diff; } else { rhs += (center[i] - radius[i] - best[i]) * diff; } } return (lhs >= 2 * rhs); }
java
private boolean prune(double[] center, double[] radius, double[][] centroids, int bestIndex, int testIndex) { if (bestIndex == testIndex) { return false; } int d = centroids[0].length; double[] best = centroids[bestIndex]; double[] test = centroids[testIndex]; double lhs = 0.0, rhs = 0.0; for (int i = 0; i < d; i++) { double diff = test[i] - best[i]; lhs += diff * diff; if (diff > 0) { rhs += (center[i] + radius[i] - best[i]) * diff; } else { rhs += (center[i] - radius[i] - best[i]) * diff; } } return (lhs >= 2 * rhs); }
[ "private", "boolean", "prune", "(", "double", "[", "]", "center", ",", "double", "[", "]", "radius", ",", "double", "[", "]", "[", "]", "centroids", ",", "int", "bestIndex", ",", "int", "testIndex", ")", "{", "if", "(", "bestIndex", "==", "testIndex", ...
Determines whether every point in the box is closer to centroids[bestIndex] than to centroids[testIndex]. If x is a point, c_0 = centroids[bestIndex], c = centroids[testIndex], then: (x-c).(x-c) < (x-c_0).(x-c_0) <=> (c-c_0).(c-c_0) < 2(x-c_0).(c-c_0) The right-hand side is maximized for a vertex of the box where for each dimension, we choose the low or high value based on the sign of x-c_0 in that dimension.
[ "Determines", "whether", "every", "point", "in", "the", "box", "is", "closer", "to", "centroids", "[", "bestIndex", "]", "than", "to", "centroids", "[", "testIndex", "]", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/BBDTree.java#L341-L362
dbracewell/mango
src/main/java/com/davidbracewell/config/Config.java
Config.closestKey
public static String closestKey(String propertyPrefix, Language language, String... propertyComponents) { return findKey(propertyPrefix, language, propertyComponents); }
java
public static String closestKey(String propertyPrefix, Language language, String... propertyComponents) { return findKey(propertyPrefix, language, propertyComponents); }
[ "public", "static", "String", "closestKey", "(", "String", "propertyPrefix", ",", "Language", "language", ",", "String", "...", "propertyComponents", ")", "{", "return", "findKey", "(", "propertyPrefix", ",", "language", ",", "propertyComponents", ")", ";", "}" ]
Finds the closest key to the given components @param propertyPrefix the property prefix @param language the language @param propertyComponents the property components @return the string
[ "Finds", "the", "closest", "key", "to", "the", "given", "components" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/config/Config.java#L239-L241
apereo/cas
core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java
DefaultRegisteredServiceAccessStrategy.doRequiredAttributesAllowPrincipalAccess
protected boolean doRequiredAttributesAllowPrincipalAccess(final Map<String, Object> principalAttributes, final Map<String, Set<String>> requiredAttributes) { LOGGER.debug("These required attributes [{}] are examined against [{}] before service can proceed.", requiredAttributes, principalAttributes); if (requiredAttributes.isEmpty()) { return true; } return requiredAttributesFoundInMap(principalAttributes, requiredAttributes); }
java
protected boolean doRequiredAttributesAllowPrincipalAccess(final Map<String, Object> principalAttributes, final Map<String, Set<String>> requiredAttributes) { LOGGER.debug("These required attributes [{}] are examined against [{}] before service can proceed.", requiredAttributes, principalAttributes); if (requiredAttributes.isEmpty()) { return true; } return requiredAttributesFoundInMap(principalAttributes, requiredAttributes); }
[ "protected", "boolean", "doRequiredAttributesAllowPrincipalAccess", "(", "final", "Map", "<", "String", ",", "Object", ">", "principalAttributes", ",", "final", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "requiredAttributes", ")", "{", "LOGGER", ...
Do required attributes allow principal access boolean. @param principalAttributes the principal attributes @param requiredAttributes the required attributes @return the boolean
[ "Do", "required", "attributes", "allow", "principal", "access", "boolean", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java#L192-L198
mangstadt/biweekly
src/main/java/biweekly/util/Recurrence.java
Recurrence.getDateIterator
public DateIterator getDateIterator(Date startDate, TimeZone timezone) { return getDateIterator(new ICalDate(startDate), timezone); }
java
public DateIterator getDateIterator(Date startDate, TimeZone timezone) { return getDateIterator(new ICalDate(startDate), timezone); }
[ "public", "DateIterator", "getDateIterator", "(", "Date", "startDate", ",", "TimeZone", "timezone", ")", "{", "return", "getDateIterator", "(", "new", "ICalDate", "(", "startDate", ")", ",", "timezone", ")", ";", "}" ]
Creates an iterator that computes the dates defined by this recurrence. @param startDate the date that the recurrence starts (typically, the value of the {@link DateStart} property) @param timezone the timezone to iterate in (typically, the timezone associated with the {@link DateStart} property). This is needed in order to adjust for when the iterator passes over a daylight savings boundary. @return the iterator @see <a href="https://code.google.com/p/google-rfc-2445/">google-rfc-2445</a>
[ "Creates", "an", "iterator", "that", "computes", "the", "dates", "defined", "by", "this", "recurrence", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/Recurrence.java#L230-L232
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/security/auth/AuthUtils.java
AuthUtils.populateSubject
public static Subject populateSubject(Subject subject, Collection<IAutoCredentials> autos, Map<String, String> credentials) { try { if (subject == null) { subject = new Subject(); } for (IAutoCredentials autoCred : autos) { autoCred.populateSubject(subject, credentials); } return subject; } catch (Exception e) { throw new RuntimeException(e); } }
java
public static Subject populateSubject(Subject subject, Collection<IAutoCredentials> autos, Map<String, String> credentials) { try { if (subject == null) { subject = new Subject(); } for (IAutoCredentials autoCred : autos) { autoCred.populateSubject(subject, credentials); } return subject; } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "Subject", "populateSubject", "(", "Subject", "subject", ",", "Collection", "<", "IAutoCredentials", ">", "autos", ",", "Map", "<", "String", ",", "String", ">", "credentials", ")", "{", "try", "{", "if", "(", "subject", "==", "null", "...
Populate a subject from credentials using the IAutoCredentials. @param subject the subject to populate or null if a new Subject should be created. @param autos the IAutoCredentials to call to populate the subject. @param credentials the credentials to pull from @return the populated subject.
[ "Populate", "a", "subject", "from", "credentials", "using", "the", "IAutoCredentials", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/security/auth/AuthUtils.java#L189-L201
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java
CmsAttributeHandler.removeAttributeValueAndReturnPrevParent
public Panel removeAttributeValueAndReturnPrevParent(int valueIndex, boolean force) { if (m_attributeValueViews.size() > valueIndex) { CmsAttributeValueView view = m_attributeValueViews.get(valueIndex); Panel result = (Panel)view.getParent(); removeAttributeValue(view, force); return result; } return null; }
java
public Panel removeAttributeValueAndReturnPrevParent(int valueIndex, boolean force) { if (m_attributeValueViews.size() > valueIndex) { CmsAttributeValueView view = m_attributeValueViews.get(valueIndex); Panel result = (Panel)view.getParent(); removeAttributeValue(view, force); return result; } return null; }
[ "public", "Panel", "removeAttributeValueAndReturnPrevParent", "(", "int", "valueIndex", ",", "boolean", "force", ")", "{", "if", "(", "m_attributeValueViews", ".", "size", "(", ")", ">", "valueIndex", ")", "{", "CmsAttributeValueView", "view", "=", "m_attributeValue...
Removes the attribute value (and corresponding widget) with the given index, and returns the parent widget.<p> @param valueIndex the value index @param force <code>true</code> if the widget should be removed even if it is the last one @return the parent widget
[ "Removes", "the", "attribute", "value", "(", "and", "corresponding", "widget", ")", "with", "the", "given", "index", "and", "returns", "the", "parent", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L921-L931
googleads/googleads-java-lib
examples/adwords_axis/src/main/java/adwords/axis/v201809/shoppingcampaigns/GetProductCategoryTaxonomy.java
GetProductCategoryTaxonomy.runExample
public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException { // Get the constant data service. ConstantDataServiceInterface constantDataService = adWordsServices.get(session, ConstantDataServiceInterface.class); Selector selector = new SelectorBuilder() .equals(ConstantDataField.Country, "US") .build(); ProductBiddingCategoryData[] results = constantDataService.getProductBiddingCategoryData(selector); // List of top level category nodes. List<CategoryNode> rootCategories = new ArrayList<>(); // Map of category ID to category node for all categories found in the results. Map<Long, CategoryNode> biddingCategories = Maps.newHashMap(); for (ProductBiddingCategoryData productBiddingCategoryData : results) { Long id = productBiddingCategoryData.getDimensionValue().getValue(); String name = productBiddingCategoryData.getDisplayValue(0).getValue(); CategoryNode node = biddingCategories.get(id); if (node == null) { node = new CategoryNode(id, name); biddingCategories.put(id, node); } else if (node.name == null) { // Ensure that the name attribute for the node is set. Name will be null for nodes added // to biddingCategories as a result of being a parentNode below. node.name = name; } if (productBiddingCategoryData.getParentDimensionValue() != null && productBiddingCategoryData.getParentDimensionValue().getValue() != null) { Long parentId = productBiddingCategoryData.getParentDimensionValue().getValue(); CategoryNode parentNode = biddingCategories.get(parentId); if (parentNode == null) { parentNode = new CategoryNode(parentId); biddingCategories.put(parentId, parentNode); } parentNode.children.add(node); } else { rootCategories.add(node); } } displayCategories(rootCategories, ""); }
java
public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException { // Get the constant data service. ConstantDataServiceInterface constantDataService = adWordsServices.get(session, ConstantDataServiceInterface.class); Selector selector = new SelectorBuilder() .equals(ConstantDataField.Country, "US") .build(); ProductBiddingCategoryData[] results = constantDataService.getProductBiddingCategoryData(selector); // List of top level category nodes. List<CategoryNode> rootCategories = new ArrayList<>(); // Map of category ID to category node for all categories found in the results. Map<Long, CategoryNode> biddingCategories = Maps.newHashMap(); for (ProductBiddingCategoryData productBiddingCategoryData : results) { Long id = productBiddingCategoryData.getDimensionValue().getValue(); String name = productBiddingCategoryData.getDisplayValue(0).getValue(); CategoryNode node = biddingCategories.get(id); if (node == null) { node = new CategoryNode(id, name); biddingCategories.put(id, node); } else if (node.name == null) { // Ensure that the name attribute for the node is set. Name will be null for nodes added // to biddingCategories as a result of being a parentNode below. node.name = name; } if (productBiddingCategoryData.getParentDimensionValue() != null && productBiddingCategoryData.getParentDimensionValue().getValue() != null) { Long parentId = productBiddingCategoryData.getParentDimensionValue().getValue(); CategoryNode parentNode = biddingCategories.get(parentId); if (parentNode == null) { parentNode = new CategoryNode(parentId); biddingCategories.put(parentId, parentNode); } parentNode.children.add(node); } else { rootCategories.add(node); } } displayCategories(rootCategories, ""); }
[ "public", "static", "void", "runExample", "(", "AdWordsServicesInterface", "adWordsServices", ",", "AdWordsSession", "session", ")", "throws", "RemoteException", "{", "// Get the constant data service.", "ConstantDataServiceInterface", "constantDataService", "=", "adWordsServices...
Runs the example. @param adWordsServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/shoppingcampaigns/GetProductCategoryTaxonomy.java#L115-L160
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/ObjectsApi.java
ObjectsApi.getPermissionsAsync
public com.squareup.okhttp.Call getPermissionsAsync(String objectType, String dbids, String dnType, String folderType, final ApiCallback<GetPermissionsSuccessResponse> 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 = getPermissionsValidateBeforeCall(objectType, dbids, dnType, folderType, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<GetPermissionsSuccessResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getPermissionsAsync(String objectType, String dbids, String dnType, String folderType, final ApiCallback<GetPermissionsSuccessResponse> 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 = getPermissionsValidateBeforeCall(objectType, dbids, dnType, folderType, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<GetPermissionsSuccessResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getPermissionsAsync", "(", "String", "objectType", ",", "String", "dbids", ",", "String", "dnType", ",", "String", "folderType", ",", "final", "ApiCallback", "<", "GetPermissionsSuccessResponse", ">", ...
Get permissions for a list of objects. (asynchronously) Get permissions from Configuration Server for objects identified by their type and DBIDs. @param objectType The type of object. Any type supported by the Config server (folders, business-attributes etc). (required) @param dbids Comma-separated list of object DBIDs to query permissions. (required) @param dnType If the object_type is &#39;dns&#39;, then you may specify the DN type (for example, CFGRoutingPoint). This parameter does not affect request results but may increase performance For possible values, see [CfgDNType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgDNType) in the Platform SDK documentation. (optional) @param folderType If the object_type is &#39;folders&#39;, then you may specify the object type of the folders (for example, CFGPerson). This parameter does not affect request results but may increase performance For possible values, see [CfgObjectType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgObjectType) in the Platform SDK documentation. (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
[ "Get", "permissions", "for", "a", "list", "of", "objects", ".", "(", "asynchronously", ")", "Get", "permissions", "from", "Configuration", "Server", "for", "objects", "identified", "by", "their", "type", "and", "DBIDs", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/ObjectsApi.java#L381-L406
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java
CompiledFEELSemanticMappings.and
public static Boolean and(Object left, Object right) { return (Boolean) InfixOpNode.and(left, right, null); }
java
public static Boolean and(Object left, Object right) { return (Boolean) InfixOpNode.and(left, right, null); }
[ "public", "static", "Boolean", "and", "(", "Object", "left", ",", "Object", "right", ")", "{", "return", "(", "Boolean", ")", "InfixOpNode", ".", "and", "(", "left", ",", "right", ",", "null", ")", ";", "}" ]
FEEL spec Table 38 Delegates to {@link InfixOpNode} except evaluationcontext
[ "FEEL", "spec", "Table", "38", "Delegates", "to", "{" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java#L258-L260
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java
SignupFormPanel.newButtonLabel
protected Label newButtonLabel(final String id, final String resourceKey, final String defaultValue) { final IModel<String> labelModel = ResourceModelFactory.newResourceModel(resourceKey, this, defaultValue); final Label label = new Label(id, labelModel); label.setOutputMarkupId(true); return label; }
java
protected Label newButtonLabel(final String id, final String resourceKey, final String defaultValue) { final IModel<String> labelModel = ResourceModelFactory.newResourceModel(resourceKey, this, defaultValue); final Label label = new Label(id, labelModel); label.setOutputMarkupId(true); return label; }
[ "protected", "Label", "newButtonLabel", "(", "final", "String", "id", ",", "final", "String", "resourceKey", ",", "final", "String", "defaultValue", ")", "{", "final", "IModel", "<", "String", ">", "labelModel", "=", "ResourceModelFactory", ".", "newResourceModel"...
Factory method for creating the Button Label. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a Label. @param id the id @param resourceKey the resource key @param defaultValue the default value @return the label
[ "Factory", "method", "for", "creating", "the", "Button", "Label", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "ver...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java#L135-L143
baratine/baratine
framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java
HeartbeatImpl.updateExternal
private void updateExternal(ServerHeartbeat server, String externalId) { if (externalId != null) { ServerHeartbeat serverExternal = _root.getServer(externalId); server.setExternalServer(serverExternal); } else { server.setExternalServer(null); /* if (serverExternal != null) { serverExternal.setDelegate(data); _root.updateSequence(); } */ } // data.setExternalId(externalId); }
java
private void updateExternal(ServerHeartbeat server, String externalId) { if (externalId != null) { ServerHeartbeat serverExternal = _root.getServer(externalId); server.setExternalServer(serverExternal); } else { server.setExternalServer(null); /* if (serverExternal != null) { serverExternal.setDelegate(data); _root.updateSequence(); } */ } // data.setExternalId(externalId); }
[ "private", "void", "updateExternal", "(", "ServerHeartbeat", "server", ",", "String", "externalId", ")", "{", "if", "(", "externalId", "!=", "null", ")", "{", "ServerHeartbeat", "serverExternal", "=", "_root", ".", "getServer", "(", "externalId", ")", ";", "se...
Update the external server delegation. Cloud static IPs might be routing IPs that aren't local interfaces. In that case, the routing assignment to the dynamic IP must be passed along with the heartbeat.
[ "Update", "the", "external", "server", "delegation", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L742-L761
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.beginMarkedContent
public void beginMarkedContent (final COSName tag, final PDPropertyList propertyList) throws IOException { writeOperand (tag); writeOperand (resources.add (propertyList)); writeOperator ((byte) 'B', (byte) 'D', (byte) 'C'); }
java
public void beginMarkedContent (final COSName tag, final PDPropertyList propertyList) throws IOException { writeOperand (tag); writeOperand (resources.add (propertyList)); writeOperator ((byte) 'B', (byte) 'D', (byte) 'C'); }
[ "public", "void", "beginMarkedContent", "(", "final", "COSName", "tag", ",", "final", "PDPropertyList", "propertyList", ")", "throws", "IOException", "{", "writeOperand", "(", "tag", ")", ";", "writeOperand", "(", "resources", ".", "add", "(", "propertyList", ")...
Begin a marked content sequence with a reference to an entry in the page resources' Properties dictionary. @param tag the tag @param propertyList property list @throws IOException If the content stream could not be written
[ "Begin", "a", "marked", "content", "sequence", "with", "a", "reference", "to", "an", "entry", "in", "the", "page", "resources", "Properties", "dictionary", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1535-L1540
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/Contracts.java
Contracts.assertParameterNotNull
public static void assertParameterNotNull(Object parameter, String parameterName) { if ( parameter == null ) { throw log.parameterMustNotBeNull( parameterName ); } }
java
public static void assertParameterNotNull(Object parameter, String parameterName) { if ( parameter == null ) { throw log.parameterMustNotBeNull( parameterName ); } }
[ "public", "static", "void", "assertParameterNotNull", "(", "Object", "parameter", ",", "String", "parameterName", ")", "{", "if", "(", "parameter", "==", "null", ")", "{", "throw", "log", ".", "parameterMustNotBeNull", "(", "parameterName", ")", ";", "}", "}" ...
Asserts that the given method or constructor is not {@code null}. @param parameter the parameter to validate @param parameterName the name of the parameter, will be used in the logging message in case the given object is {@code null} @throws IllegalArgumentException in case the given parameter is {@code null}
[ "Asserts", "that", "the", "given", "method", "or", "constructor", "is", "not", "{", "@code", "null", "}", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/Contracts.java#L46-L50
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/publisher/CommitSequencePublisher.java
CommitSequencePublisher.movePath
@Override protected void movePath(ParallelRunner parallelRunner, State state, Path src, Path dst, int branchId) throws IOException { log.info(String.format("Creating CommitStep for moving %s to %s", src, dst)); boolean overwrite = state.getPropAsBoolean(ConfigurationKeys.DATA_PUBLISHER_OVERWRITE_ENABLED, false); FsRenameCommitStep.Builder<?> builder = this.commitSequenceBuilder.get().beginStep(FsRenameCommitStep.Builder.class) .withProps(this.state).from(src).withSrcFs(this.writerFileSystemByBranches.get(branchId)).to(dst) .withDstFs(this.publisherFileSystemByBranches.get(branchId)); if (overwrite) { builder.overwrite(); } builder.endStep(); }
java
@Override protected void movePath(ParallelRunner parallelRunner, State state, Path src, Path dst, int branchId) throws IOException { log.info(String.format("Creating CommitStep for moving %s to %s", src, dst)); boolean overwrite = state.getPropAsBoolean(ConfigurationKeys.DATA_PUBLISHER_OVERWRITE_ENABLED, false); FsRenameCommitStep.Builder<?> builder = this.commitSequenceBuilder.get().beginStep(FsRenameCommitStep.Builder.class) .withProps(this.state).from(src).withSrcFs(this.writerFileSystemByBranches.get(branchId)).to(dst) .withDstFs(this.publisherFileSystemByBranches.get(branchId)); if (overwrite) { builder.overwrite(); } builder.endStep(); }
[ "@", "Override", "protected", "void", "movePath", "(", "ParallelRunner", "parallelRunner", ",", "State", "state", ",", "Path", "src", ",", "Path", "dst", ",", "int", "branchId", ")", "throws", "IOException", "{", "log", ".", "info", "(", "String", ".", "fo...
This method does not actually move data, but it creates an {@link FsRenameCommitStep}.
[ "This", "method", "does", "not", "actually", "move", "data", "but", "it", "creates", "an", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/publisher/CommitSequencePublisher.java#L79-L92
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.paymentMean_bankAccount_id_PUT
public void paymentMean_bankAccount_id_PUT(Long id, OvhBankAccount body) throws IOException { String qPath = "/me/paymentMean/bankAccount/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void paymentMean_bankAccount_id_PUT(Long id, OvhBankAccount body) throws IOException { String qPath = "/me/paymentMean/bankAccount/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "paymentMean_bankAccount_id_PUT", "(", "Long", "id", ",", "OvhBankAccount", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/paymentMean/bankAccount/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id",...
Alter this object properties REST: PUT /me/paymentMean/bankAccount/{id} @param body [required] New object properties @param id [required] Id of the object
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L763-L767
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java
EnvironmentConverter.convertEnvironmentIfNecessary
StandardEnvironment convertEnvironmentIfNecessary(ConfigurableEnvironment environment, Class<? extends StandardEnvironment> type) { if (type.equals(environment.getClass())) { return (StandardEnvironment) environment; } return convertEnvironment(environment, type); }
java
StandardEnvironment convertEnvironmentIfNecessary(ConfigurableEnvironment environment, Class<? extends StandardEnvironment> type) { if (type.equals(environment.getClass())) { return (StandardEnvironment) environment; } return convertEnvironment(environment, type); }
[ "StandardEnvironment", "convertEnvironmentIfNecessary", "(", "ConfigurableEnvironment", "environment", ",", "Class", "<", "?", "extends", "StandardEnvironment", ">", "type", ")", "{", "if", "(", "type", ".", "equals", "(", "environment", ".", "getClass", "(", ")", ...
Converts the given {@code environment} to the given {@link StandardEnvironment} type. If the environment is already of the same type, no conversion is performed and it is returned unchanged. @param environment the Environment to convert @param type the type to convert the Environment to @return the converted Environment
[ "Converts", "the", "given", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java#L71-L77
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java
TupleCombiner.getTuples
public static Collection<Tuple> getTuples( List<VarDef> varDefs, int tupleSize) { if( tupleSize < 1) { tupleSize = varDefs.size(); } int varEnd = varDefs.size() - tupleSize + 1; if( varEnd <= 0) { throw new IllegalArgumentException( "Can't create " + tupleSize + "-tuples for " + varDefs.size() + " combined variables"); } return getTuples( varDefs, 0, varEnd, tupleSize); }
java
public static Collection<Tuple> getTuples( List<VarDef> varDefs, int tupleSize) { if( tupleSize < 1) { tupleSize = varDefs.size(); } int varEnd = varDefs.size() - tupleSize + 1; if( varEnd <= 0) { throw new IllegalArgumentException( "Can't create " + tupleSize + "-tuples for " + varDefs.size() + " combined variables"); } return getTuples( varDefs, 0, varEnd, tupleSize); }
[ "public", "static", "Collection", "<", "Tuple", ">", "getTuples", "(", "List", "<", "VarDef", ">", "varDefs", ",", "int", "tupleSize", ")", "{", "if", "(", "tupleSize", "<", "1", ")", "{", "tupleSize", "=", "varDefs", ".", "size", "(", ")", ";", "}",...
Returns all valid N-tuples of values for the given input variables. A non-positive tupleSize specifies all permutations.
[ "Returns", "all", "valid", "N", "-", "tuples", "of", "values", "for", "the", "given", "input", "variables", ".", "A", "non", "-", "positive", "tupleSize", "specifies", "all", "permutations", "." ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java#L251-L263
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/convert/DoubleConverter.java
DoubleConverter.fixLocale
private String fixLocale(FacesContext facesContext, String value) { Locale loc = facesContext.getViewRoot().getLocale(); if (loc == null || loc == Locale.US) { // nothing to fix if we are already using the US Locale return value; } // TODO: DecimalFormatSymbols.getInstance exists only on JDK 1.6 // change it on JSF 2.1 //DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc); DecimalFormatSymbols dfs = new DecimalFormatSymbols(loc); char decSep = dfs.getDecimalSeparator(); // replace decimal separators which are different to '.' if (decSep != '.' && value.lastIndexOf(decSep) >= 0) { StringBuffer sbVal = new StringBuffer(); // remove all groupSeperators and change the decimalSeperator for (int i = 0; i < value.length(); i++) { if (value.charAt(i) == decSep) { sbVal.append('.'); // we append the Locale.US decimal separator continue; } // just append all other characters as usual sbVal.append(value.charAt(i)); } value = sbVal.toString(); } // we need the formatter with the correct Locale of the user return value; }
java
private String fixLocale(FacesContext facesContext, String value) { Locale loc = facesContext.getViewRoot().getLocale(); if (loc == null || loc == Locale.US) { // nothing to fix if we are already using the US Locale return value; } // TODO: DecimalFormatSymbols.getInstance exists only on JDK 1.6 // change it on JSF 2.1 //DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc); DecimalFormatSymbols dfs = new DecimalFormatSymbols(loc); char decSep = dfs.getDecimalSeparator(); // replace decimal separators which are different to '.' if (decSep != '.' && value.lastIndexOf(decSep) >= 0) { StringBuffer sbVal = new StringBuffer(); // remove all groupSeperators and change the decimalSeperator for (int i = 0; i < value.length(); i++) { if (value.charAt(i) == decSep) { sbVal.append('.'); // we append the Locale.US decimal separator continue; } // just append all other characters as usual sbVal.append(value.charAt(i)); } value = sbVal.toString(); } // we need the formatter with the correct Locale of the user return value; }
[ "private", "String", "fixLocale", "(", "FacesContext", "facesContext", ",", "String", "value", ")", "{", "Locale", "loc", "=", "facesContext", ".", "getViewRoot", "(", ")", ".", "getLocale", "(", ")", ";", "if", "(", "loc", "==", "null", "||", "loc", "==...
Since Double.valueOf is not Locale aware, and NumberFormatter cannot parse E values correctly, we need to make a US Locale string from our input value. E.g. '34,383e3' will be translated to '34.383e3' if Locale.DE is set in the {@link javax.faces.component.UIViewRoot#getLocale()} @param facesContext @param value @return the 'fixed' value String
[ "Since", "Double", ".", "valueOf", "is", "not", "Locale", "aware", "and", "NumberFormatter", "cannot", "parse", "E", "values", "correctly", "we", "need", "to", "make", "a", "US", "Locale", "string", "from", "our", "input", "value", ".", "E", ".", "g", "....
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/convert/DoubleConverter.java#L91-L131
Sciss/abc4j
abc/src/main/java/abc/notation/Voice.java
Voice.getKey
public KeySignature getKey() { for (int i = 0, j = size(); i < j; i++) { if (elementAt(i) instanceof KeySignature) return (KeySignature) elementAt(i); } return new KeySignature(Note.C, KeySignature.MAJOR); }
java
public KeySignature getKey() { for (int i = 0, j = size(); i < j; i++) { if (elementAt(i) instanceof KeySignature) return (KeySignature) elementAt(i); } return new KeySignature(Note.C, KeySignature.MAJOR); }
[ "public", "KeySignature", "getKey", "(", ")", "{", "for", "(", "int", "i", "=", "0", ",", "j", "=", "size", "(", ")", ";", "i", "<", "j", ";", "i", "++", ")", "{", "if", "(", "elementAt", "(", "i", ")", "instanceof", "KeySignature", ")", "retur...
Returns the key signature of this tune. @return The key signature of this tune.
[ "Returns", "the", "key", "signature", "of", "this", "tune", "." ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Voice.java#L206-L212
Hygieia/Hygieia
collectors/feature/versionone/src/main/java/com/capitalone/dashboard/util/DateUtil.java
DateUtil.isInteger
private boolean isInteger(String s, int radix) { Scanner sc = new Scanner(s.trim()); if (!sc.hasNextInt(radix)) return false; // we know it starts with a valid int, now make sure // there's nothing left! sc.nextInt(radix); return !sc.hasNext(); }
java
private boolean isInteger(String s, int radix) { Scanner sc = new Scanner(s.trim()); if (!sc.hasNextInt(radix)) return false; // we know it starts with a valid int, now make sure // there's nothing left! sc.nextInt(radix); return !sc.hasNext(); }
[ "private", "boolean", "isInteger", "(", "String", "s", ",", "int", "radix", ")", "{", "Scanner", "sc", "=", "new", "Scanner", "(", "s", ".", "trim", "(", ")", ")", ";", "if", "(", "!", "sc", ".", "hasNextInt", "(", "radix", ")", ")", "return", "f...
Determines if string is an integer of the radix base number system provided. @param s String to be evaluated for integer type @param radix Base number system (e.g., 10 = base 10 number system) @return boolean
[ "Determines", "if", "string", "is", "an", "integer", "of", "the", "radix", "base", "number", "system", "provided", "." ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/feature/versionone/src/main/java/com/capitalone/dashboard/util/DateUtil.java#L126-L134
google/j2objc
jre_emul/android/platform/libcore/json/src/main/java/org/json/JSONObject.java
JSONObject.put
public JSONObject put(String name, long value) throws JSONException { nameValuePairs.put(checkName(name), value); return this; }
java
public JSONObject put(String name, long value) throws JSONException { nameValuePairs.put(checkName(name), value); return this; }
[ "public", "JSONObject", "put", "(", "String", "name", ",", "long", "value", ")", "throws", "JSONException", "{", "nameValuePairs", ".", "put", "(", "checkName", "(", "name", ")", ",", "value", ")", ";", "return", "this", ";", "}" ]
Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same name. @return this object.
[ "Maps", "{", "@code", "name", "}", "to", "{", "@code", "value", "}", "clobbering", "any", "existing", "name", "/", "value", "mapping", "with", "the", "same", "name", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/json/src/main/java/org/json/JSONObject.java#L239-L242
Netflix/Turbine
turbine-core/src/main/java/com/netflix/turbine/aggregator/NumberList.java
NumberList.delta
@SuppressWarnings("unchecked") public static NumberList delta(Map<String, Object> currentMap, NumberList previousMap) { return delta(currentMap, (Map)previousMap.numbers); }
java
@SuppressWarnings("unchecked") public static NumberList delta(Map<String, Object> currentMap, NumberList previousMap) { return delta(currentMap, (Map)previousMap.numbers); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "NumberList", "delta", "(", "Map", "<", "String", ",", "Object", ">", "currentMap", ",", "NumberList", "previousMap", ")", "{", "return", "delta", "(", "currentMap", ",", "(", "Map", ")"...
unchecked but we know we can go from Map<String, Long> to Map<String, Object>
[ "unchecked", "but", "we", "know", "we", "can", "go", "from", "Map<String", "Long", ">", "to", "Map<String", "Object", ">" ]
train
https://github.com/Netflix/Turbine/blob/0e924058aa4d1d526310206a51dcf82f65274d58/turbine-core/src/main/java/com/netflix/turbine/aggregator/NumberList.java#L47-L50
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java
GVRShader.bindShader
public int bindShader(GVRContext context, IRenderable rdata, GVRScene scene, boolean isMultiview) { String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); GVRMaterial mtl = rdata.getMaterial(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, mtl); } if (nativeShader > 0) { rdata.setShader(nativeShader, isMultiview); } return nativeShader; } }
java
public int bindShader(GVRContext context, IRenderable rdata, GVRScene scene, boolean isMultiview) { String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); GVRMaterial mtl = rdata.getMaterial(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, mtl); } if (nativeShader > 0) { rdata.setShader(nativeShader, isMultiview); } return nativeShader; } }
[ "public", "int", "bindShader", "(", "GVRContext", "context", ",", "IRenderable", "rdata", ",", "GVRScene", "scene", ",", "boolean", "isMultiview", ")", "{", "String", "signature", "=", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "GVRShaderManage...
Select the specific vertex and fragment shader to use. The shader template is used to generate the sources for the vertex and fragment shader based on the vertex, material and light properties. This function may compile the shader if it does not already exist. @param context GVRContext @param rdata renderable entity with mesh and rendering options @param scene list of light sources
[ "Select", "the", "specific", "vertex", "and", "fragment", "shader", "to", "use", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java#L306-L325
spring-projects/spring-shell
spring-shell-core/src/main/java/org/springframework/shell/jline/ExtendedDefaultParser.java
ExtendedDefaultParser.isDelimiter
public boolean isDelimiter(final CharSequence buffer, final int pos) { return !isQuoted(buffer, pos) && !isEscaped(buffer, pos) && isDelimiterChar(buffer, pos); }
java
public boolean isDelimiter(final CharSequence buffer, final int pos) { return !isQuoted(buffer, pos) && !isEscaped(buffer, pos) && isDelimiterChar(buffer, pos); }
[ "public", "boolean", "isDelimiter", "(", "final", "CharSequence", "buffer", ",", "final", "int", "pos", ")", "{", "return", "!", "isQuoted", "(", "buffer", ",", "pos", ")", "&&", "!", "isEscaped", "(", "buffer", ",", "pos", ")", "&&", "isDelimiterChar", ...
Returns true if the specified character is a whitespace parameter. Check to ensure that the character is not escaped by any of {@link #getQuoteChars}, and is not escaped by ant of the {@link #getEscapeChars}, and returns true from {@link #isDelimiterChar}. @param buffer The complete command buffer @param pos The index of the character in the buffer @return True if the character should be a delimiter
[ "Returns", "true", "if", "the", "specified", "character", "is", "a", "whitespace", "parameter", ".", "Check", "to", "ensure", "that", "the", "character", "is", "not", "escaped", "by", "any", "of", "{", "@link", "#getQuoteChars", "}", "and", "is", "not", "e...
train
https://github.com/spring-projects/spring-shell/blob/23d99f45eb8f487e31a1f080c837061313bbfafa/spring-shell-core/src/main/java/org/springframework/shell/jline/ExtendedDefaultParser.java#L158-L160
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentScopeShadow.java
ComponentScopeShadow.callWithNamedValues
@Override public Object callWithNamedValues(PageContext pc, Key key, Struct args) throws PageException { // first check variables Object o = shadow.get(key); if (o instanceof UDFPlus) { return ((UDFPlus) o).callWithNamedValues(pc, key, args, false); } Member m = component.getMember(access, key, false, false); if (m != null) { if (m instanceof UDFPlus) return ((UDFPlus) m).callWithNamedValues(pc, key, args, false); return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct"); // throw ComponentUtil.notFunction(component, key, m.getValue(),access); } return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct"); // throw ComponentUtil.notFunction(component, key, null,access); }
java
@Override public Object callWithNamedValues(PageContext pc, Key key, Struct args) throws PageException { // first check variables Object o = shadow.get(key); if (o instanceof UDFPlus) { return ((UDFPlus) o).callWithNamedValues(pc, key, args, false); } Member m = component.getMember(access, key, false, false); if (m != null) { if (m instanceof UDFPlus) return ((UDFPlus) m).callWithNamedValues(pc, key, args, false); return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct"); // throw ComponentUtil.notFunction(component, key, m.getValue(),access); } return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct"); // throw ComponentUtil.notFunction(component, key, null,access); }
[ "@", "Override", "public", "Object", "callWithNamedValues", "(", "PageContext", "pc", ",", "Key", "key", ",", "Struct", "args", ")", "throws", "PageException", "{", "// first check variables", "Object", "o", "=", "shadow", ".", "get", "(", "key", ")", ";", "...
/* public Object callWithNamedValues(PageContext pc, String key,Struct args) throws PageException { return callWithNamedValues(pc, KeyImpl.init(key), args); }
[ "/", "*", "public", "Object", "callWithNamedValues", "(", "PageContext", "pc", "String", "key", "Struct", "args", ")", "throws", "PageException", "{", "return", "callWithNamedValues", "(", "pc", "KeyImpl", ".", "init", "(", "key", ")", "args", ")", ";", "}" ...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentScopeShadow.java#L315-L331
micronaut-projects/micronaut-core
cli/src/main/groovy/io/micronaut/cli/util/NameUtils.java
NameUtils.getPluginName
public static String getPluginName(String descriptorName) { if (descriptorName == null || descriptorName.length() == 0) { return descriptorName; } if (!descriptorName.endsWith("GrailsPlugin.groovy")) { throw new IllegalArgumentException("Plugin descriptor name is not valid: " + descriptorName); } return getScriptName(descriptorName.substring(0, descriptorName.indexOf("GrailsPlugin.groovy"))); }
java
public static String getPluginName(String descriptorName) { if (descriptorName == null || descriptorName.length() == 0) { return descriptorName; } if (!descriptorName.endsWith("GrailsPlugin.groovy")) { throw new IllegalArgumentException("Plugin descriptor name is not valid: " + descriptorName); } return getScriptName(descriptorName.substring(0, descriptorName.indexOf("GrailsPlugin.groovy"))); }
[ "public", "static", "String", "getPluginName", "(", "String", "descriptorName", ")", "{", "if", "(", "descriptorName", "==", "null", "||", "descriptorName", ".", "length", "(", ")", "==", "0", ")", "{", "return", "descriptorName", ";", "}", "if", "(", "!",...
Returns the name of a plugin given the name of the *GrailsPlugin.groovy descriptor file. For example, "DbUtilsGrailsPlugin.groovy" gives "db-utils". @param descriptorName The simple name of the plugin descriptor. @return The plugin name for the descriptor, or <code>null</code> if <i>descriptorName</i> is <code>null</code>, or an empty string if <i>descriptorName</i> is an empty string. @throws IllegalArgumentException if the given descriptor name is not valid, i.e. if it doesn't end with "GrailsPlugin.groovy".
[ "Returns", "the", "name", "of", "a", "plugin", "given", "the", "name", "of", "the", "*", "GrailsPlugin", ".", "groovy", "descriptor", "file", ".", "For", "example", "DbUtilsGrailsPlugin", ".", "groovy", "gives", "db", "-", "utils", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/util/NameUtils.java#L401-L411
rythmengine/rythmengine
src/main/java/org/rythmengine/utils/IO.java
IO.readContentAsString
public static String readContentAsString(URL url, String encoding) { try { return readContentAsString(url.openStream()); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static String readContentAsString(URL url, String encoding) { try { return readContentAsString(url.openStream()); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "String", "readContentAsString", "(", "URL", "url", ",", "String", "encoding", ")", "{", "try", "{", "return", "readContentAsString", "(", "url", ".", "openStream", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "t...
Read file content to a String @param url The url resource to read @return The String content
[ "Read", "file", "content", "to", "a", "String" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/IO.java#L36-L42
xebia-france/xebia-management-extras
src/main/java/fr/xebia/management/statistics/ServiceStatistics.java
ServiceStatistics.incrementExceptionCount
public void incrementExceptionCount(Throwable throwable) { if (throwable instanceof ServiceUnavailableException) { serviceUnavailableExceptionCounter.incrementAndGet(); } else if (containsThrowableOfType(throwable, communicationExceptionsTypes)) { communicationExceptionCounter.incrementAndGet(); } else if (containsThrowableOfType(throwable, businessExceptionsTypes)) { businessExceptionCounter.incrementAndGet(); } else { otherExceptionCounter.incrementAndGet(); } }
java
public void incrementExceptionCount(Throwable throwable) { if (throwable instanceof ServiceUnavailableException) { serviceUnavailableExceptionCounter.incrementAndGet(); } else if (containsThrowableOfType(throwable, communicationExceptionsTypes)) { communicationExceptionCounter.incrementAndGet(); } else if (containsThrowableOfType(throwable, businessExceptionsTypes)) { businessExceptionCounter.incrementAndGet(); } else { otherExceptionCounter.incrementAndGet(); } }
[ "public", "void", "incrementExceptionCount", "(", "Throwable", "throwable", ")", "{", "if", "(", "throwable", "instanceof", "ServiceUnavailableException", ")", "{", "serviceUnavailableExceptionCounter", ".", "incrementAndGet", "(", ")", ";", "}", "else", "if", "(", ...
Increment the {@link #communicationExceptionCounter} if the given throwable or one of its cause is an instance of on of {@link #communicationExceptionsTypes} ; otherwise, increment {@link #otherExceptionCounter}.
[ "Increment", "the", "{" ]
train
https://github.com/xebia-france/xebia-management-extras/blob/09f52a0ddb898e402a04f0adfacda74a5d0556e8/src/main/java/fr/xebia/management/statistics/ServiceStatistics.java#L346-L357
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getCenterVector
public static final Atom getCenterVector(Atom[] atomSet, Atom centroid){ double[] coords = new double[3]; coords[0] = 0 - centroid.getX(); coords[1] = 0 - centroid.getY(); coords[2] = 0 - centroid.getZ(); Atom shiftVec = new AtomImpl(); shiftVec.setCoords(coords); return shiftVec; }
java
public static final Atom getCenterVector(Atom[] atomSet, Atom centroid){ double[] coords = new double[3]; coords[0] = 0 - centroid.getX(); coords[1] = 0 - centroid.getY(); coords[2] = 0 - centroid.getZ(); Atom shiftVec = new AtomImpl(); shiftVec.setCoords(coords); return shiftVec; }
[ "public", "static", "final", "Atom", "getCenterVector", "(", "Atom", "[", "]", "atomSet", ",", "Atom", "centroid", ")", "{", "double", "[", "]", "coords", "=", "new", "double", "[", "3", "]", ";", "coords", "[", "0", "]", "=", "0", "-", "centroid", ...
Returns the Vector that needs to be applied to shift a set of atoms to the Centroid, if the centroid is already known @param atomSet array of Atoms @return the vector needed to shift the set of atoms to its geometric center
[ "Returns", "the", "Vector", "that", "needs", "to", "be", "applied", "to", "shift", "a", "set", "of", "atoms", "to", "the", "Centroid", "if", "the", "centroid", "is", "already", "known" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L917-L928
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.createLibraryHandlingGroup
protected void createLibraryHandlingGroup(Composite parent) { fLibraryHandlingGroup= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); fLibraryHandlingGroup.setLayout(layout); fLibraryHandlingGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); createLabel(fLibraryHandlingGroup, FatJarPackagerMessages.FatJarPackageWizardPage_libraryHandlingGroupTitle, false); fExtractJarsRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fExtractJarsRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_extractJars_text); fExtractJarsRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fExtractJarsRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new ExtractLibraryHandler(); } }); fPackageJarsRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fPackageJarsRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_packageJars_text); fPackageJarsRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fPackageJarsRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new PackageLibraryHandler(); } }); fCopyJarFilesRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fCopyJarFilesRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_copyJarFiles_text); fCopyJarFilesRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fCopyJarFilesRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new CopyLibraryHandler(); } }); // set default for first selection (no previous widget settings to restore) setLibraryHandler(new ExtractLibraryHandler()); }
java
protected void createLibraryHandlingGroup(Composite parent) { fLibraryHandlingGroup= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); fLibraryHandlingGroup.setLayout(layout); fLibraryHandlingGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); createLabel(fLibraryHandlingGroup, FatJarPackagerMessages.FatJarPackageWizardPage_libraryHandlingGroupTitle, false); fExtractJarsRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fExtractJarsRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_extractJars_text); fExtractJarsRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fExtractJarsRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new ExtractLibraryHandler(); } }); fPackageJarsRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fPackageJarsRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_packageJars_text); fPackageJarsRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fPackageJarsRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new PackageLibraryHandler(); } }); fCopyJarFilesRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fCopyJarFilesRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_copyJarFiles_text); fCopyJarFilesRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fCopyJarFilesRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new CopyLibraryHandler(); } }); // set default for first selection (no previous widget settings to restore) setLibraryHandler(new ExtractLibraryHandler()); }
[ "protected", "void", "createLibraryHandlingGroup", "(", "Composite", "parent", ")", "{", "fLibraryHandlingGroup", "=", "new", "Composite", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "layout", "=", "new", "GridLayout", "(", ")", ";", "fLibr...
Create the export options specification widgets. @param parent org.eclipse.swt.widgets.Composite
[ "Create", "the", "export", "options", "specification", "widgets", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L330-L373
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.setFeatureStyle
public static boolean setFeatureStyle(PolygonOptions polygonOptions, GeoPackage geoPackage, FeatureRow featureRow, float density) { FeatureStyleExtension featureStyleExtension = new FeatureStyleExtension(geoPackage); return setFeatureStyle(polygonOptions, featureStyleExtension, featureRow, density); }
java
public static boolean setFeatureStyle(PolygonOptions polygonOptions, GeoPackage geoPackage, FeatureRow featureRow, float density) { FeatureStyleExtension featureStyleExtension = new FeatureStyleExtension(geoPackage); return setFeatureStyle(polygonOptions, featureStyleExtension, featureRow, density); }
[ "public", "static", "boolean", "setFeatureStyle", "(", "PolygonOptions", "polygonOptions", ",", "GeoPackage", "geoPackage", ",", "FeatureRow", "featureRow", ",", "float", "density", ")", "{", "FeatureStyleExtension", "featureStyleExtension", "=", "new", "FeatureStyleExten...
Set the feature row style into the polygon options @param polygonOptions polygon options @param geoPackage GeoPackage @param featureRow feature row @param density display density: {@link android.util.DisplayMetrics#density} @return true if style was set into the polygon options
[ "Set", "the", "feature", "row", "style", "into", "the", "polygon", "options" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L505-L510
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readResource
public CmsResource readResource(CmsRequestContext context, CmsUUID structureID, CmsResourceFilter filter) throws CmsException { CmsResource result = null; CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { result = readResource(dbc, structureID, filter); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_RESOURCE_FOR_ID_1, structureID), e); } finally { dbc.clear(); } return result; }
java
public CmsResource readResource(CmsRequestContext context, CmsUUID structureID, CmsResourceFilter filter) throws CmsException { CmsResource result = null; CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { result = readResource(dbc, structureID, filter); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_RESOURCE_FOR_ID_1, structureID), e); } finally { dbc.clear(); } return result; }
[ "public", "CmsResource", "readResource", "(", "CmsRequestContext", "context", ",", "CmsUUID", "structureID", ",", "CmsResourceFilter", "filter", ")", "throws", "CmsException", "{", "CmsResource", "result", "=", "null", ";", "CmsDbContext", "dbc", "=", "m_dbContextFact...
Reads a resource from the VFS, using the specified resource filter.<p> A resource may be of type <code>{@link CmsFile}</code> or <code>{@link CmsFolder}</code>. In case of a file, the resource will not contain the binary file content. Since reading the binary content is a cost-expensive database operation, it's recommended to work with resources if possible, and only read the file content when absolutely required. To "upgrade" a resource to a file, use <code>{@link CmsObject#readFile(CmsResource)}</code>.<p> The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code> will ignore the date release / date expired information of the resource.<p> @param context the current request context @param structureID the ID of the structure which will be used) @param filter the resource filter to use while reading @return the resource that was read @throws CmsException if the resource could not be read for any reason @see CmsObject#readResource(CmsUUID, CmsResourceFilter) @see CmsObject#readResource(CmsUUID) @see CmsObject#readFile(CmsResource)
[ "Reads", "a", "resource", "from", "the", "VFS", "using", "the", "specified", "resource", "filter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L5017-L5030
jMetal/jMetal
jmetal-exec/src/main/java/org/uma/jmetal/experiment/ZDTStudy2.java
ZDTStudy2.configureAlgorithmList
static List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> configureAlgorithmList( List<ExperimentProblem<DoubleSolution>> problemList) { List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> algorithms = new ArrayList<>(); for (int run = 0; run < INDEPENDENT_RUNS; run++) { for (int i = 0; i < problemList.size(); i++) { double mutationProbability = 1.0 / problemList.get(i).getProblem().getNumberOfVariables(); double mutationDistributionIndex = 20.0; Algorithm<List<DoubleSolution>> algorithm = new SMPSOBuilder( (DoubleProblem) problemList.get(i).getProblem(), new CrowdingDistanceArchive<DoubleSolution>(100)) .setMutation(new PolynomialMutation(mutationProbability, mutationDistributionIndex)) .setMaxIterations(250) .setSwarmSize(100) .setSolutionListEvaluator(new SequentialSolutionListEvaluator<DoubleSolution>()) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<DoubleSolution>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 20.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0), 100) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new MOEADBuilder(problemList.get(i).getProblem(), MOEADBuilder.Variant.MOEAD) .setCrossover(new DifferentialEvolutionCrossover(1.0, 0.5, "rand/1/bin")) .setMutation(new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0)) .setMaxEvaluations(25000) .setPopulationSize(100) .setResultPopulationSize(100) .setNeighborhoodSelectionProbability(0.9) .setMaximumNumberOfReplacedSolutions(2) .setNeighborSize(20) .setFunctionType(AbstractMOEAD.FunctionType.TCHE) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } } return algorithms; }
java
static List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> configureAlgorithmList( List<ExperimentProblem<DoubleSolution>> problemList) { List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> algorithms = new ArrayList<>(); for (int run = 0; run < INDEPENDENT_RUNS; run++) { for (int i = 0; i < problemList.size(); i++) { double mutationProbability = 1.0 / problemList.get(i).getProblem().getNumberOfVariables(); double mutationDistributionIndex = 20.0; Algorithm<List<DoubleSolution>> algorithm = new SMPSOBuilder( (DoubleProblem) problemList.get(i).getProblem(), new CrowdingDistanceArchive<DoubleSolution>(100)) .setMutation(new PolynomialMutation(mutationProbability, mutationDistributionIndex)) .setMaxIterations(250) .setSwarmSize(100) .setSolutionListEvaluator(new SequentialSolutionListEvaluator<DoubleSolution>()) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<DoubleSolution>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 20.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0), 100) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new MOEADBuilder(problemList.get(i).getProblem(), MOEADBuilder.Variant.MOEAD) .setCrossover(new DifferentialEvolutionCrossover(1.0, 0.5, "rand/1/bin")) .setMutation(new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0)) .setMaxEvaluations(25000) .setPopulationSize(100) .setResultPopulationSize(100) .setNeighborhoodSelectionProbability(0.9) .setMaximumNumberOfReplacedSolutions(2) .setNeighborSize(20) .setFunctionType(AbstractMOEAD.FunctionType.TCHE) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } } return algorithms; }
[ "static", "List", "<", "ExperimentAlgorithm", "<", "DoubleSolution", ",", "List", "<", "DoubleSolution", ">", ">", ">", "configureAlgorithmList", "(", "List", "<", "ExperimentProblem", "<", "DoubleSolution", ">", ">", "problemList", ")", "{", "List", "<", "Exper...
The algorithm list is composed of pairs {@link Algorithm} + {@link Problem} which form part of a {@link ExperimentAlgorithm}, which is a decorator for class {@link Algorithm}.
[ "The", "algorithm", "list", "is", "composed", "of", "pairs", "{" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-exec/src/main/java/org/uma/jmetal/experiment/ZDTStudy2.java#L106-L154
huahin/huahin-core
src/main/java/org/huahinframework/core/SimpleJobTool.java
SimpleJobTool.addBigJoinJob
private SimpleJob addBigJoinJob(SimpleJob job) throws IOException { Configuration conf = job.getConfiguration(); String[] labels = conf.getStrings(SimpleJob.LABELS); String separator = conf.get(SimpleJob.SEPARATOR); boolean regex = conf.getBoolean(SimpleJob.SEPARATOR_REGEX, false); boolean formatIgnored = conf.getBoolean(SimpleJob.FORMAT_IGNORED, false); SimpleJob joinJob = new SimpleJob(conf, jobName, true); setConfiguration(joinJob, labels, separator, formatIgnored, regex); int type = conf.getInt(SimpleJob.READER_TYPE, -1); Configuration joinConf = joinJob.getConfiguration(); joinConf.setInt(SimpleJob.READER_TYPE, type); joinConf.setStrings(SimpleJob.MASTER_LABELS, conf.getStrings(SimpleJob.MASTER_LABELS)); if (type == SimpleJob.SINGLE_COLUMN_JOIN_READER) { joinConf.set(SimpleJob.JOIN_MASTER_COLUMN, conf.get(SimpleJob.JOIN_MASTER_COLUMN)); joinConf.set(SimpleJob.JOIN_DATA_COLUMN, conf.get(SimpleJob.JOIN_DATA_COLUMN)); } else if (type == SimpleJob.SOME_COLUMN_JOIN_READER) { joinConf.setStrings(SimpleJob.JOIN_MASTER_COLUMN, conf.getStrings(SimpleJob.JOIN_MASTER_COLUMN)); joinConf.setStrings(SimpleJob.JOIN_DATA_COLUMN, conf.getStrings(SimpleJob.JOIN_DATA_COLUMN)); } joinConf.set(SimpleJob.MASTER_PATH, conf.get(SimpleJob.MASTER_PATH)); joinConf.set(SimpleJob.MASTER_SEPARATOR, conf.get(SimpleJob.MASTER_SEPARATOR)); joinJob.setMapOutputKeyClass(Key.class); joinJob.setMapOutputValueClass(Value.class); joinJob.setPartitionerClass(SimplePartitioner.class); joinJob.setGroupingComparatorClass(SimpleGroupingComparator.class); joinJob.setSortComparatorClass(SimpleSortComparator.class); joinJob.setSummarizer(JoinSummarizer.class); if (!job.isMapper() && !job.isReducer()) { joinConf.setBoolean(SimpleJob.ONLY_JOIN, true); joinJob.setOutputKeyClass(Value.class); joinJob.setOutputValueClass(NullWritable.class); } else { joinJob.setOutputKeyClass(Key.class); joinJob.setOutputValueClass(Value.class); } return joinJob; }
java
private SimpleJob addBigJoinJob(SimpleJob job) throws IOException { Configuration conf = job.getConfiguration(); String[] labels = conf.getStrings(SimpleJob.LABELS); String separator = conf.get(SimpleJob.SEPARATOR); boolean regex = conf.getBoolean(SimpleJob.SEPARATOR_REGEX, false); boolean formatIgnored = conf.getBoolean(SimpleJob.FORMAT_IGNORED, false); SimpleJob joinJob = new SimpleJob(conf, jobName, true); setConfiguration(joinJob, labels, separator, formatIgnored, regex); int type = conf.getInt(SimpleJob.READER_TYPE, -1); Configuration joinConf = joinJob.getConfiguration(); joinConf.setInt(SimpleJob.READER_TYPE, type); joinConf.setStrings(SimpleJob.MASTER_LABELS, conf.getStrings(SimpleJob.MASTER_LABELS)); if (type == SimpleJob.SINGLE_COLUMN_JOIN_READER) { joinConf.set(SimpleJob.JOIN_MASTER_COLUMN, conf.get(SimpleJob.JOIN_MASTER_COLUMN)); joinConf.set(SimpleJob.JOIN_DATA_COLUMN, conf.get(SimpleJob.JOIN_DATA_COLUMN)); } else if (type == SimpleJob.SOME_COLUMN_JOIN_READER) { joinConf.setStrings(SimpleJob.JOIN_MASTER_COLUMN, conf.getStrings(SimpleJob.JOIN_MASTER_COLUMN)); joinConf.setStrings(SimpleJob.JOIN_DATA_COLUMN, conf.getStrings(SimpleJob.JOIN_DATA_COLUMN)); } joinConf.set(SimpleJob.MASTER_PATH, conf.get(SimpleJob.MASTER_PATH)); joinConf.set(SimpleJob.MASTER_SEPARATOR, conf.get(SimpleJob.MASTER_SEPARATOR)); joinJob.setMapOutputKeyClass(Key.class); joinJob.setMapOutputValueClass(Value.class); joinJob.setPartitionerClass(SimplePartitioner.class); joinJob.setGroupingComparatorClass(SimpleGroupingComparator.class); joinJob.setSortComparatorClass(SimpleSortComparator.class); joinJob.setSummarizer(JoinSummarizer.class); if (!job.isMapper() && !job.isReducer()) { joinConf.setBoolean(SimpleJob.ONLY_JOIN, true); joinJob.setOutputKeyClass(Value.class); joinJob.setOutputValueClass(NullWritable.class); } else { joinJob.setOutputKeyClass(Key.class); joinJob.setOutputValueClass(Value.class); } return joinJob; }
[ "private", "SimpleJob", "addBigJoinJob", "(", "SimpleJob", "job", ")", "throws", "IOException", "{", "Configuration", "conf", "=", "job", ".", "getConfiguration", "(", ")", ";", "String", "[", "]", "labels", "=", "conf", ".", "getStrings", "(", "SimpleJob", ...
create big join SimpleJob @param job job that big join is set. @return big join {@link SimpleJob} @throws IOException
[ "create", "big", "join", "SimpleJob" ]
train
https://github.com/huahin/huahin-core/blob/a87921b5a12be92a822f753c075ab2431036e6f5/src/main/java/org/huahinframework/core/SimpleJobTool.java#L407-L451
looly/hutool
hutool-log/src/main/java/cn/hutool/log/dialect/log4j2/Log4j2Log.java
Log4j2Log.logIfEnabled
private boolean logIfEnabled(String fqcn, Level level, Throwable t, String msgTemplate, Object... arguments) { if(this.logger instanceof AbstractLogger){ ((AbstractLogger)this.logger).logIfEnabled(fqcn, level, null, StrUtil.format(msgTemplate, arguments), t); return true; }else{ return false; } }
java
private boolean logIfEnabled(String fqcn, Level level, Throwable t, String msgTemplate, Object... arguments) { if(this.logger instanceof AbstractLogger){ ((AbstractLogger)this.logger).logIfEnabled(fqcn, level, null, StrUtil.format(msgTemplate, arguments), t); return true; }else{ return false; } }
[ "private", "boolean", "logIfEnabled", "(", "String", "fqcn", ",", "Level", "level", ",", "Throwable", "t", ",", "String", "msgTemplate", ",", "Object", "...", "arguments", ")", "{", "if", "(", "this", ".", "logger", "instanceof", "AbstractLogger", ")", "{", ...
打印日志<br> 此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题 @param fqcn 完全限定类名(Fully Qualified Class Name),用于纠正定位错误行号 @param level 日志级别,使用org.apache.logging.log4j.Level中的常量 @param t 异常 @param msgTemplate 消息模板 @param arguments 参数 @return 是否支持 LocationAwareLogger对象,如果不支持需要日志方法调用被包装类的相应方法
[ "打印日志<br", ">", "此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/log4j2/Log4j2Log.java#L192-L199
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java
CompositeInputFormat.compose
public static String compose(Class<? extends InputFormat> inf, String path) { return compose(inf.getName().intern(), path, new StringBuffer()).toString(); }
java
public static String compose(Class<? extends InputFormat> inf, String path) { return compose(inf.getName().intern(), path, new StringBuffer()).toString(); }
[ "public", "static", "String", "compose", "(", "Class", "<", "?", "extends", "InputFormat", ">", "inf", ",", "String", "path", ")", "{", "return", "compose", "(", "inf", ".", "getName", "(", ")", ".", "intern", "(", ")", ",", "path", ",", "new", "Stri...
Convenience method for constructing composite formats. Given InputFormat class (inf), path (p) return: {@code tbl(<inf>, <p>) }
[ "Convenience", "method", "for", "constructing", "composite", "formats", ".", "Given", "InputFormat", "class", "(", "inf", ")", "path", "(", "p", ")", "return", ":", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java#L138-L140
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/RingBuffer.java
RingBuffer.createMultiProducer
public static <E> RingBuffer<E> createMultiProducer(EventFactory<E> factory, int bufferSize) { return createMultiProducer(factory, bufferSize, new BlockingWaitStrategy()); }
java
public static <E> RingBuffer<E> createMultiProducer(EventFactory<E> factory, int bufferSize) { return createMultiProducer(factory, bufferSize, new BlockingWaitStrategy()); }
[ "public", "static", "<", "E", ">", "RingBuffer", "<", "E", ">", "createMultiProducer", "(", "EventFactory", "<", "E", ">", "factory", ",", "int", "bufferSize", ")", "{", "return", "createMultiProducer", "(", "factory", ",", "bufferSize", ",", "new", "Blockin...
Create a new multiple producer RingBuffer using the default wait strategy {@link BlockingWaitStrategy}. @param <E> Class of the event stored in the ring buffer. @param factory used to create the events within the ring buffer. @param bufferSize number of elements to create within the ring buffer. @return a constructed ring buffer. @throws IllegalArgumentException if <code>bufferSize</code> is less than 1 or not a power of 2 @see MultiProducerSequencer
[ "Create", "a", "new", "multiple", "producer", "RingBuffer", "using", "the", "default", "wait", "strategy", "{", "@link", "BlockingWaitStrategy", "}", "." ]
train
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/RingBuffer.java#L153-L156
citrusframework/citrus
modules/citrus-cucumber/src/main/java/com/consol/citrus/cucumber/message/MessageCreators.java
MessageCreators.addType
public void addType(String type) { try { messageCreators.add(Class.forName(type).newInstance()); } catch (ClassNotFoundException | IllegalAccessException e) { throw new CitrusRuntimeException("Unable to access message creator type: " + type, e); } catch (InstantiationException e) { throw new CitrusRuntimeException("Unable to create message creator instance of type: " + type, e); } }
java
public void addType(String type) { try { messageCreators.add(Class.forName(type).newInstance()); } catch (ClassNotFoundException | IllegalAccessException e) { throw new CitrusRuntimeException("Unable to access message creator type: " + type, e); } catch (InstantiationException e) { throw new CitrusRuntimeException("Unable to create message creator instance of type: " + type, e); } }
[ "public", "void", "addType", "(", "String", "type", ")", "{", "try", "{", "messageCreators", ".", "add", "(", "Class", ".", "forName", "(", "type", ")", ".", "newInstance", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "|", "IllegalAcc...
Adds new message creator POJO instance from type. @param type
[ "Adds", "new", "message", "creator", "POJO", "instance", "from", "type", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-cucumber/src/main/java/com/consol/citrus/cucumber/message/MessageCreators.java#L76-L84
apereo/cas
core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/WebApplicationServiceFactory.java
WebApplicationServiceFactory.newWebApplicationService
protected static AbstractWebApplicationService newWebApplicationService(final HttpServletRequest request, final String serviceToUse) { val artifactId = request != null ? request.getParameter(CasProtocolConstants.PARAMETER_TICKET) : null; val id = cleanupUrl(serviceToUse); val newService = new SimpleWebApplicationServiceImpl(id, serviceToUse, artifactId); determineWebApplicationFormat(request, newService); val source = getSourceParameter(request, CasProtocolConstants.PARAMETER_TARGET_SERVICE, CasProtocolConstants.PARAMETER_SERVICE); newService.setSource(source); return newService; }
java
protected static AbstractWebApplicationService newWebApplicationService(final HttpServletRequest request, final String serviceToUse) { val artifactId = request != null ? request.getParameter(CasProtocolConstants.PARAMETER_TICKET) : null; val id = cleanupUrl(serviceToUse); val newService = new SimpleWebApplicationServiceImpl(id, serviceToUse, artifactId); determineWebApplicationFormat(request, newService); val source = getSourceParameter(request, CasProtocolConstants.PARAMETER_TARGET_SERVICE, CasProtocolConstants.PARAMETER_SERVICE); newService.setSource(source); return newService; }
[ "protected", "static", "AbstractWebApplicationService", "newWebApplicationService", "(", "final", "HttpServletRequest", "request", ",", "final", "String", "serviceToUse", ")", "{", "val", "artifactId", "=", "request", "!=", "null", "?", "request", ".", "getParameter", ...
Build new web application service simple web application service. @param request the request @param serviceToUse the service to use @return the simple web application service
[ "Build", "new", "web", "application", "service", "simple", "web", "application", "service", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/WebApplicationServiceFactory.java#L51-L60
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java
LatLongUtils.zoomForBounds
public static byte zoomForBounds(Dimension dimension, BoundingBox boundingBox, int tileSize) { long mapSize = MercatorProjection.getMapSize((byte) 0, tileSize); double pixelXMax = MercatorProjection.longitudeToPixelX(boundingBox.maxLongitude, mapSize); double pixelXMin = MercatorProjection.longitudeToPixelX(boundingBox.minLongitude, mapSize); double zoomX = -Math.log(Math.abs(pixelXMax - pixelXMin) / dimension.width) / Math.log(2); double pixelYMax = MercatorProjection.latitudeToPixelY(boundingBox.maxLatitude, mapSize); double pixelYMin = MercatorProjection.latitudeToPixelY(boundingBox.minLatitude, mapSize); double zoomY = -Math.log(Math.abs(pixelYMax - pixelYMin) / dimension.height) / Math.log(2); double zoom = Math.floor(Math.min(zoomX, zoomY)); if (zoom < 0) { return 0; } if (zoom > Byte.MAX_VALUE) { return Byte.MAX_VALUE; } return (byte) zoom; }
java
public static byte zoomForBounds(Dimension dimension, BoundingBox boundingBox, int tileSize) { long mapSize = MercatorProjection.getMapSize((byte) 0, tileSize); double pixelXMax = MercatorProjection.longitudeToPixelX(boundingBox.maxLongitude, mapSize); double pixelXMin = MercatorProjection.longitudeToPixelX(boundingBox.minLongitude, mapSize); double zoomX = -Math.log(Math.abs(pixelXMax - pixelXMin) / dimension.width) / Math.log(2); double pixelYMax = MercatorProjection.latitudeToPixelY(boundingBox.maxLatitude, mapSize); double pixelYMin = MercatorProjection.latitudeToPixelY(boundingBox.minLatitude, mapSize); double zoomY = -Math.log(Math.abs(pixelYMax - pixelYMin) / dimension.height) / Math.log(2); double zoom = Math.floor(Math.min(zoomX, zoomY)); if (zoom < 0) { return 0; } if (zoom > Byte.MAX_VALUE) { return Byte.MAX_VALUE; } return (byte) zoom; }
[ "public", "static", "byte", "zoomForBounds", "(", "Dimension", "dimension", ",", "BoundingBox", "boundingBox", ",", "int", "tileSize", ")", "{", "long", "mapSize", "=", "MercatorProjection", ".", "getMapSize", "(", "(", "byte", ")", "0", ",", "tileSize", ")", ...
Calculates the zoom level that allows to display the {@link BoundingBox} on a view with the {@link Dimension} and tile size. @param dimension the {@link Dimension} of the view. @param boundingBox the {@link BoundingBox} to display. @param tileSize the size of the tiles. @return the zoom level that allows to display the {@link BoundingBox} on a view with the {@link Dimension} and tile size.
[ "Calculates", "the", "zoom", "level", "that", "allows", "to", "display", "the", "{", "@link", "BoundingBox", "}", "on", "a", "view", "with", "the", "{", "@link", "Dimension", "}", "and", "tile", "size", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java#L406-L422
oasp/oasp4j
modules/basic/src/main/java/io/oasp/module/basic/common/api/config/SimpleConfigProperties.java
SimpleConfigProperties.ofFlatMap
public static ConfigProperties ofFlatMap(String key, Map<String, String> map) { SimpleConfigProperties root = new SimpleConfigProperties(key); root.fromFlatMap(map); return root; }
java
public static ConfigProperties ofFlatMap(String key, Map<String, String> map) { SimpleConfigProperties root = new SimpleConfigProperties(key); root.fromFlatMap(map); return root; }
[ "public", "static", "ConfigProperties", "ofFlatMap", "(", "String", "key", ",", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "SimpleConfigProperties", "root", "=", "new", "SimpleConfigProperties", "(", "key", ")", ";", "root", ".", "fromFlatMap",...
Converts a flat {@link Map} of configuration values to hierarchical {@link ConfigProperties}. E.g. the flat map <code>{"foo.bar.some"="some-value", "foo.bar.other"="other-value"}</code> would result in {@link ConfigProperties} {@code myRoot} such that <code>myRoot.{@link #getChild(String...) getChild}("foo", "bar").{@link #getChildKeys()}</code> returns the {@link Collection} {"some", "other"} and <code>myRoot.{@link #getChildValue(String) getValue}("foo.bar.some")</code> returns "my-value". @param key the top-level key of the returned root {@link ConfigProperties}-node. Typically the empty string ("") for root. @param map the flat {@link Map} of the configuration values. @return the root {@link ConfigProperties}-node of the given flat {@link Map} converted to hierarchical {@link ConfigProperties}.
[ "Converts", "a", "flat", "{", "@link", "Map", "}", "of", "configuration", "values", "to", "hierarchical", "{", "@link", "ConfigProperties", "}", ".", "E", ".", "g", ".", "the", "flat", "map", "<code", ">", "{", "foo", ".", "bar", ".", "some", "=", "s...
train
https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/basic/src/main/java/io/oasp/module/basic/common/api/config/SimpleConfigProperties.java#L329-L334
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java
XcodeProjectWriter.createPBXReferenceProxy
private static PBXObjectRef createPBXReferenceProxy(final PBXObjectRef remoteRef, final DependencyDef dependency) { final Map map = new HashMap(); map.put("isa", "PBXReferenceProxy"); final String fileType = "compiled.mach-o.dylib"; map.put("fileType", fileType); map.put("remoteRef", remoteRef); map.put("path", dependency.getFile().getName() + ".dylib"); map.put("sourceTree", "BUILT_PRODUCTS_DIR"); return new PBXObjectRef(map); }
java
private static PBXObjectRef createPBXReferenceProxy(final PBXObjectRef remoteRef, final DependencyDef dependency) { final Map map = new HashMap(); map.put("isa", "PBXReferenceProxy"); final String fileType = "compiled.mach-o.dylib"; map.put("fileType", fileType); map.put("remoteRef", remoteRef); map.put("path", dependency.getFile().getName() + ".dylib"); map.put("sourceTree", "BUILT_PRODUCTS_DIR"); return new PBXObjectRef(map); }
[ "private", "static", "PBXObjectRef", "createPBXReferenceProxy", "(", "final", "PBXObjectRef", "remoteRef", ",", "final", "DependencyDef", "dependency", ")", "{", "final", "Map", "map", "=", "new", "HashMap", "(", ")", ";", "map", ".", "put", "(", "\"isa\"", ",...
Create a proxy for a file in a different project. @param remoteRef PBXContainerItemProxy for reference. @param dependency dependency. @return PBXContainerItemProxy.
[ "Create", "a", "proxy", "for", "a", "file", "in", "a", "different", "project", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java#L331-L340
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.longFunction
public static <R> LongFunction<R> longFunction(CheckedLongFunction<R> function) { return longFunction(function, THROWABLE_TO_RUNTIME_EXCEPTION); }
java
public static <R> LongFunction<R> longFunction(CheckedLongFunction<R> function) { return longFunction(function, THROWABLE_TO_RUNTIME_EXCEPTION); }
[ "public", "static", "<", "R", ">", "LongFunction", "<", "R", ">", "longFunction", "(", "CheckedLongFunction", "<", "R", ">", "function", ")", "{", "return", "longFunction", "(", "function", ",", "THROWABLE_TO_RUNTIME_EXCEPTION", ")", ";", "}" ]
Wrap a {@link CheckedLongFunction} in a {@link LongFunction}. <p> Example: <code><pre> LongStream.of(1L, 2L, 3L).mapToObj(Unchecked.longFunction(l -> { if (l &lt; 0L) throw new Exception("Only positive numbers allowed"); return "" + l; }); </pre></code>
[ "Wrap", "a", "{", "@link", "CheckedLongFunction", "}", "in", "a", "{", "@link", "LongFunction", "}", ".", "<p", ">", "Example", ":", "<code", ">", "<pre", ">", "LongStream", ".", "of", "(", "1L", "2L", "3L", ")", ".", "mapToObj", "(", "Unchecked", "....
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1189-L1191
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java
WorkflowClient.getWorkflowsByTimePeriod
public List<String> getWorkflowsByTimePeriod(String workflowName, int version, Long startTime, Long endTime) { Preconditions.checkArgument(StringUtils.isNotBlank(workflowName), "Workflow name cannot be blank"); Preconditions.checkNotNull(startTime, "Start time cannot be null"); Preconditions.checkNotNull(endTime, "End time cannot be null"); Object[] params = new Object[]{"version", version, "startTime", startTime, "endTime", endTime}; return getForEntity("workflow/running/{name}", params, new GenericType<List<String>>() { }, workflowName); }
java
public List<String> getWorkflowsByTimePeriod(String workflowName, int version, Long startTime, Long endTime) { Preconditions.checkArgument(StringUtils.isNotBlank(workflowName), "Workflow name cannot be blank"); Preconditions.checkNotNull(startTime, "Start time cannot be null"); Preconditions.checkNotNull(endTime, "End time cannot be null"); Object[] params = new Object[]{"version", version, "startTime", startTime, "endTime", endTime}; return getForEntity("workflow/running/{name}", params, new GenericType<List<String>>() { }, workflowName); }
[ "public", "List", "<", "String", ">", "getWorkflowsByTimePeriod", "(", "String", "workflowName", ",", "int", "version", ",", "Long", "startTime", ",", "Long", "endTime", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(",...
Retrieve all workflow instances for a given workflow name between a specific time period @param workflowName the name of the workflow @param version the version of the workflow definition. Defaults to 1. @param startTime the start time of the period @param endTime the end time of the period @return returns a list of workflows created during the specified during the time period
[ "Retrieve", "all", "workflow", "instances", "for", "a", "given", "workflow", "name", "between", "a", "specific", "time", "period" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java#L218-L226
leadware/jpersistence-tools
jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java
RestrictionsContainer.addGe
public <Y extends Comparable<? super Y>> RestrictionsContainer addGe(String property, Y value) { // Ajout de la restriction restrictions.add(new Ge<Y>(property, value)); // On retourne le conteneur return this; }
java
public <Y extends Comparable<? super Y>> RestrictionsContainer addGe(String property, Y value) { // Ajout de la restriction restrictions.add(new Ge<Y>(property, value)); // On retourne le conteneur return this; }
[ "public", "<", "Y", "extends", "Comparable", "<", "?", "super", "Y", ">", ">", "RestrictionsContainer", "addGe", "(", "String", "property", ",", "Y", "value", ")", "{", "// Ajout de la restriction\r", "restrictions", ".", "add", "(", "new", "Ge", "<", "Y", ...
Methode d'ajout de la restriction GE @param property Nom de la Propriete @param value Valeur de la propriete @param <Y> Type de valeur @return Conteneur
[ "Methode", "d", "ajout", "de", "la", "restriction", "GE" ]
train
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java#L121-L128
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.appendRegion
protected IStyleAppendable appendRegion(IStyleAppendable it, String name, String start, String end, String... contains) { return appendRegion(it, true, name, start, end, contains); }
java
protected IStyleAppendable appendRegion(IStyleAppendable it, String name, String start, String end, String... contains) { return appendRegion(it, true, name, start, end, contains); }
[ "protected", "IStyleAppendable", "appendRegion", "(", "IStyleAppendable", "it", ",", "String", "name", ",", "String", "start", ",", "String", "end", ",", "String", "...", "contains", ")", "{", "return", "appendRegion", "(", "it", ",", "true", ",", "name", ",...
Append a Vim region. @param it the receiver of the generated elements. @param name the name of the pattern. @param start the start pattern. @param end the end pattern. @param contains the contained elements. @return {@code it}.
[ "Append", "a", "Vim", "region", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L386-L388
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesInner.java
RecoverableDatabasesInner.listByServerAsync
public Observable<List<RecoverableDatabaseInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<RecoverableDatabaseInner>>, List<RecoverableDatabaseInner>>() { @Override public List<RecoverableDatabaseInner> call(ServiceResponse<List<RecoverableDatabaseInner>> response) { return response.body(); } }); }
java
public Observable<List<RecoverableDatabaseInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<RecoverableDatabaseInner>>, List<RecoverableDatabaseInner>>() { @Override public List<RecoverableDatabaseInner> call(ServiceResponse<List<RecoverableDatabaseInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "RecoverableDatabaseInner", ">", ">", "listByServerAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ...
Gets a list of recoverable databases. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;RecoverableDatabaseInner&gt; object
[ "Gets", "a", "list", "of", "recoverable", "databases", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesInner.java#L193-L200
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/io/TileProperties.java
TileProperties.getIntegerProperty
public Integer getIntegerProperty(String property, boolean required) { Integer integerValue = null; String value = getProperty(property, required); if (value != null) { try { integerValue = Integer.valueOf(value); } catch (NumberFormatException e) { throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE + " property file property '" + property + "' must be an integer"); } } return integerValue; }
java
public Integer getIntegerProperty(String property, boolean required) { Integer integerValue = null; String value = getProperty(property, required); if (value != null) { try { integerValue = Integer.valueOf(value); } catch (NumberFormatException e) { throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE + " property file property '" + property + "' must be an integer"); } } return integerValue; }
[ "public", "Integer", "getIntegerProperty", "(", "String", "property", ",", "boolean", "required", ")", "{", "Integer", "integerValue", "=", "null", ";", "String", "value", "=", "getProperty", "(", "property", ",", "required", ")", ";", "if", "(", "value", "!...
Get the Integer property @param property property @param required required flag @return integer property
[ "Get", "the", "Integer", "property" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/io/TileProperties.java#L136-L149
JodaOrg/joda-time
src/main/java/org/joda/time/format/PeriodFormatterBuilder.java
PeriodFormatterBuilder.appendSuffix
public PeriodFormatterBuilder appendSuffix(String singularText, String pluralText) { if (singularText == null || pluralText == null) { throw new IllegalArgumentException(); } return appendSuffix(new PluralAffix(singularText, pluralText)); }
java
public PeriodFormatterBuilder appendSuffix(String singularText, String pluralText) { if (singularText == null || pluralText == null) { throw new IllegalArgumentException(); } return appendSuffix(new PluralAffix(singularText, pluralText)); }
[ "public", "PeriodFormatterBuilder", "appendSuffix", "(", "String", "singularText", ",", "String", "pluralText", ")", "{", "if", "(", "singularText", "==", "null", "||", "pluralText", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", "...
Append a field suffix which applies only to the last appended field. If the field is not printed, neither is the suffix. <p> During parsing, the singular and plural versions are accepted whether or not the actual value matches plurality. @param singularText text to print if field value is one @param pluralText text to print if field value is not one @return this PeriodFormatterBuilder @throws IllegalStateException if no field exists to append to @see #appendPrefix
[ "Append", "a", "field", "suffix", "which", "applies", "only", "to", "the", "last", "appended", "field", ".", "If", "the", "field", "is", "not", "printed", "neither", "is", "the", "suffix", ".", "<p", ">", "During", "parsing", "the", "singular", "and", "p...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L626-L632
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java
RelatedTablesCoreExtension.addTilesRelationship
public ExtendedRelation addTilesRelationship(String baseTableName, TileTable tileTable, UserMappingTable userMappingTable) { return addRelationship(baseTableName, tileTable, userMappingTable); }
java
public ExtendedRelation addTilesRelationship(String baseTableName, TileTable tileTable, UserMappingTable userMappingTable) { return addRelationship(baseTableName, tileTable, userMappingTable); }
[ "public", "ExtendedRelation", "addTilesRelationship", "(", "String", "baseTableName", ",", "TileTable", "tileTable", ",", "UserMappingTable", "userMappingTable", ")", "{", "return", "addRelationship", "(", "baseTableName", ",", "tileTable", ",", "userMappingTable", ")", ...
Adds a tiles relationship between the base table and user tiles related table. Creates the user mapping table and a tile table if needed. @param baseTableName base table name @param tileTable user tile table @param userMappingTable user mapping table @return The relationship that was added @since 3.2.0
[ "Adds", "a", "tiles", "relationship", "between", "the", "base", "table", "and", "user", "tiles", "related", "table", ".", "Creates", "the", "user", "mapping", "table", "and", "a", "tile", "table", "if", "needed", "." ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java#L734-L737
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/aws/EIPManager.java
EIPManager.getEC2Service
private AmazonEC2 getEC2Service() { String aWSAccessId = serverConfig.getAWSAccessId(); String aWSSecretKey = serverConfig.getAWSSecretKey(); AmazonEC2 ec2Service; if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) { ec2Service = new AmazonEC2Client(new BasicAWSCredentials(aWSAccessId, aWSSecretKey)); } else { ec2Service = new AmazonEC2Client(new InstanceProfileCredentialsProvider()); } String region = clientConfig.getRegion(); region = region.trim().toLowerCase(); ec2Service.setEndpoint("ec2." + region + ".amazonaws.com"); return ec2Service; }
java
private AmazonEC2 getEC2Service() { String aWSAccessId = serverConfig.getAWSAccessId(); String aWSSecretKey = serverConfig.getAWSSecretKey(); AmazonEC2 ec2Service; if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) { ec2Service = new AmazonEC2Client(new BasicAWSCredentials(aWSAccessId, aWSSecretKey)); } else { ec2Service = new AmazonEC2Client(new InstanceProfileCredentialsProvider()); } String region = clientConfig.getRegion(); region = region.trim().toLowerCase(); ec2Service.setEndpoint("ec2." + region + ".amazonaws.com"); return ec2Service; }
[ "private", "AmazonEC2", "getEC2Service", "(", ")", "{", "String", "aWSAccessId", "=", "serverConfig", ".", "getAWSAccessId", "(", ")", ";", "String", "aWSSecretKey", "=", "serverConfig", ".", "getAWSSecretKey", "(", ")", ";", "AmazonEC2", "ec2Service", ";", "if"...
Gets the EC2 service object to call AWS APIs. @return the EC2 service object to call AWS APIs.
[ "Gets", "the", "EC2", "service", "object", "to", "call", "AWS", "APIs", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/aws/EIPManager.java#L405-L421
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java
CollationBuilder.findOrInsertNodeForCEs
private int findOrInsertNodeForCEs(int strength) { assert(Collator.PRIMARY <= strength && strength <= Collator.QUATERNARY); // Find the last CE that is at least as "strong" as the requested difference. // Note: Stronger is smaller (Collator.PRIMARY=0). long ce; for(;; --cesLength) { if(cesLength == 0) { ce = ces[0] = 0; cesLength = 1; break; } else { ce = ces[cesLength - 1]; } if(ceStrength(ce) <= strength) { break; } } if(isTempCE(ce)) { // No need to findCommonNode() here for lower levels // because insertTailoredNodeAfter() will do that anyway. return indexFromTempCE(ce); } // root CE if((int)(ce >>> 56) == Collation.UNASSIGNED_IMPLICIT_BYTE) { throw new UnsupportedOperationException( "tailoring relative to an unassigned code point not supported"); } return findOrInsertNodeForRootCE(ce, strength); }
java
private int findOrInsertNodeForCEs(int strength) { assert(Collator.PRIMARY <= strength && strength <= Collator.QUATERNARY); // Find the last CE that is at least as "strong" as the requested difference. // Note: Stronger is smaller (Collator.PRIMARY=0). long ce; for(;; --cesLength) { if(cesLength == 0) { ce = ces[0] = 0; cesLength = 1; break; } else { ce = ces[cesLength - 1]; } if(ceStrength(ce) <= strength) { break; } } if(isTempCE(ce)) { // No need to findCommonNode() here for lower levels // because insertTailoredNodeAfter() will do that anyway. return indexFromTempCE(ce); } // root CE if((int)(ce >>> 56) == Collation.UNASSIGNED_IMPLICIT_BYTE) { throw new UnsupportedOperationException( "tailoring relative to an unassigned code point not supported"); } return findOrInsertNodeForRootCE(ce, strength); }
[ "private", "int", "findOrInsertNodeForCEs", "(", "int", "strength", ")", "{", "assert", "(", "Collator", ".", "PRIMARY", "<=", "strength", "&&", "strength", "<=", "Collator", ".", "QUATERNARY", ")", ";", "// Find the last CE that is at least as \"strong\" as the request...
Picks one of the current CEs and finds or inserts a node in the graph for the CE + strength.
[ "Picks", "one", "of", "the", "current", "CEs", "and", "finds", "or", "inserts", "a", "node", "in", "the", "graph", "for", "the", "CE", "+", "strength", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L532-L561
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
DirectoryHelper.uncompressEveryFileFromDirectory
public static void uncompressEveryFileFromDirectory(File srcPath, File dstPath) throws IOException { if (srcPath.isDirectory()) { if (!dstPath.exists()) { dstPath.mkdirs(); } String files[] = srcPath.list(); for (int i = 0; i < files.length; i++) { uncompressEveryFileFromDirectory(new File(srcPath, files[i]), new File(dstPath, files[i])); } } else { ZipInputStream in = null; OutputStream out = null; try { in = new ZipInputStream(new FileInputStream(srcPath)); in.getNextEntry(); out = new FileOutputStream(dstPath); transfer(in, out); } finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } } }
java
public static void uncompressEveryFileFromDirectory(File srcPath, File dstPath) throws IOException { if (srcPath.isDirectory()) { if (!dstPath.exists()) { dstPath.mkdirs(); } String files[] = srcPath.list(); for (int i = 0; i < files.length; i++) { uncompressEveryFileFromDirectory(new File(srcPath, files[i]), new File(dstPath, files[i])); } } else { ZipInputStream in = null; OutputStream out = null; try { in = new ZipInputStream(new FileInputStream(srcPath)); in.getNextEntry(); out = new FileOutputStream(dstPath); transfer(in, out); } finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } } }
[ "public", "static", "void", "uncompressEveryFileFromDirectory", "(", "File", "srcPath", ",", "File", "dstPath", ")", "throws", "IOException", "{", "if", "(", "srcPath", ".", "isDirectory", "(", ")", ")", "{", "if", "(", "!", "dstPath", ".", "exists", "(", ...
Uncompress data to the destination directory. @param srcPath path to the compressed file, could be the file or the directory @param dstPath destination path @throws IOException if any exception occurred
[ "Uncompress", "data", "to", "the", "destination", "directory", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java#L313-L355
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
StylesheetHandler.getNamespaceForPrefix
public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context) { // Don't need to support this here. Return the current URI for the prefix, // ignoring the context. assertion(true, "can't process a context node in StylesheetHandler!"); return null; }
java
public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context) { // Don't need to support this here. Return the current URI for the prefix, // ignoring the context. assertion(true, "can't process a context node in StylesheetHandler!"); return null; }
[ "public", "String", "getNamespaceForPrefix", "(", "String", "prefix", ",", "org", ".", "w3c", ".", "dom", ".", "Node", "context", ")", "{", "// Don't need to support this here. Return the current URI for the prefix,", "// ignoring the context.", "assertion", "(", "true", ...
Given a namespace, get the corrisponding prefix. This is here only to support the {@link org.apache.xml.utils.PrefixResolver} interface, and will throw an error if invoked on this object. @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace. @param context The node context from which to look up the URI. @return The associated Namespace URI, or null if the prefix is undeclared in this context.
[ "Given", "a", "namespace", "get", "the", "corrisponding", "prefix", ".", "This", "is", "here", "only", "to", "support", "the", "{", "@link", "org", ".", "apache", ".", "xml", ".", "utils", ".", "PrefixResolver", "}", "interface", "and", "will", "throw", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L208-L216
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java
CapabilitiesInner.listByLocation
public LocationCapabilitiesInner listByLocation(String locationName, CapabilityGroup include) { return listByLocationWithServiceResponseAsync(locationName, include).toBlocking().single().body(); }
java
public LocationCapabilitiesInner listByLocation(String locationName, CapabilityGroup include) { return listByLocationWithServiceResponseAsync(locationName, include).toBlocking().single().body(); }
[ "public", "LocationCapabilitiesInner", "listByLocation", "(", "String", "locationName", ",", "CapabilityGroup", "include", ")", "{", "return", "listByLocationWithServiceResponseAsync", "(", "locationName", ",", "include", ")", ".", "toBlocking", "(", ")", ".", "single",...
Gets the subscription capabilities available for the specified location. @param locationName The location name whose capabilities are retrieved. @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' @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 LocationCapabilitiesInner object if successful.
[ "Gets", "the", "subscription", "capabilities", "available", "for", "the", "specified", "location", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java#L144-L146
remkop/picocli
src/main/java/picocli/CommandLine.java
CommandLine.populateSpec
public static <T> T populateSpec(Class<T> spec, String... args) { CommandLine cli = toCommandLine(spec, new DefaultFactory()); cli.parse(args); return cli.getCommand(); }
java
public static <T> T populateSpec(Class<T> spec, String... args) { CommandLine cli = toCommandLine(spec, new DefaultFactory()); cli.parse(args); return cli.getCommand(); }
[ "public", "static", "<", "T", ">", "T", "populateSpec", "(", "Class", "<", "T", ">", "spec", ",", "String", "...", "args", ")", "{", "CommandLine", "cli", "=", "toCommandLine", "(", "spec", ",", "new", "DefaultFactory", "(", ")", ")", ";", "cli", "."...
<p> Convenience method that derives the command specification from the specified interface class, and returns an instance of the specified interface. The interface is expected to have annotated getter methods. Picocli will instantiate the interface and the getter methods will return the option and positional parameter values matched on the command line. </p><p> This is equivalent to </p><pre> CommandLine cli = new CommandLine(spec); cli.parse(args); return cli.getCommand(); </pre> @param spec the interface that defines the command specification. This object contains getter methods annotated with {@code @Option} or {@code @Parameters}. @param args the command line arguments to parse @param <T> the type of the annotated object @return an instance of the specified annotated interface @throws InitializationException if the specified command object does not have a {@link Command}, {@link Option} or {@link Parameters} annotation @throws ParameterException if the specified command line arguments are invalid @since 3.1
[ "<p", ">", "Convenience", "method", "that", "derives", "the", "command", "specification", "from", "the", "specified", "interface", "class", "and", "returns", "an", "instance", "of", "the", "specified", "interface", ".", "The", "interface", "is", "expected", "to"...
train
https://github.com/remkop/picocli/blob/3c5384f0d12817401d1921c3013c1282e2edcab2/src/main/java/picocli/CommandLine.java#L1059-L1063
mapbox/mapbox-events-android
libcore/src/main/java/com/mapbox/android/core/FileUtils.java
FileUtils.deleteFirst
public static void deleteFirst(@NonNull File[] files, @NonNull Comparator<File> sortedBy, int numFiles) { Arrays.sort(files, sortedBy); int size = Math.min(files.length, numFiles); for (int i = 0; i < size; i++) { if (!files[i].delete()) { Log.w(LOG_TAG, "Failed to delete file: " + files[i]); } } }
java
public static void deleteFirst(@NonNull File[] files, @NonNull Comparator<File> sortedBy, int numFiles) { Arrays.sort(files, sortedBy); int size = Math.min(files.length, numFiles); for (int i = 0; i < size; i++) { if (!files[i].delete()) { Log.w(LOG_TAG, "Failed to delete file: " + files[i]); } } }
[ "public", "static", "void", "deleteFirst", "(", "@", "NonNull", "File", "[", "]", "files", ",", "@", "NonNull", "Comparator", "<", "File", ">", "sortedBy", ",", "int", "numFiles", ")", "{", "Arrays", ".", "sort", "(", "files", ",", "sortedBy", ")", ";"...
Delete first n files sorted by property. @param files list of files to delete. @param sortedBy sorting comparator. @param numFiles number of files from list to delete.
[ "Delete", "first", "n", "files", "sorted", "by", "property", "." ]
train
https://github.com/mapbox/mapbox-events-android/blob/5b5ca7e04cb8fab31a8dc040b6e7521f930a58a4/libcore/src/main/java/com/mapbox/android/core/FileUtils.java#L127-L135
geomajas/geomajas-project-client-gwt2
common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java
StyleUtil.createCssParameter
public static CssParameterInfo createCssParameter(String name, Object value) { CssParameterInfo css = new CssParameterInfo(); css.setName(name); css.setValue(value.toString()); return css; }
java
public static CssParameterInfo createCssParameter(String name, Object value) { CssParameterInfo css = new CssParameterInfo(); css.setName(name); css.setValue(value.toString()); return css; }
[ "public", "static", "CssParameterInfo", "createCssParameter", "(", "String", "name", ",", "Object", "value", ")", "{", "CssParameterInfo", "css", "=", "new", "CssParameterInfo", "(", ")", ";", "css", ".", "setName", "(", "name", ")", ";", "css", ".", "setVal...
Creates a CSS parameter with specified name and value. @param name the name @param value the value @return the parameter
[ "Creates", "a", "CSS", "parameter", "with", "specified", "name", "and", "value", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L335-L340
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java
MessageUtils.buildMessage
static String buildMessage(BeanResolutionContext resolutionContext, String message) { BeanResolutionContext.Path path = resolutionContext.getPath(); BeanDefinition declaringType; boolean hasPath = !path.isEmpty(); if (hasPath) { BeanResolutionContext.Segment segment = path.peek(); declaringType = segment.getDeclaringType(); } else { declaringType = resolutionContext.getRootDefinition(); } String ls = System.getProperty("line.separator"); StringBuilder builder = new StringBuilder("Error instantiating bean of type ["); builder .append(declaringType.getName()) .append("]") .append(ls) .append(ls); if (message != null) { builder.append("Message: ").append(message).append(ls); } if (hasPath) { String pathString = path.toString(); builder.append("Path Taken: ").append(pathString); } return builder.toString(); }
java
static String buildMessage(BeanResolutionContext resolutionContext, String message) { BeanResolutionContext.Path path = resolutionContext.getPath(); BeanDefinition declaringType; boolean hasPath = !path.isEmpty(); if (hasPath) { BeanResolutionContext.Segment segment = path.peek(); declaringType = segment.getDeclaringType(); } else { declaringType = resolutionContext.getRootDefinition(); } String ls = System.getProperty("line.separator"); StringBuilder builder = new StringBuilder("Error instantiating bean of type ["); builder .append(declaringType.getName()) .append("]") .append(ls) .append(ls); if (message != null) { builder.append("Message: ").append(message).append(ls); } if (hasPath) { String pathString = path.toString(); builder.append("Path Taken: ").append(pathString); } return builder.toString(); }
[ "static", "String", "buildMessage", "(", "BeanResolutionContext", "resolutionContext", ",", "String", "message", ")", "{", "BeanResolutionContext", ".", "Path", "path", "=", "resolutionContext", ".", "getPath", "(", ")", ";", "BeanDefinition", "declaringType", ";", ...
Builds an appropriate error message. @param resolutionContext The resolution context @param message The message @return The message
[ "Builds", "an", "appropriate", "error", "message", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java#L39-L65
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ButtonFactory.java
ButtonFactory.createPhoneNumberButton
public static Button createPhoneNumberButton(String title, String phoneNumber) { return new PostbackButton(title, ButtonType.PHONE_NUMBER, phoneNumber); }
java
public static Button createPhoneNumberButton(String title, String phoneNumber) { return new PostbackButton(title, ButtonType.PHONE_NUMBER, phoneNumber); }
[ "public", "static", "Button", "createPhoneNumberButton", "(", "String", "title", ",", "String", "phoneNumber", ")", "{", "return", "new", "PostbackButton", "(", "title", ",", "ButtonType", ".", "PHONE_NUMBER", ",", "phoneNumber", ")", ";", "}" ]
Creates a button with a phone number. @param title the button label. @param phoneNumber a phone number. Must be in the format '+' prefix followed by the country code, area code and local number. @return a {@link PostbackButton}.
[ "Creates", "a", "button", "with", "a", "phone", "number", "." ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ButtonFactory.java#L116-L119
aws/aws-sdk-java
aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CopyProductRequest.java
CopyProductRequest.withSourceProvisioningArtifactIdentifiers
public CopyProductRequest withSourceProvisioningArtifactIdentifiers(java.util.Map<String, String>... sourceProvisioningArtifactIdentifiers) { if (this.sourceProvisioningArtifactIdentifiers == null) { setSourceProvisioningArtifactIdentifiers(new java.util.ArrayList<java.util.Map<String, String>>(sourceProvisioningArtifactIdentifiers.length)); } for (java.util.Map<String, String> ele : sourceProvisioningArtifactIdentifiers) { this.sourceProvisioningArtifactIdentifiers.add(ele); } return this; }
java
public CopyProductRequest withSourceProvisioningArtifactIdentifiers(java.util.Map<String, String>... sourceProvisioningArtifactIdentifiers) { if (this.sourceProvisioningArtifactIdentifiers == null) { setSourceProvisioningArtifactIdentifiers(new java.util.ArrayList<java.util.Map<String, String>>(sourceProvisioningArtifactIdentifiers.length)); } for (java.util.Map<String, String> ele : sourceProvisioningArtifactIdentifiers) { this.sourceProvisioningArtifactIdentifiers.add(ele); } return this; }
[ "public", "CopyProductRequest", "withSourceProvisioningArtifactIdentifiers", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "...", "sourceProvisioningArtifactIdentifiers", ")", "{", "if", "(", "this", ".", "sourceProvisioningArtifactIdentifiers",...
<p> The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all provisioning artifacts are copied. </p> <p> <b>NOTE:</b> This method appends the values to the existing list (if any). Use {@link #setSourceProvisioningArtifactIdentifiers(java.util.Collection)} or {@link #withSourceProvisioningArtifactIdentifiers(java.util.Collection)} if you want to override the existing values. </p> @param sourceProvisioningArtifactIdentifiers The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all provisioning artifacts are copied. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "identifiers", "of", "the", "provisioning", "artifacts", "(", "also", "known", "as", "versions", ")", "of", "the", "product", "to", "copy", ".", "By", "default", "all", "provisioning", "artifacts", "are", "copied", ".", "<", "/", "p", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CopyProductRequest.java#L402-L410
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java
ValidationUtils.validate4NonNegative
public static int[] validate4NonNegative(int[] data, String paramName){ validateNonNegative(data, paramName); return validate4(data, paramName); }
java
public static int[] validate4NonNegative(int[] data, String paramName){ validateNonNegative(data, paramName); return validate4(data, paramName); }
[ "public", "static", "int", "[", "]", "validate4NonNegative", "(", "int", "[", "]", "data", ",", "String", "paramName", ")", "{", "validateNonNegative", "(", "data", ",", "paramName", ")", ";", "return", "validate4", "(", "data", ",", "paramName", ")", ";",...
Reformats the input array to a length 4 array and checks that all values >= 0. If the array is length 1, returns [a, a, a, a] If the array is length 2, return [a, a, b, b] If the array is length 4, returns the array. @param data An array @param paramName The param name, for error reporting @return An int array of length 4 that represents the input
[ "Reformats", "the", "input", "array", "to", "a", "length", "4", "array", "and", "checks", "that", "all", "values", ">", "=", "0", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L272-L275
bitcoinj/bitcoinj
core/src/main/java/org/bitcoin/NativeSecp256k1.java
NativeSecp256k1.secKeyVerify
public static boolean secKeyVerify(byte[] seckey) { Preconditions.checkArgument(seckey.length == 32); ByteBuffer byteBuff = nativeECDSABuffer.get(); if (byteBuff == null || byteBuff.capacity() < seckey.length) { byteBuff = ByteBuffer.allocateDirect(seckey.length); byteBuff.order(ByteOrder.nativeOrder()); nativeECDSABuffer.set(byteBuff); } byteBuff.rewind(); byteBuff.put(seckey); r.lock(); try { return secp256k1_ec_seckey_verify(byteBuff, Secp256k1Context.getContext()) == 1; } finally { r.unlock(); } }
java
public static boolean secKeyVerify(byte[] seckey) { Preconditions.checkArgument(seckey.length == 32); ByteBuffer byteBuff = nativeECDSABuffer.get(); if (byteBuff == null || byteBuff.capacity() < seckey.length) { byteBuff = ByteBuffer.allocateDirect(seckey.length); byteBuff.order(ByteOrder.nativeOrder()); nativeECDSABuffer.set(byteBuff); } byteBuff.rewind(); byteBuff.put(seckey); r.lock(); try { return secp256k1_ec_seckey_verify(byteBuff, Secp256k1Context.getContext()) == 1; } finally { r.unlock(); } }
[ "public", "static", "boolean", "secKeyVerify", "(", "byte", "[", "]", "seckey", ")", "{", "Preconditions", ".", "checkArgument", "(", "seckey", ".", "length", "==", "32", ")", ";", "ByteBuffer", "byteBuff", "=", "nativeECDSABuffer", ".", "get", "(", ")", "...
libsecp256k1 Seckey Verify - returns 1 if valid, 0 if invalid @param seckey ECDSA Secret key, 32 bytes
[ "libsecp256k1", "Seckey", "Verify", "-", "returns", "1", "if", "valid", "0", "if", "invalid" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoin/NativeSecp256k1.java#L120-L138
sagiegurari/fax4j
src/main/java/org/fax4j/util/IOHelper.java
IOHelper.writeTextFile
public static void writeTextFile(String text,File file) throws IOException { Writer writer=null; try { //create writer to file (with default encoding) OutputStream outputStream=new FileOutputStream(file); writer=IOHelper.createWriter(outputStream,null); //write to file writer.write(text); } finally { //close writer IOHelper.closeResource(writer); } }
java
public static void writeTextFile(String text,File file) throws IOException { Writer writer=null; try { //create writer to file (with default encoding) OutputStream outputStream=new FileOutputStream(file); writer=IOHelper.createWriter(outputStream,null); //write to file writer.write(text); } finally { //close writer IOHelper.closeResource(writer); } }
[ "public", "static", "void", "writeTextFile", "(", "String", "text", ",", "File", "file", ")", "throws", "IOException", "{", "Writer", "writer", "=", "null", ";", "try", "{", "//create writer to file (with default encoding)", "OutputStream", "outputStream", "=", "new...
Writes the text to the file. @param text The text to write to the provided file @param file The text file @throws IOException Any IO exception
[ "Writes", "the", "text", "to", "the", "file", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/IOHelper.java#L354-L371
JodaOrg/joda-time
src/main/java/org/joda/time/chrono/BasicChronology.java
BasicChronology.getYearMonthMillis
long getYearMonthMillis(int year, int month) { long millis = getYearMillis(year); millis += getTotalMillisByYearMonth(year, month); return millis; }
java
long getYearMonthMillis(int year, int month) { long millis = getYearMillis(year); millis += getTotalMillisByYearMonth(year, month); return millis; }
[ "long", "getYearMonthMillis", "(", "int", "year", ",", "int", "month", ")", "{", "long", "millis", "=", "getYearMillis", "(", "year", ")", ";", "millis", "+=", "getTotalMillisByYearMonth", "(", "year", ",", "month", ")", ";", "return", "millis", ";", "}" ]
Get the milliseconds for the start of a month. @param year The year to use. @param month The month to use @return millis from 1970-01-01T00:00:00Z
[ "Get", "the", "milliseconds", "for", "the", "start", "of", "a", "month", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/BasicChronology.java#L397-L401
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ThreadLocalProxyCopyOnWriteArrayList.java
ThreadLocalProxyCopyOnWriteArrayList.lastIndexOf
public int lastIndexOf(E e, int index) { Object[] elements = getArray(); return lastIndexOf(e, elements, index); }
java
public int lastIndexOf(E e, int index) { Object[] elements = getArray(); return lastIndexOf(e, elements, index); }
[ "public", "int", "lastIndexOf", "(", "E", "e", ",", "int", "index", ")", "{", "Object", "[", "]", "elements", "=", "getArray", "(", ")", ";", "return", "lastIndexOf", "(", "e", ",", "elements", ",", "index", ")", ";", "}" ]
Returns the index of the last occurrence of the specified element in this list, searching backwards from <tt>index</tt>, or returns -1 if the element is not found. More formally, returns the highest index <tt>i</tt> such that <tt>(i&nbsp;&lt;=&nbsp;index&nbsp;&amp;&amp;&nbsp;(e==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;e.equals(get(i))))</tt>, or -1 if there is no such index. @param e element to search for @param index index to start searching backwards from @return the index of the last occurrence of the element at position less than or equal to <tt>index</tt> in this list; -1 if the element is not found. @throws IndexOutOfBoundsException if the specified index is greater than or equal to the current size of this list
[ "Returns", "the", "index", "of", "the", "last", "occurrence", "of", "the", "specified", "element", "in", "this", "list", "searching", "backwards", "from", "<tt", ">", "index<", "/", "tt", ">", "or", "returns", "-", "1", "if", "the", "element", "is", "not...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ThreadLocalProxyCopyOnWriteArrayList.java#L224-L227
looly/hutool
hutool-log/src/main/java/cn/hutool/log/dialect/slf4j/Slf4jLog.java
Slf4jLog.locationAwareLog
private boolean locationAwareLog(int level_int, Throwable t, String msgTemplate, Object[] arguments) { return locationAwareLog(FQCN, level_int, t, msgTemplate, arguments); }
java
private boolean locationAwareLog(int level_int, Throwable t, String msgTemplate, Object[] arguments) { return locationAwareLog(FQCN, level_int, t, msgTemplate, arguments); }
[ "private", "boolean", "locationAwareLog", "(", "int", "level_int", ",", "Throwable", "t", ",", "String", "msgTemplate", ",", "Object", "[", "]", "arguments", ")", "{", "return", "locationAwareLog", "(", "FQCN", ",", "level_int", ",", "t", ",", "msgTemplate", ...
打印日志<br> 此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题 @param level_int 日志级别,使用LocationAwareLogger中的常量 @param msgTemplate 消息模板 @param arguments 参数 @param t 异常 @return 是否支持 LocationAwareLogger对象,如果不支持需要日志方法调用被包装类的相应方法
[ "打印日志<br", ">", "此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/slf4j/Slf4jLog.java#L200-L202