repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/Node.java
Node.getContext
Context getContext(final String path, List<String> aliases) { VHostMapping host = null; for (final VHostMapping vhost : vHosts) { if (aliases.equals(vhost.getAliases())) { host = vhost; break; } } if (host == null) { return null; } for (final Context context : contexts) { if (context.getPath().equals(path) && context.getVhost() == host) { return context; } } return null; }
java
Context getContext(final String path, List<String> aliases) { VHostMapping host = null; for (final VHostMapping vhost : vHosts) { if (aliases.equals(vhost.getAliases())) { host = vhost; break; } } if (host == null) { return null; } for (final Context context : contexts) { if (context.getPath().equals(path) && context.getVhost() == host) { return context; } } return null; }
[ "Context", "getContext", "(", "final", "String", "path", ",", "List", "<", "String", ">", "aliases", ")", "{", "VHostMapping", "host", "=", "null", ";", "for", "(", "final", "VHostMapping", "vhost", ":", "vHosts", ")", "{", "if", "(", "aliases", ".", "...
Get a context. @param path the context path @param aliases the aliases @return the context, {@code null} if there is no matching context
[ "Get", "a", "context", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/Node.java#L275-L292
zaproxy/zaproxy
src/org/zaproxy/zap/extension/spider/ExtensionSpider.java
ExtensionSpider.startScan
public int startScan(Target target, User user, Object[] customConfigurations) { return startScan(createDisplayName(target, customConfigurations), target, user, customConfigurations); }
java
public int startScan(Target target, User user, Object[] customConfigurations) { return startScan(createDisplayName(target, customConfigurations), target, user, customConfigurations); }
[ "public", "int", "startScan", "(", "Target", "target", ",", "User", "user", ",", "Object", "[", "]", "customConfigurations", ")", "{", "return", "startScan", "(", "createDisplayName", "(", "target", ",", "customConfigurations", ")", ",", "target", ",", "user",...
Starts a new spider scan using the given target and, optionally, spidering from the perspective of a user and with custom configurations. <p> The spider scan will use the most appropriate display name created from the given target, user and custom configurations. @param target the target that will be spidered @param user the user that will be used to spider, might be {@code null} @param customConfigurations other custom configurations for the spider, might be {@code null} @return the ID of the spider scan @since 2.5.0 @see #startScan(String, Target, User, Object[]) @throws IllegalStateException if the target or custom configurations are not allowed in the current {@link org.parosproxy.paros.control.Control.Mode mode}.
[ "Starts", "a", "new", "spider", "scan", "using", "the", "given", "target", "and", "optionally", "spidering", "from", "the", "perspective", "of", "a", "user", "and", "with", "custom", "configurations", ".", "<p", ">", "The", "spider", "scan", "will", "use", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/spider/ExtensionSpider.java#L547-L549
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java
MeshGenerator.generateCone
public static VertexData generateCone(float radius, float height) { final VertexData destination = new VertexData(); final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3); destination.addAttribute(0, positionsAttribute); final TFloatList positions = new TFloatArrayList(); final VertexAttribute normalsAttribute = new VertexAttribute("normals", DataType.FLOAT, 3); destination.addAttribute(1, normalsAttribute); final TFloatList normals = new TFloatArrayList(); final TIntList indices = destination.getIndices(); // Generate the mesh generateCone(positions, normals, indices, radius, height); // Put the mesh in the vertex data positionsAttribute.setData(positions); normalsAttribute.setData(normals); return destination; }
java
public static VertexData generateCone(float radius, float height) { final VertexData destination = new VertexData(); final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3); destination.addAttribute(0, positionsAttribute); final TFloatList positions = new TFloatArrayList(); final VertexAttribute normalsAttribute = new VertexAttribute("normals", DataType.FLOAT, 3); destination.addAttribute(1, normalsAttribute); final TFloatList normals = new TFloatArrayList(); final TIntList indices = destination.getIndices(); // Generate the mesh generateCone(positions, normals, indices, radius, height); // Put the mesh in the vertex data positionsAttribute.setData(positions); normalsAttribute.setData(normals); return destination; }
[ "public", "static", "VertexData", "generateCone", "(", "float", "radius", ",", "float", "height", ")", "{", "final", "VertexData", "destination", "=", "new", "VertexData", "(", ")", ";", "final", "VertexAttribute", "positionsAttribute", "=", "new", "VertexAttribut...
Generates a conical solid mesh. The center is at the middle of the cone. @param radius The radius of the base @param height The height (distance from the base to the apex) @return The vertex data
[ "Generates", "a", "conical", "solid", "mesh", ".", "The", "center", "is", "at", "the", "middle", "of", "the", "cone", "." ]
train
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L999-L1014
adohe/etcd4j
src/main/java/com/xqbase/etcd4j/EtcdClient.java
EtcdClient.cas
public EtcdResult cas(String key, String value, Map<String, String> params) throws EtcdClientException { List<BasicNameValuePair> data = Lists.newArrayList(); data.add(new BasicNameValuePair("value", value)); return put(key, data, params, new int[] {200, 412}, 101, 105); }
java
public EtcdResult cas(String key, String value, Map<String, String> params) throws EtcdClientException { List<BasicNameValuePair> data = Lists.newArrayList(); data.add(new BasicNameValuePair("value", value)); return put(key, data, params, new int[] {200, 412}, 101, 105); }
[ "public", "EtcdResult", "cas", "(", "String", "key", ",", "String", "value", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "EtcdClientException", "{", "List", "<", "BasicNameValuePair", ">", "data", "=", "Lists", ".", "newArrayList"...
Atomic Compare-and-Swap @param key the key @param value the new value @param params comparable conditions @return operation result @throws EtcdClientException
[ "Atomic", "Compare", "-", "and", "-", "Swap" ]
train
https://github.com/adohe/etcd4j/blob/8d30ae9aa5da32d8e78287d61e69861c63538629/src/main/java/com/xqbase/etcd4j/EtcdClient.java#L267-L272
overturetool/overture
core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java
SyntaxReader.checkFor
protected void checkFor(VDMToken tok, int number, String message) throws LexException, ParserException { if (lastToken().is(tok)) { nextToken(); } else { throwMessage(number, message); } }
java
protected void checkFor(VDMToken tok, int number, String message) throws LexException, ParserException { if (lastToken().is(tok)) { nextToken(); } else { throwMessage(number, message); } }
[ "protected", "void", "checkFor", "(", "VDMToken", "tok", ",", "int", "number", ",", "String", "message", ")", "throws", "LexException", ",", "ParserException", "{", "if", "(", "lastToken", "(", ")", ".", "is", "(", "tok", ")", ")", "{", "nextToken", "(",...
If the last token is as expected, advance, else raise an error. @param tok The token type to check for. @param number The error number. @param message The error message to raise if the token is not as expected. @throws LexException @throws ParserException
[ "If", "the", "last", "token", "is", "as", "expected", "advance", "else", "raise", "an", "error", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java#L445-L455
calimero-project/calimero-core
src/tuwien/auto/calimero/knxnetip/servicetype/TunnelingFeature.java
TunnelingFeature.newInfo
public static TunnelingFeature newInfo(final int channelId, final int seq, final InterfaceFeature featureId, final byte... featureValue) { return new TunnelingFeature(KNXnetIPHeader.TunnelingFeatureInfo, channelId, seq, featureId, Success, featureValue); }
java
public static TunnelingFeature newInfo(final int channelId, final int seq, final InterfaceFeature featureId, final byte... featureValue) { return new TunnelingFeature(KNXnetIPHeader.TunnelingFeatureInfo, channelId, seq, featureId, Success, featureValue); }
[ "public", "static", "TunnelingFeature", "newInfo", "(", "final", "int", "channelId", ",", "final", "int", "seq", ",", "final", "InterfaceFeature", "featureId", ",", "final", "byte", "...", "featureValue", ")", "{", "return", "new", "TunnelingFeature", "(", "KNXn...
Creates a new tunneling feature-info service. @param channelId tunneling connection channel identifier @param seq tunneling connection send sequence number @param featureId interface feature which should be announced @param featureValue feature value to announce @return new tunneling feature-info service
[ "Creates", "a", "new", "tunneling", "feature", "-", "info", "service", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/knxnetip/servicetype/TunnelingFeature.java#L124-L127
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_hlr_POST
public OvhSmsSendingReport serviceName_hlr_POST(String serviceName, String[] receivers, String receiversDocumentUrl) throws IOException { String qPath = "/sms/{serviceName}/hlr"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "receivers", receivers); addBody(o, "receiversDocumentUrl", receiversDocumentUrl); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhSmsSendingReport.class); }
java
public OvhSmsSendingReport serviceName_hlr_POST(String serviceName, String[] receivers, String receiversDocumentUrl) throws IOException { String qPath = "/sms/{serviceName}/hlr"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "receivers", receivers); addBody(o, "receiversDocumentUrl", receiversDocumentUrl); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhSmsSendingReport.class); }
[ "public", "OvhSmsSendingReport", "serviceName_hlr_POST", "(", "String", "serviceName", ",", "String", "[", "]", "receivers", ",", "String", "receiversDocumentUrl", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/hlr\"", ";", "StringBuild...
Add one or several sending hlr lookup request REST: POST /sms/{serviceName}/hlr @param receiversDocumentUrl [required] The receivers document url link in csv format @param receivers [required] The receivers @param serviceName [required] The internal name of your SMS offer
[ "Add", "one", "or", "several", "sending", "hlr", "lookup", "request" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1517-L1525
apache/groovy
src/main/groovy/groovy/ui/GroovyMain.java
GroovyMain.getScriptSource
protected GroovyCodeSource getScriptSource(boolean isScriptFile, String script) throws IOException, URISyntaxException { //check the script is currently valid before starting a server against the script if (isScriptFile) { // search for the file and if it exists don't try to use URIs ... File scriptFile = huntForTheScriptFile(script); if (!scriptFile.exists() && URI_PATTERN.matcher(script).matches()) { return new GroovyCodeSource(new URI(script)); } return new GroovyCodeSource( scriptFile ); } return new GroovyCodeSource(script, "script_from_command_line", GroovyShell.DEFAULT_CODE_BASE); }
java
protected GroovyCodeSource getScriptSource(boolean isScriptFile, String script) throws IOException, URISyntaxException { //check the script is currently valid before starting a server against the script if (isScriptFile) { // search for the file and if it exists don't try to use URIs ... File scriptFile = huntForTheScriptFile(script); if (!scriptFile.exists() && URI_PATTERN.matcher(script).matches()) { return new GroovyCodeSource(new URI(script)); } return new GroovyCodeSource( scriptFile ); } return new GroovyCodeSource(script, "script_from_command_line", GroovyShell.DEFAULT_CODE_BASE); }
[ "protected", "GroovyCodeSource", "getScriptSource", "(", "boolean", "isScriptFile", ",", "String", "script", ")", "throws", "IOException", ",", "URISyntaxException", "{", "//check the script is currently valid before starting a server against the script", "if", "(", "isScriptFile...
Get a new GroovyCodeSource for a script which may be given as a location (isScript is true) or as text (isScript is false). @param isScriptFile indicates whether the script parameter is a location or content @param script the location or context of the script @return a new GroovyCodeSource for the given script @throws IOException @throws URISyntaxException @since 2.3.0
[ "Get", "a", "new", "GroovyCodeSource", "for", "a", "script", "which", "may", "be", "given", "as", "a", "location", "(", "isScript", "is", "true", ")", "or", "as", "text", "(", "isScript", "is", "false", ")", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/ui/GroovyMain.java#L402-L413
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.hasRole
public boolean hasRole(CmsRequestContext context, CmsUser user, CmsRole role) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); boolean result; try { result = hasRole(dbc, user, role); } finally { dbc.clear(); } return result; }
java
public boolean hasRole(CmsRequestContext context, CmsUser user, CmsRole role) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); boolean result; try { result = hasRole(dbc, user, role); } finally { dbc.clear(); } return result; }
[ "public", "boolean", "hasRole", "(", "CmsRequestContext", "context", ",", "CmsUser", "user", ",", "CmsRole", "role", ")", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "boolean", "result", ";", "try", "{"...
Checks if the given user has the given role in the given organizational unit.<p> If the organizational unit is <code>null</code>, this method will check if the given user has the given role for at least one organizational unit.<p> @param context the current request context @param user the user to check the role for @param role the role to check @return <code>true</code> if the given user has the given role in the given organizational unit
[ "Checks", "if", "the", "given", "user", "has", "the", "given", "role", "in", "the", "given", "organizational", "unit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3065-L3075
ehcache/ehcache3
core/src/main/java/org/ehcache/core/util/CollectionUtil.java
CollectionUtil.findBestCollectionSize
public static int findBestCollectionSize(Iterable<?> iterable, int bestBet) { return (iterable instanceof Collection ? ((Collection<?>) iterable).size() : bestBet); }
java
public static int findBestCollectionSize(Iterable<?> iterable, int bestBet) { return (iterable instanceof Collection ? ((Collection<?>) iterable).size() : bestBet); }
[ "public", "static", "int", "findBestCollectionSize", "(", "Iterable", "<", "?", ">", "iterable", ",", "int", "bestBet", ")", "{", "return", "(", "iterable", "instanceof", "Collection", "?", "(", "(", "Collection", "<", "?", ">", ")", "iterable", ")", ".", ...
Used to create a new collection with the correct size. Given an iterable, will try to see it the iterable actually have a size and will return it. If the iterable has no known size, we return the best bet. @param iterable the iterable we will try to find the size of @param bestBet our best bet for the size if the iterable is not sizeable @return the size of the iterable if found or null
[ "Used", "to", "create", "a", "new", "collection", "with", "the", "correct", "size", ".", "Given", "an", "iterable", "will", "try", "to", "see", "it", "the", "iterable", "actually", "have", "a", "size", "and", "will", "return", "it", ".", "If", "the", "...
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/util/CollectionUtil.java#L37-L39
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/InstanceFailoverGroupsInner.java
InstanceFailoverGroupsInner.createOrUpdate
public InstanceFailoverGroupInner createOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().last().body(); }
java
public InstanceFailoverGroupInner createOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().last().body(); }
[ "public", "InstanceFailoverGroupInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "locationName", ",", "String", "failoverGroupName", ",", "InstanceFailoverGroupInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", ...
Creates or updates a failover group. @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 locationName The name of the region where the resource is located. @param failoverGroupName The name of the failover group. @param parameters The failover group parameters. @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 InstanceFailoverGroupInner object if successful.
[ "Creates", "or", "updates", "a", "failover", "group", "." ]
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/InstanceFailoverGroupsInner.java#L216-L218
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java
LiveOutputsInner.listAsync
public Observable<Page<LiveOutputInner>> listAsync(final String resourceGroupName, final String accountName, final String liveEventName) { return listWithServiceResponseAsync(resourceGroupName, accountName, liveEventName) .map(new Func1<ServiceResponse<Page<LiveOutputInner>>, Page<LiveOutputInner>>() { @Override public Page<LiveOutputInner> call(ServiceResponse<Page<LiveOutputInner>> response) { return response.body(); } }); }
java
public Observable<Page<LiveOutputInner>> listAsync(final String resourceGroupName, final String accountName, final String liveEventName) { return listWithServiceResponseAsync(resourceGroupName, accountName, liveEventName) .map(new Func1<ServiceResponse<Page<LiveOutputInner>>, Page<LiveOutputInner>>() { @Override public Page<LiveOutputInner> call(ServiceResponse<Page<LiveOutputInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "LiveOutputInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ",", "final", "String", "liveEventName", ")", "{", "return", "listWithServiceResponseAsync", "(", ...
List Live Outputs. Lists the Live Outputs in the Live Event. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param liveEventName The name of the Live Event. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;LiveOutputInner&gt; object
[ "List", "Live", "Outputs", ".", "Lists", "the", "Live", "Outputs", "in", "the", "Live", "Event", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java#L149-L157
RestComm/media-core
ice/src/main/java/org/restcomm/media/core/ice/IceAgent.java
IceAgent.addMediaStream
public IceMediaStream addMediaStream(String streamName, boolean rtcp, boolean rtcpMux) { if (!this.mediaStreams.containsKey(streamName)) { // Updates number of maximum allowed candidate pairs this.maxSelectedPairs += (rtcp && !rtcpMux) ? 2 : 1; // Register media stream return this.mediaStreams.put(streamName, new IceMediaStream(streamName, rtcp, rtcpMux)); } return null; }
java
public IceMediaStream addMediaStream(String streamName, boolean rtcp, boolean rtcpMux) { if (!this.mediaStreams.containsKey(streamName)) { // Updates number of maximum allowed candidate pairs this.maxSelectedPairs += (rtcp && !rtcpMux) ? 2 : 1; // Register media stream return this.mediaStreams.put(streamName, new IceMediaStream(streamName, rtcp, rtcpMux)); } return null; }
[ "public", "IceMediaStream", "addMediaStream", "(", "String", "streamName", ",", "boolean", "rtcp", ",", "boolean", "rtcpMux", ")", "{", "if", "(", "!", "this", ".", "mediaStreams", ".", "containsKey", "(", "streamName", ")", ")", "{", "// Updates number of maxim...
Creates and registers a new media stream with an RTP component.<br> An secondary component may be created if the stream supports RTCP. @param streamName the name of the media stream @param rtcp Indicates whether the media server supports RTCP. @param rtcpMux Indicates whether the media stream supports <a href=""http://tools.ietf.org/html/rfc5761">rtcp-mux</a> @return The newly created media stream.
[ "Creates", "and", "registers", "a", "new", "media", "stream", "with", "an", "RTP", "component", ".", "<br", ">", "An", "secondary", "component", "may", "be", "created", "if", "the", "stream", "supports", "RTCP", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/ice/src/main/java/org/restcomm/media/core/ice/IceAgent.java#L185-L193
eclipse/xtext-extras
org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/IndexedJvmTypeAccess.java
IndexedJvmTypeAccess.getIndexedJvmType
public EObject getIndexedJvmType(URI javaObjectURI, ResourceSet resourceSet) throws UnknownNestedTypeException { return getIndexedJvmType(javaObjectURI, resourceSet, false); }
java
public EObject getIndexedJvmType(URI javaObjectURI, ResourceSet resourceSet) throws UnknownNestedTypeException { return getIndexedJvmType(javaObjectURI, resourceSet, false); }
[ "public", "EObject", "getIndexedJvmType", "(", "URI", "javaObjectURI", ",", "ResourceSet", "resourceSet", ")", "throws", "UnknownNestedTypeException", "{", "return", "getIndexedJvmType", "(", "javaObjectURI", ",", "resourceSet", ",", "false", ")", ";", "}" ]
Locate and resolve a {@link JvmType} in the context of the given resource set. It'll try to decode the qualified name from the URI and find an instance with that name in the {@link IResourceDescriptions index}. Short-circuits to a resource that is already available in the resource set. @param javaObjectURI the uri of the to-be-loaded instance. It is expected to be a Java-scheme URI. May not be <code>null</code>. @param resourceSet the context resource set. May not be <code>null</code>. @return the located instance. May be <code>null</code>.
[ "Locate", "and", "resolve", "a", "{", "@link", "JvmType", "}", "in", "the", "context", "of", "the", "given", "resource", "set", ".", "It", "ll", "try", "to", "decode", "the", "qualified", "name", "from", "the", "URI", "and", "find", "an", "instance", "...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/IndexedJvmTypeAccess.java#L68-L70
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/util/ResourceManager.java
ResourceManager.getString
public String getString(String key, Object[] args) { String value = getString(key); return MessageFormat.format(value, args); }
java
public String getString(String key, Object[] args) { String value = getString(key); return MessageFormat.format(value, args); }
[ "public", "String", "getString", "(", "String", "key", ",", "Object", "[", "]", "args", ")", "{", "String", "value", "=", "getString", "(", "key", ")", ";", "return", "MessageFormat", ".", "format", "(", "value", ",", "args", ")", ";", "}" ]
Gets the String associated with <code>key</code> after having resolved any nested keys ({@link #resolve(String)}) and applied a formatter using the given <code>args</code>. @param key the key to lookup @param args the arguments to pass to the formatter @return the String associated with <code>key</code>
[ "Gets", "the", "String", "associated", "with", "<code", ">", "key<", "/", "code", ">", "after", "having", "resolved", "any", "nested", "keys", "(", "{", "@link", "#resolve", "(", "String", ")", "}", ")", "and", "applied", "a", "formatter", "using", "the"...
train
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/util/ResourceManager.java#L144-L147
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/spi/federation/PageKey.java
PageKey.withParentId
public PageKey withParentId(String parentId) { if (StringUtil.isBlank(parentId)) { throw new IllegalArgumentException("Parent ID cannot be empty"); } return new PageKey(parentId, this.offset, this.blockSize); }
java
public PageKey withParentId(String parentId) { if (StringUtil.isBlank(parentId)) { throw new IllegalArgumentException("Parent ID cannot be empty"); } return new PageKey(parentId, this.offset, this.blockSize); }
[ "public", "PageKey", "withParentId", "(", "String", "parentId", ")", "{", "if", "(", "StringUtil", ".", "isBlank", "(", "parentId", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parent ID cannot be empty\"", ")", ";", "}", "return", "new", ...
Creates a new {@link org.modeshape.jcr.spi.federation.PageKey} instance which has the given parent ID and the same offset & block size as this page. @param parentId a {@link String} representing the ID of the new parent; may not be null. @return a new {@link org.modeshape.jcr.spi.federation.PageKey} instance; never null.
[ "Creates", "a", "new", "{" ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/spi/federation/PageKey.java#L76-L81
telly/groundy
library/src/main/java/com/telly/groundy/Groundy.java
Groundy.arg
public Groundy arg(String key, ArrayList<CharSequence> value) { mArgs.putCharSequenceArrayList(key, value); return this; }
java
public Groundy arg(String key, ArrayList<CharSequence> value) { mArgs.putCharSequenceArrayList(key, value); return this; }
[ "public", "Groundy", "arg", "(", "String", "key", ",", "ArrayList", "<", "CharSequence", ">", "value", ")", "{", "mArgs", ".", "putCharSequenceArrayList", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts an ArrayList<CharSequence> value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value an ArrayList<CharSequence> object, or null
[ "Inserts", "an", "ArrayList<CharSequence", ">", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/Groundy.java#L584-L587
knowm/XChange
xchange-core/src/main/java/org/knowm/xchange/utils/CertHelper.java
CertHelper.trustAllCerts
@Deprecated public static void trustAllCerts() throws Exception { TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } @Override public void checkClientTrusted(X509Certificate[] certs, String authType) {} @Override public void checkServerTrusted(X509Certificate[] certs, String authType) {} } }; // Install the all-trusting trust manager SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); // Create all-trusting host name verifier HostnameVerifier allHostsValid = new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } }; // Install the all-trusting host verifier HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid); }
java
@Deprecated public static void trustAllCerts() throws Exception { TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } @Override public void checkClientTrusted(X509Certificate[] certs, String authType) {} @Override public void checkServerTrusted(X509Certificate[] certs, String authType) {} } }; // Install the all-trusting trust manager SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); // Create all-trusting host name verifier HostnameVerifier allHostsValid = new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } }; // Install the all-trusting host verifier HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid); }
[ "@", "Deprecated", "public", "static", "void", "trustAllCerts", "(", ")", "throws", "Exception", "{", "TrustManager", "[", "]", "trustAllCerts", "=", "new", "TrustManager", "[", "]", "{", "new", "X509TrustManager", "(", ")", "{", "@", "Override", "public", "...
Manually override the JVM's TrustManager to accept all HTTPS connections. Use this ONLY for testing, and even at that use it cautiously. Someone could steal your API keys with a MITM attack! @deprecated create an exclusion specific to your need rather than changing all behavior
[ "Manually", "override", "the", "JVM", "s", "TrustManager", "to", "accept", "all", "HTTPS", "connections", ".", "Use", "this", "ONLY", "for", "testing", "and", "even", "at", "that", "use", "it", "cautiously", ".", "Someone", "could", "steal", "your", "API", ...
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/CertHelper.java#L250-L289
apache/incubator-gobblin
gobblin-restli/gobblin-throttling-service/gobblin-throttling-service-server/src/main/java/org/apache/gobblin/restli/throttling/TokenBucket.java
TokenBucket.tryReserveTokens
synchronized long tryReserveTokens(long tokens, long maxWaitMillis) { long now = System.currentTimeMillis(); long waitUntilNextTokenAvailable = Math.max(0, this.nextTokenAvailableMillis - now); updateTokensStored(now); if (tokens <= this.tokensStored) { this.tokensStored -= tokens; return waitUntilNextTokenAvailable; } double additionalNeededTokens = tokens - this.tokensStored; // casting to long will round towards 0 long additionalWaitForEnoughTokens = (long) (additionalNeededTokens / this.tokensPerMilli) + 1; long totalWait = waitUntilNextTokenAvailable + additionalWaitForEnoughTokens; if (totalWait > maxWaitMillis) { return -1; } this.tokensStored = this.tokensPerMilli * additionalWaitForEnoughTokens - additionalNeededTokens; this.nextTokenAvailableMillis = this.nextTokenAvailableMillis + additionalWaitForEnoughTokens; return totalWait; }
java
synchronized long tryReserveTokens(long tokens, long maxWaitMillis) { long now = System.currentTimeMillis(); long waitUntilNextTokenAvailable = Math.max(0, this.nextTokenAvailableMillis - now); updateTokensStored(now); if (tokens <= this.tokensStored) { this.tokensStored -= tokens; return waitUntilNextTokenAvailable; } double additionalNeededTokens = tokens - this.tokensStored; // casting to long will round towards 0 long additionalWaitForEnoughTokens = (long) (additionalNeededTokens / this.tokensPerMilli) + 1; long totalWait = waitUntilNextTokenAvailable + additionalWaitForEnoughTokens; if (totalWait > maxWaitMillis) { return -1; } this.tokensStored = this.tokensPerMilli * additionalWaitForEnoughTokens - additionalNeededTokens; this.nextTokenAvailableMillis = this.nextTokenAvailableMillis + additionalWaitForEnoughTokens; return totalWait; }
[ "synchronized", "long", "tryReserveTokens", "(", "long", "tokens", ",", "long", "maxWaitMillis", ")", "{", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "waitUntilNextTokenAvailable", "=", "Math", ".", "max", "(", "0", ",", "...
Note: this method should only be called while holding the class lock. For performance, the lock is not explicitly acquired. @return the wait until the tokens are available or negative if they can't be acquired in the give timeout.
[ "Note", ":", "this", "method", "should", "only", "be", "called", "while", "holding", "the", "class", "lock", ".", "For", "performance", "the", "lock", "is", "not", "explicitly", "acquired", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-restli/gobblin-throttling-service/gobblin-throttling-service-server/src/main/java/org/apache/gobblin/restli/throttling/TokenBucket.java#L101-L121
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/MethodCompiler.java
MethodCompiler.getStaticField
public void getStaticField(Class<?> cls, String name) throws IOException { getStaticField(El.getField(cls, name)); }
java
public void getStaticField(Class<?> cls, String name) throws IOException { getStaticField(El.getField(cls, name)); }
[ "public", "void", "getStaticField", "(", "Class", "<", "?", ">", "cls", ",", "String", "name", ")", "throws", "IOException", "{", "getStaticField", "(", "El", ".", "getField", "(", "cls", ",", "name", ")", ")", ";", "}" ]
Get field from class <p>Stack: ..., =&gt; ..., value @param cls @param name @throws IOException
[ "Get", "field", "from", "class", "<p", ">", "Stack", ":", "...", "=", "&gt", ";", "...", "value" ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/MethodCompiler.java#L943-L946
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.paymentMean_creditCard_id_PUT
public void paymentMean_creditCard_id_PUT(Long id, OvhCreditCard body) throws IOException { String qPath = "/me/paymentMean/creditCard/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void paymentMean_creditCard_id_PUT(Long id, OvhCreditCard body) throws IOException { String qPath = "/me/paymentMean/creditCard/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "paymentMean_creditCard_id_PUT", "(", "Long", "id", ",", "OvhCreditCard", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/paymentMean/creditCard/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", ...
Alter this object properties REST: PUT /me/paymentMean/creditCard/{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#L844-L848
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/chunklistener/ChunkListener.java
ChunkListener.callPreListener
public boolean callPreListener(Chunk chunk, BlockPos listener, BlockPos modified, IBlockState oldState, IBlockState newState) { IBlockListener.Pre bl = IComponent.getComponent(IBlockListener.Pre.class, chunk.getWorld().getBlockState(listener).getBlock()); return bl.onBlockSet(chunk.getWorld(), listener, modified, oldState, newState); }
java
public boolean callPreListener(Chunk chunk, BlockPos listener, BlockPos modified, IBlockState oldState, IBlockState newState) { IBlockListener.Pre bl = IComponent.getComponent(IBlockListener.Pre.class, chunk.getWorld().getBlockState(listener).getBlock()); return bl.onBlockSet(chunk.getWorld(), listener, modified, oldState, newState); }
[ "public", "boolean", "callPreListener", "(", "Chunk", "chunk", ",", "BlockPos", "listener", ",", "BlockPos", "modified", ",", "IBlockState", "oldState", ",", "IBlockState", "newState", ")", "{", "IBlockListener", ".", "Pre", "bl", "=", "IComponent", ".", "getCom...
Calls {@link IBlockListener.Pre#onBlockSet(net.minecraft.world.World, BlockPos, BlockPos, IBlockState, IBlockState)} for the listener {@link BlockPos}. @param chunk the chunk @param listener the listener @param modified the modified @param oldState the old state @param newState the new state @return true, if successful
[ "Calls", "{", "@link", "IBlockListener", ".", "Pre#onBlockSet", "(", "net", ".", "minecraft", ".", "world", ".", "World", "BlockPos", "BlockPos", "IBlockState", "IBlockState", ")", "}", "for", "the", "listener", "{", "@link", "BlockPos", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunklistener/ChunkListener.java#L72-L76
couchbase/CouchbaseMock
src/main/java/com/couchbase/mock/memcached/protocol/BinaryConfigResponse.java
BinaryConfigResponse.createGetConfig
public static BinaryResponse createGetConfig(BinaryCommand command, MemcachedServer server) { return create(command, server, ErrorCode.SUCCESS, ErrorCode.NOT_SUPPORTED); }
java
public static BinaryResponse createGetConfig(BinaryCommand command, MemcachedServer server) { return create(command, server, ErrorCode.SUCCESS, ErrorCode.NOT_SUPPORTED); }
[ "public", "static", "BinaryResponse", "createGetConfig", "(", "BinaryCommand", "command", ",", "MemcachedServer", "server", ")", "{", "return", "create", "(", "command", ",", "server", ",", "ErrorCode", ".", "SUCCESS", ",", "ErrorCode", ".", "NOT_SUPPORTED", ")", ...
Creates a response for {@code CMD_GET_CONFIG} @param command The command received @param server The server @return A response containing the config with a successful code, or an empty response with NOT_SUPPORTED
[ "Creates", "a", "response", "for", "{" ]
train
https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/memcached/protocol/BinaryConfigResponse.java#L68-L70
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/util/BooleanFormula.java
BooleanFormula.addExpandTerm
private static void addExpandTerm(int i, int ord, int byteValue, Term termValue, Set<Integer> terms) { if (i < ord) { int mask = 1 << i; byte bitValue = termValue.get(i); if (bitValue == 1) { byteValue |= (-1 & mask); addExpandTerm(i+1, ord, byteValue, termValue, terms); } else if (bitValue == 0) { addExpandTerm(i+1, ord, byteValue, termValue, terms); } else { // Dont care addExpandTerm(i+1, ord, byteValue, termValue, terms); byteValue |= (-1 & mask); addExpandTerm(i+1, ord, byteValue, termValue, terms); } } else { // add the term to the term list terms.add(byteValue); } }
java
private static void addExpandTerm(int i, int ord, int byteValue, Term termValue, Set<Integer> terms) { if (i < ord) { int mask = 1 << i; byte bitValue = termValue.get(i); if (bitValue == 1) { byteValue |= (-1 & mask); addExpandTerm(i+1, ord, byteValue, termValue, terms); } else if (bitValue == 0) { addExpandTerm(i+1, ord, byteValue, termValue, terms); } else { // Dont care addExpandTerm(i+1, ord, byteValue, termValue, terms); byteValue |= (-1 & mask); addExpandTerm(i+1, ord, byteValue, termValue, terms); } } else { // add the term to the term list terms.add(byteValue); } }
[ "private", "static", "void", "addExpandTerm", "(", "int", "i", ",", "int", "ord", ",", "int", "byteValue", ",", "Term", "termValue", ",", "Set", "<", "Integer", ">", "terms", ")", "{", "if", "(", "i", "<", "ord", ")", "{", "int", "mask", "=", "1", ...
Utility method to expand a term and add it to the list of results when the expansion is complete. The result terms are represented using a list of integer bit-fields, with each integer representing a term in bit-field form. This usage imposes a size limit of {@link Integer#SIZE} on the terms that can be handled by this method. @param i Shift value used in recursion. Specify 0 in initial call. @param ord Term size @param byteValue Used in recursion. Specify 0 in initial call. @param termValue The term being expanded @param terms The expanded terms represented as a set of bit-field ints
[ "Utility", "method", "to", "expand", "a", "term", "and", "add", "it", "to", "the", "list", "of", "results", "when", "the", "expansion", "is", "complete", ".", "The", "result", "terms", "are", "represented", "using", "a", "list", "of", "integer", "bit", "...
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/BooleanFormula.java#L656-L674
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteCompositeEntityAsync
public Observable<OperationStatus> deleteCompositeEntityAsync(UUID appId, String versionId, UUID cEntityId) { return deleteCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deleteCompositeEntityAsync(UUID appId, String versionId, UUID cEntityId) { return deleteCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deleteCompositeEntityAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ")", "{", "return", "deleteCompositeEntityWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "cE...
Deletes a composite entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Deletes", "a", "composite", "entity", "extractor", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4154-L4161
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.deleteAllStaticExportPublishedResources
public void deleteAllStaticExportPublishedResources(CmsRequestContext context, int linkType) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.deleteAllStaticExportPublishedResources(dbc, linkType); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DELETE_STATEXP_PUBLISHED_RESOURCES_0), e); } finally { dbc.clear(); } }
java
public void deleteAllStaticExportPublishedResources(CmsRequestContext context, int linkType) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.deleteAllStaticExportPublishedResources(dbc, linkType); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DELETE_STATEXP_PUBLISHED_RESOURCES_0), e); } finally { dbc.clear(); } }
[ "public", "void", "deleteAllStaticExportPublishedResources", "(", "CmsRequestContext", "context", ",", "int", "linkType", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try", "{", ...
Deletes all entries in the published resource table.<p> @param context the current request context @param linkType the type of resource deleted (0= non-parameter, 1=parameter) @throws CmsException if something goes wrong
[ "Deletes", "all", "entries", "in", "the", "published", "resource", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1280-L1290
biezhi/anima
src/main/java/io/github/biezhi/anima/core/AnimaCache.java
AnimaCache.getTableName
public static String getTableName(String className, String prefix) { boolean hasPrefix = prefix != null && prefix.trim().length() > 0; return hasPrefix ? English.plural(prefix + "_" + AnimaUtils.toUnderline(className), 2) : English.plural(AnimaUtils.toUnderline(className), 2); }
java
public static String getTableName(String className, String prefix) { boolean hasPrefix = prefix != null && prefix.trim().length() > 0; return hasPrefix ? English.plural(prefix + "_" + AnimaUtils.toUnderline(className), 2) : English.plural(AnimaUtils.toUnderline(className), 2); }
[ "public", "static", "String", "getTableName", "(", "String", "className", ",", "String", "prefix", ")", "{", "boolean", "hasPrefix", "=", "prefix", "!=", "null", "&&", "prefix", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ";", "return", "...
User -> users User -> t_users @param className @param prefix @return
[ "User", "-", ">", "users", "User", "-", ">", "t_users" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/core/AnimaCache.java#L79-L82
liferay/com-liferay-commerce
commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java
CommerceWishListPersistenceImpl.countByU_LtC
@Override public int countByU_LtC(long userId, Date createDate) { FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_U_LTC; Object[] finderArgs = new Object[] { userId, _getTime(createDate) }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCEWISHLIST_WHERE); query.append(_FINDER_COLUMN_U_LTC_USERID_2); boolean bindCreateDate = false; if (createDate == null) { query.append(_FINDER_COLUMN_U_LTC_CREATEDATE_1); } else { bindCreateDate = true; query.append(_FINDER_COLUMN_U_LTC_CREATEDATE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(userId); if (bindCreateDate) { qPos.add(new Timestamp(createDate.getTime())); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByU_LtC(long userId, Date createDate) { FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_U_LTC; Object[] finderArgs = new Object[] { userId, _getTime(createDate) }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCEWISHLIST_WHERE); query.append(_FINDER_COLUMN_U_LTC_USERID_2); boolean bindCreateDate = false; if (createDate == null) { query.append(_FINDER_COLUMN_U_LTC_CREATEDATE_1); } else { bindCreateDate = true; query.append(_FINDER_COLUMN_U_LTC_CREATEDATE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(userId); if (bindCreateDate) { qPos.add(new Timestamp(createDate.getTime())); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByU_LtC", "(", "long", "userId", ",", "Date", "createDate", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_WITH_PAGINATION_COUNT_BY_U_LTC", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{...
Returns the number of commerce wish lists where userId = &#63; and createDate &lt; &#63;. @param userId the user ID @param createDate the create date @return the number of matching commerce wish lists
[ "Returns", "the", "number", "of", "commerce", "wish", "lists", "where", "userId", "=", "&#63", ";", "and", "createDate", "&lt", ";", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java#L3550-L3608
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateNotEqual
public static void validateNotEqual(Object t1, Object t2, String errorMsg) throws ValidateException { if (equal(t1, t2)) { throw new ValidateException(errorMsg); } }
java
public static void validateNotEqual(Object t1, Object t2, String errorMsg) throws ValidateException { if (equal(t1, t2)) { throw new ValidateException(errorMsg); } }
[ "public", "static", "void", "validateNotEqual", "(", "Object", "t1", ",", "Object", "t2", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "equal", "(", "t1", ",", "t2", ")", ")", "{", "throw", "new", "ValidateException", "(",...
验证是否不等,相等抛出异常<br> @param t1 对象1 @param t2 对象2 @param errorMsg 错误信息 @throws ValidateException 验证异常
[ "验证是否不等,相等抛出异常<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L263-L267
advantageous/guicefx
guicefx/src/main/java/io/advantageous/guicefx/JavaFXModule.java
JavaFXModule.configure
@Override protected final void configure() { bindListener( new AbstractMatcher<TypeLiteral<?>>() { @Override public boolean matches(TypeLiteral<?> typeLiteral) { return typeLiteral.getRawType().isAnnotationPresent(Presents.class); } }, new TypeListener() { @Override public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) { final Presents presents = type.getRawType().getAnnotation(Presents.class); encounter.register((InjectionListener<I>) injectee -> { final FXMLLoader loader = new FXMLLoader(injectee.getClass().getResource(presents.value())); loader.setController(injectee); try { loader.load(); } catch (IOException e) { addError(e); throw new IllegalStateException(e); } }); } } ); bindListener( new AbstractMatcher<TypeLiteral<?>>() { @Override public boolean matches(TypeLiteral<?> typeLiteral) { return typeLiteral.getRawType().isAnnotationPresent(LoadedBy.class); } }, new TypeListener() { @Override public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) { final LoadedBy loadedBy = type.getRawType().getAnnotation(LoadedBy.class); encounter.register((InjectionListener<I>) injectee -> { final FXMLLoader loader = new FXMLLoader(injectee.getClass().getResource(loadedBy.value())); loader.setControllerFactory(aClass -> injectee); try { loader.load(); } catch (IOException e) { addError(e); throw new IllegalStateException(e); } }); } } ); configureFXApplication(); }
java
@Override protected final void configure() { bindListener( new AbstractMatcher<TypeLiteral<?>>() { @Override public boolean matches(TypeLiteral<?> typeLiteral) { return typeLiteral.getRawType().isAnnotationPresent(Presents.class); } }, new TypeListener() { @Override public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) { final Presents presents = type.getRawType().getAnnotation(Presents.class); encounter.register((InjectionListener<I>) injectee -> { final FXMLLoader loader = new FXMLLoader(injectee.getClass().getResource(presents.value())); loader.setController(injectee); try { loader.load(); } catch (IOException e) { addError(e); throw new IllegalStateException(e); } }); } } ); bindListener( new AbstractMatcher<TypeLiteral<?>>() { @Override public boolean matches(TypeLiteral<?> typeLiteral) { return typeLiteral.getRawType().isAnnotationPresent(LoadedBy.class); } }, new TypeListener() { @Override public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) { final LoadedBy loadedBy = type.getRawType().getAnnotation(LoadedBy.class); encounter.register((InjectionListener<I>) injectee -> { final FXMLLoader loader = new FXMLLoader(injectee.getClass().getResource(loadedBy.value())); loader.setControllerFactory(aClass -> injectee); try { loader.load(); } catch (IOException e) { addError(e); throw new IllegalStateException(e); } }); } } ); configureFXApplication(); }
[ "@", "Override", "protected", "final", "void", "configure", "(", ")", "{", "bindListener", "(", "new", "AbstractMatcher", "<", "TypeLiteral", "<", "?", ">", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "TypeLiteral", "<", "?", ...
Binds two listeners for classes annotated with {@link Presents} and {@link LoadedBy}. Classes annotated with {@link Presents} will be directly set as the controller for the loaded fxml. Classes annotated with {@link LoadedBy} will be used in the controller factory created by the {@link javafx.fxml.FXMLLoader}.
[ "Binds", "two", "listeners", "for", "classes", "annotated", "with", "{" ]
train
https://github.com/advantageous/guicefx/blob/03a31740298041d8fb77edc195e19945fc8b479a/guicefx/src/main/java/io/advantageous/guicefx/JavaFXModule.java#L49-L103
moparisthebest/beehive
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java
ValidatableField.setRuleArg
void setRuleArg(XmlModelWriter xw, ValidatorRule rule, int argNum, Element element, String altMessageVar) { Integer argPosition = new Integer( argNum ); ValidatorRule.MessageArg arg = rule.getArg( argPosition ); if ( arg != null || altMessageVar != null ) { String ruleName = rule.getRuleName(); Element argElementToUse = getArgElement(xw, element, argNum, ruleName, true); if ( arg != null ) { String argMessage = arg.getMessage(); String key = arg.isKey() ? argMessage : ValidatorConstants.EXPRESSION_KEY_PREFIX + argMessage; setElementAttribute(argElementToUse, "key", key); setElementAttribute(argElementToUse, "resource", true); if (arg.isKey() && _isValidatorOneOne) { setElementAttribute(argElementToUse, "bundle", rule.getBundle()); } } else { altMessageVar = "${var:" + altMessageVar + '}'; setElementAttribute(argElementToUse, "key", altMessageVar); setElementAttribute(argElementToUse, "resource", "false"); } setElementAttribute(argElementToUse, "name", ruleName); } }
java
void setRuleArg(XmlModelWriter xw, ValidatorRule rule, int argNum, Element element, String altMessageVar) { Integer argPosition = new Integer( argNum ); ValidatorRule.MessageArg arg = rule.getArg( argPosition ); if ( arg != null || altMessageVar != null ) { String ruleName = rule.getRuleName(); Element argElementToUse = getArgElement(xw, element, argNum, ruleName, true); if ( arg != null ) { String argMessage = arg.getMessage(); String key = arg.isKey() ? argMessage : ValidatorConstants.EXPRESSION_KEY_PREFIX + argMessage; setElementAttribute(argElementToUse, "key", key); setElementAttribute(argElementToUse, "resource", true); if (arg.isKey() && _isValidatorOneOne) { setElementAttribute(argElementToUse, "bundle", rule.getBundle()); } } else { altMessageVar = "${var:" + altMessageVar + '}'; setElementAttribute(argElementToUse, "key", altMessageVar); setElementAttribute(argElementToUse, "resource", "false"); } setElementAttribute(argElementToUse, "name", ruleName); } }
[ "void", "setRuleArg", "(", "XmlModelWriter", "xw", ",", "ValidatorRule", "rule", ",", "int", "argNum", ",", "Element", "element", ",", "String", "altMessageVar", ")", "{", "Integer", "argPosition", "=", "new", "Integer", "(", "argNum", ")", ";", "ValidatorRule...
Set up the desired &lt;arg&gt; element and attributes for the given rule. @param rule the rule with the message and arg information to use @param argNum the position of the arg in the message @param element a <code>&lt;field&gt;</code> element in the validation XML to update @param altMessageVar alternative message var
[ "Set", "up", "the", "desired", "&lt", ";", "arg&gt", ";", "element", "and", "attributes", "for", "the", "given", "rule", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java#L268-L297
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withCharArray
public Postcard withCharArray(@Nullable String key, @Nullable char[] value) { mBundle.putCharArray(key, value); return this; }
java
public Postcard withCharArray(@Nullable String key, @Nullable char[] value) { mBundle.putCharArray(key, value); return this; }
[ "public", "Postcard", "withCharArray", "(", "@", "Nullable", "String", "key", ",", "@", "Nullable", "char", "[", "]", "value", ")", "{", "mBundle", ".", "putCharArray", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a char array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a char array object, or null @return current
[ "Inserts", "a", "char", "array", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L507-L510
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_phone_functionKey_keyNum_PUT
public void billingAccount_line_serviceName_phone_functionKey_keyNum_PUT(String billingAccount, String serviceName, Long keyNum, OvhFunctionKey body) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/functionKey/{keyNum}"; StringBuilder sb = path(qPath, billingAccount, serviceName, keyNum); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_line_serviceName_phone_functionKey_keyNum_PUT(String billingAccount, String serviceName, Long keyNum, OvhFunctionKey body) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/functionKey/{keyNum}"; StringBuilder sb = path(qPath, billingAccount, serviceName, keyNum); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_line_serviceName_phone_functionKey_keyNum_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "keyNum", ",", "OvhFunctionKey", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/...
Alter this object properties REST: PUT /telephony/{billingAccount}/line/{serviceName}/phone/functionKey/{keyNum} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param keyNum [required] The number of the function key
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1164-L1168
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/Medias.java
Medias.getByExtension
public static synchronized List<Media> getByExtension(File jar, String fullPath, int prefixLength, String extension) { if (jar.isDirectory()) { return UtilFile.getFilesByExtension(new File(jar, fullPath), extension) .stream() .map(file -> Medias.create(file.getName())) .collect(Collectors.toList()); } final Collection<ZipEntry> entries = UtilZip.getEntriesByExtension(jar, fullPath, extension); final List<Media> medias = new ArrayList<>(entries.size()); for (final ZipEntry entry : entries) { final Media media = create(entry.getName().substring(prefixLength)); medias.add(media); } return medias; }
java
public static synchronized List<Media> getByExtension(File jar, String fullPath, int prefixLength, String extension) { if (jar.isDirectory()) { return UtilFile.getFilesByExtension(new File(jar, fullPath), extension) .stream() .map(file -> Medias.create(file.getName())) .collect(Collectors.toList()); } final Collection<ZipEntry> entries = UtilZip.getEntriesByExtension(jar, fullPath, extension); final List<Media> medias = new ArrayList<>(entries.size()); for (final ZipEntry entry : entries) { final Media media = create(entry.getName().substring(prefixLength)); medias.add(media); } return medias; }
[ "public", "static", "synchronized", "List", "<", "Media", ">", "getByExtension", "(", "File", "jar", ",", "String", "fullPath", ",", "int", "prefixLength", ",", "String", "extension", ")", "{", "if", "(", "jar", ".", "isDirectory", "(", ")", ")", "{", "r...
Get all media by extension found in the direct JAR path (does not search in sub folders). @param jar The JAR file (must not be <code>null</code>). @param fullPath The full path in JAR (must not be <code>null</code>). @param prefixLength The prefix length in JAR (must not be <code>null</code>). @param extension The extension without dot; eg: png (must not be <code>null</code>). @return The medias found. @throws LionEngineException If invalid parameters.
[ "Get", "all", "media", "by", "extension", "found", "in", "the", "direct", "JAR", "path", "(", "does", "not", "search", "in", "sub", "folders", ")", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/Medias.java#L165-L182
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/util/Util.java
Util.adjustToFirstDayOfWeek
public static LocalDate adjustToFirstDayOfWeek(LocalDate date, DayOfWeek firstDayOfWeek) { LocalDate newDate = date.with(DAY_OF_WEEK, firstDayOfWeek.getValue()); if (newDate.isAfter(date)) { newDate = newDate.minusWeeks(1); } return newDate; }
java
public static LocalDate adjustToFirstDayOfWeek(LocalDate date, DayOfWeek firstDayOfWeek) { LocalDate newDate = date.with(DAY_OF_WEEK, firstDayOfWeek.getValue()); if (newDate.isAfter(date)) { newDate = newDate.minusWeeks(1); } return newDate; }
[ "public", "static", "LocalDate", "adjustToFirstDayOfWeek", "(", "LocalDate", "date", ",", "DayOfWeek", "firstDayOfWeek", ")", "{", "LocalDate", "newDate", "=", "date", ".", "with", "(", "DAY_OF_WEEK", ",", "firstDayOfWeek", ".", "getValue", "(", ")", ")", ";", ...
Adjusts the given date to a new date that marks the beginning of the week where the given date is located. If "Monday" is the first day of the week and the given date is a "Wednesday" then this method will return a date that is two days earlier than the given date. @param date the date to adjust @param firstDayOfWeek the day of week that is considered the start of the week ("Monday" in Germany, "Sunday" in the US) @return the date of the first day of the week @see #adjustToLastDayOfWeek(LocalDate, DayOfWeek) @see DateControl#getFirstDayOfWeek()
[ "Adjusts", "the", "given", "date", "to", "a", "new", "date", "that", "marks", "the", "beginning", "of", "the", "week", "where", "the", "given", "date", "is", "located", ".", "If", "Monday", "is", "the", "first", "day", "of", "the", "week", "and", "the"...
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/util/Util.java#L272-L279
rainu/dbc
src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java
MetadataManager.getTableMetadata
public TableMetadata getTableMetadata(String tableName){ if(tableName == null) return null; try { tableMetadataStatement.setInt(1, tableName.hashCode()); ResultSet set = tableMetadataStatement.executeQuery(); return transformToTableMetadata(set); } catch (SQLException e) { throw new BackendException("Could not get TableMetadata for table '" + tableName + "'", e); } }
java
public TableMetadata getTableMetadata(String tableName){ if(tableName == null) return null; try { tableMetadataStatement.setInt(1, tableName.hashCode()); ResultSet set = tableMetadataStatement.executeQuery(); return transformToTableMetadata(set); } catch (SQLException e) { throw new BackendException("Could not get TableMetadata for table '" + tableName + "'", e); } }
[ "public", "TableMetadata", "getTableMetadata", "(", "String", "tableName", ")", "{", "if", "(", "tableName", "==", "null", ")", "return", "null", ";", "try", "{", "tableMetadataStatement", ".", "setInt", "(", "1", ",", "tableName", ".", "hashCode", "(", ")",...
Liefert die Metadaten der gegebenen Tabelle. @param tableName Name der Tabelle, deren Metadaten ermitetelt werden soll. @return <b>Null</b> wenn keine Daten gefunden werden konnten. ANdernfals die entsprechenden Metadaten.
[ "Liefert", "die", "Metadaten", "der", "gegebenen", "Tabelle", "." ]
train
https://github.com/rainu/dbc/blob/bdf1d1945ccaa8db8ed0b91bd08d5ef9802777f7/src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java#L87-L98
eurekaclinical/eurekaclinical-common
src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java
EurekaClinicalClient.doGet
protected <T> T doGet(String path, MultivaluedMap<String, String> queryParams, GenericType<T> genericType) throws ClientException { return doGet(path, queryParams, genericType, null); }
java
protected <T> T doGet(String path, MultivaluedMap<String, String> queryParams, GenericType<T> genericType) throws ClientException { return doGet(path, queryParams, genericType, null); }
[ "protected", "<", "T", ">", "T", "doGet", "(", "String", "path", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "queryParams", ",", "GenericType", "<", "T", ">", "genericType", ")", "throws", "ClientException", "{", "return", "doGet", "(", "path...
Gets the requested resource. Adds an appropriate Accepts header. @param <T> the type of the requested resource. @param path the path to the resource. @param queryParams any query parameters to send. @param genericType the type of the requested resource. @return the requested resource. @throws ClientException if a status code other than 200 (OK) is returned.
[ "Gets", "the", "requested", "resource", ".", "Adds", "an", "appropriate", "Accepts", "header", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L398-L400
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/xml/stream/IndentingXMLEventWriter.java
IndentingXMLEventWriter.getIndent
protected String getIndent(int depth, int size) { final int length = depth * size; String indent = indentCache.get(length); if (indent == null) { indent = getLineSeparator() + StringUtils.repeat(" ", length); indentCache.put(length, indent); } return indent; }
java
protected String getIndent(int depth, int size) { final int length = depth * size; String indent = indentCache.get(length); if (indent == null) { indent = getLineSeparator() + StringUtils.repeat(" ", length); indentCache.put(length, indent); } return indent; }
[ "protected", "String", "getIndent", "(", "int", "depth", ",", "int", "size", ")", "{", "final", "int", "length", "=", "depth", "*", "size", ";", "String", "indent", "=", "indentCache", ".", "get", "(", "length", ")", ";", "if", "(", "indent", "==", "...
Generate an indentation string for the specified depth and indent size
[ "Generate", "an", "indentation", "string", "for", "the", "specified", "depth", "and", "indent", "size" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/xml/stream/IndentingXMLEventWriter.java#L199-L207
google/closure-compiler
src/com/google/javascript/jscomp/Promises.java
Promises.getTemplateTypeOfThenable
static final JSType getTemplateTypeOfThenable(JSTypeRegistry registry, JSType maybeThenable) { return maybeThenable // Without ".restrictByNotNullOrUndefined" we'd get the unknown type for "?IThenable<null>" .restrictByNotNullOrUndefined() .getInstantiatedTypeArgument(registry.getNativeType(JSTypeNative.I_THENABLE_TYPE)); }
java
static final JSType getTemplateTypeOfThenable(JSTypeRegistry registry, JSType maybeThenable) { return maybeThenable // Without ".restrictByNotNullOrUndefined" we'd get the unknown type for "?IThenable<null>" .restrictByNotNullOrUndefined() .getInstantiatedTypeArgument(registry.getNativeType(JSTypeNative.I_THENABLE_TYPE)); }
[ "static", "final", "JSType", "getTemplateTypeOfThenable", "(", "JSTypeRegistry", "registry", ",", "JSType", "maybeThenable", ")", "{", "return", "maybeThenable", "// Without \".restrictByNotNullOrUndefined\" we'd get the unknown type for \"?IThenable<null>\"", ".", "restrictByNotNull...
If this object is known to be an IThenable, returns the type it resolves to. <p>Returns unknown otherwise. <p>(This is different from {@code getResolvedType}, which will attempt to model the then type of an expression after calling Promise.resolve() on it.
[ "If", "this", "object", "is", "known", "to", "be", "an", "IThenable", "returns", "the", "type", "it", "resolves", "to", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Promises.java#L46-L51
apereo/cas
core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/AbstractWebApplicationServiceResponseBuilder.java
AbstractWebApplicationServiceResponseBuilder.buildHeader
protected Response buildHeader(final WebApplicationService service, final Map<String, String> parameters) { return DefaultResponse.getHeaderResponse(service.getOriginalUrl(), parameters); }
java
protected Response buildHeader(final WebApplicationService service, final Map<String, String> parameters) { return DefaultResponse.getHeaderResponse(service.getOriginalUrl(), parameters); }
[ "protected", "Response", "buildHeader", "(", "final", "WebApplicationService", "service", ",", "final", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "return", "DefaultResponse", ".", "getHeaderResponse", "(", "service", ".", "getOriginalUrl", ...
Build header response. @param service the service @param parameters the parameters @return the response
[ "Build", "header", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/AbstractWebApplicationServiceResponseBuilder.java#L55-L57
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java
AddThenHideOldStrategy.getMinAndMaxAppliesToVersionFromAppliesTo
private MinAndMaxVersion getMinAndMaxAppliesToVersionFromAppliesTo(String appliesTo) { List<AppliesToFilterInfo> res1Filters = AppliesToProcessor.parseAppliesToHeader(appliesTo); Version4Digit highestVersion = null; Version4Digit lowestVersion = null; for (AppliesToFilterInfo f : res1Filters) { Version4Digit vHigh = (f.getMaxVersion() == null) ? MAX_VERSION : new Version4Digit(f.getMaxVersion().getValue()); Version4Digit vLow = (f.getMinVersion() == null) ? MIN_VERSION : new Version4Digit(f.getMinVersion().getValue()); if (highestVersion == null || vHigh.compareTo(highestVersion) > 0) { highestVersion = vHigh; lowestVersion = vLow; } else if (vHigh.compareTo(highestVersion) == 0) { if (lowestVersion == null || vLow.compareTo(lowestVersion) > 0) { highestVersion = vHigh; lowestVersion = vLow; } } } return new MinAndMaxVersion(lowestVersion, highestVersion); }
java
private MinAndMaxVersion getMinAndMaxAppliesToVersionFromAppliesTo(String appliesTo) { List<AppliesToFilterInfo> res1Filters = AppliesToProcessor.parseAppliesToHeader(appliesTo); Version4Digit highestVersion = null; Version4Digit lowestVersion = null; for (AppliesToFilterInfo f : res1Filters) { Version4Digit vHigh = (f.getMaxVersion() == null) ? MAX_VERSION : new Version4Digit(f.getMaxVersion().getValue()); Version4Digit vLow = (f.getMinVersion() == null) ? MIN_VERSION : new Version4Digit(f.getMinVersion().getValue()); if (highestVersion == null || vHigh.compareTo(highestVersion) > 0) { highestVersion = vHigh; lowestVersion = vLow; } else if (vHigh.compareTo(highestVersion) == 0) { if (lowestVersion == null || vLow.compareTo(lowestVersion) > 0) { highestVersion = vHigh; lowestVersion = vLow; } } } return new MinAndMaxVersion(lowestVersion, highestVersion); }
[ "private", "MinAndMaxVersion", "getMinAndMaxAppliesToVersionFromAppliesTo", "(", "String", "appliesTo", ")", "{", "List", "<", "AppliesToFilterInfo", ">", "res1Filters", "=", "AppliesToProcessor", ".", "parseAppliesToHeader", "(", "appliesTo", ")", ";", "Version4Digit", "...
Parse an appliesTo to get the lowest and highest version that this asset applies to and return an object describing this. @param apliesTo the appliesTo String @return MinAndMaxVersion object describing the range of levels supported
[ "Parse", "an", "appliesTo", "to", "get", "the", "lowest", "and", "highest", "version", "that", "this", "asset", "applies", "to", "and", "return", "an", "object", "describing", "this", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java#L407-L426
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/model/Project.java
Project.getEntityBySchemaAndTableName
public Entity getEntityBySchemaAndTableName(String schemaName, String tableName) { return currentEntitiesBySchemaAndTableName.get(Table.keyForMap(schemaName, tableName)); }
java
public Entity getEntityBySchemaAndTableName(String schemaName, String tableName) { return currentEntitiesBySchemaAndTableName.get(Table.keyForMap(schemaName, tableName)); }
[ "public", "Entity", "getEntityBySchemaAndTableName", "(", "String", "schemaName", ",", "String", "tableName", ")", "{", "return", "currentEntitiesBySchemaAndTableName", ".", "get", "(", "Table", ".", "keyForMap", "(", "schemaName", ",", "tableName", ")", ")", ";", ...
Return the entity corresponding to the passed table. In case of inheritance, the root entity is returned.
[ "Return", "the", "entity", "corresponding", "to", "the", "passed", "table", ".", "In", "case", "of", "inheritance", "the", "root", "entity", "is", "returned", "." ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/model/Project.java#L151-L153
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.rotateSmall
public void rotateSmall(PointF center1, PointF center2) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "rotateSmall("+center1+", "+center2+")"); } if (android.os.Build.VERSION.SDK_INT < 14){ throw new RuntimeException("rotateSmall(PointF center1, PointF center2) requires API level >= 14"); } rotator.generateRotateGesture(Rotator.SMALL, center1, center2); }
java
public void rotateSmall(PointF center1, PointF center2) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "rotateSmall("+center1+", "+center2+")"); } if (android.os.Build.VERSION.SDK_INT < 14){ throw new RuntimeException("rotateSmall(PointF center1, PointF center2) requires API level >= 14"); } rotator.generateRotateGesture(Rotator.SMALL, center1, center2); }
[ "public", "void", "rotateSmall", "(", "PointF", "center1", ",", "PointF", "center2", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"rotateSmall(\"", "+", "center1", "+", "\"...
Draws two semi-circles at the specified centers. Both circles are smaller than rotateLarge(). Requires API level >= 14. @param center1 Center of semi-circle drawn from [0, Pi] @param center2 Center of semi-circle drawn from [Pi, 3*Pi]
[ "Draws", "two", "semi", "-", "circles", "at", "the", "specified", "centers", ".", "Both", "circles", "are", "smaller", "than", "rotateLarge", "()", ".", "Requires", "API", "level", ">", "=", "14", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2469-L2479
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithProvider.java
PactDslWithProvider.given
public PactDslWithState given(String state) { return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName, new ProviderState(state), defaultRequestValues, defaultResponseValues); }
java
public PactDslWithState given(String state) { return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName, new ProviderState(state), defaultRequestValues, defaultResponseValues); }
[ "public", "PactDslWithState", "given", "(", "String", "state", ")", "{", "return", "new", "PactDslWithState", "(", "consumerPactBuilder", ",", "consumerPactBuilder", ".", "getConsumerName", "(", ")", ",", "providerName", ",", "new", "ProviderState", "(", "state", ...
Describe the state the provider needs to be in for the pact test to be verified. @param state Provider state
[ "Describe", "the", "state", "the", "provider", "needs", "to", "be", "in", "for", "the", "pact", "test", "to", "be", "verified", "." ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithProvider.java#L26-L29
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.getObject
public InputStream getObject(String bucketName, String objectName, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException { if ((sse.getType() == ServerSideEncryption.Type.SSE_S3) || (sse.getType() == ServerSideEncryption.Type.SSE_KMS)) { throw new InvalidArgumentException("Invalid encryption option specified for encryption type " + sse.getType()); } else if ((sse.getType() == ServerSideEncryption.Type.SSE_C) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_C provided keys must be made over a secure connection."); } Map<String, String> headers = new HashMap<>(); sse.marshal(headers); HttpResponse response = executeGet(bucketName, objectName, headers, null); return response.body().byteStream(); }
java
public InputStream getObject(String bucketName, String objectName, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException { if ((sse.getType() == ServerSideEncryption.Type.SSE_S3) || (sse.getType() == ServerSideEncryption.Type.SSE_KMS)) { throw new InvalidArgumentException("Invalid encryption option specified for encryption type " + sse.getType()); } else if ((sse.getType() == ServerSideEncryption.Type.SSE_C) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_C provided keys must be made over a secure connection."); } Map<String, String> headers = new HashMap<>(); sse.marshal(headers); HttpResponse response = executeGet(bucketName, objectName, headers, null); return response.body().byteStream(); }
[ "public", "InputStream", "getObject", "(", "String", "bucketName", ",", "String", "objectName", ",", "ServerSideEncryption", "sse", ")", "throws", "InvalidBucketNameException", ",", "NoSuchAlgorithmException", ",", "InsufficientDataException", ",", "IOException", ",", "In...
Gets entire object's data as {@link InputStream} in given bucket. The InputStream must be closed after use else the connection will remain open. <p><b>Example:</b> <pre>{@code InputStream stream = minioClient.getObject("my-bucketname", "my-objectname", sse); byte[] buf = new byte[16384]; int bytesRead; while ((bytesRead = stream.read(buf, 0, buf.length)) >= 0) { System.out.println(new String(buf, 0, bytesRead)); } stream.close(); }</pre> @param bucketName Bucket name. @param objectName Object name in the bucket. @param sse Encryption metadata only required for SSE-C. @return {@link InputStream} containing the object data. @throws InvalidBucketNameException upon invalid bucket name is given @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation @throws InsufficientDataException upon getting EOFException while reading given InputStream even before reading given length @throws IOException upon connection error @throws InvalidKeyException upon an invalid access key or secret key @throws NoResponseException upon no response from server @throws XmlPullParserException upon parsing response xml @throws ErrorResponseException upon unsuccessful execution @throws InternalException upon internal library error @throws InvalidArgumentException upon invalid value is passed to a method.
[ "Gets", "entire", "object", "s", "data", "as", "{", "@link", "InputStream", "}", "in", "given", "bucket", ".", "The", "InputStream", "must", "be", "closed", "after", "use", "else", "the", "connection", "will", "remain", "open", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1753-L1767
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLUtils.java
XMLUtils.addOrSetAttribute
public static void addOrSetAttribute(final AttributesImpl atts, final QName name, final String value) { addOrSetAttribute(atts, name.getNamespaceURI(), name.getLocalPart(), name.getPrefix() + ":" + name.getLocalPart(), "CDATA", value); }
java
public static void addOrSetAttribute(final AttributesImpl atts, final QName name, final String value) { addOrSetAttribute(atts, name.getNamespaceURI(), name.getLocalPart(), name.getPrefix() + ":" + name.getLocalPart(), "CDATA", value); }
[ "public", "static", "void", "addOrSetAttribute", "(", "final", "AttributesImpl", "atts", ",", "final", "QName", "name", ",", "final", "String", "value", ")", "{", "addOrSetAttribute", "(", "atts", ",", "name", ".", "getNamespaceURI", "(", ")", ",", "name", "...
Add or set attribute. Convenience method for {@link #addOrSetAttribute(AttributesImpl, String, String, String, String, String)}. @param atts attributes @param name name @param value attribute value
[ "Add", "or", "set", "attribute", ".", "Convenience", "method", "for", "{", "@link", "#addOrSetAttribute", "(", "AttributesImpl", "String", "String", "String", "String", "String", ")", "}", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLUtils.java#L369-L371
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/BaseQueryRequest.java
BaseQueryRequest.setNamedBindings
public void setNamedBindings(Map<String, Object> namedBindings) { if (namedBindings == null) { throw new IllegalArgumentException("namedBindings cannot be null"); } this.namedBindings = namedBindings; }
java
public void setNamedBindings(Map<String, Object> namedBindings) { if (namedBindings == null) { throw new IllegalArgumentException("namedBindings cannot be null"); } this.namedBindings = namedBindings; }
[ "public", "void", "setNamedBindings", "(", "Map", "<", "String", ",", "Object", ">", "namedBindings", ")", "{", "if", "(", "namedBindings", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"namedBindings cannot be null\"", ")", ";", "}"...
Sets the named bindings that are needed for any named parameters in the GQL query. @param namedBindings the named bindings. @throws NullPointerException if the <code>namedBindings</code> argument is <code>null</code>.
[ "Sets", "the", "named", "bindings", "that", "are", "needed", "for", "any", "named", "parameters", "in", "the", "GQL", "query", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/BaseQueryRequest.java#L95-L100
lucee/Lucee
core/src/main/java/lucee/transformer/bytecode/util/ExpressionUtil.java
ExpressionUtil.writeOutSilent
public static void writeOutSilent(Expression value, BytecodeContext bc, int mode) throws TransformerException { Position start = value.getStart(); Position end = value.getEnd(); value.setStart(null); value.setEnd(null); value.writeOut(bc, mode); value.setStart(start); value.setEnd(end); }
java
public static void writeOutSilent(Expression value, BytecodeContext bc, int mode) throws TransformerException { Position start = value.getStart(); Position end = value.getEnd(); value.setStart(null); value.setEnd(null); value.writeOut(bc, mode); value.setStart(start); value.setEnd(end); }
[ "public", "static", "void", "writeOutSilent", "(", "Expression", "value", ",", "BytecodeContext", "bc", ",", "int", "mode", ")", "throws", "TransformerException", "{", "Position", "start", "=", "value", ".", "getStart", "(", ")", ";", "Position", "end", "=", ...
write out expression without LNT @param value @param bc @param mode @throws TransformerException
[ "write", "out", "expression", "without", "LNT" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/util/ExpressionUtil.java#L105-L113
Azure/azure-sdk-for-java
locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java
ManagementLocksInner.getByResourceGroup
public ManagementLockObjectInner getByResourceGroup(String resourceGroupName, String lockName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, lockName).toBlocking().single().body(); }
java
public ManagementLockObjectInner getByResourceGroup(String resourceGroupName, String lockName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, lockName).toBlocking().single().body(); }
[ "public", "ManagementLockObjectInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "lockName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "lockName", ")", ".", "toBlocking", "(", ")", ".", ...
Gets a management lock at the resource group level. @param resourceGroupName The name of the locked resource group. @param lockName The name of the lock to get. @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 ManagementLockObjectInner object if successful.
[ "Gets", "a", "management", "lock", "at", "the", "resource", "group", "level", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L339-L341
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/BaseLevel1.java
BaseLevel1.rotmg
@Override public void rotmg(INDArray d1, INDArray d2, INDArray b1, double b2, INDArray P) { throw new UnsupportedOperationException(); }
java
@Override public void rotmg(INDArray d1, INDArray d2, INDArray b1, double b2, INDArray P) { throw new UnsupportedOperationException(); }
[ "@", "Override", "public", "void", "rotmg", "(", "INDArray", "d1", ",", "INDArray", "d2", ",", "INDArray", "b1", ",", "double", "b2", ",", "INDArray", "P", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}" ]
computes the modified parameters for a Givens rotation. @param d1 @param d2 @param b1 @param b2 @param P
[ "computes", "the", "modified", "parameters", "for", "a", "Givens", "rotation", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/BaseLevel1.java#L407-L410
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/PropertiesAdapter.java
PropertiesAdapter.getAsType
public <T> T getAsType(String propertyName, Class<T> type, T defaultValue) { return defaultIfNotSet(propertyName, defaultValue, type); }
java
public <T> T getAsType(String propertyName, Class<T> type, T defaultValue) { return defaultIfNotSet(propertyName, defaultValue, type); }
[ "public", "<", "T", ">", "T", "getAsType", "(", "String", "propertyName", ",", "Class", "<", "T", ">", "type", ",", "T", "defaultValue", ")", "{", "return", "defaultIfNotSet", "(", "propertyName", ",", "defaultValue", ",", "type", ")", ";", "}" ]
Gets the assigned value of the named property as an instance of the specified {@link Class} type or the default value if the named property does not exist. @param <T> {@link Class} type of the return value. @param propertyName the name of the property to get. @param type Class type of the value to return for the specified property. @param defaultValue the default value to return if the named property does not exist. @return the assigned value of the named property as an instance of the specified {@link Class} type or the default value if the named property does not exist. @see #defaultIfNotSet(String, Object, Class) @see java.lang.Class
[ "Gets", "the", "assigned", "value", "of", "the", "named", "property", "as", "an", "instance", "of", "the", "specified", "{", "@link", "Class", "}", "type", "or", "the", "default", "value", "if", "the", "named", "property", "does", "not", "exist", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/PropertiesAdapter.java#L260-L262
marvinlabs/android-floatinglabel-widgets
library/src/main/java/com/marvinlabs/widget/floatinglabel/FloatingLabelWidgetBase.java
FloatingLabelWidgetBase.inflateWidgetLayout
private void inflateWidgetLayout(Context context, int layoutId) { inflate(context, layoutId, this); floatingLabel = (TextView) findViewById(R.id.flw_floating_label); if (floatingLabel == null) { throw new RuntimeException("Your layout must have a TextView whose ID is @id/flw_floating_label"); } View iw = findViewById(R.id.flw_input_widget); if (iw == null) { throw new RuntimeException("Your layout must have an input widget whose ID is @id/flw_input_widget"); } try { inputWidget = (InputWidgetT) iw; } catch (ClassCastException e) { throw new RuntimeException("The input widget is not of the expected type"); } }
java
private void inflateWidgetLayout(Context context, int layoutId) { inflate(context, layoutId, this); floatingLabel = (TextView) findViewById(R.id.flw_floating_label); if (floatingLabel == null) { throw new RuntimeException("Your layout must have a TextView whose ID is @id/flw_floating_label"); } View iw = findViewById(R.id.flw_input_widget); if (iw == null) { throw new RuntimeException("Your layout must have an input widget whose ID is @id/flw_input_widget"); } try { inputWidget = (InputWidgetT) iw; } catch (ClassCastException e) { throw new RuntimeException("The input widget is not of the expected type"); } }
[ "private", "void", "inflateWidgetLayout", "(", "Context", "context", ",", "int", "layoutId", ")", "{", "inflate", "(", "context", ",", "layoutId", ",", "this", ")", ";", "floatingLabel", "=", "(", "TextView", ")", "findViewById", "(", "R", ".", "id", ".", ...
Inflate the widget layout and make sure we have everything in there @param context The context @param layoutId The id of the layout to inflate
[ "Inflate", "the", "widget", "layout", "and", "make", "sure", "we", "have", "everything", "in", "there" ]
train
https://github.com/marvinlabs/android-floatinglabel-widgets/blob/bb89889f1e75ed9b228b77d3ba895ceeeb41fe4f/library/src/main/java/com/marvinlabs/widget/floatinglabel/FloatingLabelWidgetBase.java#L605-L622
neoremind/fluent-validator
fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/QuickValidator.java
QuickValidator.doAndGetComplexResult
public static ComplexResult doAndGetComplexResult(Decorator decorator) { return validate(decorator, FluentValidator.checkAll(), null, ResultCollectors.toComplex()); }
java
public static ComplexResult doAndGetComplexResult(Decorator decorator) { return validate(decorator, FluentValidator.checkAll(), null, ResultCollectors.toComplex()); }
[ "public", "static", "ComplexResult", "doAndGetComplexResult", "(", "Decorator", "decorator", ")", "{", "return", "validate", "(", "decorator", ",", "FluentValidator", ".", "checkAll", "(", ")", ",", "null", ",", "ResultCollectors", ".", "toComplex", "(", ")", ")...
Execute validation by using a new FluentValidator instance without a shared context. The result type is {@link ComplexResult} @param decorator Same as decorator design pattern, provided to add more functions to the fluentValidator @param context Validation context which can be shared @return ComplexResult
[ "Execute", "validation", "by", "using", "a", "new", "FluentValidator", "instance", "without", "a", "shared", "context", ".", "The", "result", "type", "is", "{", "@link", "ComplexResult", "}" ]
train
https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/QuickValidator.java#L39-L41
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.setLookAt
public Matrix4d setLookAt(Vector3dc eye, Vector3dc center, Vector3dc up) { return setLookAt(eye.x(), eye.y(), eye.z(), center.x(), center.y(), center.z(), up.x(), up.y(), up.z()); }
java
public Matrix4d setLookAt(Vector3dc eye, Vector3dc center, Vector3dc up) { return setLookAt(eye.x(), eye.y(), eye.z(), center.x(), center.y(), center.z(), up.x(), up.y(), up.z()); }
[ "public", "Matrix4d", "setLookAt", "(", "Vector3dc", "eye", ",", "Vector3dc", "center", ",", "Vector3dc", "up", ")", "{", "return", "setLookAt", "(", "eye", ".", "x", "(", ")", ",", "eye", ".", "y", "(", ")", ",", "eye", ".", "z", "(", ")", ",", ...
Set this matrix to be a "lookat" transformation for a right-handed coordinate system, that aligns <code>-z</code> with <code>center - eye</code>. <p> In order to not make use of vectors to specify <code>eye</code>, <code>center</code> and <code>up</code> but use primitives, like in the GLU function, use {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt()} instead. <p> In order to apply the lookat transformation to a previous existing transformation, use {@link #lookAt(Vector3dc, Vector3dc, Vector3dc) lookAt()}. @see #setLookAt(double, double, double, double, double, double, double, double, double) @see #lookAt(Vector3dc, Vector3dc, Vector3dc) @param eye the position of the camera @param center the point in space to look at @param up the direction of 'up' @return this
[ "Set", "this", "matrix", "to", "be", "a", "lookat", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "that", "aligns", "<code", ">", "-", "z<", "/", "code", ">", "with", "<code", ">", "center", "-", "eye<", "/", "code", ">"...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L11114-L11116
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java
TypeConverter.convertToByte
public static byte convertToByte (@Nonnull final Object aSrcValue) { if (aSrcValue == null) throw new TypeConverterException (byte.class, EReason.NULL_SOURCE_NOT_ALLOWED); final Byte aValue = convert (aSrcValue, Byte.class); return aValue.byteValue (); }
java
public static byte convertToByte (@Nonnull final Object aSrcValue) { if (aSrcValue == null) throw new TypeConverterException (byte.class, EReason.NULL_SOURCE_NOT_ALLOWED); final Byte aValue = convert (aSrcValue, Byte.class); return aValue.byteValue (); }
[ "public", "static", "byte", "convertToByte", "(", "@", "Nonnull", "final", "Object", "aSrcValue", ")", "{", "if", "(", "aSrcValue", "==", "null", ")", "throw", "new", "TypeConverterException", "(", "byte", ".", "class", ",", "EReason", ".", "NULL_SOURCE_NOT_AL...
Convert the passed source value to byte @param aSrcValue The source value. May not be <code>null</code>. @return The converted value. @throws TypeConverterException if the source value is <code>null</code> or if no converter was found or if the converter returned a <code>null</code> object. @throws RuntimeException If the converter itself throws an exception @see TypeConverterProviderBestMatch
[ "Convert", "the", "passed", "source", "value", "to", "byte" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L154-L160
OpenLiberty/open-liberty
dev/com.ibm.ws.management.j2ee.mejb/src/com/ibm/ws/management/j2ee/mejb/ManagementEJB.java
ManagementEJB.setAttributes
public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException { AttributeList a = getMBeanServer().setAttributes(name, attributes); return a; }
java
public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException { AttributeList a = getMBeanServer().setAttributes(name, attributes); return a; }
[ "public", "AttributeList", "setAttributes", "(", "ObjectName", "name", ",", "AttributeList", "attributes", ")", "throws", "InstanceNotFoundException", ",", "ReflectionException", "{", "AttributeList", "a", "=", "getMBeanServer", "(", ")", ".", "setAttributes", "(", "n...
/* Sets the values of several attributes of a named managed object. The managed object is identified by its object name. Throws: javax.management.InstanceNotFoundException javax.management.ReflectionException java.rmi.RemoteException Parameters: name - The object name of the managed object within which the attributes are to be set. attributes - A list of attributes: The identification of the attributes to be set and the values they are to be set to. Returns: The list of attributes that were set, with their new values.
[ "/", "*", "Sets", "the", "values", "of", "several", "attributes", "of", "a", "named", "managed", "object", ".", "The", "managed", "object", "is", "identified", "by", "its", "object", "name", ".", "Throws", ":", "javax", ".", "management", ".", "InstanceNot...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.j2ee.mejb/src/com/ibm/ws/management/j2ee/mejb/ManagementEJB.java#L244-L250
Stratio/deep-spark
deep-cassandra/src/main/java/com/stratio/deep/cassandra/thrift/ThriftRangeUtils.java
ThriftRangeUtils.getSplits
public List<DeepTokenRange> getSplits(DeepTokenRange deepTokenRange) { String start = tokenAsString((Comparable) deepTokenRange.getStartToken()); String end = tokenAsString((Comparable) deepTokenRange.getEndToken()); List<String> endpoints = deepTokenRange.getReplicas(); for (String endpoint : endpoints) { try { ThriftClient client = ThriftClient.build(endpoint, rpcPort, keyspace); List<CfSplit> splits = client.describe_splits_ex(columnFamily, start, end, splitSize); client.close(); return deepTokenRanges(splits, endpoints); } catch (TException e) { LOG.warn("Endpoint %s failed while splitting range %s", endpoint, deepTokenRange); } } throw new DeepGenericException("No available replicas for splitting range " + deepTokenRange); }
java
public List<DeepTokenRange> getSplits(DeepTokenRange deepTokenRange) { String start = tokenAsString((Comparable) deepTokenRange.getStartToken()); String end = tokenAsString((Comparable) deepTokenRange.getEndToken()); List<String> endpoints = deepTokenRange.getReplicas(); for (String endpoint : endpoints) { try { ThriftClient client = ThriftClient.build(endpoint, rpcPort, keyspace); List<CfSplit> splits = client.describe_splits_ex(columnFamily, start, end, splitSize); client.close(); return deepTokenRanges(splits, endpoints); } catch (TException e) { LOG.warn("Endpoint %s failed while splitting range %s", endpoint, deepTokenRange); } } throw new DeepGenericException("No available replicas for splitting range " + deepTokenRange); }
[ "public", "List", "<", "DeepTokenRange", ">", "getSplits", "(", "DeepTokenRange", "deepTokenRange", ")", "{", "String", "start", "=", "tokenAsString", "(", "(", "Comparable", ")", "deepTokenRange", ".", "getStartToken", "(", ")", ")", ";", "String", "end", "="...
Returns the computed token range splits of the specified token range. @param deepTokenRange the token range to be splitted. @return the list of token range splits, which are also token ranges.
[ "Returns", "the", "computed", "token", "range", "splits", "of", "the", "specified", "token", "range", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/thrift/ThriftRangeUtils.java#L160-L177
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentValueSequence.java
CmsXmlContentValueSequence.addValue
public I_CmsXmlContentValue addValue(CmsObject cms, I_CmsXmlSchemaType type, int index) { String xpath = CmsXmlUtils.concatXpath(CmsXmlUtils.removeLastXpathElement(getPath()), type.getName()); return addValue(cms, xpath, index); }
java
public I_CmsXmlContentValue addValue(CmsObject cms, I_CmsXmlSchemaType type, int index) { String xpath = CmsXmlUtils.concatXpath(CmsXmlUtils.removeLastXpathElement(getPath()), type.getName()); return addValue(cms, xpath, index); }
[ "public", "I_CmsXmlContentValue", "addValue", "(", "CmsObject", "cms", ",", "I_CmsXmlSchemaType", "type", ",", "int", "index", ")", "{", "String", "xpath", "=", "CmsXmlUtils", ".", "concatXpath", "(", "CmsXmlUtils", ".", "removeLastXpathElement", "(", "getPath", "...
Adds a value element of the given type at the selected index to the XML content document.<p> @param cms the current users OpenCms context @param type the type to add @param index the index where to add the new value element @return the added XML content value element @see CmsXmlContent#addValue(CmsObject, String, Locale, int) @see #addValue(CmsObject, String, int) @see #addValue(CmsObject, int)
[ "Adds", "a", "value", "element", "of", "the", "given", "type", "at", "the", "selected", "index", "to", "the", "XML", "content", "document", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentValueSequence.java#L111-L115
Azure/azure-sdk-for-java
cognitiveservices/data-plane/search/bingvideosearch/src/main/java/com/microsoft/azure/cognitiveservices/search/videosearch/implementation/BingVideosImpl.java
BingVideosImpl.detailsAsync
public Observable<VideoDetails> detailsAsync(String query, DetailsOptionalParameter detailsOptionalParameter) { return detailsWithServiceResponseAsync(query, detailsOptionalParameter).map(new Func1<ServiceResponse<VideoDetails>, VideoDetails>() { @Override public VideoDetails call(ServiceResponse<VideoDetails> response) { return response.body(); } }); }
java
public Observable<VideoDetails> detailsAsync(String query, DetailsOptionalParameter detailsOptionalParameter) { return detailsWithServiceResponseAsync(query, detailsOptionalParameter).map(new Func1<ServiceResponse<VideoDetails>, VideoDetails>() { @Override public VideoDetails call(ServiceResponse<VideoDetails> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VideoDetails", ">", "detailsAsync", "(", "String", "query", ",", "DetailsOptionalParameter", "detailsOptionalParameter", ")", "{", "return", "detailsWithServiceResponseAsync", "(", "query", ",", "detailsOptionalParameter", ")", ".", "map", ...
The Video Detail Search API lets you search on Bing and get back insights about a video, such as related videos. This section provides technical details about the query parameters and headers that you use to request insights of videos and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web). @param query The user's search query string. The query string cannot be empty. The query string may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit videos to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this parameter only with the Video Search API. Do not specify this parameter when calling the Trending Videos API. @param detailsOptionalParameter 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 VideoDetails object
[ "The", "Video", "Detail", "Search", "API", "lets", "you", "search", "on", "Bing", "and", "get", "back", "insights", "about", "a", "video", "such", "as", "related", "videos", ".", "This", "section", "provides", "technical", "details", "about", "the", "query",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingvideosearch/src/main/java/com/microsoft/azure/cognitiveservices/search/videosearch/implementation/BingVideosImpl.java#L418-L425
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/model/Tile.java
Tile.getLeft
public Tile getLeft() { int x = tileX - 1; if (x < 0) { x = getMaxTileNumber(this.zoomLevel); } return new Tile(x, this.tileY, this.zoomLevel, this.tileSize); }
java
public Tile getLeft() { int x = tileX - 1; if (x < 0) { x = getMaxTileNumber(this.zoomLevel); } return new Tile(x, this.tileY, this.zoomLevel, this.tileSize); }
[ "public", "Tile", "getLeft", "(", ")", "{", "int", "x", "=", "tileX", "-", "1", ";", "if", "(", "x", "<", "0", ")", "{", "x", "=", "getMaxTileNumber", "(", "this", ".", "zoomLevel", ")", ";", "}", "return", "new", "Tile", "(", "x", ",", "this",...
Returns the tile to the left of this tile. @return tile to the left.
[ "Returns", "the", "tile", "to", "the", "left", "of", "this", "tile", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/Tile.java#L241-L247
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.isPointNearPoint
public static boolean isPointNearPoint(LatLng point, LatLng shapePoint, double tolerance) { return SphericalUtil.computeDistanceBetween(point, shapePoint) <= tolerance; }
java
public static boolean isPointNearPoint(LatLng point, LatLng shapePoint, double tolerance) { return SphericalUtil.computeDistanceBetween(point, shapePoint) <= tolerance; }
[ "public", "static", "boolean", "isPointNearPoint", "(", "LatLng", "point", ",", "LatLng", "shapePoint", ",", "double", "tolerance", ")", "{", "return", "SphericalUtil", ".", "computeDistanceBetween", "(", "point", ",", "shapePoint", ")", "<=", "tolerance", ";", ...
Is the point near the shape point @param point point @param shapePoint shape point @param tolerance distance tolerance @return true if near
[ "Is", "the", "point", "near", "the", "shape", "point" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L293-L295
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/HostActiveDirectoryAuthentication.java
HostActiveDirectoryAuthentication.removeSmartCardTrustAnchor
public void removeSmartCardTrustAnchor(String issuer, String serial) throws HostConfigFault, RuntimeFault, RemoteException { getVimService().removeSmartCardTrustAnchor(getMOR(), issuer, serial); }
java
public void removeSmartCardTrustAnchor(String issuer, String serial) throws HostConfigFault, RuntimeFault, RemoteException { getVimService().removeSmartCardTrustAnchor(getMOR(), issuer, serial); }
[ "public", "void", "removeSmartCardTrustAnchor", "(", "String", "issuer", ",", "String", "serial", ")", "throws", "HostConfigFault", ",", "RuntimeFault", ",", "RemoteException", "{", "getVimService", "(", ")", ".", "removeSmartCardTrustAnchor", "(", "getMOR", "(", ")...
Remove a smart card trust anchor certificate from the system. @param issuer Certificate issuer @param serial Certificate serial number (decimal integer) @throws HostConfigFault @throws RuntimeFault @throws RemoteException @since 6.0 @deprecated Please remove by fingerprint/digest instead.
[ "Remove", "a", "smart", "card", "trust", "anchor", "certificate", "from", "the", "system", "." ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/HostActiveDirectoryAuthentication.java#L105-L107
rimerosolutions/ant-git-tasks
src/main/java/com/rimerosolutions/ant/git/GitTaskUtils.java
GitTaskUtils.validateTrackingRefUpdates
public static void validateTrackingRefUpdates(String errorPrefix, Collection<TrackingRefUpdate> refUpdates) { for (TrackingRefUpdate refUpdate : refUpdates) { RefUpdate.Result result = refUpdate.getResult(); if (result == RefUpdate.Result.IO_FAILURE || result == RefUpdate.Result.LOCK_FAILURE || result == RefUpdate.Result.REJECTED || result == RefUpdate.Result.REJECTED_CURRENT_BRANCH ) { throw new BuildException(String.format("%s - Status '%s'", errorPrefix, result.name())); } } }
java
public static void validateTrackingRefUpdates(String errorPrefix, Collection<TrackingRefUpdate> refUpdates) { for (TrackingRefUpdate refUpdate : refUpdates) { RefUpdate.Result result = refUpdate.getResult(); if (result == RefUpdate.Result.IO_FAILURE || result == RefUpdate.Result.LOCK_FAILURE || result == RefUpdate.Result.REJECTED || result == RefUpdate.Result.REJECTED_CURRENT_BRANCH ) { throw new BuildException(String.format("%s - Status '%s'", errorPrefix, result.name())); } } }
[ "public", "static", "void", "validateTrackingRefUpdates", "(", "String", "errorPrefix", ",", "Collection", "<", "TrackingRefUpdate", ">", "refUpdates", ")", "{", "for", "(", "TrackingRefUpdate", "refUpdate", ":", "refUpdates", ")", "{", "RefUpdate", ".", "Result", ...
Check references updates for any errors @param errorPrefix The error prefix for any error message @param refUpdates A collection of tracking references updates
[ "Check", "references", "updates", "for", "any", "errors" ]
train
https://github.com/rimerosolutions/ant-git-tasks/blob/bfb32fe68afe6b9dcfd0a5194497d748ef3e8a6f/src/main/java/com/rimerosolutions/ant/git/GitTaskUtils.java#L92-L103
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/OneProperties.java
OneProperties.modifyConfig
protected void modifyConfig(Map<? extends IConfigKey, String> modifyConfig) throws IOException { if (propertiesFilePath == null) { LOGGER.warn("Config " + propertiesAbsoluteClassPath + " is not a file, maybe just a resource in library."); } if (configs == null) { loadConfigs(); } for (IConfigKey key : modifyConfig.keySet()) { if (modifyConfig.get(key) != null) { configs.setProperty(key.getKeyString(), modifyConfig.get(key)); } } PropertiesIO.store(propertiesFilePath, configs); }
java
protected void modifyConfig(Map<? extends IConfigKey, String> modifyConfig) throws IOException { if (propertiesFilePath == null) { LOGGER.warn("Config " + propertiesAbsoluteClassPath + " is not a file, maybe just a resource in library."); } if (configs == null) { loadConfigs(); } for (IConfigKey key : modifyConfig.keySet()) { if (modifyConfig.get(key) != null) { configs.setProperty(key.getKeyString(), modifyConfig.get(key)); } } PropertiesIO.store(propertiesFilePath, configs); }
[ "protected", "void", "modifyConfig", "(", "Map", "<", "?", "extends", "IConfigKey", ",", "String", ">", "modifyConfig", ")", "throws", "IOException", "{", "if", "(", "propertiesFilePath", "==", "null", ")", "{", "LOGGER", ".", "warn", "(", "\"Config \"", "+"...
<p>Modify configs and write new configs into properties file.</p> If new config value is null, will not update old value. @param modifyConfig need update config map.
[ "<p", ">", "Modify", "configs", "and", "write", "new", "configs", "into", "properties", "file", ".", "<", "/", "p", ">", "If", "new", "config", "value", "is", "null", "will", "not", "update", "old", "value", "." ]
train
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/OneProperties.java#L262-L275
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/buffer/ImmutableRoaringBitmap.java
ImmutableRoaringBitmap.andNot
@Deprecated public static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1, final ImmutableRoaringBitmap x2, final int rangeStart, final int rangeEnd) { return andNot(x1, x2, (long) rangeStart, (long) rangeEnd); }
java
@Deprecated public static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1, final ImmutableRoaringBitmap x2, final int rangeStart, final int rangeEnd) { return andNot(x1, x2, (long) rangeStart, (long) rangeEnd); }
[ "@", "Deprecated", "public", "static", "MutableRoaringBitmap", "andNot", "(", "final", "ImmutableRoaringBitmap", "x1", ",", "final", "ImmutableRoaringBitmap", "x2", ",", "final", "int", "rangeStart", ",", "final", "int", "rangeEnd", ")", "{", "return", "andNot", "...
Bitwise ANDNOT (difference) operation for the given range, rangeStart (inclusive) and rangeEnd (exclusive). The provided bitmaps are *not* modified. This operation is thread-safe as long as the provided bitmaps remain unchanged. @param x1 first bitmap @param x2 other bitmap @param rangeStart beginning of the range (inclusive) @param rangeEnd end of range (exclusive) @return result of the operation @deprecated use the version where longs specify the range. Negative values for range endpoints are not allowed.
[ "Bitwise", "ANDNOT", "(", "difference", ")", "operation", "for", "the", "given", "range", "rangeStart", "(", "inclusive", ")", "and", "rangeEnd", "(", "exclusive", ")", ".", "The", "provided", "bitmaps", "are", "*", "not", "*", "modified", ".", "This", "op...
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/ImmutableRoaringBitmap.java#L382-L387
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_import_POST
public OvhTask zone_zoneName_import_POST(String zoneName, String zoneFile) throws IOException { String qPath = "/domain/zone/{zoneName}/import"; StringBuilder sb = path(qPath, zoneName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "zoneFile", zoneFile); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask zone_zoneName_import_POST(String zoneName, String zoneFile) throws IOException { String qPath = "/domain/zone/{zoneName}/import"; StringBuilder sb = path(qPath, zoneName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "zoneFile", zoneFile); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "zone_zoneName_import_POST", "(", "String", "zoneName", ",", "String", "zoneFile", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/import\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "zone...
Import zone REST: POST /domain/zone/{zoneName}/import @param zoneFile [required] Zone file that will be imported @param zoneName [required] The internal name of your zone
[ "Import", "zone" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L326-L333
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/performance/PerformanceTracker.java
PerformanceTracker.addMemoryTransaction
public long addMemoryTransaction(int deviceId, long timeSpentNanos, long numberOfBytes, @NonNull MemcpyDirection direction) { // we calculate bytes per microsecond now val bw = (long) (numberOfBytes / (timeSpentNanos / (double) 1000.0)); // we skip too small values if (bw > 0) bandwidth.get(deviceId).addValue(direction, bw); return bw; }
java
public long addMemoryTransaction(int deviceId, long timeSpentNanos, long numberOfBytes, @NonNull MemcpyDirection direction) { // we calculate bytes per microsecond now val bw = (long) (numberOfBytes / (timeSpentNanos / (double) 1000.0)); // we skip too small values if (bw > 0) bandwidth.get(deviceId).addValue(direction, bw); return bw; }
[ "public", "long", "addMemoryTransaction", "(", "int", "deviceId", ",", "long", "timeSpentNanos", ",", "long", "numberOfBytes", ",", "@", "NonNull", "MemcpyDirection", "direction", ")", "{", "// we calculate bytes per microsecond now", "val", "bw", "=", "(", "long", ...
This method stores bandwidth used for given transaction. PLEASE NOTE: Bandwidth is stored in per millisecond value. @param deviceId device used for this transaction @param timeSpent time spent on this transaction in nanoseconds @param numberOfBytes number of bytes @param direction direction for the given memory transaction
[ "This", "method", "stores", "bandwidth", "used", "for", "given", "transaction", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/performance/PerformanceTracker.java#L79-L88
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.notNegative
public static void notNegative(final Integer input, final String inputName) { notNull(input, inputName); if (input < 0) { throw new IllegalArgumentException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be positive"); } }
java
public static void notNegative(final Integer input, final String inputName) { notNull(input, inputName); if (input < 0) { throw new IllegalArgumentException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be positive"); } }
[ "public", "static", "void", "notNegative", "(", "final", "Integer", "input", ",", "final", "String", "inputName", ")", "{", "notNull", "(", "input", ",", "inputName", ")", ";", "if", "(", "input", "<", "0", ")", "{", "throw", "new", "IllegalArgumentExcepti...
Checks that the input value is non-negative @param input the input to check @param inputName the name of the input @throws IllegalArgumentException if input is null or if the input is less than zero
[ "Checks", "that", "the", "input", "value", "is", "non", "-", "negative" ]
train
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L163-L169
czyzby/gdx-lml
mvc/src/main/java/com/github/czyzby/autumn/mvc/component/i18n/LocaleService.java
LocaleService.saveLocaleInPreferences
public void saveLocaleInPreferences(final String preferencesPath, final String preferenceName) { if (Strings.isEmpty(preferencesPath) || Strings.isEmpty(preferenceName)) { throw new GdxRuntimeException( "Preference path and name cannot be empty! These are set automatically if you annotate a path to preference with @I18nBundle and pass a corrent path to the preferences."); } final Preferences preferences = ApplicationPreferences.getPreferences(preferencesPath); preferences.putString(preferenceName, fromLocale(currentLocale.get())); preferences.flush(); }
java
public void saveLocaleInPreferences(final String preferencesPath, final String preferenceName) { if (Strings.isEmpty(preferencesPath) || Strings.isEmpty(preferenceName)) { throw new GdxRuntimeException( "Preference path and name cannot be empty! These are set automatically if you annotate a path to preference with @I18nBundle and pass a corrent path to the preferences."); } final Preferences preferences = ApplicationPreferences.getPreferences(preferencesPath); preferences.putString(preferenceName, fromLocale(currentLocale.get())); preferences.flush(); }
[ "public", "void", "saveLocaleInPreferences", "(", "final", "String", "preferencesPath", ",", "final", "String", "preferenceName", ")", "{", "if", "(", "Strings", ".", "isEmpty", "(", "preferencesPath", ")", "||", "Strings", ".", "isEmpty", "(", "preferenceName", ...
Saves current locale in the selected preferences. @param preferencesPath used to retrieve preferences with {@link com.github.czyzby.kiwi.util.gdx.preference.ApplicationPreferences#getPreferences(String)} method. @param preferenceName name of the locale setting in the preferences.
[ "Saves", "current", "locale", "in", "the", "selected", "preferences", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/mvc/src/main/java/com/github/czyzby/autumn/mvc/component/i18n/LocaleService.java#L178-L186
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWriterDriver.java
KMLWriterDriver.writePlacemark
public void writePlacemark(XMLStreamWriter xmlOut, ResultSet rs, int geoFieldIndex, String spatialFieldName) throws XMLStreamException, SQLException { xmlOut.writeStartElement("Placemark"); if (columnCount > 1) { writeExtendedData(xmlOut, rs); } StringBuilder sb = new StringBuilder(); Geometry geom = (Geometry) rs.getObject(geoFieldIndex); int inputSRID = geom.getSRID(); if (inputSRID == 0) { throw new SQLException("A coordinate reference system must be set to save the KML file"); } else if (inputSRID != 4326) { throw new SQLException("The kml format supports only the WGS84 projection. \n" + "Please use ST_Transform(" + spatialFieldName + "," + inputSRID + ")"); } KMLGeometry.toKMLGeometry(geom, ExtrudeMode.NONE, AltitudeMode.NONE, sb); //Write geometry xmlOut.writeCharacters(sb.toString()); xmlOut.writeEndElement();//Write Placemark }
java
public void writePlacemark(XMLStreamWriter xmlOut, ResultSet rs, int geoFieldIndex, String spatialFieldName) throws XMLStreamException, SQLException { xmlOut.writeStartElement("Placemark"); if (columnCount > 1) { writeExtendedData(xmlOut, rs); } StringBuilder sb = new StringBuilder(); Geometry geom = (Geometry) rs.getObject(geoFieldIndex); int inputSRID = geom.getSRID(); if (inputSRID == 0) { throw new SQLException("A coordinate reference system must be set to save the KML file"); } else if (inputSRID != 4326) { throw new SQLException("The kml format supports only the WGS84 projection. \n" + "Please use ST_Transform(" + spatialFieldName + "," + inputSRID + ")"); } KMLGeometry.toKMLGeometry(geom, ExtrudeMode.NONE, AltitudeMode.NONE, sb); //Write geometry xmlOut.writeCharacters(sb.toString()); xmlOut.writeEndElement();//Write Placemark }
[ "public", "void", "writePlacemark", "(", "XMLStreamWriter", "xmlOut", ",", "ResultSet", "rs", ",", "int", "geoFieldIndex", ",", "String", "spatialFieldName", ")", "throws", "XMLStreamException", ",", "SQLException", "{", "xmlOut", ".", "writeStartElement", "(", "\"P...
A Placemark is a Feature with associated Geometry. Syntax : <Placemark id="ID"> <!-- inherited from Feature element --> <name>...</name> <!-- string --> <visibility>1</visibility> <!-- boolean --> <open>0</open> <!-- boolean --> <atom:author>...<atom:author> <!-- xmlns:atom --> <atom:link href=" "/> <!-- xmlns:atom --> <address>...</address> <!-- string --> <xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal --> <phoneNumber>...</phoneNumber> <!-- string --> <Snippet maxLines="2">...</Snippet> <!-- string --> <description>...</description> <!-- string --> <AbstractView>...</AbstractView> <!-- Camera or LookAt --> <TimePrimitive>...</TimePrimitive> <styleUrl>...</styleUrl> <!-- anyURI --> <StyleSelector>...</StyleSelector> <Region>...</Region> <Metadata>...</Metadata> <!-- deprecated in KML 2.2 --> <ExtendedData>...</ExtendedData> <!-- new in KML 2.2 --> <!-- specific to Placemark element --> <Geometry>...</Geometry> </Placemark> @param xmlOut
[ "A", "Placemark", "is", "a", "Feature", "with", "associated", "Geometry", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWriterDriver.java#L295-L313
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.validIndex
public <T extends Collection<?>> T validIndex(final T collection, final int index, final String message, final Object... values) { notNull(collection); if (index < 0 || index >= collection.size()) { failIndexOutOfBounds(String.format(message, values)); } return collection; }
java
public <T extends Collection<?>> T validIndex(final T collection, final int index, final String message, final Object... values) { notNull(collection); if (index < 0 || index >= collection.size()) { failIndexOutOfBounds(String.format(message, values)); } return collection; }
[ "public", "<", "T", "extends", "Collection", "<", "?", ">", ">", "T", "validIndex", "(", "final", "T", "collection", ",", "final", "int", "index", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "notNull", "(", "co...
<p>Validates that the index is within the bounds of the argument collection; otherwise throwing an exception with the specified message.</p> <pre>Validate.validIndex(myCollection, 2, "The collection index is invalid: ");</pre> <p>If the collection is {@code null}, then the message of the exception is &quot;The validated object is null&quot;.</p> @param <T> the collection type @param collection the collection to check, validated not null by this method @param index the index to check @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the validated collection (never {@code null} for chaining) @throws NullPointerValidationException if the collection is {@code null} @throws IndexOutOfBoundsException if the index is invalid @see #validIndex(java.util.Collection, int)
[ "<p", ">", "Validates", "that", "the", "index", "is", "within", "the", "bounds", "of", "the", "argument", "collection", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "<", "/", "p", ">", "<pre", ">", "Validate"...
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1012-L1018
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseFFDCService.java
BaseFFDCService.rollLogs
@Override public void rollLogs() { summaryFile = null; List<IncidentImpl> incidentCopies; synchronized (incidents) { incidentCopies = new ArrayList<IncidentImpl>(incidents.values()); } int overage = incidentCopies.size() - 500; if (overage > 0) { // we have more than 500 incidents: we need to remove least-recently-seen // incidents until we're back to 500. We do this daily to prevent unchecked growth // in the number of incidents we remember List<IncidentImpl> lastSeenIncidents = new ArrayList<IncidentImpl>(incidentCopies); // sort the incidents by when they were last seen, rather than when they were added Collections.sort(lastSeenIncidents, new Comparator<IncidentImpl>() { @Override public int compare(IncidentImpl o1, IncidentImpl o2) { // static method on double does the same as Long.compareTo, and we avoid // object allocation or auto-boxing, etc. return Double.compare(o1.getTimeStamp(), o2.getTimeStamp()); } }); // For each item we're over 500, remove one from the front of the list (least recently seen) synchronized (incidents) { for (Iterator<IncidentImpl> i = lastSeenIncidents.iterator(); i.hasNext() && overage > 0; overage--) { IncidentImpl impl = i.next(); i.remove(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "FFDC cleanup -- removing " + impl.key); } // remove the incident from the map, and clean it up (remove the associated files) incidents.remove(impl.key); impl.cleanup(); } } } for (IncidentImpl incident : incidentCopies) { incident.roll(); } logSummary(incidentCopies); }
java
@Override public void rollLogs() { summaryFile = null; List<IncidentImpl> incidentCopies; synchronized (incidents) { incidentCopies = new ArrayList<IncidentImpl>(incidents.values()); } int overage = incidentCopies.size() - 500; if (overage > 0) { // we have more than 500 incidents: we need to remove least-recently-seen // incidents until we're back to 500. We do this daily to prevent unchecked growth // in the number of incidents we remember List<IncidentImpl> lastSeenIncidents = new ArrayList<IncidentImpl>(incidentCopies); // sort the incidents by when they were last seen, rather than when they were added Collections.sort(lastSeenIncidents, new Comparator<IncidentImpl>() { @Override public int compare(IncidentImpl o1, IncidentImpl o2) { // static method on double does the same as Long.compareTo, and we avoid // object allocation or auto-boxing, etc. return Double.compare(o1.getTimeStamp(), o2.getTimeStamp()); } }); // For each item we're over 500, remove one from the front of the list (least recently seen) synchronized (incidents) { for (Iterator<IncidentImpl> i = lastSeenIncidents.iterator(); i.hasNext() && overage > 0; overage--) { IncidentImpl impl = i.next(); i.remove(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "FFDC cleanup -- removing " + impl.key); } // remove the incident from the map, and clean it up (remove the associated files) incidents.remove(impl.key); impl.cleanup(); } } } for (IncidentImpl incident : incidentCopies) { incident.roll(); } logSummary(incidentCopies); }
[ "@", "Override", "public", "void", "rollLogs", "(", ")", "{", "summaryFile", "=", "null", ";", "List", "<", "IncidentImpl", ">", "incidentCopies", ";", "synchronized", "(", "incidents", ")", "{", "incidentCopies", "=", "new", "ArrayList", "<", "IncidentImpl", ...
{@inheritDoc} This method is called in response to a scheduled trigger. A new summary log file will be created for the next summary period. @see FFDCJanitor
[ "{", "@inheritDoc", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseFFDCService.java#L363-L410
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java
CalendarPanel.addBorderLabels
private void addBorderLabels() { borderLabels = new JLabel[6][6]; // These two arrays represent the cell location of every border label. // Note that some coordinate combinations from these arrays are not used. // The array index is based on the border label index (not the cell location). int[] labelLocations_X_forColumn = new int[]{0, 1, 2, 3, 4, 11}; int[] labelLocations_Y_forRow = new int[]{0, 1, 2, 5, 6, 12}; // These integers represent the dimensions of every border label. // Note that some dimension combinations from these arrays are not used. // The array index is based on the border label index (not the cell location). int[] labelWidthsInCells_forColumn = new int[]{0, 1, 1, 1, 7, 1}; int[] labelHeightsInCells_forRow = new int[]{0, 1, 3, 1, 6, 1}; // These points represent border label indexes that should be created and used. Point[] allBorderLabelIndexes = new Point[]{ new Point(1, 1), new Point(2, 1), new Point(3, 1), new Point(4, 1), new Point(5, 1), new Point(1, 2), new Point(3, 2), new Point(5, 2), new Point(1, 3), new Point(2, 3), new Point(3, 3), new Point(4, 3), new Point(5, 3), new Point(1, 4), new Point(3, 4), new Point(5, 4), new Point(1, 5), new Point(2, 5), new Point(3, 5), new Point(4, 5), new Point(5, 5)}; // Create all the border labels. for (Point index : allBorderLabelIndexes) { Point labelLocationCell = new Point(labelLocations_X_forColumn[index.x], labelLocations_Y_forRow[index.y]); Dimension labelSizeInCells = new Dimension(labelWidthsInCells_forColumn[index.x], labelHeightsInCells_forRow[index.y]); JLabel label = new JLabel(); // The only properties we need on instantiation are that the label is opaque, and // that it is not visible by default. The other default border properties will be // set later. label.setOpaque(true); label.setVisible(false); borderLabels[index.x][index.y] = label; centerPanel.add(label, CC.xywh(labelLocationCell.x, labelLocationCell.y, labelSizeInCells.width, labelSizeInCells.height)); } }
java
private void addBorderLabels() { borderLabels = new JLabel[6][6]; // These two arrays represent the cell location of every border label. // Note that some coordinate combinations from these arrays are not used. // The array index is based on the border label index (not the cell location). int[] labelLocations_X_forColumn = new int[]{0, 1, 2, 3, 4, 11}; int[] labelLocations_Y_forRow = new int[]{0, 1, 2, 5, 6, 12}; // These integers represent the dimensions of every border label. // Note that some dimension combinations from these arrays are not used. // The array index is based on the border label index (not the cell location). int[] labelWidthsInCells_forColumn = new int[]{0, 1, 1, 1, 7, 1}; int[] labelHeightsInCells_forRow = new int[]{0, 1, 3, 1, 6, 1}; // These points represent border label indexes that should be created and used. Point[] allBorderLabelIndexes = new Point[]{ new Point(1, 1), new Point(2, 1), new Point(3, 1), new Point(4, 1), new Point(5, 1), new Point(1, 2), new Point(3, 2), new Point(5, 2), new Point(1, 3), new Point(2, 3), new Point(3, 3), new Point(4, 3), new Point(5, 3), new Point(1, 4), new Point(3, 4), new Point(5, 4), new Point(1, 5), new Point(2, 5), new Point(3, 5), new Point(4, 5), new Point(5, 5)}; // Create all the border labels. for (Point index : allBorderLabelIndexes) { Point labelLocationCell = new Point(labelLocations_X_forColumn[index.x], labelLocations_Y_forRow[index.y]); Dimension labelSizeInCells = new Dimension(labelWidthsInCells_forColumn[index.x], labelHeightsInCells_forRow[index.y]); JLabel label = new JLabel(); // The only properties we need on instantiation are that the label is opaque, and // that it is not visible by default. The other default border properties will be // set later. label.setOpaque(true); label.setVisible(false); borderLabels[index.x][index.y] = label; centerPanel.add(label, CC.xywh(labelLocationCell.x, labelLocationCell.y, labelSizeInCells.width, labelSizeInCells.height)); } }
[ "private", "void", "addBorderLabels", "(", ")", "{", "borderLabels", "=", "new", "JLabel", "[", "6", "]", "[", "6", "]", ";", "// These two arrays represent the cell location of every border label.", "// Note that some coordinate combinations from these arrays are not used.", "...
addBorderLabels, This adds the border labels to the calendar panel and to the two dimensional border labels array. Below is a visual representation of the location of the border labels inside this array. The character 'X' represents a border label, and 'o' represents null. <pre> ~012345 0oooooo 1oXXXXX 2oXoXoX 3oXXXXX 4oXoXoX 5oXXXXX This function should not depend on any settings variables.
[ "addBorderLabels", "This", "adds", "the", "border", "labels", "to", "the", "calendar", "panel", "and", "to", "the", "two", "dimensional", "border", "labels", "array", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java#L311-L346
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_vrack_network_POST
public OvhVrackNetwork serviceName_vrack_network_POST(String serviceName, String displayName, Long[] farmId, String natIp, String subnet, Long vlan) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/vrack/network"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "displayName", displayName); addBody(o, "farmId", farmId); addBody(o, "natIp", natIp); addBody(o, "subnet", subnet); addBody(o, "vlan", vlan); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVrackNetwork.class); }
java
public OvhVrackNetwork serviceName_vrack_network_POST(String serviceName, String displayName, Long[] farmId, String natIp, String subnet, Long vlan) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/vrack/network"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "displayName", displayName); addBody(o, "farmId", farmId); addBody(o, "natIp", natIp); addBody(o, "subnet", subnet); addBody(o, "vlan", vlan); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVrackNetwork.class); }
[ "public", "OvhVrackNetwork", "serviceName_vrack_network_POST", "(", "String", "serviceName", ",", "String", "displayName", ",", "Long", "[", "]", "farmId", ",", "String", "natIp", ",", "String", "subnet", ",", "Long", "vlan", ")", "throws", "IOException", "{", "...
Add a description of a private network in the attached vRack REST: POST /ipLoadbalancing/{serviceName}/vrack/network @param vlan [required] VLAN of the private network in the vRack. 0 if the private network is not in a VLAN @param farmId [required] Farm Id you want to attach to that vrack network @param subnet [required] IP Block of the private network in the vRack @param displayName [required] Human readable name for your vrack network @param natIp [required] An IP block used as a pool of IPs by this Load Balancer to connect to the servers in this private network. The block must be in the private network and reserved for the Load Balancer @param serviceName [required] The internal name of your IP load balancing API beta
[ "Add", "a", "description", "of", "a", "private", "network", "in", "the", "attached", "vRack" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1179-L1190
zaproxy/zaproxy
src/org/parosproxy/paros/view/AbstractParamDialog.java
AbstractParamDialog.addParamPanel
public void addParamPanel(String[] parentParams, AbstractParamPanel panel, boolean sort) { addParamPanel(parentParams, panel.getName(), panel, sort); }
java
public void addParamPanel(String[] parentParams, AbstractParamPanel panel, boolean sort) { addParamPanel(parentParams, panel.getName(), panel, sort); }
[ "public", "void", "addParamPanel", "(", "String", "[", "]", "parentParams", ",", "AbstractParamPanel", "panel", ",", "boolean", "sort", ")", "{", "addParamPanel", "(", "parentParams", ",", "panel", ".", "getName", "(", ")", ",", "panel", ",", "sort", ")", ...
Adds the given panel, with its {@link Component#getName() own name}, positioned under the given parents (or root node if none given). <p> If not sorted the panel is appended to existing panels. @param parentParams the name of the parent nodes of the panel, might be {@code null}. @param panel the panel, must not be {@code null}. @param sort {@code true} if the panel should be added in alphabetic order, {@code false} otherwise
[ "Adds", "the", "given", "panel", "with", "its", "{", "@link", "Component#getName", "()", "own", "name", "}", "positioned", "under", "the", "given", "parents", "(", "or", "root", "node", "if", "none", "given", ")", ".", "<p", ">", "If", "not", "sorted", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/AbstractParamDialog.java#L282-L284
JodaOrg/joda-time
src/main/java/org/joda/time/base/BasePeriod.java
BasePeriod.toDurationTo
public Duration toDurationTo(ReadableInstant endInstant) { long endMillis = DateTimeUtils.getInstantMillis(endInstant); Chronology chrono = DateTimeUtils.getInstantChronology(endInstant); long startMillis = chrono.add(this, endMillis, -1); return new Duration(startMillis, endMillis); }
java
public Duration toDurationTo(ReadableInstant endInstant) { long endMillis = DateTimeUtils.getInstantMillis(endInstant); Chronology chrono = DateTimeUtils.getInstantChronology(endInstant); long startMillis = chrono.add(this, endMillis, -1); return new Duration(startMillis, endMillis); }
[ "public", "Duration", "toDurationTo", "(", "ReadableInstant", "endInstant", ")", "{", "long", "endMillis", "=", "DateTimeUtils", ".", "getInstantMillis", "(", "endInstant", ")", ";", "Chronology", "chrono", "=", "DateTimeUtils", ".", "getInstantChronology", "(", "en...
Gets the total millisecond duration of this period relative to an end instant. <p> This method subtracts the period from the specified instant in order to calculate the duration. <p> An instant must be supplied as the duration of a period varies. For example, a period of 1 month could vary between the equivalent of 28 and 31 days in milliseconds due to different length months. Similarly, a day can vary at Daylight Savings cutover, typically between 23 and 25 hours. @param endInstant the instant to subtract the period from, thus obtaining the duration @return the total length of the period as a duration relative to the end instant @throws ArithmeticException if the millis exceeds the capacity of the duration
[ "Gets", "the", "total", "millisecond", "duration", "of", "this", "period", "relative", "to", "an", "end", "instant", ".", "<p", ">", "This", "method", "subtracts", "the", "period", "from", "the", "specified", "instant", "in", "order", "to", "calculate", "the...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/base/BasePeriod.java#L373-L378
Dempsy/dempsy
dempsy-framework.api/src/main/java/net/dempsy/lifecycle/simple/MessageProcessor.java
MessageProcessor.invokeEvictable
@Override public boolean invokeEvictable(final Mp instance) throws DempsyException { try { return instance.shouldBeEvicted(); } catch(final RuntimeException rte) { throw new DempsyException(rte, true); } }
java
@Override public boolean invokeEvictable(final Mp instance) throws DempsyException { try { return instance.shouldBeEvicted(); } catch(final RuntimeException rte) { throw new DempsyException(rte, true); } }
[ "@", "Override", "public", "boolean", "invokeEvictable", "(", "final", "Mp", "instance", ")", "throws", "DempsyException", "{", "try", "{", "return", "instance", ".", "shouldBeEvicted", "(", ")", ";", "}", "catch", "(", "final", "RuntimeException", "rte", ")",...
This lifecycle phase is implemented by invoking the {@link Mp#shouldBeEvicted()} method on the instance @see MessageProcessorLifecycle#invokeEvictable(Object)
[ "This", "lifecycle", "phase", "is", "implemented", "by", "invoking", "the", "{", "@link", "Mp#shouldBeEvicted", "()", "}", "method", "on", "the", "instance" ]
train
https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/lifecycle/simple/MessageProcessor.java#L141-L148
unbescape/unbescape
src/main/java/org/unbescape/java/JavaEscape.java
JavaEscape.escapeJavaMinimal
public static void escapeJavaMinimal(final Reader reader, final Writer writer) throws IOException { escapeJava(reader, writer, JavaEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
java
public static void escapeJavaMinimal(final Reader reader, final Writer writer) throws IOException { escapeJava(reader, writer, JavaEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapeJavaMinimal", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeJava", "(", "reader", ",", "writer", ",", "JavaEscapeLevel", ".", "LEVEL_1_BASIC_ESCAPE_SET", ")", ";", ...
<p> Perform a Java level 1 (only basic set) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the Java basic escape set: </p> <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;b</tt> (<tt>U+0008</tt>), <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&quot;</tt> (<tt>U+0022</tt>), <tt>&#92;&#39;</tt> (<tt>U+0027</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). Note <tt>&#92;&#39;</tt> is not really needed in String literals (only in Character literals), so it won't be used until escape level 3. </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> <p> This method calls {@link #escapeJava(Reader, Writer, JavaEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link JavaEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "Java", "level", "1", "(", "only", "basic", "set", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/java/JavaEscape.java#L547-L550
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.setBody
public void setBody(/* @Nullable */ JvmExecutable executable, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) { removeExistingBody(executable); setCompilationStrategy(executable, strategy); }
java
public void setBody(/* @Nullable */ JvmExecutable executable, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) { removeExistingBody(executable); setCompilationStrategy(executable, strategy); }
[ "public", "void", "setBody", "(", "/* @Nullable */", "JvmExecutable", "executable", ",", "/* @Nullable */", "Procedures", ".", "Procedure1", "<", "ITreeAppendable", ">", "strategy", ")", "{", "removeExistingBody", "(", "executable", ")", ";", "setCompilationStrategy", ...
Attaches the given compile strategy to the given {@link JvmExecutable} such that the compiler knows how to implement the {@link JvmExecutable} when it is translated to Java source code. @param executable the operation or constructor to add the method body to. If <code>null</code> this method does nothing. @param strategy the compilation strategy. If <code>null</code> this method does nothing.
[ "Attaches", "the", "given", "compile", "strategy", "to", "the", "given", "{", "@link", "JvmExecutable", "}", "such", "that", "the", "compiler", "knows", "how", "to", "implement", "the", "{", "@link", "JvmExecutable", "}", "when", "it", "is", "translated", "t...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L226-L229
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/KappaDistribution.java
KappaDistribution.logpdf
public static double logpdf(double val, double loc, double scale, double shape1, double shape2) { val = (val - loc) / scale; final double logc = logcdf(val, shape1, shape2); if(shape1 != 0.) { val = shape1 * val; if(val >= 1) { return Double.NEGATIVE_INFINITY; } val = (1. - 1. / shape1) * FastMath.log1p(-val); } if(Double.isInfinite(val)) { return Double.NEGATIVE_INFINITY; } return -val - FastMath.log(scale) + logc * (1. - shape2); }
java
public static double logpdf(double val, double loc, double scale, double shape1, double shape2) { val = (val - loc) / scale; final double logc = logcdf(val, shape1, shape2); if(shape1 != 0.) { val = shape1 * val; if(val >= 1) { return Double.NEGATIVE_INFINITY; } val = (1. - 1. / shape1) * FastMath.log1p(-val); } if(Double.isInfinite(val)) { return Double.NEGATIVE_INFINITY; } return -val - FastMath.log(scale) + logc * (1. - shape2); }
[ "public", "static", "double", "logpdf", "(", "double", "val", ",", "double", "loc", ",", "double", "scale", ",", "double", "shape1", ",", "double", "shape2", ")", "{", "val", "=", "(", "val", "-", "loc", ")", "/", "scale", ";", "final", "double", "lo...
Probability density function. @param val Value @param loc Location @param scale Scale @param shape1 Shape parameter @param shape2 Shape parameter @return PDF
[ "Probability", "density", "function", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/KappaDistribution.java#L162-L176
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java
MinecraftTypeHelper.blockVariantMatches
public static boolean blockVariantMatches(IBlockState bs, List<Variation> allowedVariants) { for (IProperty prop : bs.getProperties().keySet()) { if (prop.getName().equals("variant") && prop.getValueClass().isEnum()) { Object current = bs.getValue(prop); if (current != null) { for (Variation var : allowedVariants) { if (var.getValue().equalsIgnoreCase(current.toString())) return true; } } } } return false; }
java
public static boolean blockVariantMatches(IBlockState bs, List<Variation> allowedVariants) { for (IProperty prop : bs.getProperties().keySet()) { if (prop.getName().equals("variant") && prop.getValueClass().isEnum()) { Object current = bs.getValue(prop); if (current != null) { for (Variation var : allowedVariants) { if (var.getValue().equalsIgnoreCase(current.toString())) return true; } } } } return false; }
[ "public", "static", "boolean", "blockVariantMatches", "(", "IBlockState", "bs", ",", "List", "<", "Variation", ">", "allowedVariants", ")", "{", "for", "(", "IProperty", "prop", ":", "bs", ".", "getProperties", "(", ")", ".", "keySet", "(", ")", ")", "{", ...
Test whether this block has a variant attribute which matches the list of allowed variants @param bs the blockstate to test @param allowedVariants list of allowed Variant enum values @return true if the block matches.
[ "Test", "whether", "this", "block", "has", "a", "variant", "attribute", "which", "matches", "the", "list", "of", "allowed", "variants" ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L126-L144
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.createOrUpdate
public EnvironmentInner createOrUpdate(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, EnvironmentInner environment) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).toBlocking().single().body(); }
java
public EnvironmentInner createOrUpdate(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, EnvironmentInner environment) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).toBlocking().single().body(); }
[ "public", "EnvironmentInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ",", "EnvironmentInner", "environment", ")", "{", "r...
Create or replace an existing Environment. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param environment Represents an environment instance @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 EnvironmentInner object if successful.
[ "Create", "or", "replace", "an", "existing", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L647-L649
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/FolderResourcesImpl.java
FolderResourcesImpl.moveFolder
public Folder moveFolder(long folderId, ContainerDestination containerDestination) throws SmartsheetException { String path = "folders/" + folderId + "/move"; return this.createResource(path, Folder.class, containerDestination); }
java
public Folder moveFolder(long folderId, ContainerDestination containerDestination) throws SmartsheetException { String path = "folders/" + folderId + "/move"; return this.createResource(path, Folder.class, containerDestination); }
[ "public", "Folder", "moveFolder", "(", "long", "folderId", ",", "ContainerDestination", "containerDestination", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"folders/\"", "+", "folderId", "+", "\"/move\"", ";", "return", "this", ".", "createRe...
Moves the specified Folder to another location. It mirrors to the following Smartsheet REST API method: POST /folders/{folderId}/move Exceptions: IllegalArgumentException : if folder is null InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param folderId the folder id @param containerDestination describes the destination container @return the folder @throws SmartsheetException the smartsheet exception
[ "Moves", "the", "specified", "Folder", "to", "another", "location", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/FolderResourcesImpl.java#L262-L266
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.updateIssueNote
public Note updateIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId, String body) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
java
public Note updateIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId, String body) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
[ "public", "Note", "updateIssueNote", "(", "Object", "projectIdOrPath", ",", "Integer", "issueIid", ",", "Integer", "noteId", ",", "String", "body", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", ...
Update the specified issues's note. @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the issue IID to update the notes for @param noteId the ID of the node to update @param body the update content for the Note @return the modified Note instance @throws GitLabApiException if any exception occurs
[ "Update", "the", "specified", "issues", "s", "note", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L188-L194
getsentry/sentry-java
sentry-appengine/src/main/java/io/sentry/appengine/AppEngineSentryClientFactory.java
AppEngineSentryClientFactory.createAsyncConnection
@Override protected Connection createAsyncConnection(Dsn dsn, Connection connection) { String connectionIdentifier = Lookup.lookup(CONNECTION_IDENTIFIER, dsn); if (connectionIdentifier == null) { connectionIdentifier = AppEngineSentryClientFactory.class.getCanonicalName() + dsn + SystemProperty.version.get(); } AppEngineAsyncConnection asyncConnection = new AppEngineAsyncConnection(connectionIdentifier, connection); String queueName = Lookup.lookup(QUEUE_NAME, dsn); if (queueName != null) { asyncConnection.setQueue(queueName); } return asyncConnection; }
java
@Override protected Connection createAsyncConnection(Dsn dsn, Connection connection) { String connectionIdentifier = Lookup.lookup(CONNECTION_IDENTIFIER, dsn); if (connectionIdentifier == null) { connectionIdentifier = AppEngineSentryClientFactory.class.getCanonicalName() + dsn + SystemProperty.version.get(); } AppEngineAsyncConnection asyncConnection = new AppEngineAsyncConnection(connectionIdentifier, connection); String queueName = Lookup.lookup(QUEUE_NAME, dsn); if (queueName != null) { asyncConnection.setQueue(queueName); } return asyncConnection; }
[ "@", "Override", "protected", "Connection", "createAsyncConnection", "(", "Dsn", "dsn", ",", "Connection", "connection", ")", "{", "String", "connectionIdentifier", "=", "Lookup", ".", "lookup", "(", "CONNECTION_IDENTIFIER", ",", "dsn", ")", ";", "if", "(", "con...
Encapsulates an already existing connection in an {@link AppEngineAsyncConnection} and get the async options from the Sentry DSN. @param dsn Data Source Name of the Sentry server. @param connection Connection to encapsulate in an {@link AppEngineAsyncConnection}. @return the asynchronous connection.
[ "Encapsulates", "an", "already", "existing", "connection", "in", "an", "{", "@link", "AppEngineAsyncConnection", "}", "and", "get", "the", "async", "options", "from", "the", "Sentry", "DSN", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry-appengine/src/main/java/io/sentry/appengine/AppEngineSentryClientFactory.java#L48-L64
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.moveSheet
public Sheet moveSheet(long sheetId, ContainerDestination containerDestination) throws SmartsheetException { String path = "sheets/" + sheetId + "/move"; return this.createResource(path, Sheet.class, containerDestination); }
java
public Sheet moveSheet(long sheetId, ContainerDestination containerDestination) throws SmartsheetException { String path = "sheets/" + sheetId + "/move"; return this.createResource(path, Sheet.class, containerDestination); }
[ "public", "Sheet", "moveSheet", "(", "long", "sheetId", ",", "ContainerDestination", "containerDestination", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", "+", "sheetId", "+", "\"/move\"", ";", "return", "this", ".", "createResourc...
Moves the specified Sheet to another location. It mirrors to the following Smartsheet REST API method: POST /folders/{folderId}/move Exceptions: IllegalArgumentException : if folder is null InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param sheetId the folder id @param containerDestination describes the destination container @return the sheet @throws SmartsheetException the smartsheet exception
[ "Moves", "the", "specified", "Sheet", "to", "another", "location", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L1092-L1096
knowm/XChange
xchange-koineks/src/main/java/org/knowm/xchange/koineks/KoineksAdapters.java
KoineksAdapters.adaptTicker
public static Ticker adaptTicker(KoineksTicker koineksTicker, CurrencyPair currencyPair) { switch (currencyPair.base.getCurrencyCode()) { case KoineksCurrency.BTC: return getTickerOf(koineksTicker.getKoineksBTCTicker(), currencyPair.base); case KoineksCurrency.ETH: return getTickerOf(koineksTicker.getKoineksETHTicker(), currencyPair.base); case KoineksCurrency.LTC: return getTickerOf(koineksTicker.getKoineksLTCTicker(), currencyPair.base); case KoineksCurrency.DASH: return getTickerOf(koineksTicker.getKoineksDASHTicker(), currencyPair.base); case KoineksCurrency.DOGE: return getTickerOf(koineksTicker.getKoineksDOGETicker(), currencyPair.base); default: throw new NotAvailableFromExchangeException(); } }
java
public static Ticker adaptTicker(KoineksTicker koineksTicker, CurrencyPair currencyPair) { switch (currencyPair.base.getCurrencyCode()) { case KoineksCurrency.BTC: return getTickerOf(koineksTicker.getKoineksBTCTicker(), currencyPair.base); case KoineksCurrency.ETH: return getTickerOf(koineksTicker.getKoineksETHTicker(), currencyPair.base); case KoineksCurrency.LTC: return getTickerOf(koineksTicker.getKoineksLTCTicker(), currencyPair.base); case KoineksCurrency.DASH: return getTickerOf(koineksTicker.getKoineksDASHTicker(), currencyPair.base); case KoineksCurrency.DOGE: return getTickerOf(koineksTicker.getKoineksDOGETicker(), currencyPair.base); default: throw new NotAvailableFromExchangeException(); } }
[ "public", "static", "Ticker", "adaptTicker", "(", "KoineksTicker", "koineksTicker", ",", "CurrencyPair", "currencyPair", ")", "{", "switch", "(", "currencyPair", ".", "base", ".", "getCurrencyCode", "(", ")", ")", "{", "case", "KoineksCurrency", ".", "BTC", ":",...
Adapts a KoineksTicker to a Ticker Object @param koineksTicker The exchange specific ticker @param currencyPair @return The ticker
[ "Adapts", "a", "KoineksTicker", "to", "a", "Ticker", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-koineks/src/main/java/org/knowm/xchange/koineks/KoineksAdapters.java#L25-L40
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java
CreateFileExtensions.newDirectory
public static boolean newDirectory(Path dir, FileAttribute<?>... attrs) throws IOException { Path directory = Files.createDirectory(dir, attrs); return Files.exists(directory); }
java
public static boolean newDirectory(Path dir, FileAttribute<?>... attrs) throws IOException { Path directory = Files.createDirectory(dir, attrs); return Files.exists(directory); }
[ "public", "static", "boolean", "newDirectory", "(", "Path", "dir", ",", "FileAttribute", "<", "?", ">", "...", "attrs", ")", "throws", "IOException", "{", "Path", "directory", "=", "Files", ".", "createDirectory", "(", "dir", ",", "attrs", ")", ";", "retur...
Creates a new directory from the given {@link Path} object and the optional {@link FileAttribute}.<br> <br> Note: this method decorates the {@link Files#createDirectory(Path, FileAttribute...)} and returns if the directory is created or not. @param dir the dir the directory to create @param attrs an optional list of file attributes to set atomically when creating the directory @return Returns true if the directory was created otherwise false. @throws IOException Signals that an I/O exception has occurred. @see <code>Files#createDirectory(Path, FileAttribute...)</code>
[ "Creates", "a", "new", "directory", "from", "the", "given", "{", "@link", "Path", "}", "object", "and", "the", "optional", "{", "@link", "FileAttribute", "}", ".", "<br", ">", "<br", ">", "Note", ":", "this", "method", "decorates", "the", "{", "@link", ...
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java#L108-L112
forge/core
dependencies/api/src/main/java/org/jboss/forge/addon/dependencies/util/Dependencies.java
Dependencies.areEquivalent
public static boolean areEquivalent(Dependency l, Dependency r) { if (l == r) { return true; } if ((l == null) && (r == null)) { return true; } else if ((l == null) || (r == null)) { return false; } return areEquivalent(l.getCoordinate(), r.getCoordinate()); }
java
public static boolean areEquivalent(Dependency l, Dependency r) { if (l == r) { return true; } if ((l == null) && (r == null)) { return true; } else if ((l == null) || (r == null)) { return false; } return areEquivalent(l.getCoordinate(), r.getCoordinate()); }
[ "public", "static", "boolean", "areEquivalent", "(", "Dependency", "l", ",", "Dependency", "r", ")", "{", "if", "(", "l", "==", "r", ")", "{", "return", "true", ";", "}", "if", "(", "(", "l", "==", "null", ")", "&&", "(", "r", "==", "null", ")", ...
Compare the {@link Coordinate} of each given {@link Dependency} for equivalence.
[ "Compare", "the", "{" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/dependencies/api/src/main/java/org/jboss/forge/addon/dependencies/util/Dependencies.java#L20-L36
lucee/Lucee
core/src/main/java/lucee/runtime/converter/JSConverter.java
JSConverter._serializeDateTime
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) { Calendar c = JREDateTimeUtil.getThreadCalendar(ThreadLocalPageContext.getTimeZone()); c.setTime(dateTime); sb.append(goIn()); sb.append("new Date("); sb.append(c.get(Calendar.YEAR)); sb.append(","); sb.append(c.get(Calendar.MONTH)); sb.append(","); sb.append(c.get(Calendar.DAY_OF_MONTH)); sb.append(","); sb.append(c.get(Calendar.HOUR_OF_DAY)); sb.append(","); sb.append(c.get(Calendar.MINUTE)); sb.append(","); sb.append(c.get(Calendar.SECOND)); sb.append(");"); }
java
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) { Calendar c = JREDateTimeUtil.getThreadCalendar(ThreadLocalPageContext.getTimeZone()); c.setTime(dateTime); sb.append(goIn()); sb.append("new Date("); sb.append(c.get(Calendar.YEAR)); sb.append(","); sb.append(c.get(Calendar.MONTH)); sb.append(","); sb.append(c.get(Calendar.DAY_OF_MONTH)); sb.append(","); sb.append(c.get(Calendar.HOUR_OF_DAY)); sb.append(","); sb.append(c.get(Calendar.MINUTE)); sb.append(","); sb.append(c.get(Calendar.SECOND)); sb.append(");"); }
[ "private", "void", "_serializeDateTime", "(", "DateTime", "dateTime", ",", "StringBuilder", "sb", ")", "{", "Calendar", "c", "=", "JREDateTimeUtil", ".", "getThreadCalendar", "(", "ThreadLocalPageContext", ".", "getTimeZone", "(", ")", ")", ";", "c", ".", "setTi...
serialize a DateTime @param dateTime DateTime to serialize @param sb @param sb @throws ConverterException
[ "serialize", "a", "DateTime" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/JSConverter.java#L327-L345
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.setAttributes
private void setAttributes(Map attrs, int offset) { if (runCount == 0) { createRunAttributeDataVectors(); } int index = ensureRunBreak(offset, false); int size; if (attrs != null && (size = attrs.size()) > 0) { Vector runAttrs = new Vector(size); Vector runValues = new Vector(size); Iterator iterator = attrs.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry)iterator.next(); runAttrs.add(entry.getKey()); runValues.add(entry.getValue()); } runAttributes[index] = runAttrs; runAttributeValues[index] = runValues; } }
java
private void setAttributes(Map attrs, int offset) { if (runCount == 0) { createRunAttributeDataVectors(); } int index = ensureRunBreak(offset, false); int size; if (attrs != null && (size = attrs.size()) > 0) { Vector runAttrs = new Vector(size); Vector runValues = new Vector(size); Iterator iterator = attrs.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry)iterator.next(); runAttrs.add(entry.getKey()); runValues.add(entry.getValue()); } runAttributes[index] = runAttrs; runAttributeValues[index] = runValues; } }
[ "private", "void", "setAttributes", "(", "Map", "attrs", ",", "int", "offset", ")", "{", "if", "(", "runCount", "==", "0", ")", "{", "createRunAttributeDataVectors", "(", ")", ";", "}", "int", "index", "=", "ensureRunBreak", "(", "offset", ",", "false", ...
Sets the attributes for the range from offset to the next run break (typically the end of the text) to the ones specified in attrs. This is only meant to be called from the constructor!
[ "Sets", "the", "attributes", "for", "the", "range", "from", "offset", "to", "the", "next", "run", "break", "(", "typically", "the", "end", "of", "the", "text", ")", "to", "the", "ones", "specified", "in", "attrs", ".", "This", "is", "only", "meant", "t...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L693-L715
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/utils/HealthPinger.java
HealthPinger.pingQuery
private static Observable<PingServiceHealth> pingQuery( final NetworkAddress hostname, final String bucket, final String password, final ClusterFacade core, final long timeout, final TimeUnit timeUnit) { final AtomicReference<CouchbaseRequest> request = new AtomicReference<CouchbaseRequest>(); Observable<com.couchbase.client.core.message.query.PingResponse> response = Observable.defer(new Func0<Observable<com.couchbase.client.core.message.query.PingResponse>>() { @Override public Observable<com.couchbase.client.core.message.query.PingResponse> call() { CouchbaseRequest r; try { r = new com.couchbase.client.core.message.query.PingRequest( InetAddress.getByName(hostname.address()), bucket, password ); } catch (Exception e) { return Observable.error(e); } request.set(r); return core.send(r); } }).timeout(timeout, timeUnit); return mapToServiceHealth(null, ServiceType.QUERY, response, request, timeout, timeUnit); }
java
private static Observable<PingServiceHealth> pingQuery( final NetworkAddress hostname, final String bucket, final String password, final ClusterFacade core, final long timeout, final TimeUnit timeUnit) { final AtomicReference<CouchbaseRequest> request = new AtomicReference<CouchbaseRequest>(); Observable<com.couchbase.client.core.message.query.PingResponse> response = Observable.defer(new Func0<Observable<com.couchbase.client.core.message.query.PingResponse>>() { @Override public Observable<com.couchbase.client.core.message.query.PingResponse> call() { CouchbaseRequest r; try { r = new com.couchbase.client.core.message.query.PingRequest( InetAddress.getByName(hostname.address()), bucket, password ); } catch (Exception e) { return Observable.error(e); } request.set(r); return core.send(r); } }).timeout(timeout, timeUnit); return mapToServiceHealth(null, ServiceType.QUERY, response, request, timeout, timeUnit); }
[ "private", "static", "Observable", "<", "PingServiceHealth", ">", "pingQuery", "(", "final", "NetworkAddress", "hostname", ",", "final", "String", "bucket", ",", "final", "String", "password", ",", "final", "ClusterFacade", "core", ",", "final", "long", "timeout",...
Pings the service and completes if successful - and fails if it didn't work for some reason (reason is in the exception).
[ "Pings", "the", "service", "and", "completes", "if", "successful", "-", "and", "fails", "if", "it", "didn", "t", "work", "for", "some", "reason", "(", "reason", "is", "in", "the", "exception", ")", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/HealthPinger.java#L246-L267
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/FileInputFormat.java
FileInputFormat.setInputPaths
public static void setInputPaths(JobConf conf, Path... inputPaths) { if (!inputPaths[0].isAbsolute()) { FileSystem.LogForCollect.info("set relative path to non absolute path: " + inputPaths[0]+ " working directory: " + conf.getWorkingDirectory()); } Path path = new Path(conf.getWorkingDirectory(), inputPaths[0]); StringBuffer str = new StringBuffer(StringUtils.escapeString(path.toString())); for(int i = 1; i < inputPaths.length;i++) { str.append(StringUtils.COMMA_STR); if (!inputPaths[i].isAbsolute()) { FileSystem.LogForCollect.info("set input path to non absolute path: " + inputPaths[i] + " working directory: " + conf.getWorkingDirectory()); } path = new Path(conf.getWorkingDirectory(), inputPaths[i]); str.append(StringUtils.escapeString(path.toString())); } conf.set("mapred.input.dir", str.toString()); }
java
public static void setInputPaths(JobConf conf, Path... inputPaths) { if (!inputPaths[0].isAbsolute()) { FileSystem.LogForCollect.info("set relative path to non absolute path: " + inputPaths[0]+ " working directory: " + conf.getWorkingDirectory()); } Path path = new Path(conf.getWorkingDirectory(), inputPaths[0]); StringBuffer str = new StringBuffer(StringUtils.escapeString(path.toString())); for(int i = 1; i < inputPaths.length;i++) { str.append(StringUtils.COMMA_STR); if (!inputPaths[i].isAbsolute()) { FileSystem.LogForCollect.info("set input path to non absolute path: " + inputPaths[i] + " working directory: " + conf.getWorkingDirectory()); } path = new Path(conf.getWorkingDirectory(), inputPaths[i]); str.append(StringUtils.escapeString(path.toString())); } conf.set("mapred.input.dir", str.toString()); }
[ "public", "static", "void", "setInputPaths", "(", "JobConf", "conf", ",", "Path", "...", "inputPaths", ")", "{", "if", "(", "!", "inputPaths", "[", "0", "]", ".", "isAbsolute", "(", ")", ")", "{", "FileSystem", ".", "LogForCollect", ".", "info", "(", "...
Set the array of {@link Path}s as the list of inputs for the map-reduce job. @param conf Configuration of the job. @param inputPaths the {@link Path}s of the input directories/files for the map-reduce job.
[ "Set", "the", "array", "of", "{", "@link", "Path", "}", "s", "as", "the", "list", "of", "inputs", "for", "the", "map", "-", "reduce", "job", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/FileInputFormat.java#L515-L533
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/TransactionLoadRequest.java
TransactionLoadRequest.addLoad
public TransactionLoadRequest addLoad(Object key, DynamoDBTransactionLoadExpression transactLoadExpression) { objectsToLoad.add(key); objectLoadExpressions.add(transactLoadExpression); return this; }
java
public TransactionLoadRequest addLoad(Object key, DynamoDBTransactionLoadExpression transactLoadExpression) { objectsToLoad.add(key); objectLoadExpressions.add(transactLoadExpression); return this; }
[ "public", "TransactionLoadRequest", "addLoad", "(", "Object", "key", ",", "DynamoDBTransactionLoadExpression", "transactLoadExpression", ")", "{", "objectsToLoad", ".", "add", "(", "key", ")", ";", "objectLoadExpressions", ".", "add", "(", "transactLoadExpression", ")",...
Adds specified key to list of objects to load. Item attributes will be loaded as specified by transactLoadExpression.
[ "Adds", "specified", "key", "to", "list", "of", "objects", "to", "load", ".", "Item", "attributes", "will", "be", "loaded", "as", "specified", "by", "transactLoadExpression", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/TransactionLoadRequest.java#L55-L59
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJAreaChartBuilder.java
DJAreaChartBuilder.addSerie
public DJAreaChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { getDataset().addSerie(column, labelExpression); return this; }
java
public DJAreaChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { getDataset().addSerie(column, labelExpression); return this; }
[ "public", "DJAreaChartBuilder", "addSerie", "(", "AbstractColumn", "column", ",", "StringExpression", "labelExpression", ")", "{", "getDataset", "(", ")", ".", "addSerie", "(", "column", ",", "labelExpression", ")", ";", "return", "this", ";", "}" ]
Adds the specified serie column to the dataset with custom label. @param column the serie column
[ "Adds", "the", "specified", "serie", "column", "to", "the", "dataset", "with", "custom", "label", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJAreaChartBuilder.java#L376-L379
mgm-tp/jfunk
jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java
WebDriverTool.getInnerText
public String getInnerText(final By by, final boolean normalizeSpace) { WebElement element = findElement(by); String text = element.getAttribute("innerText"); return normalizeSpace ? JFunkUtils.normalizeSpace(text) : text; }
java
public String getInnerText(final By by, final boolean normalizeSpace) { WebElement element = findElement(by); String text = element.getAttribute("innerText"); return normalizeSpace ? JFunkUtils.normalizeSpace(text) : text; }
[ "public", "String", "getInnerText", "(", "final", "By", "by", ",", "final", "boolean", "normalizeSpace", ")", "{", "WebElement", "element", "=", "findElement", "(", "by", ")", ";", "String", "text", "=", "element", ".", "getAttribute", "(", "\"innerText\"", ...
<p> Delegates to {@link #findElement(By)} and then calls {@link WebElement#getAttribute(String) getAttribute("innerText")} on the returned element. If {@code normalizeSpace} is {@code true} , the element's text is passed to {@link JFunkUtils#normalizeSpace(String)}. </p> <p> The difference to {@link #getElementText(By, boolean)} is that this method returns the complete inner text of the element, not only the visible (i. e. not hidden by CSS) one. </p> @param by the {@link By} used to locate the element @param normalizeSpace specifies whether whitespace in the element text are to be normalized @return the text
[ "<p", ">", "Delegates", "to", "{", "@link", "#findElement", "(", "By", ")", "}", "and", "then", "calls", "{", "@link", "WebElement#getAttribute", "(", "String", ")", "getAttribute", "(", "innerText", ")", "}", "on", "the", "returned", "element", ".", "If",...
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L615-L619
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java
ProfileManager.keepCheckPointForReposOnly
@Trivial private Root keepCheckPointForReposOnly(Root searchDO, String reposId) { Root retDO = new Root(); Map<String, Control> ctrlsMap = ControlsHelper.getControlMap(searchDO); ChangeControl changeCtrl = (ChangeControl) ctrlsMap.get(DO_CHANGE_CONTROL); ChangeControl returnChangeControl = new ChangeControl(); CheckPointType returnCheckPoint = new CheckPointType(); returnChangeControl.getCheckPoint().add(returnCheckPoint); retDO.getControls().add(returnChangeControl); List<CheckPointType> checkPointList = changeCtrl.getCheckPoint(); if (checkPointList != null) { for (CheckPointType checkPointDO : checkPointList) { if (checkPointDO.getRepositoryId().equals(reposId)) { returnCheckPoint.setRepositoryCheckPoint(checkPointDO.getRepositoryCheckPoint()); returnCheckPoint.setRepositoryId(checkPointDO.getRepositoryId()); } } } return retDO; }
java
@Trivial private Root keepCheckPointForReposOnly(Root searchDO, String reposId) { Root retDO = new Root(); Map<String, Control> ctrlsMap = ControlsHelper.getControlMap(searchDO); ChangeControl changeCtrl = (ChangeControl) ctrlsMap.get(DO_CHANGE_CONTROL); ChangeControl returnChangeControl = new ChangeControl(); CheckPointType returnCheckPoint = new CheckPointType(); returnChangeControl.getCheckPoint().add(returnCheckPoint); retDO.getControls().add(returnChangeControl); List<CheckPointType> checkPointList = changeCtrl.getCheckPoint(); if (checkPointList != null) { for (CheckPointType checkPointDO : checkPointList) { if (checkPointDO.getRepositoryId().equals(reposId)) { returnCheckPoint.setRepositoryCheckPoint(checkPointDO.getRepositoryCheckPoint()); returnCheckPoint.setRepositoryId(checkPointDO.getRepositoryId()); } } } return retDO; }
[ "@", "Trivial", "private", "Root", "keepCheckPointForReposOnly", "(", "Root", "searchDO", ",", "String", "reposId", ")", "{", "Root", "retDO", "=", "new", "Root", "(", ")", ";", "Map", "<", "String", ",", "Control", ">", "ctrlsMap", "=", "ControlsHelper", ...
This method is invoked by searchImpl() to make sure that each adapter receives only its corresponding checkpoint in the change control. @param searchDO Input search DataObject @param reposId Identifier for the repository whose checkpoint needs to be retained @return Object for search containing checkpoint corresponding to reposId only
[ "This", "method", "is", "invoked", "by", "searchImpl", "()", "to", "make", "sure", "that", "each", "adapter", "receives", "only", "its", "corresponding", "checkpoint", "in", "the", "change", "control", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java#L1342-L1361
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java
EventHubConnectionsInner.get
public EventHubConnectionInner get(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName) { return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName).toBlocking().single().body(); }
java
public EventHubConnectionInner get(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName) { return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName).toBlocking().single().body(); }
[ "public", "EventHubConnectionInner", "get", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "String", "eventHubConnectionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "cluster...
Returns an Event Hub connection. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param eventHubConnectionName The name of the event hub connection. @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 EventHubConnectionInner object if successful.
[ "Returns", "an", "Event", "Hub", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L312-L314
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java
ServerKeysInner.beginCreateOrUpdateAsync
public Observable<ServerKeyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).map(new Func1<ServiceResponse<ServerKeyInner>, ServerKeyInner>() { @Override public ServerKeyInner call(ServiceResponse<ServerKeyInner> response) { return response.body(); } }); }
java
public Observable<ServerKeyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).map(new Func1<ServiceResponse<ServerKeyInner>, ServerKeyInner>() { @Override public ServerKeyInner call(ServiceResponse<ServerKeyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerKeyInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "keyName", ",", "ServerKeyInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync",...
Creates or updates a server key. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 @param parameters The requested server key resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerKeyInner object
[ "Creates", "or", "updates", "a", "server", "key", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java#L435-L442
virgo47/javasimon
core/src/main/java/org/javasimon/utils/SimonUtils.java
SimonUtils.generatePrivate
private static String generatePrivate(String suffix, boolean includeMethodName) { StackTraceElement stackElement = Thread.currentThread().getStackTrace()[CLIENT_CODE_STACK_INDEX]; StringBuilder nameBuilder = new StringBuilder(stackElement.getClassName()); if (includeMethodName) { nameBuilder.append('.').append(stackElement.getMethodName()); } if (suffix != null) { nameBuilder.append(suffix); } return nameBuilder.toString(); }
java
private static String generatePrivate(String suffix, boolean includeMethodName) { StackTraceElement stackElement = Thread.currentThread().getStackTrace()[CLIENT_CODE_STACK_INDEX]; StringBuilder nameBuilder = new StringBuilder(stackElement.getClassName()); if (includeMethodName) { nameBuilder.append('.').append(stackElement.getMethodName()); } if (suffix != null) { nameBuilder.append(suffix); } return nameBuilder.toString(); }
[ "private", "static", "String", "generatePrivate", "(", "String", "suffix", ",", "boolean", "includeMethodName", ")", "{", "StackTraceElement", "stackElement", "=", "Thread", ".", "currentThread", "(", ")", ".", "getStackTrace", "(", ")", "[", "CLIENT_CODE_STACK_INDE...
method is extracted, so the stack trace index is always right
[ "method", "is", "extracted", "so", "the", "stack", "trace", "index", "is", "always", "right" ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SimonUtils.java#L312-L322