repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java
DestinationManager.destinationExists
public boolean destinationExists(String destinationName, String busName) throws SIMPNullParameterException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "destinationExists", new Object[] { destinationName, busName }); // Check that the destination name is not null. If it is, throw a // SIMPNullParameterException if (destinationName == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit( tc, "destinationExists", "Destination name null"); throw new SIMPNullParameterException( nls_cwsik.getFormattedMessage( "MISSING_PARAM_ERROR_CWSIP0044", new Object[] { messageProcessor.getMessagingEngineName() }, null)); } // Now look for the destination in the hash table boolean exists = destinationIndex.containsKey(busName, destinationName); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "destinationExists", new Boolean(exists)); return exists; }
java
public boolean destinationExists(String destinationName, String busName) throws SIMPNullParameterException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "destinationExists", new Object[] { destinationName, busName }); // Check that the destination name is not null. If it is, throw a // SIMPNullParameterException if (destinationName == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit( tc, "destinationExists", "Destination name null"); throw new SIMPNullParameterException( nls_cwsik.getFormattedMessage( "MISSING_PARAM_ERROR_CWSIP0044", new Object[] { messageProcessor.getMessagingEngineName() }, null)); } // Now look for the destination in the hash table boolean exists = destinationIndex.containsKey(busName, destinationName); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "destinationExists", new Boolean(exists)); return exists; }
[ "public", "boolean", "destinationExists", "(", "String", "destinationName", ",", "String", "busName", ")", "throws", "SIMPNullParameterException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ...
Method destinationExists @param destinationName @param busName @return boolean @throws SIMPNullParameterException <p>This method returns true if the named destination is known in the destination manager, otherwise it returns false.</p>
[ "Method", "destinationExists" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1919-L1949
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/json/JSONUtils.java
JSONUtils.fieldIsSerializable
static boolean fieldIsSerializable(final Field field, final boolean onlySerializePublicFields) { final int modifiers = field.getModifiers(); if ((!onlySerializePublicFields || Modifier.isPublic(modifiers)) && !Modifier.isTransient(modifiers) && !Modifier.isFinal(modifiers) && ((modifiers & 0x1000 /* synthetic */) == 0)) { return JSONUtils.isAccessibleOrMakeAccessible(field); } return false; }
java
static boolean fieldIsSerializable(final Field field, final boolean onlySerializePublicFields) { final int modifiers = field.getModifiers(); if ((!onlySerializePublicFields || Modifier.isPublic(modifiers)) && !Modifier.isTransient(modifiers) && !Modifier.isFinal(modifiers) && ((modifiers & 0x1000 /* synthetic */) == 0)) { return JSONUtils.isAccessibleOrMakeAccessible(field); } return false; }
[ "static", "boolean", "fieldIsSerializable", "(", "final", "Field", "field", ",", "final", "boolean", "onlySerializePublicFields", ")", "{", "final", "int", "modifiers", "=", "field", ".", "getModifiers", "(", ")", ";", "if", "(", "(", "!", "onlySerializePublicFi...
Check if a field is serializable. Don't serialize transient, final, synthetic, or inaccessible fields. <p> N.B. Tries to set field to accessible, which will require an "opens" declarations from modules that want to allow this introspection. @param field the field @param onlySerializePublicFields if true, only serialize public fields @return true if the field is serializable
[ "Check", "if", "a", "field", "is", "serializable", ".", "Don", "t", "serialize", "transient", "final", "synthetic", "or", "inaccessible", "fields", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/json/JSONUtils.java#L353-L360
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesInner.java
RecoverableDatabasesInner.getAsync
public Observable<RecoverableDatabaseInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<RecoverableDatabaseInner>, RecoverableDatabaseInner>() { @Override public RecoverableDatabaseInner call(ServiceResponse<RecoverableDatabaseInner> response) { return response.body(); } }); }
java
public Observable<RecoverableDatabaseInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<RecoverableDatabaseInner>, RecoverableDatabaseInner>() { @Override public RecoverableDatabaseInner call(ServiceResponse<RecoverableDatabaseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RecoverableDatabaseInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",",...
Gets a recoverable database, which is a resource representing a database's geo backup. @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 databaseName The name of the database @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RecoverableDatabaseInner object
[ "Gets", "a", "recoverable", "database", "which", "is", "a", "resource", "representing", "a", "database", "s", "geo", "backup", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesInner.java#L103-L110
j256/simplejmx
src/main/java/com/j256/simplejmx/client/JmxClient.java
JmxClient.closeThrow
public void closeThrow() throws JMException { try { if (jmxConnector != null) { jmxConnector.close(); jmxConnector = null; } // NOTE: doesn't seem to be close method on MBeanServerConnection mbeanConn = null; } catch (IOException e) { throw createJmException("Could not close the jmx connector", e); } }
java
public void closeThrow() throws JMException { try { if (jmxConnector != null) { jmxConnector.close(); jmxConnector = null; } // NOTE: doesn't seem to be close method on MBeanServerConnection mbeanConn = null; } catch (IOException e) { throw createJmException("Could not close the jmx connector", e); } }
[ "public", "void", "closeThrow", "(", ")", "throws", "JMException", "{", "try", "{", "if", "(", "jmxConnector", "!=", "null", ")", "{", "jmxConnector", ".", "close", "(", ")", ";", "jmxConnector", "=", "null", ";", "}", "// NOTE: doesn't seem to be close method...
Close the client connection to the mbean server. If you want a method that does not throw then use {@link #close()}.
[ "Close", "the", "client", "connection", "to", "the", "mbean", "server", ".", "If", "you", "want", "a", "method", "that", "does", "not", "throw", "then", "use", "{" ]
train
https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L188-L199
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftsInner.java
RunbookDraftsInner.beginReplaceContentAsync
public Observable<String> beginReplaceContentAsync(String resourceGroupName, String automationAccountName, String runbookName, String runbookContent) { return beginReplaceContentWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName, runbookContent).map(new Func1<ServiceResponseWithHeaders<String, RunbookDraftReplaceContentHeaders>, String>() { @Override public String call(ServiceResponseWithHeaders<String, RunbookDraftReplaceContentHeaders> response) { return response.body(); } }); }
java
public Observable<String> beginReplaceContentAsync(String resourceGroupName, String automationAccountName, String runbookName, String runbookContent) { return beginReplaceContentWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName, runbookContent).map(new Func1<ServiceResponseWithHeaders<String, RunbookDraftReplaceContentHeaders>, String>() { @Override public String call(ServiceResponseWithHeaders<String, RunbookDraftReplaceContentHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "String", ">", "beginReplaceContentAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "runbookName", ",", "String", "runbookContent", ")", "{", "return", "beginReplaceContentWithServiceResponseAsyn...
Replaces the runbook draft content. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param runbookName The runbook name. @param runbookContent The runbook draft content. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the String object
[ "Replaces", "the", "runbook", "draft", "content", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftsInner.java#L304-L311
Netflix/karyon
karyon2-governator/src/main/java/netflix/karyon/Karyon.java
Karyon.forRequestHandler
public static KaryonServer forRequestHandler(int port, final RequestHandler<ByteBuf, ByteBuf> handler, Module... modules) { return forRequestHandler(port, handler, toBootstrapModule(modules)); }
java
public static KaryonServer forRequestHandler(int port, final RequestHandler<ByteBuf, ByteBuf> handler, Module... modules) { return forRequestHandler(port, handler, toBootstrapModule(modules)); }
[ "public", "static", "KaryonServer", "forRequestHandler", "(", "int", "port", ",", "final", "RequestHandler", "<", "ByteBuf", ",", "ByteBuf", ">", "handler", ",", "Module", "...", "modules", ")", "{", "return", "forRequestHandler", "(", "port", ",", "handler", ...
Creates a new {@link KaryonServer} that has a single HTTP server instance which delegates all request handling to {@link RequestHandler}. The {@link HttpServer} is created using {@link KaryonTransport#newHttpServer(int, HttpRequestHandler)} @param port Port for the server. @param handler Request Handler @param modules Additional modules if any. @return {@link KaryonServer} which is to be used to start the created server.
[ "Creates", "a", "new", "{", "@link", "KaryonServer", "}", "that", "has", "a", "single", "HTTP", "server", "instance", "which", "delegates", "all", "request", "handling", "to", "{", "@link", "RequestHandler", "}", ".", "The", "{", "@link", "HttpServer", "}", ...
train
https://github.com/Netflix/karyon/blob/d50bc0ff37693ef3fbda373e90a109d1f92e0b9a/karyon2-governator/src/main/java/netflix/karyon/Karyon.java#L47-L50
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java
GVRSkeleton.setBindPose
public void setBindPose(float[] rotations, float[] positions) { mBindPose.setWorldRotations(rotations); mBindPose.setWorldPositions(positions); if (mInverseBindPose == null) { mInverseBindPose = new GVRPose(this); } mInverseBindPose.inverse(mBindPose); mPose.copy(mBindPose); updateBonePose(); }
java
public void setBindPose(float[] rotations, float[] positions) { mBindPose.setWorldRotations(rotations); mBindPose.setWorldPositions(positions); if (mInverseBindPose == null) { mInverseBindPose = new GVRPose(this); } mInverseBindPose.inverse(mBindPose); mPose.copy(mBindPose); updateBonePose(); }
[ "public", "void", "setBindPose", "(", "float", "[", "]", "rotations", ",", "float", "[", "]", "positions", ")", "{", "mBindPose", ".", "setWorldRotations", "(", "rotations", ")", ";", "mBindPose", ".", "setWorldPositions", "(", "positions", ")", ";", "if", ...
Set the bind pose of the skeleton to describe the initial position and orientation of the bones when the skinned meshes are not modified. <p> The <i>bind pose</i> of the skeleton defines the position and orientation of the bones before any animations are applied. Usually it represents the pose that matches the source vertices of the meshes driven by the skeleton. You can restore the skeleton to it's bind pose with {@link #restoreBindPose()} <p> The bind pose is maintained as a {link GVRPose} object internal to the skeleton and cannot be shared across skeletons. Setting the bind pose copies the value of the input pose into the skeleton's bind pose. Subsequent updates to the input pose are not reflected in the skeleton's bind pose. @param rotations new bind pose rotations @param positions new bind pose positions Both arrays must have enough entries for all the bones in the skeleton. The positions and orientation are all relative to the root bone of the skeleton (not the parent bone). @see #setPose(GVRPose) @see #getBindPose() @see #restoreBindPose() @see {@link GVRPose}
[ "Set", "the", "bind", "pose", "of", "the", "skeleton", "to", "describe", "the", "initial", "position", "and", "orientation", "of", "the", "bones", "when", "the", "skinned", "meshes", "are", "not", "modified", ".", "<p", ">", "The", "<i", ">", "bind", "po...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java#L402-L413
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/utils/SmapStratum.java
SmapStratum.addFile
public synchronized void addFile(String filename, String filePath) { // fix this to check if duplicate name exists. int fileIndex = fileNameList.indexOf(filename); if (fileIndex == -1) { fileNameList.add(filename); filePathList.add(filePath); } }
java
public synchronized void addFile(String filename, String filePath) { // fix this to check if duplicate name exists. int fileIndex = fileNameList.indexOf(filename); if (fileIndex == -1) { fileNameList.add(filename); filePathList.add(filePath); } }
[ "public", "synchronized", "void", "addFile", "(", "String", "filename", ",", "String", "filePath", ")", "{", "// fix this to check if duplicate name exists.", "int", "fileIndex", "=", "fileNameList", ".", "indexOf", "(", "filename", ")", ";", "if", "(", "fileIndex",...
Adds record of a new file, by filename and path. The path may be relative to a source compilation path. @param fileName the filename to add, unqualified by path @param filePath the path for the filename, potentially relative to a source compilation path
[ "Adds", "record", "of", "a", "new", "file", "by", "filename", "and", "path", ".", "The", "path", "may", "be", "relative", "to", "a", "source", "compilation", "path", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/utils/SmapStratum.java#L153-L160
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/Node.java
Node.checkHealth
protected void checkHealth(long threshold, NodeHealthChecker healthChecker) { final int state = this.state; if (anyAreSet(state, REMOVED | ACTIVE_PING)) { return; } healthCheckPing(threshold, healthChecker); }
java
protected void checkHealth(long threshold, NodeHealthChecker healthChecker) { final int state = this.state; if (anyAreSet(state, REMOVED | ACTIVE_PING)) { return; } healthCheckPing(threshold, healthChecker); }
[ "protected", "void", "checkHealth", "(", "long", "threshold", ",", "NodeHealthChecker", "healthChecker", ")", "{", "final", "int", "state", "=", "this", ".", "state", ";", "if", "(", "anyAreSet", "(", "state", ",", "REMOVED", "|", "ACTIVE_PING", ")", ")", ...
Check the health of the node and try to ping it if necessary. @param threshold the threshold after which the node should be removed @param healthChecker the node health checker
[ "Check", "the", "health", "of", "the", "node", "and", "try", "to", "ping", "it", "if", "necessary", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/Node.java#L189-L195
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java
Citrus.afterSuite
public void afterSuite(String suiteName, String ... testGroups) { testSuiteListener.onFinish(); if (!CollectionUtils.isEmpty(afterSuite)) { for (SequenceAfterSuite sequenceAfterSuite : afterSuite) { try { if (sequenceAfterSuite.shouldExecute(suiteName, testGroups)) { sequenceAfterSuite.execute(createTestContext()); } } catch (Exception e) { testSuiteListener.onFinishFailure(e); throw new AssertionError("After suite failed with errors", e); } } testSuiteListener.onFinishSuccess(); } else { testSuiteListener.onFinishSuccess(); } }
java
public void afterSuite(String suiteName, String ... testGroups) { testSuiteListener.onFinish(); if (!CollectionUtils.isEmpty(afterSuite)) { for (SequenceAfterSuite sequenceAfterSuite : afterSuite) { try { if (sequenceAfterSuite.shouldExecute(suiteName, testGroups)) { sequenceAfterSuite.execute(createTestContext()); } } catch (Exception e) { testSuiteListener.onFinishFailure(e); throw new AssertionError("After suite failed with errors", e); } } testSuiteListener.onFinishSuccess(); } else { testSuiteListener.onFinishSuccess(); } }
[ "public", "void", "afterSuite", "(", "String", "suiteName", ",", "String", "...", "testGroups", ")", "{", "testSuiteListener", ".", "onFinish", "(", ")", ";", "if", "(", "!", "CollectionUtils", ".", "isEmpty", "(", "afterSuite", ")", ")", "{", "for", "(", ...
Performs after suite test actions. @param suiteName @param testGroups
[ "Performs", "after", "suite", "test", "actions", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java#L353-L372
pro-grade/pro-grade
src/main/java/net/sourceforge/prograde/generator/GeneratePolicyFromDeniedPermissions.java
GeneratePolicyFromDeniedPermissions.permissionDenied
@Override public void permissionDenied(final ProtectionDomain pd, final Permission perm) { if (filePermissionToSkip.equals(perm)) { return; } final CodeSource codeSource = pd.getCodeSource(); Set<Permission> permSet = missingPermissions.get(codeSource); if (permSet == null) { synchronized (missingPermissions) { permSet = missingPermissions.get(codeSource); if (permSet == null) { permSet = Collections.synchronizedSet(new TreeSet<Permission>(new PermissionComparator())); missingPermissions.put(codeSource, permSet); } } } if (permSet.add(perm)) { AccessController.doPrivileged(WRITE_TO_FILE_ACTION); } }
java
@Override public void permissionDenied(final ProtectionDomain pd, final Permission perm) { if (filePermissionToSkip.equals(perm)) { return; } final CodeSource codeSource = pd.getCodeSource(); Set<Permission> permSet = missingPermissions.get(codeSource); if (permSet == null) { synchronized (missingPermissions) { permSet = missingPermissions.get(codeSource); if (permSet == null) { permSet = Collections.synchronizedSet(new TreeSet<Permission>(new PermissionComparator())); missingPermissions.put(codeSource, permSet); } } } if (permSet.add(perm)) { AccessController.doPrivileged(WRITE_TO_FILE_ACTION); } }
[ "@", "Override", "public", "void", "permissionDenied", "(", "final", "ProtectionDomain", "pd", ",", "final", "Permission", "perm", ")", "{", "if", "(", "filePermissionToSkip", ".", "equals", "(", "perm", ")", ")", "{", "return", ";", "}", "final", "CodeSourc...
Writes the given permission under the grant entry with codesource from given {@link ProtectionDomain} into the generated policy file. @see net.sourceforge.prograde.generator.DeniedPermissionListener#permissionDenied(java.security.ProtectionDomain, java.security.Permission)
[ "Writes", "the", "given", "permission", "under", "the", "grant", "entry", "with", "codesource", "from", "given", "{", "@link", "ProtectionDomain", "}", "into", "the", "generated", "policy", "file", "." ]
train
https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/generator/GeneratePolicyFromDeniedPermissions.java#L107-L126
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java
ImageLoader.loadImage
public static BufferedImage loadImage(InputStream is, int imageType){ BufferedImage img = loadImage(is); if(img.getType() != imageType){ img = BufferedImageFactory.get(img, imageType); } return img; }
java
public static BufferedImage loadImage(InputStream is, int imageType){ BufferedImage img = loadImage(is); if(img.getType() != imageType){ img = BufferedImageFactory.get(img, imageType); } return img; }
[ "public", "static", "BufferedImage", "loadImage", "(", "InputStream", "is", ",", "int", "imageType", ")", "{", "BufferedImage", "img", "=", "loadImage", "(", "is", ")", ";", "if", "(", "img", ".", "getType", "(", ")", "!=", "imageType", ")", "{", "img", ...
Tries to load Image from file and converts it to the desired image type if needed. <br> See {@link BufferedImage#BufferedImage(int, int, int)} for details on the available image types. The InputStream is not closed, this is the responsibility of the caller. @param is {@link InputStream} of the image file @param imageType of the resulting BufferedImage @return loaded Image. @throws ImageLoaderException if no image could be loaded from the InputStream. @since 1.1
[ "Tries", "to", "load", "Image", "from", "file", "and", "converts", "it", "to", "the", "desired", "image", "type", "if", "needed", ".", "<br", ">", "See", "{", "@link", "BufferedImage#BufferedImage", "(", "int", "int", "int", ")", "}", "for", "details", "...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java#L165-L171
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigTreeBuilder.java
ConfigTreeBuilder.resolveRootTypes
@SuppressWarnings("unchecked") private static List<Class> resolveRootTypes(final List<Class> roots, final Class type) { roots.add(type); if (type == Configuration.class) { return roots; } for (Class iface : type.getInterfaces()) { if (isInStopPackage(iface)) { continue; } roots.add(iface); } return resolveRootTypes(roots, type.getSuperclass()); }
java
@SuppressWarnings("unchecked") private static List<Class> resolveRootTypes(final List<Class> roots, final Class type) { roots.add(type); if (type == Configuration.class) { return roots; } for (Class iface : type.getInterfaces()) { if (isInStopPackage(iface)) { continue; } roots.add(iface); } return resolveRootTypes(roots, type.getSuperclass()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "List", "<", "Class", ">", "resolveRootTypes", "(", "final", "List", "<", "Class", ">", "roots", ",", "final", "Class", "type", ")", "{", "roots", ".", "add", "(", "type", ")", ";",...
Analyze configuration class structure to extract all classes in hierarchy with all custom interfaces (ignoring, for example Serializable or something like this). @param roots all collected types so far @param type type to analyze @return all collected types
[ "Analyze", "configuration", "class", "structure", "to", "extract", "all", "classes", "in", "hierarchy", "with", "all", "custom", "interfaces", "(", "ignoring", "for", "example", "Serializable", "or", "something", "like", "this", ")", "." ]
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigTreeBuilder.java#L125-L138
vigna/Sux4J
src/it/unimi/dsi/sux4j/mph/MinimalPerfectHashFunction.java
MinimalPerfectHashFunction.getLongByTripleNoCheck
private long getLongByTripleNoCheck(final long[] triple, final int[] e) { final int chunk = chunkShift == Long.SIZE ? 0 : (int)(triple[0] >>> chunkShift); final long chunkOffset = offset[chunk]; HypergraphSorter.tripleToEdge(triple, seed[chunk], (int)(offset[chunk + 1] - chunkOffset), e); return rank(chunkOffset + e[(int)(values.getLong(e[0] + chunkOffset) + values.getLong(e[1] + chunkOffset) + values.getLong(e[2] + chunkOffset)) % 3]); }
java
private long getLongByTripleNoCheck(final long[] triple, final int[] e) { final int chunk = chunkShift == Long.SIZE ? 0 : (int)(triple[0] >>> chunkShift); final long chunkOffset = offset[chunk]; HypergraphSorter.tripleToEdge(triple, seed[chunk], (int)(offset[chunk + 1] - chunkOffset), e); return rank(chunkOffset + e[(int)(values.getLong(e[0] + chunkOffset) + values.getLong(e[1] + chunkOffset) + values.getLong(e[2] + chunkOffset)) % 3]); }
[ "private", "long", "getLongByTripleNoCheck", "(", "final", "long", "[", "]", "triple", ",", "final", "int", "[", "]", "e", ")", "{", "final", "int", "chunk", "=", "chunkShift", "==", "Long", ".", "SIZE", "?", "0", ":", "(", "int", ")", "(", "triple",...
A dirty function replicating the behaviour of {@link #getLongByTriple(long[])} but skipping the signature test. Used in the constructor. <strong>Must</strong> be kept in sync with {@link #getLongByTriple(long[])}.
[ "A", "dirty", "function", "replicating", "the", "behaviour", "of", "{" ]
train
https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/MinimalPerfectHashFunction.java#L529-L534
alipay/sofa-rpc
extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/context/BaggageResolver.java
BaggageResolver.pickupFromResponse
public static void pickupFromResponse(RpcInvokeContext context, SofaResponse response, boolean init) { if (context == null && !init) { return; } Map<String, String> responseBaggage = response.getResponseProps(); if (CommonUtils.isNotEmpty(responseBaggage)) { String prefix = RemotingConstants.RPC_RESPONSE_BAGGAGE + "."; for (Map.Entry<String, String> entry : responseBaggage.entrySet()) { if (entry.getKey().startsWith(prefix)) { if (context == null) { context = RpcInvokeContext.getContext(); } context.putResponseBaggage(entry.getKey().substring(prefix.length()), entry.getValue()); } } } }
java
public static void pickupFromResponse(RpcInvokeContext context, SofaResponse response, boolean init) { if (context == null && !init) { return; } Map<String, String> responseBaggage = response.getResponseProps(); if (CommonUtils.isNotEmpty(responseBaggage)) { String prefix = RemotingConstants.RPC_RESPONSE_BAGGAGE + "."; for (Map.Entry<String, String> entry : responseBaggage.entrySet()) { if (entry.getKey().startsWith(prefix)) { if (context == null) { context = RpcInvokeContext.getContext(); } context.putResponseBaggage(entry.getKey().substring(prefix.length()), entry.getValue()); } } } }
[ "public", "static", "void", "pickupFromResponse", "(", "RpcInvokeContext", "context", ",", "SofaResponse", "response", ",", "boolean", "init", ")", "{", "if", "(", "context", "==", "null", "&&", "!", "init", ")", "{", "return", ";", "}", "Map", "<", "Strin...
从响应里获取透传数据 @param context RpcInvokeContext @param response 响应 @param init 传入上下文为空时,是否初始化
[ "从响应里获取透传数据" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/context/BaggageResolver.java#L112-L129
apereo/cas
support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/BaseSamlRegisteredServiceMetadataResolver.java
BaseSamlRegisteredServiceMetadataResolver.buildSignatureValidationFilterIfNeeded
protected static void buildSignatureValidationFilterIfNeeded(final SamlRegisteredService service, final List<MetadataFilter> metadataFilterList) throws Exception { if (StringUtils.isBlank(service.getMetadataSignatureLocation())) { LOGGER.warn("No metadata signature location is defined for [{}], so SignatureValidationFilter will not be invoked", service.getMetadataLocation()); return; } buildSignatureValidationFilterIfNeeded(service, metadataFilterList, service.getMetadataSignatureLocation()); }
java
protected static void buildSignatureValidationFilterIfNeeded(final SamlRegisteredService service, final List<MetadataFilter> metadataFilterList) throws Exception { if (StringUtils.isBlank(service.getMetadataSignatureLocation())) { LOGGER.warn("No metadata signature location is defined for [{}], so SignatureValidationFilter will not be invoked", service.getMetadataLocation()); return; } buildSignatureValidationFilterIfNeeded(service, metadataFilterList, service.getMetadataSignatureLocation()); }
[ "protected", "static", "void", "buildSignatureValidationFilterIfNeeded", "(", "final", "SamlRegisteredService", "service", ",", "final", "List", "<", "MetadataFilter", ">", "metadataFilterList", ")", "throws", "Exception", "{", "if", "(", "StringUtils", ".", "isBlank", ...
Build signature validation filter if needed. @param service the service @param metadataFilterList the metadata filter list @throws Exception the exception
[ "Build", "signature", "validation", "filter", "if", "needed", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/BaseSamlRegisteredServiceMetadataResolver.java#L207-L213
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.generateKey
public static SecretKey generateKey(String algorithm, KeySpec keySpec) { final SecretKeyFactory keyFactory = getSecretKeyFactory(algorithm); try { return keyFactory.generateSecret(keySpec); } catch (InvalidKeySpecException e) { throw new CryptoException(e); } }
java
public static SecretKey generateKey(String algorithm, KeySpec keySpec) { final SecretKeyFactory keyFactory = getSecretKeyFactory(algorithm); try { return keyFactory.generateSecret(keySpec); } catch (InvalidKeySpecException e) { throw new CryptoException(e); } }
[ "public", "static", "SecretKey", "generateKey", "(", "String", "algorithm", ",", "KeySpec", "keySpec", ")", "{", "final", "SecretKeyFactory", "keyFactory", "=", "getSecretKeyFactory", "(", "algorithm", ")", ";", "try", "{", "return", "keyFactory", ".", "generateSe...
生成 {@link SecretKey},仅用于对称加密和摘要算法 @param algorithm 算法 @param keySpec {@link KeySpec} @return {@link SecretKey}
[ "生成", "{", "@link", "SecretKey", "}", ",仅用于对称加密和摘要算法" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L188-L195
mojohaus/jaxb2-maven-plugin
src/main/java/org/codehaus/mojo/jaxb2/shared/arguments/ArgumentBuilder.java
ArgumentBuilder.withNamedArgument
public ArgumentBuilder withNamedArgument(final String name, final String value) { // Check sanity Validate.notEmpty(name, "name"); // Only add a named argument if the value is non-empty. if (value != null && !value.trim().isEmpty()) { withNamedArgument(true, name, value.trim()); } // All done. return this; }
java
public ArgumentBuilder withNamedArgument(final String name, final String value) { // Check sanity Validate.notEmpty(name, "name"); // Only add a named argument if the value is non-empty. if (value != null && !value.trim().isEmpty()) { withNamedArgument(true, name, value.trim()); } // All done. return this; }
[ "public", "ArgumentBuilder", "withNamedArgument", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "// Check sanity", "Validate", ".", "notEmpty", "(", "name", ",", "\"name\"", ")", ";", "// Only add a named argument if the value is non-empty."...
Convenience form for the {@code withNamedArgument} method, where a named argument is only added if the value is non-null and non-empty after trimming. @param name The name of the namedArgument to add. Cannot be empty. @param value The value of the namedArgument to add. @return This ArgumentBuilder, for chaining. @see #withNamedArgument(boolean, String, String)
[ "Convenience", "form", "for", "the", "{", "@code", "withNamedArgument", "}", "method", "where", "a", "named", "argument", "is", "only", "added", "if", "the", "value", "is", "non", "-", "null", "and", "non", "-", "empty", "after", "trimming", "." ]
train
https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/arguments/ArgumentBuilder.java#L169-L181
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.readUser
public CmsUser readUser(CmsDbContext dbc, CmsUUID id) throws CmsException { CmsUser user = m_monitor.getCachedUser(id.toString()); if (user == null) { user = getUserDriver(dbc).readUser(dbc, id); m_monitor.cacheUser(user); } // important: do not return the cached user object, but a clone to avoid unwanted changes on cached objects return user.clone(); }
java
public CmsUser readUser(CmsDbContext dbc, CmsUUID id) throws CmsException { CmsUser user = m_monitor.getCachedUser(id.toString()); if (user == null) { user = getUserDriver(dbc).readUser(dbc, id); m_monitor.cacheUser(user); } // important: do not return the cached user object, but a clone to avoid unwanted changes on cached objects return user.clone(); }
[ "public", "CmsUser", "readUser", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "id", ")", "throws", "CmsException", "{", "CmsUser", "user", "=", "m_monitor", ".", "getCachedUser", "(", "id", ".", "toString", "(", ")", ")", ";", "if", "(", "user", "==", "nu...
Returns a user object based on the id of a user.<p> @param dbc the current database context @param id the id of the user to read @return the user read @throws CmsException if something goes wrong
[ "Returns", "a", "user", "object", "based", "on", "the", "id", "of", "a", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L8097-L8106
spring-projects/spring-credhub
spring-credhub-core/src/main/java/org/springframework/credhub/configuration/CredHubTemplateFactory.java
CredHubTemplateFactory.reactiveCredHubTemplate
public ReactiveCredHubTemplate reactiveCredHubTemplate(CredHubProperties credHubProperties, ClientOptions clientOptions) { return new ReactiveCredHubTemplate(credHubProperties, clientHttpConnector(clientOptions)); }
java
public ReactiveCredHubTemplate reactiveCredHubTemplate(CredHubProperties credHubProperties, ClientOptions clientOptions) { return new ReactiveCredHubTemplate(credHubProperties, clientHttpConnector(clientOptions)); }
[ "public", "ReactiveCredHubTemplate", "reactiveCredHubTemplate", "(", "CredHubProperties", "credHubProperties", ",", "ClientOptions", "clientOptions", ")", "{", "return", "new", "ReactiveCredHubTemplate", "(", "credHubProperties", ",", "clientHttpConnector", "(", "clientOptions"...
Create a {@link ReactiveCredHubTemplate} for interaction with a CredHub server. @param credHubProperties connection properties @param clientOptions connection options @return a {@code ReactiveCredHubTemplate}
[ "Create", "a", "{", "@link", "ReactiveCredHubTemplate", "}", "for", "interaction", "with", "a", "CredHub", "server", "." ]
train
https://github.com/spring-projects/spring-credhub/blob/4d82cfa60d6c04e707ff32d78bc5d80cff4e132e/spring-credhub-core/src/main/java/org/springframework/credhub/configuration/CredHubTemplateFactory.java#L76-L79
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.fromResponseData
public static HttpMessage fromResponseData(final String responseData) { try (final BufferedReader reader = new BufferedReader(new StringReader(responseData))) { final HttpMessage response = new HttpMessage(); final String[] statusLine = reader.readLine().split("\\s"); if (statusLine.length > 0) { response.version(statusLine[0]); } if (statusLine.length > 1) { response.status(HttpStatus.valueOf(Integer.valueOf(statusLine[1]))); } return parseHttpMessage(reader, response); } catch (final IOException e) { throw new CitrusRuntimeException("Failed to parse Http raw response data", e); } }
java
public static HttpMessage fromResponseData(final String responseData) { try (final BufferedReader reader = new BufferedReader(new StringReader(responseData))) { final HttpMessage response = new HttpMessage(); final String[] statusLine = reader.readLine().split("\\s"); if (statusLine.length > 0) { response.version(statusLine[0]); } if (statusLine.length > 1) { response.status(HttpStatus.valueOf(Integer.valueOf(statusLine[1]))); } return parseHttpMessage(reader, response); } catch (final IOException e) { throw new CitrusRuntimeException("Failed to parse Http raw response data", e); } }
[ "public", "static", "HttpMessage", "fromResponseData", "(", "final", "String", "responseData", ")", "{", "try", "(", "final", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "StringReader", "(", "responseData", ")", ")", ")", "{", "final", ...
Reads response from complete response dump. @param responseData The response dump to parse @return The parsed dump as HttpMessage
[ "Reads", "response", "from", "complete", "response", "dump", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L538-L555
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.userInGroup
public boolean userInGroup(CmsDbContext dbc, String username, String groupname, boolean readRoles) throws CmsException { List<CmsGroup> groups = getGroupsOfUser(dbc, username, readRoles); for (int i = 0; i < groups.size(); i++) { CmsGroup group = groups.get(i); if (groupname.equals(group.getName()) || groupname.substring(1).equals(group.getName())) { return true; } } return false; }
java
public boolean userInGroup(CmsDbContext dbc, String username, String groupname, boolean readRoles) throws CmsException { List<CmsGroup> groups = getGroupsOfUser(dbc, username, readRoles); for (int i = 0; i < groups.size(); i++) { CmsGroup group = groups.get(i); if (groupname.equals(group.getName()) || groupname.substring(1).equals(group.getName())) { return true; } } return false; }
[ "public", "boolean", "userInGroup", "(", "CmsDbContext", "dbc", ",", "String", "username", ",", "String", "groupname", ",", "boolean", "readRoles", ")", "throws", "CmsException", "{", "List", "<", "CmsGroup", ">", "groups", "=", "getGroupsOfUser", "(", "dbc", ...
Returns <code>true</code> if a user is member of the given group.<p> @param dbc the current database context @param username the name of the user to check @param groupname the name of the group to check @param readRoles if to read roles or groups @return <code>true</code>, if the user is in the group, <code>false</code> otherwise @throws CmsException if something goes wrong
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "a", "user", "is", "member", "of", "the", "given", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L9548-L9559
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.getKeyPair
public static KeyPair getKeyPair(String type, InputStream in, char[] password, String alias) { final KeyStore keyStore = readKeyStore(type, in, password); return getKeyPair(keyStore, password, alias); }
java
public static KeyPair getKeyPair(String type, InputStream in, char[] password, String alias) { final KeyStore keyStore = readKeyStore(type, in, password); return getKeyPair(keyStore, password, alias); }
[ "public", "static", "KeyPair", "getKeyPair", "(", "String", "type", ",", "InputStream", "in", ",", "char", "[", "]", "password", ",", "String", "alias", ")", "{", "final", "KeyStore", "keyStore", "=", "readKeyStore", "(", "type", ",", "in", ",", "password"...
从KeyStore中获取私钥公钥 @param type 类型 @param in {@link InputStream} 如果想从文件读取.keystore文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取 @param password 密码 @param alias 别名 @return {@link KeyPair} @since 4.4.1
[ "从KeyStore中获取私钥公钥" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L592-L595
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/builder/WorkItem.java
WorkItem.addSecondaryTypesToPattern
private static String addSecondaryTypesToPattern(IFile file, String fileName, String classNamePattern) { ICompilationUnit cu = JavaCore.createCompilationUnitFrom(file); if (cu == null) { FindbugsPlugin.getDefault().logError( "NULL compilation unit for " + file + ", FB analysis might be incomplete for included types"); return classNamePattern; } try { IType[] types = cu.getTypes(); if (types.length > 1) { StringBuilder sb = new StringBuilder(classNamePattern); for (IType type : types) { if (fileName.equals(type.getElementName())) { // "usual" type with the same name: we have it already continue; } sb.append("|").append(type.getElementName()); sb.append("\\.class|").append(type.getElementName()); sb.append("\\$.*\\.class"); } classNamePattern = sb.toString(); } } catch (JavaModelException e) { FindbugsPlugin.getDefault().logException(e, "Cannot get types from compilation unit: " + cu); } return classNamePattern; }
java
private static String addSecondaryTypesToPattern(IFile file, String fileName, String classNamePattern) { ICompilationUnit cu = JavaCore.createCompilationUnitFrom(file); if (cu == null) { FindbugsPlugin.getDefault().logError( "NULL compilation unit for " + file + ", FB analysis might be incomplete for included types"); return classNamePattern; } try { IType[] types = cu.getTypes(); if (types.length > 1) { StringBuilder sb = new StringBuilder(classNamePattern); for (IType type : types) { if (fileName.equals(type.getElementName())) { // "usual" type with the same name: we have it already continue; } sb.append("|").append(type.getElementName()); sb.append("\\.class|").append(type.getElementName()); sb.append("\\$.*\\.class"); } classNamePattern = sb.toString(); } } catch (JavaModelException e) { FindbugsPlugin.getDefault().logException(e, "Cannot get types from compilation unit: " + cu); } return classNamePattern; }
[ "private", "static", "String", "addSecondaryTypesToPattern", "(", "IFile", "file", ",", "String", "fileName", ",", "String", "classNamePattern", ")", "{", "ICompilationUnit", "cu", "=", "JavaCore", ".", "createCompilationUnitFrom", "(", "file", ")", ";", "if", "("...
Add secondary types patterns (not nested in the type itself but contained in the java file) @param fileName java file name (not path!) without .java suffix @param classNamePattern non null pattern for all matching .class file names @return modified classNamePattern, if there are more then one type defined in the java file
[ "Add", "secondary", "types", "patterns", "(", "not", "nested", "in", "the", "type", "itself", "but", "contained", "in", "the", "java", "file", ")" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/builder/WorkItem.java#L202-L228
samskivert/pythagoras
src/main/java/pythagoras/f/Rectangles.java
Rectangles.pointRectDistanceSq
public static float pointRectDistanceSq (IRectangle r, IPoint p) { Point p2 = closestInteriorPoint(r, p); return Points.distanceSq(p.x(), p.y(), p2.x, p2.y); }
java
public static float pointRectDistanceSq (IRectangle r, IPoint p) { Point p2 = closestInteriorPoint(r, p); return Points.distanceSq(p.x(), p.y(), p2.x, p2.y); }
[ "public", "static", "float", "pointRectDistanceSq", "(", "IRectangle", "r", ",", "IPoint", "p", ")", "{", "Point", "p2", "=", "closestInteriorPoint", "(", "r", ",", "p", ")", ";", "return", "Points", ".", "distanceSq", "(", "p", ".", "x", "(", ")", ","...
Returns the squared Euclidean distance between the given point and the nearest point inside the bounds of the given rectangle. If the supplied point is inside the rectangle, the distance will be zero.
[ "Returns", "the", "squared", "Euclidean", "distance", "between", "the", "given", "point", "and", "the", "nearest", "point", "inside", "the", "bounds", "of", "the", "given", "rectangle", ".", "If", "the", "supplied", "point", "is", "inside", "the", "rectangle",...
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Rectangles.java#L58-L61
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvToSqlExtensions.java
CsvToSqlExtensions.getCsvFileAsSqlInsertScript
public static String getCsvFileAsSqlInsertScript(final String tableName, final CsvBean csvBean) { return getCsvFileAsSqlInsertScript(tableName, csvBean, true, true); }
java
public static String getCsvFileAsSqlInsertScript(final String tableName, final CsvBean csvBean) { return getCsvFileAsSqlInsertScript(tableName, csvBean, true, true); }
[ "public", "static", "String", "getCsvFileAsSqlInsertScript", "(", "final", "String", "tableName", ",", "final", "CsvBean", "csvBean", ")", "{", "return", "getCsvFileAsSqlInsertScript", "(", "tableName", ",", "csvBean", ",", "true", ",", "true", ")", ";", "}" ]
Gets the csv file as sql insert script. @param tableName the table name @param csvBean the csv bean @return the csv file as sql insert script
[ "Gets", "the", "csv", "file", "as", "sql", "insert", "script", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvToSqlExtensions.java#L75-L78
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java
DefaultURLTemplatesFactory.getTemplateNameByRef
public String getTemplateNameByRef( String refGroupName, String key ) { assert _urlTemplates != null : "The template config file has not been loaded."; if ( _urlTemplates == null ) { return null; } String ref = _urlTemplates.getTemplateNameByRef( refGroupName, key ); if ( ref == null ) { // If the template is a secure template, look for the secure default // before resolving to the default if ( key.equals( URLTemplatesFactory.SECURE_RENDER_TEMPLATE ) || key.equals( URLTemplatesFactory.SECURE_ACTION_TEMPLATE ) || key.equals( URLTemplatesFactory.SECURE_RESOURCE_TEMPLATE ) ) { ref = _urlTemplates.getTemplateNameByRef( refGroupName, URLTemplatesFactory.SECURE_DEFAULT_TEMPLATE ); } } return ref; }
java
public String getTemplateNameByRef( String refGroupName, String key ) { assert _urlTemplates != null : "The template config file has not been loaded."; if ( _urlTemplates == null ) { return null; } String ref = _urlTemplates.getTemplateNameByRef( refGroupName, key ); if ( ref == null ) { // If the template is a secure template, look for the secure default // before resolving to the default if ( key.equals( URLTemplatesFactory.SECURE_RENDER_TEMPLATE ) || key.equals( URLTemplatesFactory.SECURE_ACTION_TEMPLATE ) || key.equals( URLTemplatesFactory.SECURE_RESOURCE_TEMPLATE ) ) { ref = _urlTemplates.getTemplateNameByRef( refGroupName, URLTemplatesFactory.SECURE_DEFAULT_TEMPLATE ); } } return ref; }
[ "public", "String", "getTemplateNameByRef", "(", "String", "refGroupName", ",", "String", "key", ")", "{", "assert", "_urlTemplates", "!=", "null", ":", "\"The template config file has not been loaded.\"", ";", "if", "(", "_urlTemplates", "==", "null", ")", "{", "re...
Returns URL template name of the given type (by key) from the desired reference group. @param refGroupName name of a group of templates from the config file. @param key type of the template @return template name
[ "Returns", "URL", "template", "name", "of", "the", "given", "type", "(", "by", "key", ")", "from", "the", "desired", "reference", "group", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java#L126-L149
jenkinsci/jenkins
core/src/main/java/hudson/model/ChoiceParameterDefinition.java
ChoiceParameterDefinition.setChoices
@DataBoundSetter @Restricted(NoExternalUse.class) // this is terrible enough without being used anywhere public void setChoices(Object choices) { if (choices instanceof String) { setChoicesText((String) choices); return; } if (choices instanceof List) { ArrayList<String> newChoices = new ArrayList<>(); for (Object o : (List) choices) { if (o != null) { newChoices.add(o.toString()); } } this.choices = newChoices; return; } throw new IllegalArgumentException("expected String or List, but got " + choices.getClass().getName()); }
java
@DataBoundSetter @Restricted(NoExternalUse.class) // this is terrible enough without being used anywhere public void setChoices(Object choices) { if (choices instanceof String) { setChoicesText((String) choices); return; } if (choices instanceof List) { ArrayList<String> newChoices = new ArrayList<>(); for (Object o : (List) choices) { if (o != null) { newChoices.add(o.toString()); } } this.choices = newChoices; return; } throw new IllegalArgumentException("expected String or List, but got " + choices.getClass().getName()); }
[ "@", "DataBoundSetter", "@", "Restricted", "(", "NoExternalUse", ".", "class", ")", "// this is terrible enough without being used anywhere", "public", "void", "setChoices", "(", "Object", "choices", ")", "{", "if", "(", "choices", "instanceof", "String", ")", "{", ...
Set the list of choices. Legal arguments are String (in which case the arguments gets split into lines) and Collection which sets the list of legal parameters to the String representations of the argument's non-null entries. See JENKINS-26143 for background. This retains the compatibility with the legacy String 'choices' parameter, while supporting the list type as generated by the snippet generator. @param choices String or Collection representing this parameter definition's possible values. @since 2.112
[ "Set", "the", "list", "of", "choices", ".", "Legal", "arguments", "are", "String", "(", "in", "which", "case", "the", "arguments", "gets", "split", "into", "lines", ")", "and", "Collection", "which", "sets", "the", "list", "of", "legal", "parameters", "to"...
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ChoiceParameterDefinition.java#L88-L106
knowm/XChange
xchange-cryptopia/src/main/java/org/knowm/xchange/cryptopia/CryptopiaAdapters.java
CryptopiaAdapters.adaptTicker
public static Ticker adaptTicker(CryptopiaTicker cryptopiaTicker, CurrencyPair currencyPair) { return new Ticker.Builder() .currencyPair(currencyPair) .last(cryptopiaTicker.getLast()) .bid(cryptopiaTicker.getBid()) .ask(cryptopiaTicker.getAsk()) .high(cryptopiaTicker.getHigh()) .low(cryptopiaTicker.getLow()) .volume(cryptopiaTicker.getVolume()) .timestamp(new Date()) .build(); }
java
public static Ticker adaptTicker(CryptopiaTicker cryptopiaTicker, CurrencyPair currencyPair) { return new Ticker.Builder() .currencyPair(currencyPair) .last(cryptopiaTicker.getLast()) .bid(cryptopiaTicker.getBid()) .ask(cryptopiaTicker.getAsk()) .high(cryptopiaTicker.getHigh()) .low(cryptopiaTicker.getLow()) .volume(cryptopiaTicker.getVolume()) .timestamp(new Date()) .build(); }
[ "public", "static", "Ticker", "adaptTicker", "(", "CryptopiaTicker", "cryptopiaTicker", ",", "CurrencyPair", "currencyPair", ")", "{", "return", "new", "Ticker", ".", "Builder", "(", ")", ".", "currencyPair", "(", "currencyPair", ")", ".", "last", "(", "cryptopi...
Adapts a CryptopiaTicker to a Ticker Object @param cryptopiaTicker The exchange specific ticker @param currencyPair (e.g. BTC/USD) @return The XChange ticker
[ "Adapts", "a", "CryptopiaTicker", "to", "a", "Ticker", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-cryptopia/src/main/java/org/knowm/xchange/cryptopia/CryptopiaAdapters.java#L84-L95
groupon/odo
client/src/main/java/com/groupon/odo/client/Client.java
Client.setCustomForDefaultProfile
protected static boolean setCustomForDefaultProfile(String pathName, Boolean isResponse, String customData) { try { JSONObject profile = getDefaultProfile(); String profileName = profile.getString("name"); Client client = new Client(profileName, false); return client.setCustom(isResponse, pathName, customData); } catch (Exception e) { e.printStackTrace(); } return false; }
java
protected static boolean setCustomForDefaultProfile(String pathName, Boolean isResponse, String customData) { try { JSONObject profile = getDefaultProfile(); String profileName = profile.getString("name"); Client client = new Client(profileName, false); return client.setCustom(isResponse, pathName, customData); } catch (Exception e) { e.printStackTrace(); } return false; }
[ "protected", "static", "boolean", "setCustomForDefaultProfile", "(", "String", "pathName", ",", "Boolean", "isResponse", ",", "String", "customData", ")", "{", "try", "{", "JSONObject", "profile", "=", "getDefaultProfile", "(", ")", ";", "String", "profileName", "...
set custom request/response for the default profile's default client @param pathName friendly name of path @param isResponse true for response, false for request @param customData custom response/request data @return true if success, false otherwise
[ "set", "custom", "request", "/", "response", "for", "the", "default", "profile", "s", "default", "client" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L852-L862
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
JavacParser.reportSyntaxError
protected void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) { int pos = diagPos.getPreferredPosition(); if (pos > S.errPos() || pos == Position.NOPOS) { if (token.kind == EOF) { error(diagPos, "premature.eof"); } else { error(diagPos, key, args); } } S.errPos(pos); if (token.pos == errorPos) { //check for a possible infinite loop in parsing: Assert.check(count++ < RECOVERY_THRESHOLD); } else { count = 0; errorPos = token.pos; } }
java
protected void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) { int pos = diagPos.getPreferredPosition(); if (pos > S.errPos() || pos == Position.NOPOS) { if (token.kind == EOF) { error(diagPos, "premature.eof"); } else { error(diagPos, key, args); } } S.errPos(pos); if (token.pos == errorPos) { //check for a possible infinite loop in parsing: Assert.check(count++ < RECOVERY_THRESHOLD); } else { count = 0; errorPos = token.pos; } }
[ "protected", "void", "reportSyntaxError", "(", "JCDiagnostic", ".", "DiagnosticPosition", "diagPos", ",", "String", "key", ",", "Object", "...", "args", ")", "{", "int", "pos", "=", "diagPos", ".", "getPreferredPosition", "(", ")", ";", "if", "(", "pos", ">"...
Report a syntax error using the given DiagnosticPosition object and arguments, unless one was already reported at the same position.
[ "Report", "a", "syntax", "error", "using", "the", "given", "DiagnosticPosition", "object", "and", "arguments", "unless", "one", "was", "already", "reported", "at", "the", "same", "position", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L469-L486
liaochong/spring-boot-starter-converter
src/main/java/com/github/liaochong/converter/core/BeansConvertStrategy.java
BeansConvertStrategy.convertBeans
public static <E, T, X extends RuntimeException> List<E> convertBeans(List<T> source, Class<E> targetClass, Supplier<X> exceptionSupplier, boolean nonNullFilter) { return convertBeans(source, targetClass, exceptionSupplier, false, nonNullFilter); }
java
public static <E, T, X extends RuntimeException> List<E> convertBeans(List<T> source, Class<E> targetClass, Supplier<X> exceptionSupplier, boolean nonNullFilter) { return convertBeans(source, targetClass, exceptionSupplier, false, nonNullFilter); }
[ "public", "static", "<", "E", ",", "T", ",", "X", "extends", "RuntimeException", ">", "List", "<", "E", ">", "convertBeans", "(", "List", "<", "T", ">", "source", ",", "Class", "<", "E", ">", "targetClass", ",", "Supplier", "<", "X", ">", "exceptionS...
集合转换,无指定异常提供 @param source 需要转换的集合 @param targetClass 需要转换到的类型 @param exceptionSupplier 异常操作 @param nonNullFilter 是否非空过滤 @param <E> 转换后的类型 @param <T> 转换前的类型 @param <X> 异常返回类型 @return 结果
[ "集合转换,无指定异常提供" ]
train
https://github.com/liaochong/spring-boot-starter-converter/blob/a36bea44bd23330a6f43b0372906a804a09285c5/src/main/java/com/github/liaochong/converter/core/BeansConvertStrategy.java#L68-L71
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.exportIteration
public Export exportIteration(UUID projectId, UUID iterationId, String platform, ExportIterationOptionalParameter exportIterationOptionalParameter) { return exportIterationWithServiceResponseAsync(projectId, iterationId, platform, exportIterationOptionalParameter).toBlocking().single().body(); }
java
public Export exportIteration(UUID projectId, UUID iterationId, String platform, ExportIterationOptionalParameter exportIterationOptionalParameter) { return exportIterationWithServiceResponseAsync(projectId, iterationId, platform, exportIterationOptionalParameter).toBlocking().single().body(); }
[ "public", "Export", "exportIteration", "(", "UUID", "projectId", ",", "UUID", "iterationId", ",", "String", "platform", ",", "ExportIterationOptionalParameter", "exportIterationOptionalParameter", ")", "{", "return", "exportIterationWithServiceResponseAsync", "(", "projectId"...
Export a trained iteration. @param projectId The project id @param iterationId The iteration id @param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX' @param exportIterationOptionalParameter the object representing the optional parameters to be set before calling this API @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 Export object if successful.
[ "Export", "a", "trained", "iteration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L946-L948
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GGradientToEdgeFeatures.java
GGradientToEdgeFeatures.intensityE
static public <D extends ImageGray<D>> void intensityE( D derivX , D derivY , GrayF32 intensity ) { if( derivX instanceof GrayF32) { GradientToEdgeFeatures.intensityE((GrayF32)derivX,(GrayF32)derivY,intensity); } else if( derivX instanceof GrayS16) { GradientToEdgeFeatures.intensityE((GrayS16)derivX,(GrayS16)derivY,intensity); } else if( derivX instanceof GrayS32) { GradientToEdgeFeatures.intensityE((GrayS32)derivX,(GrayS32)derivY,intensity); } else { throw new IllegalArgumentException("Unknown input type"); } }
java
static public <D extends ImageGray<D>> void intensityE( D derivX , D derivY , GrayF32 intensity ) { if( derivX instanceof GrayF32) { GradientToEdgeFeatures.intensityE((GrayF32)derivX,(GrayF32)derivY,intensity); } else if( derivX instanceof GrayS16) { GradientToEdgeFeatures.intensityE((GrayS16)derivX,(GrayS16)derivY,intensity); } else if( derivX instanceof GrayS32) { GradientToEdgeFeatures.intensityE((GrayS32)derivX,(GrayS32)derivY,intensity); } else { throw new IllegalArgumentException("Unknown input type"); } }
[ "static", "public", "<", "D", "extends", "ImageGray", "<", "D", ">", ">", "void", "intensityE", "(", "D", "derivX", ",", "D", "derivY", ",", "GrayF32", "intensity", ")", "{", "if", "(", "derivX", "instanceof", "GrayF32", ")", "{", "GradientToEdgeFeatures",...
Computes the edge intensity using a Euclidean norm. @param derivX Derivative along x-axis. Not modified. @param derivY Derivative along y-axis. Not modified. @param intensity Edge intensity.
[ "Computes", "the", "edge", "intensity", "using", "a", "Euclidean", "norm", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GGradientToEdgeFeatures.java#L41-L53
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/FullySegmentedWindowTinyLfuPolicy.java
FullySegmentedWindowTinyLfuPolicy.policies
public static Set<Policy> policies(Config config) { FullySegmentedWindowTinyLfuSettings settings = new FullySegmentedWindowTinyLfuSettings(config); return settings.percentMain().stream() .map(percentMain -> new FullySegmentedWindowTinyLfuPolicy(percentMain, settings)) .collect(toSet()); }
java
public static Set<Policy> policies(Config config) { FullySegmentedWindowTinyLfuSettings settings = new FullySegmentedWindowTinyLfuSettings(config); return settings.percentMain().stream() .map(percentMain -> new FullySegmentedWindowTinyLfuPolicy(percentMain, settings)) .collect(toSet()); }
[ "public", "static", "Set", "<", "Policy", ">", "policies", "(", "Config", "config", ")", "{", "FullySegmentedWindowTinyLfuSettings", "settings", "=", "new", "FullySegmentedWindowTinyLfuSettings", "(", "config", ")", ";", "return", "settings", ".", "percentMain", "("...
Returns all variations of this policy based on the configuration parameters.
[ "Returns", "all", "variations", "of", "this", "policy", "based", "on", "the", "configuration", "parameters", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/FullySegmentedWindowTinyLfuPolicy.java#L81-L86
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.beginUpdate
public EventHubConnectionInner beginUpdate(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).toBlocking().single().body(); }
java
public EventHubConnectionInner beginUpdate(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).toBlocking().single().body(); }
[ "public", "EventHubConnectionInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "String", "eventHubConnectionName", ",", "EventHubConnectionUpdate", "parameters", ")", "{", "return", "beginUpdateWithS...
Updates a 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. @param parameters The Event Hub connection parameters supplied to the Update operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EventHubConnectionInner object if successful.
[ "Updates", "a", "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#L705-L707
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java
AmazonS3Client.addStringListHeader
private static void addStringListHeader(Request<?> request, String header, List<String> values) { if (values != null && !values.isEmpty()) { request.addHeader(header, ServiceUtils.join(values)); } }
java
private static void addStringListHeader(Request<?> request, String header, List<String> values) { if (values != null && !values.isEmpty()) { request.addHeader(header, ServiceUtils.join(values)); } }
[ "private", "static", "void", "addStringListHeader", "(", "Request", "<", "?", ">", "request", ",", "String", "header", ",", "List", "<", "String", ">", "values", ")", "{", "if", "(", "values", "!=", "null", "&&", "!", "values", ".", "isEmpty", "(", ")"...
<p> Adds the specified string list header, joined together separated with commas, to the specified request. This method will not add a string list header if the specified values are <code>null</code> or empty. </p> @param request The request to add the header to. @param header The header name. @param values The list of strings to join together for the header value.
[ "<p", ">", "Adds", "the", "specified", "string", "list", "header", "joined", "together", "separated", "with", "commas", "to", "the", "specified", "request", ".", "This", "method", "will", "not", "add", "a", "string", "list", "header", "if", "the", "specified...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L4512-L4516
ontop/ontop
mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/RAExpressionAttributes.java
RAExpressionAttributes.joinUsing
public static RAExpressionAttributes joinUsing(RAExpressionAttributes re1, RAExpressionAttributes re2, ImmutableSet<QuotedID> using) throws IllegalJoinException { checkRelationAliasesConsistency(re1, re2); if (using.stream().anyMatch(id -> !re1.isUnique(id) || !re2.isUnique(id))) { ImmutableList<QuotedID> notFound = using.stream() .filter(id -> re1.isAbsent(id) || re2.isAbsent(id)) .collect(ImmutableCollectors.toList()); ImmutableList<QuotedID> ambiguous = using.stream() .filter(id -> re1.isAmbiguous(id) || re2.isAmbiguous(id)) .collect(ImmutableCollectors.toList()); throw new IllegalJoinException(re1, re2, (!notFound.isEmpty() ? "Attribute(s) " + notFound + " cannot be found" : "") + (!notFound.isEmpty() && !ambiguous.isEmpty() ? ", " : "") + (!ambiguous.isEmpty() ? "Attribute(s) " + ambiguous + " are ambiguous" : "")); } ImmutableMap<QualifiedAttributeID, Term> attributes = merge( re1.selectAttributes(id -> (id.getRelation() != null && !using.contains(id.getAttribute())) || (id.getRelation() == null && re2.isAbsent(id.getAttribute())) || (id.getRelation() == null && using.contains(id.getAttribute()))), re2.selectAttributes(id -> (id.getRelation() != null && !using.contains(id.getAttribute())) || (id.getRelation() == null && re1.isAbsent(id.getAttribute())))); ImmutableMap<QuotedID, ImmutableSet<RelationID>> attributeOccurrences = getAttributeOccurrences(re1, re2, id -> using.contains(id) ? re1.attributeOccurrences.get(id) : attributeOccurrencesUnion(id, re1, re2)); return new RAExpressionAttributes(attributes, attributeOccurrences); }
java
public static RAExpressionAttributes joinUsing(RAExpressionAttributes re1, RAExpressionAttributes re2, ImmutableSet<QuotedID> using) throws IllegalJoinException { checkRelationAliasesConsistency(re1, re2); if (using.stream().anyMatch(id -> !re1.isUnique(id) || !re2.isUnique(id))) { ImmutableList<QuotedID> notFound = using.stream() .filter(id -> re1.isAbsent(id) || re2.isAbsent(id)) .collect(ImmutableCollectors.toList()); ImmutableList<QuotedID> ambiguous = using.stream() .filter(id -> re1.isAmbiguous(id) || re2.isAmbiguous(id)) .collect(ImmutableCollectors.toList()); throw new IllegalJoinException(re1, re2, (!notFound.isEmpty() ? "Attribute(s) " + notFound + " cannot be found" : "") + (!notFound.isEmpty() && !ambiguous.isEmpty() ? ", " : "") + (!ambiguous.isEmpty() ? "Attribute(s) " + ambiguous + " are ambiguous" : "")); } ImmutableMap<QualifiedAttributeID, Term> attributes = merge( re1.selectAttributes(id -> (id.getRelation() != null && !using.contains(id.getAttribute())) || (id.getRelation() == null && re2.isAbsent(id.getAttribute())) || (id.getRelation() == null && using.contains(id.getAttribute()))), re2.selectAttributes(id -> (id.getRelation() != null && !using.contains(id.getAttribute())) || (id.getRelation() == null && re1.isAbsent(id.getAttribute())))); ImmutableMap<QuotedID, ImmutableSet<RelationID>> attributeOccurrences = getAttributeOccurrences(re1, re2, id -> using.contains(id) ? re1.attributeOccurrences.get(id) : attributeOccurrencesUnion(id, re1, re2)); return new RAExpressionAttributes(attributes, attributeOccurrences); }
[ "public", "static", "RAExpressionAttributes", "joinUsing", "(", "RAExpressionAttributes", "re1", ",", "RAExpressionAttributes", "re2", ",", "ImmutableSet", "<", "QuotedID", ">", "using", ")", "throws", "IllegalJoinException", "{", "checkRelationAliasesConsistency", "(", "...
JOIN USING @param re1 a {@link RAExpressionAttributes} @param re2 a {@link RAExpressionAttributes} @param using a {@link ImmutableSet}<{@link QuotedID}> @return a {@link RAExpressionAttributes} @throws IllegalJoinException if the same alias occurs in both arguments or one of the `using' attributes is ambiguous or absent
[ "JOIN", "USING" ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/RAExpressionAttributes.java#L114-L153
ravendb/ravendb-jvm-client
src/main/java/net/ravendb/client/primitives/NetISO8601Utils.java
NetISO8601Utils.checkOffset
private static void checkOffset(String value, int offset, char expected) throws IndexOutOfBoundsException { char found = value.charAt(offset); if (found != expected) { throw new IndexOutOfBoundsException("Expected '" + expected + "' character but found '" + found + "'"); } }
java
private static void checkOffset(String value, int offset, char expected) throws IndexOutOfBoundsException { char found = value.charAt(offset); if (found != expected) { throw new IndexOutOfBoundsException("Expected '" + expected + "' character but found '" + found + "'"); } }
[ "private", "static", "void", "checkOffset", "(", "String", "value", ",", "int", "offset", ",", "char", "expected", ")", "throws", "IndexOutOfBoundsException", "{", "char", "found", "=", "value", ".", "charAt", "(", "offset", ")", ";", "if", "(", "found", "...
Check if the expected character exist at the given offset of the @param value the string to check at the specified offset @param offset the offset to look for the expected character @param expected the expected character @throws IndexOutOfBoundsException if the expected character is not found
[ "Check", "if", "the", "expected", "character", "exist", "at", "the", "given", "offset", "of", "the" ]
train
https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/primitives/NetISO8601Utils.java#L190-L195
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java
SeaGlassInternalShadowEffect.fillInternalShadow
private void fillInternalShadow(Graphics2D g, Shape s, boolean paintRightShadow) { Rectangle bounds = s.getBounds(); int x = bounds.x; int y = bounds.y; int w = bounds.width; int h = bounds.height; s = shapeGenerator.createRectangle(x, y, w, 2); g.setPaint(getTopShadowGradient(s)); g.fill(s); s = shapeGenerator.createRectangle(x, y, 1, h); g.setPaint(getLeftShadowGradient(s)); g.fill(s); if (paintRightShadow) { s = shapeGenerator.createRectangle(x + w - 1, y, 1, h); g.setPaint(getRightShadowGradient(s)); g.fill(s); } }
java
private void fillInternalShadow(Graphics2D g, Shape s, boolean paintRightShadow) { Rectangle bounds = s.getBounds(); int x = bounds.x; int y = bounds.y; int w = bounds.width; int h = bounds.height; s = shapeGenerator.createRectangle(x, y, w, 2); g.setPaint(getTopShadowGradient(s)); g.fill(s); s = shapeGenerator.createRectangle(x, y, 1, h); g.setPaint(getLeftShadowGradient(s)); g.fill(s); if (paintRightShadow) { s = shapeGenerator.createRectangle(x + w - 1, y, 1, h); g.setPaint(getRightShadowGradient(s)); g.fill(s); } }
[ "private", "void", "fillInternalShadow", "(", "Graphics2D", "g", ",", "Shape", "s", ",", "boolean", "paintRightShadow", ")", "{", "Rectangle", "bounds", "=", "s", ".", "getBounds", "(", ")", ";", "int", "x", "=", "bounds", ".", "x", ";", "int", "y", "=...
Fill a rectangular shadow. @param g the Graphics context to paint with. @param s the shape to fill. This is only used for its bounds. @param paintRightShadow {@code true} if the shape is rectangular and the rightmost shadow should be painted, {@code false} otherwise.
[ "Fill", "a", "rectangular", "shadow", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L82-L102
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.tracev
public void tracev(String format, Object... params) { doLog(Level.TRACE, FQCN, format, params, null); }
java
public void tracev(String format, Object... params) { doLog(Level.TRACE, FQCN, format, params, null); }
[ "public", "void", "tracev", "(", "String", "format", ",", "Object", "...", "params", ")", "{", "doLog", "(", "Level", ".", "TRACE", ",", "FQCN", ",", "format", ",", "params", ",", "null", ")", ";", "}" ]
Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. @param format the message format string @param params the parameters
[ "Issue", "a", "log", "message", "with", "a", "level", "of", "TRACE", "using", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "-", "style", "formatting", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L174-L176
rometools/rome
rome-propono/src/main/java/com/rometools/propono/atom/server/AtomServlet.java
AtomServlet.doPut
@Override protected void doPut(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException { LOG.debug("Entering"); final AtomHandler handler = createAtomRequestHandler(req, res); final String userName = handler.getAuthenticatedUsername(); if (userName != null) { final AtomRequest areq = new AtomRequestImpl(req); try { if (handler.isEntryURI(areq)) { // parse incoming entry final Entry unsavedEntry = Atom10Parser.parseEntry(new BufferedReader(new InputStreamReader(req.getInputStream(), "UTF-8")), null, Locale.US); // call handler to put entry handler.putEntry(areq, unsavedEntry); res.setStatus(HttpServletResponse.SC_OK); } else if (handler.isMediaEditURI(areq)) { // hand input stream to handler handler.putMedia(areq); res.setStatus(HttpServletResponse.SC_OK); } else { res.setStatus(HttpServletResponse.SC_NOT_FOUND); } } catch (final AtomException ae) { res.sendError(ae.getStatus(), ae.getMessage()); LOG.debug("An error occured while processing PUT", ae); } catch (final Exception e) { res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); LOG.debug("An error occured while processing PUT", e); } } else { res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\""); // Wanted to use sendError() here but Tomcat sends 403 forbidden // when I do that, so sticking with setStatus() for time being. res.setStatus(HttpServletResponse.SC_UNAUTHORIZED); } LOG.debug("Exiting"); }
java
@Override protected void doPut(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException { LOG.debug("Entering"); final AtomHandler handler = createAtomRequestHandler(req, res); final String userName = handler.getAuthenticatedUsername(); if (userName != null) { final AtomRequest areq = new AtomRequestImpl(req); try { if (handler.isEntryURI(areq)) { // parse incoming entry final Entry unsavedEntry = Atom10Parser.parseEntry(new BufferedReader(new InputStreamReader(req.getInputStream(), "UTF-8")), null, Locale.US); // call handler to put entry handler.putEntry(areq, unsavedEntry); res.setStatus(HttpServletResponse.SC_OK); } else if (handler.isMediaEditURI(areq)) { // hand input stream to handler handler.putMedia(areq); res.setStatus(HttpServletResponse.SC_OK); } else { res.setStatus(HttpServletResponse.SC_NOT_FOUND); } } catch (final AtomException ae) { res.sendError(ae.getStatus(), ae.getMessage()); LOG.debug("An error occured while processing PUT", ae); } catch (final Exception e) { res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); LOG.debug("An error occured while processing PUT", e); } } else { res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\""); // Wanted to use sendError() here but Tomcat sends 403 forbidden // when I do that, so sticking with setStatus() for time being. res.setStatus(HttpServletResponse.SC_UNAUTHORIZED); } LOG.debug("Exiting"); }
[ "@", "Override", "protected", "void", "doPut", "(", "final", "HttpServletRequest", "req", ",", "final", "HttpServletResponse", "res", ")", "throws", "ServletException", ",", "IOException", "{", "LOG", ".", "debug", "(", "\"Entering\"", ")", ";", "final", "AtomHa...
Handles an Atom PUT by calling handler to identify URI, reading/parsing data, calling handler and writing results to response.
[ "Handles", "an", "Atom", "PUT", "by", "calling", "handler", "to", "identify", "URI", "reading", "/", "parsing", "data", "calling", "handler", "and", "writing", "results", "to", "response", "." ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/server/AtomServlet.java#L279-L322
apache/groovy
src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
GenericsUtils.parameterizeSAM
public static Tuple2<ClassNode[], ClassNode> parameterizeSAM(ClassNode sam) { MethodNode methodNode = ClassHelper.findSAM(sam); final Map<GenericsType, GenericsType> map = makeDeclaringAndActualGenericsTypeMapOfExactType(methodNode.getDeclaringClass(), sam); ClassNode[] parameterTypes = Arrays.stream(methodNode.getParameters()) .map(e -> { ClassNode originalParameterType = e.getType(); return originalParameterType.isGenericsPlaceHolder() ? findActualTypeByGenericsPlaceholderName(originalParameterType.getUnresolvedName(), map) : originalParameterType; }) .toArray(ClassNode[]::new); ClassNode originalReturnType = methodNode.getReturnType(); ClassNode returnType = originalReturnType.isGenericsPlaceHolder() ? findActualTypeByGenericsPlaceholderName(originalReturnType.getUnresolvedName(), map) : originalReturnType; return tuple(parameterTypes, returnType); }
java
public static Tuple2<ClassNode[], ClassNode> parameterizeSAM(ClassNode sam) { MethodNode methodNode = ClassHelper.findSAM(sam); final Map<GenericsType, GenericsType> map = makeDeclaringAndActualGenericsTypeMapOfExactType(methodNode.getDeclaringClass(), sam); ClassNode[] parameterTypes = Arrays.stream(methodNode.getParameters()) .map(e -> { ClassNode originalParameterType = e.getType(); return originalParameterType.isGenericsPlaceHolder() ? findActualTypeByGenericsPlaceholderName(originalParameterType.getUnresolvedName(), map) : originalParameterType; }) .toArray(ClassNode[]::new); ClassNode originalReturnType = methodNode.getReturnType(); ClassNode returnType = originalReturnType.isGenericsPlaceHolder() ? findActualTypeByGenericsPlaceholderName(originalReturnType.getUnresolvedName(), map) : originalReturnType; return tuple(parameterTypes, returnType); }
[ "public", "static", "Tuple2", "<", "ClassNode", "[", "]", ",", "ClassNode", ">", "parameterizeSAM", "(", "ClassNode", "sam", ")", "{", "MethodNode", "methodNode", "=", "ClassHelper", ".", "findSAM", "(", "sam", ")", ";", "final", "Map", "<", "GenericsType", ...
Get the parameter and return types of the abstract method of SAM If the abstract method is not parameterized, we will get generics placeholders, e.g. T, U For example, the abstract method of {@link java.util.function.Function} is <pre> R apply(T t); </pre> We parameterize the above interface as {@code Function<String, Integer>}, then the abstract method will be <pre> Integer apply(String t); </pre> When we call {@code parameterizeSAM} on the ClassNode {@code Function<String, Integer>}, we can get parameter types and return type of the above abstract method, i.e. ClassNode {@code ClassHelper.STRING_TYPE} and {@code ClassHelper.Integer_TYPE} @param sam the class node which contains only one abstract method @return the parameter and return types @since 3.0.0
[ "Get", "the", "parameter", "and", "return", "types", "of", "the", "abstract", "method", "of", "SAM" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java#L961-L982
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusHub.java
BusHub.addBusStop
boolean addBusStop(BusStop busStop, boolean fireEvents) { if (busStop == null) { return false; } if (this.busStops.indexOf(busStop) != -1) { return false; } if (!this.busStops.add(busStop)) { return false; } busStop.addBusHub(this); resetBoundingBox(); if (fireEvents) { firePrimitiveChanged(new BusChangeEvent(this, BusChangeEventType.STOP_ADDED, busStop, this.busStops.size() - 1, null, null, null)); checkPrimitiveValidity(); } return true; }
java
boolean addBusStop(BusStop busStop, boolean fireEvents) { if (busStop == null) { return false; } if (this.busStops.indexOf(busStop) != -1) { return false; } if (!this.busStops.add(busStop)) { return false; } busStop.addBusHub(this); resetBoundingBox(); if (fireEvents) { firePrimitiveChanged(new BusChangeEvent(this, BusChangeEventType.STOP_ADDED, busStop, this.busStops.size() - 1, null, null, null)); checkPrimitiveValidity(); } return true; }
[ "boolean", "addBusStop", "(", "BusStop", "busStop", ",", "boolean", "fireEvents", ")", "{", "if", "(", "busStop", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "this", ".", "busStops", ".", "indexOf", "(", "busStop", ")", "!=", "-", ...
Add a bus stop inside the bus hub. @param busStop is the bus stop to insert. @param fireEvents indicates if the events should be fired and the validity checked. @return <code>true</code> if the bus stop was added, otherwise <code>false</code>
[ "Add", "a", "bus", "stop", "inside", "the", "bus", "hub", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusHub.java#L377-L400
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java
SSOCookieHelperImpl.createLogoutCookies
@Override public void createLogoutCookies(HttpServletRequest req, HttpServletResponse res, boolean deleteJwtCookies) { Cookie[] cookies = req.getCookies(); java.util.ArrayList<Cookie> logoutCookieList = new java.util.ArrayList<Cookie>(); if (cookies != null) { String ssoCookieName = resolveCookieName(cookies); for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equalsIgnoreCase(ssoCookieName)) { cookies[i].setValue(null); addLogoutCookieToList(req, ssoCookieName, logoutCookieList); } } if (deleteJwtCookies) { logoutJwtCookies(req, cookies, logoutCookieList); } //TODO: deal with jwtsso's customizable cookie path. for (Cookie cookie : logoutCookieList) { res.addCookie(cookie); } } }
java
@Override public void createLogoutCookies(HttpServletRequest req, HttpServletResponse res, boolean deleteJwtCookies) { Cookie[] cookies = req.getCookies(); java.util.ArrayList<Cookie> logoutCookieList = new java.util.ArrayList<Cookie>(); if (cookies != null) { String ssoCookieName = resolveCookieName(cookies); for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equalsIgnoreCase(ssoCookieName)) { cookies[i].setValue(null); addLogoutCookieToList(req, ssoCookieName, logoutCookieList); } } if (deleteJwtCookies) { logoutJwtCookies(req, cookies, logoutCookieList); } //TODO: deal with jwtsso's customizable cookie path. for (Cookie cookie : logoutCookieList) { res.addCookie(cookie); } } }
[ "@", "Override", "public", "void", "createLogoutCookies", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ",", "boolean", "deleteJwtCookies", ")", "{", "Cookie", "[", "]", "cookies", "=", "req", ".", "getCookies", "(", ")", ";", "java", "....
/* 1) If we have the custom cookie name, then delete just the custom cookie name 2) If we have the custom cookie name but no cookie found, then will delete the default cookie name LTPAToken2 3) If jwtsso is active, clean up those cookies too.
[ "/", "*", "1", ")", "If", "we", "have", "the", "custom", "cookie", "name", "then", "delete", "just", "the", "custom", "cookie", "name", "2", ")", "If", "we", "have", "the", "custom", "cookie", "name", "but", "no", "cookie", "found", "then", "will", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java#L275-L295
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java
CommerceWarehouseItemPersistenceImpl.findAll
@Override public List<CommerceWarehouseItem> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceWarehouseItem> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceWarehouseItem", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce warehouse items. @return the commerce warehouse items
[ "Returns", "all", "the", "commerce", "warehouse", "items", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java#L2062-L2065
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/reflect/ReflectionUtils.java
ReflectionUtils.getRequiredInternalMethod
@Internal public static Method getRequiredInternalMethod(Class type, String name, Class... argumentTypes) { try { return type.getDeclaredMethod(name, argumentTypes); } catch (NoSuchMethodException e) { return findMethod(type, name, argumentTypes) .orElseThrow(() -> newNoSuchMethodInternalError(type, name, argumentTypes)); } }
java
@Internal public static Method getRequiredInternalMethod(Class type, String name, Class... argumentTypes) { try { return type.getDeclaredMethod(name, argumentTypes); } catch (NoSuchMethodException e) { return findMethod(type, name, argumentTypes) .orElseThrow(() -> newNoSuchMethodInternalError(type, name, argumentTypes)); } }
[ "@", "Internal", "public", "static", "Method", "getRequiredInternalMethod", "(", "Class", "type", ",", "String", "name", ",", "Class", "...", "argumentTypes", ")", "{", "try", "{", "return", "type", ".", "getDeclaredMethod", "(", "name", ",", "argumentTypes", ...
Finds an internal method defined by the Micronaut API and throws a {@link NoSuchMethodError} if it doesn't exist. @param type The type @param name The name @param argumentTypes The argument types @return An {@link Optional} contains the method or empty @throws NoSuchMethodError If the method doesn't exist
[ "Finds", "an", "internal", "method", "defined", "by", "the", "Micronaut", "API", "and", "throws", "a", "{", "@link", "NoSuchMethodError", "}", "if", "it", "doesn", "t", "exist", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/reflect/ReflectionUtils.java#L254-L262
google/closure-templates
java/src/com/google/template/soy/SoyFileSet.java
SoyFileSet.compileToJar
void compileToJar(ByteSink jarTarget, Optional<ByteSink> srcJarTarget) throws IOException { resetErrorReporter(); disallowExternalCalls(); ServerCompilationPrimitives primitives = compileForServerRendering(); BytecodeCompiler.compileToJar( primitives.registry, primitives.soyTree, errorReporter, typeRegistry, jarTarget); if (srcJarTarget.isPresent()) { BytecodeCompiler.writeSrcJar(primitives.soyTree, soyFileSuppliers, srcJarTarget.get()); } throwIfErrorsPresent(); reportWarnings(); }
java
void compileToJar(ByteSink jarTarget, Optional<ByteSink> srcJarTarget) throws IOException { resetErrorReporter(); disallowExternalCalls(); ServerCompilationPrimitives primitives = compileForServerRendering(); BytecodeCompiler.compileToJar( primitives.registry, primitives.soyTree, errorReporter, typeRegistry, jarTarget); if (srcJarTarget.isPresent()) { BytecodeCompiler.writeSrcJar(primitives.soyTree, soyFileSuppliers, srcJarTarget.get()); } throwIfErrorsPresent(); reportWarnings(); }
[ "void", "compileToJar", "(", "ByteSink", "jarTarget", ",", "Optional", "<", "ByteSink", ">", "srcJarTarget", ")", "throws", "IOException", "{", "resetErrorReporter", "(", ")", ";", "disallowExternalCalls", "(", ")", ";", "ServerCompilationPrimitives", "primitives", ...
Compiles this Soy file set into a set of java classes implementing the {@link CompiledTemplate} interface and writes them out to the given ByteSink as a JAR file. @throws SoyCompilationException If compilation fails.
[ "Compiles", "this", "Soy", "file", "set", "into", "a", "set", "of", "java", "classes", "implementing", "the", "{", "@link", "CompiledTemplate", "}", "interface", "and", "writes", "them", "out", "to", "the", "given", "ByteSink", "as", "a", "JAR", "file", "....
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/SoyFileSet.java#L806-L817
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/BicValidator.java
BicValidator.isValid
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString; if (ignoreWhitspaces) { valueAsString = Objects.toString(pvalue, StringUtils.EMPTY).replaceAll("\\s+", StringUtils.EMPTY); } else { valueAsString = Objects.toString(pvalue, null); } if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } if (valueAsString.length() != BIC_LENGTH_MIN && valueAsString.length() != BIC_LENGTH_MAX) { // to short or to long, but it's handled by size validator! return true; } if (!valueAsString.matches(BIC_REGEX)) { // format is wrong! return false; } final String countryCode = valueAsString.substring(4, 6); final IbanLengthDefinition validBicLength = IBAN_LENGTH_MAP.ibanLengths().get(countryCode); return validBicLength != null; }
java
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString; if (ignoreWhitspaces) { valueAsString = Objects.toString(pvalue, StringUtils.EMPTY).replaceAll("\\s+", StringUtils.EMPTY); } else { valueAsString = Objects.toString(pvalue, null); } if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } if (valueAsString.length() != BIC_LENGTH_MIN && valueAsString.length() != BIC_LENGTH_MAX) { // to short or to long, but it's handled by size validator! return true; } if (!valueAsString.matches(BIC_REGEX)) { // format is wrong! return false; } final String countryCode = valueAsString.substring(4, 6); final IbanLengthDefinition validBicLength = IBAN_LENGTH_MAP.ibanLengths().get(countryCode); return validBicLength != null; }
[ "@", "Override", "public", "final", "boolean", "isValid", "(", "final", "Object", "pvalue", ",", "final", "ConstraintValidatorContext", "pcontext", ")", "{", "final", "String", "valueAsString", ";", "if", "(", "ignoreWhitspaces", ")", "{", "valueAsString", "=", ...
{@inheritDoc} check if given string is a valid BIC. @see javax.validation.ConstraintValidator#isValid(java.lang.Object, javax.validation.ConstraintValidatorContext)
[ "{", "@inheritDoc", "}", "check", "if", "given", "string", "is", "a", "valid", "BIC", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/BicValidator.java#L78-L103
Netflix/eureka
eureka-client/src/main/java/com/netflix/discovery/util/DeserializerStringCache.java
DeserializerStringCache.apply
public String apply(final JsonParser jp, CacheScope cacheScope, Supplier<String> source) throws IOException { return apply(CharBuffer.wrap(jp, source), cacheScope); }
java
public String apply(final JsonParser jp, CacheScope cacheScope, Supplier<String> source) throws IOException { return apply(CharBuffer.wrap(jp, source), cacheScope); }
[ "public", "String", "apply", "(", "final", "JsonParser", "jp", ",", "CacheScope", "cacheScope", ",", "Supplier", "<", "String", ">", "source", ")", "throws", "IOException", "{", "return", "apply", "(", "CharBuffer", ".", "wrap", "(", "jp", ",", "source", "...
returns a String read from the JsonParser argument's current position. The returned value may be interned at the given cacheScope to reduce heap consumption @param jp @param cacheScope @return a possibly interned String @throws IOException
[ "returns", "a", "String", "read", "from", "the", "JsonParser", "argument", "s", "current", "position", ".", "The", "returned", "value", "may", "be", "interned", "at", "the", "given", "cacheScope", "to", "reduce", "heap", "consumption" ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/discovery/util/DeserializerStringCache.java#L209-L211
loldevs/riotapi
spectator/src/main/java/net/boreeas/riotapi/spectator/MappedDataCache.java
MappedDataCache.put
public void put(K k, V v) { cache.put(k, v); acquireLock(k).countDown(); }
java
public void put(K k, V v) { cache.put(k, v); acquireLock(k).countDown(); }
[ "public", "void", "put", "(", "K", "k", ",", "V", "v", ")", "{", "cache", ".", "put", "(", "k", ",", "v", ")", ";", "acquireLock", "(", "k", ")", ".", "countDown", "(", ")", ";", "}" ]
Caches the given mapping and releases all waiting locks. @param k The key to store. @param v The value to store.
[ "Caches", "the", "given", "mapping", "and", "releases", "all", "waiting", "locks", "." ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/spectator/src/main/java/net/boreeas/riotapi/spectator/MappedDataCache.java#L56-L59
apache/incubator-gobblin
gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanAjaxAPIClient.java
AzkabanAjaxAPIClient.getProjectId
public static String getProjectId(String sessionId, AzkabanProjectConfig azkabanProjectConfig) throws IOException { // Note: Every get call to Azkaban provides a projectId in response, so we have are using fetchProjectFlows call // .. because it does not need any additional params other than project name Map<String, String> params = Maps.newHashMap(); params.put("ajax", "fetchprojectflows"); params.put("project", azkabanProjectConfig.getAzkabanProjectName()); return executeGetRequest(prepareGetRequest(azkabanProjectConfig.getAzkabanServerUrl() + "/manager", sessionId, params)).get("projectId"); }
java
public static String getProjectId(String sessionId, AzkabanProjectConfig azkabanProjectConfig) throws IOException { // Note: Every get call to Azkaban provides a projectId in response, so we have are using fetchProjectFlows call // .. because it does not need any additional params other than project name Map<String, String> params = Maps.newHashMap(); params.put("ajax", "fetchprojectflows"); params.put("project", azkabanProjectConfig.getAzkabanProjectName()); return executeGetRequest(prepareGetRequest(azkabanProjectConfig.getAzkabanServerUrl() + "/manager", sessionId, params)).get("projectId"); }
[ "public", "static", "String", "getProjectId", "(", "String", "sessionId", ",", "AzkabanProjectConfig", "azkabanProjectConfig", ")", "throws", "IOException", "{", "// Note: Every get call to Azkaban provides a projectId in response, so we have are using fetchProjectFlows call", "// .. b...
* Get project.id for a Project Name. @param sessionId Session Id. @param azkabanProjectConfig Azkaban Project Config. @return Project Id. @throws IOException
[ "*", "Get", "project", ".", "id", "for", "a", "Project", "Name", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanAjaxAPIClient.java#L102-L111
getsentry/sentry-java
sentry/src/main/java/io/sentry/marshaller/json/ExceptionInterfaceBinding.java
ExceptionInterfaceBinding.writeException
private void writeException(JsonGenerator generator, SentryException sentryException) throws IOException { generator.writeStartObject(); generator.writeStringField(TYPE_PARAMETER, sentryException.getExceptionClassName()); generator.writeStringField(VALUE_PARAMETER, sentryException.getExceptionMessage()); generator.writeStringField(MODULE_PARAMETER, sentryException.getExceptionPackageName()); generator.writeFieldName(STACKTRACE_PARAMETER); stackTraceInterfaceBinding.writeInterface(generator, sentryException.getStackTraceInterface()); generator.writeEndObject(); }
java
private void writeException(JsonGenerator generator, SentryException sentryException) throws IOException { generator.writeStartObject(); generator.writeStringField(TYPE_PARAMETER, sentryException.getExceptionClassName()); generator.writeStringField(VALUE_PARAMETER, sentryException.getExceptionMessage()); generator.writeStringField(MODULE_PARAMETER, sentryException.getExceptionPackageName()); generator.writeFieldName(STACKTRACE_PARAMETER); stackTraceInterfaceBinding.writeInterface(generator, sentryException.getStackTraceInterface()); generator.writeEndObject(); }
[ "private", "void", "writeException", "(", "JsonGenerator", "generator", ",", "SentryException", "sentryException", ")", "throws", "IOException", "{", "generator", ".", "writeStartObject", "(", ")", ";", "generator", ".", "writeStringField", "(", "TYPE_PARAMETER", ",",...
Outputs an exception with its StackTrace on a JSon stream. @param generator JSonGenerator. @param sentryException Sentry exception with its associated {@link StackTraceInterface}. @throws IOException
[ "Outputs", "an", "exception", "with", "its", "StackTrace", "on", "a", "JSon", "stream", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/marshaller/json/ExceptionInterfaceBinding.java#L53-L61
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java
Node.unsubscribe
public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { sendPubsubPacket(createPubsubPacket(Type.set, new UnsubscribeExtension(jid, getId(), subscriptionId))); }
java
public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { sendPubsubPacket(createPubsubPacket(Type.set, new UnsubscribeExtension(jid, getId(), subscriptionId))); }
[ "public", "void", "unsubscribe", "(", "String", "jid", ",", "String", "subscriptionId", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "sendPubsubPacket", "(", "createPubsubPacket", "(", "...
Remove the specific subscription related to the specified JID. @param jid The JID used to subscribe to the node @param subscriptionId The id of the subscription being removed @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Remove", "the", "specific", "subscription", "related", "to", "the", "specified", "JID", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L450-L452
anotheria/moskito
moskito-webui/src/main/java/net/anotheria/moskito/webui/journey/api/AnalyzedProducerCallsMapAO.java
AnalyzedProducerCallsMapAO.addProducerCall
public void addProducerCall(String producerId, long duration){ AnalyzedProducerCallsAO bean = beans.get(producerId); if (bean==null){ bean = new AnalyzedProducerCallsAO(producerId); beans.put(producerId, bean); } bean.addCall(duration); totalCalls++; totalDuration+=duration; }
java
public void addProducerCall(String producerId, long duration){ AnalyzedProducerCallsAO bean = beans.get(producerId); if (bean==null){ bean = new AnalyzedProducerCallsAO(producerId); beans.put(producerId, bean); } bean.addCall(duration); totalCalls++; totalDuration+=duration; }
[ "public", "void", "addProducerCall", "(", "String", "producerId", ",", "long", "duration", ")", "{", "AnalyzedProducerCallsAO", "bean", "=", "beans", ".", "get", "(", "producerId", ")", ";", "if", "(", "bean", "==", "null", ")", "{", "bean", "=", "new", ...
Adds a new producer call. The duration and the number of calls for each producer will be increased accordingly. @param producerId id of the producer. @param duration duration of the call.
[ "Adds", "a", "new", "producer", "call", ".", "The", "duration", "and", "the", "number", "of", "calls", "for", "each", "producer", "will", "be", "increased", "accordingly", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/journey/api/AnalyzedProducerCallsMapAO.java#L52-L62
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/EdgeIntensityPolygon.java
EdgeIntensityPolygon.checkIntensity
public boolean checkIntensity( boolean insideDark , double threshold ) { if( insideDark ) return averageOutside-averageInside >= threshold; else return averageInside-averageOutside >= threshold; }
java
public boolean checkIntensity( boolean insideDark , double threshold ) { if( insideDark ) return averageOutside-averageInside >= threshold; else return averageInside-averageOutside >= threshold; }
[ "public", "boolean", "checkIntensity", "(", "boolean", "insideDark", ",", "double", "threshold", ")", "{", "if", "(", "insideDark", ")", "return", "averageOutside", "-", "averageInside", ">=", "threshold", ";", "else", "return", "averageInside", "-", "averageOutsi...
Checks the edge intensity against a threshold. dark: outside-inside &ge; threshold light: inside-outside &ge; threshold @param insideDark is the inside of the polygon supposed to be dark or light? @param threshold threshold for average difference @return true if the edge intensity is significant enough
[ "Checks", "the", "edge", "intensity", "against", "a", "threshold", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/EdgeIntensityPolygon.java#L158-L163
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java
AbstractSourceImporter.updateDB
public void updateDB(final Instance _instance) throws InstallationException { try { final InputStream is = newCodeInputStream(); final Checkin checkin = new Checkin(_instance); checkin.executeWithoutAccessCheck(getProgramName(), is, is.available()); } catch (final UnsupportedEncodingException e) { throw new InstallationException("Encoding failed for " + this.programName, e); } catch (final EFapsException e) { throw new InstallationException("Could not check in " + this.programName, e); } catch (final IOException e) { throw new InstallationException("Reading from inoutstream faild for " + this.programName, e); } }
java
public void updateDB(final Instance _instance) throws InstallationException { try { final InputStream is = newCodeInputStream(); final Checkin checkin = new Checkin(_instance); checkin.executeWithoutAccessCheck(getProgramName(), is, is.available()); } catch (final UnsupportedEncodingException e) { throw new InstallationException("Encoding failed for " + this.programName, e); } catch (final EFapsException e) { throw new InstallationException("Could not check in " + this.programName, e); } catch (final IOException e) { throw new InstallationException("Reading from inoutstream faild for " + this.programName, e); } }
[ "public", "void", "updateDB", "(", "final", "Instance", "_instance", ")", "throws", "InstallationException", "{", "try", "{", "final", "InputStream", "is", "=", "newCodeInputStream", "(", ")", ";", "final", "Checkin", "checkin", "=", "new", "Checkin", "(", "_i...
Stores the read source code in eFaps. This is done with a check in. @param _instance instance (object id) of the source code object in eFaps @throws InstallationException if source code in eFaps could not updated or the source code could not encoded
[ "Stores", "the", "read", "source", "code", "in", "eFaps", ".", "This", "is", "done", "with", "a", "check", "in", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java#L243-L257
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/block/MatrixOps_DDRB.java
MatrixOps_DDRB.blockAligned
public static boolean blockAligned( int blockLength , DSubmatrixD1 A ) { if( A.col0 % blockLength != 0 ) return false; if( A.row0 % blockLength != 0 ) return false; if( A.col1 % blockLength != 0 && A.col1 != A.original.numCols ) { return false; } if( A.row1 % blockLength != 0 && A.row1 != A.original.numRows) { return false; } return true; }
java
public static boolean blockAligned( int blockLength , DSubmatrixD1 A ) { if( A.col0 % blockLength != 0 ) return false; if( A.row0 % blockLength != 0 ) return false; if( A.col1 % blockLength != 0 && A.col1 != A.original.numCols ) { return false; } if( A.row1 % blockLength != 0 && A.row1 != A.original.numRows) { return false; } return true; }
[ "public", "static", "boolean", "blockAligned", "(", "int", "blockLength", ",", "DSubmatrixD1", "A", ")", "{", "if", "(", "A", ".", "col0", "%", "blockLength", "!=", "0", ")", "return", "false", ";", "if", "(", "A", ".", "row0", "%", "blockLength", "!="...
Checks to see if the submatrix has its boundaries along inner blocks. @param blockLength Size of an inner block. @param A Submatrix. @return If it is block aligned or not.
[ "Checks", "to", "see", "if", "the", "submatrix", "has", "its", "boundaries", "along", "inner", "blocks", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/MatrixOps_DDRB.java#L604-L619
ixa-ehu/ixa-pipe-ml
src/main/java/eus/ixa/ixa/pipe/ml/utils/IOUtils.java
IOUtils.openFromFile
public static InputStream openFromFile(final File file) { try { InputStream is = new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE); if (file.getName().endsWith(".gz") || file.getName().endsWith("gz")) { is = new GZIPInputStream(is, BUFFER_SIZE); } return is; } catch (final IOException e) { throw new TerminateToolException(-1, "File '" + file + "' cannot be found", e); } }
java
public static InputStream openFromFile(final File file) { try { InputStream is = new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE); if (file.getName().endsWith(".gz") || file.getName().endsWith("gz")) { is = new GZIPInputStream(is, BUFFER_SIZE); } return is; } catch (final IOException e) { throw new TerminateToolException(-1, "File '" + file + "' cannot be found", e); } }
[ "public", "static", "InputStream", "openFromFile", "(", "final", "File", "file", ")", "{", "try", "{", "InputStream", "is", "=", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "file", ")", ",", "BUFFER_SIZE", ")", ";", "if", "(", "file", ...
Open file to an input stream. @param file the file @return the input stream
[ "Open", "file", "to", "an", "input", "stream", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/IOUtils.java#L368-L380
sarxos/webcam-capture
webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java
Webcam.getDefault
public static Webcam getDefault(long timeout) throws TimeoutException, WebcamException { if (timeout < 0) { throw new IllegalArgumentException(String.format("Timeout cannot be negative (%d)", timeout)); } return getDefault(timeout, TimeUnit.MILLISECONDS); }
java
public static Webcam getDefault(long timeout) throws TimeoutException, WebcamException { if (timeout < 0) { throw new IllegalArgumentException(String.format("Timeout cannot be negative (%d)", timeout)); } return getDefault(timeout, TimeUnit.MILLISECONDS); }
[ "public", "static", "Webcam", "getDefault", "(", "long", "timeout", ")", "throws", "TimeoutException", ",", "WebcamException", "{", "if", "(", "timeout", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Time...
Will discover and return first webcam available in the system. @param timeout the webcam discovery timeout (1 minute by default) @return Default webcam (first from the list) @throws TimeoutException when discovery timeout has been exceeded @throws WebcamException if something is really wrong @throws IllegalArgumentException when timeout is negative @see Webcam#getWebcams(long)
[ "Will", "discover", "and", "return", "first", "webcam", "available", "in", "the", "system", "." ]
train
https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java#L929-L934
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/ArgUtils.java
ArgUtils.notNull
public static void notNull(final Object arg, final String name) { if(arg == null) { throw new IllegalArgumentException(String.format("%s should not be null.", name)); } }
java
public static void notNull(final Object arg, final String name) { if(arg == null) { throw new IllegalArgumentException(String.format("%s should not be null.", name)); } }
[ "public", "static", "void", "notNull", "(", "final", "Object", "arg", ",", "final", "String", "name", ")", "{", "if", "(", "arg", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"%s should not be null....
値がnullでないかどうか検証する。 @param arg 検証対象の値 @param name 検証対象の引数の名前 @throws IllegalArgumentException {@literal arg == null.}
[ "値がnullでないかどうか検証する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/ArgUtils.java#L22-L26
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/ManagedInstanceEncryptionProtectorsInner.java
ManagedInstanceEncryptionProtectorsInner.listByInstanceAsync
public Observable<Page<ManagedInstanceEncryptionProtectorInner>> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName) .map(new Func1<ServiceResponse<Page<ManagedInstanceEncryptionProtectorInner>>, Page<ManagedInstanceEncryptionProtectorInner>>() { @Override public Page<ManagedInstanceEncryptionProtectorInner> call(ServiceResponse<Page<ManagedInstanceEncryptionProtectorInner>> response) { return response.body(); } }); }
java
public Observable<Page<ManagedInstanceEncryptionProtectorInner>> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName) .map(new Func1<ServiceResponse<Page<ManagedInstanceEncryptionProtectorInner>>, Page<ManagedInstanceEncryptionProtectorInner>>() { @Override public Page<ManagedInstanceEncryptionProtectorInner> call(ServiceResponse<Page<ManagedInstanceEncryptionProtectorInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ManagedInstanceEncryptionProtectorInner", ">", ">", "listByInstanceAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "managedInstanceName", ")", "{", "return", "listByInstanceWithServiceResponseAsync", "(...
Gets a list of managed instance encryption protectors. @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 managedInstanceName The name of the managed instance. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ManagedInstanceEncryptionProtectorInner&gt; object
[ "Gets", "a", "list", "of", "managed", "instance", "encryption", "protectors", "." ]
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/ManagedInstanceEncryptionProtectorsInner.java#L134-L142
openengsb/openengsb
components/ekb/common/src/main/java/org/openengsb/core/ekb/common/EDBConverter.java
EDBConverter.getEntryNameForMapValue
public static String getEntryNameForMapValue(String property, Integer index) { return getEntryNameForMap(property, false, index); }
java
public static String getEntryNameForMapValue(String property, Integer index) { return getEntryNameForMap(property, false, index); }
[ "public", "static", "String", "getEntryNameForMapValue", "(", "String", "property", ",", "Integer", "index", ")", "{", "return", "getEntryNameForMap", "(", "property", ",", "false", ",", "index", ")", ";", "}" ]
Returns the entry name for a map value in the EDB format. E.g. the map value for the property "map" with the index 0 would be "map.0.value".
[ "Returns", "the", "entry", "name", "for", "a", "map", "value", "in", "the", "EDB", "format", ".", "E", ".", "g", ".", "the", "map", "value", "for", "the", "property", "map", "with", "the", "index", "0", "would", "be", "map", ".", "0", ".", "value",...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/common/src/main/java/org/openengsb/core/ekb/common/EDBConverter.java#L512-L514
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_migration_migrationId_GET
public OvhMigration project_serviceName_migration_migrationId_GET(String serviceName, String migrationId) throws IOException { String qPath = "/cloud/project/{serviceName}/migration/{migrationId}"; StringBuilder sb = path(qPath, serviceName, migrationId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhMigration.class); }
java
public OvhMigration project_serviceName_migration_migrationId_GET(String serviceName, String migrationId) throws IOException { String qPath = "/cloud/project/{serviceName}/migration/{migrationId}"; StringBuilder sb = path(qPath, serviceName, migrationId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhMigration.class); }
[ "public", "OvhMigration", "project_serviceName_migration_migrationId_GET", "(", "String", "serviceName", ",", "String", "migrationId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/migration/{migrationId}\"", ";", "StringBuilder", "s...
Get planned migration REST: GET /cloud/project/{serviceName}/migration/{migrationId} @param migrationId [required] Migration id @param serviceName [required] Service name API beta
[ "Get", "planned", "migration" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1040-L1045
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java
ResolvableType.forArrayComponent
public static ResolvableType forArrayComponent(ResolvableType componentType) { LettuceAssert.notNull(componentType, "Component type must not be null"); Class<?> arrayClass = Array.newInstance(componentType.resolve(), 0).getClass(); return new ResolvableType(arrayClass, null, null, componentType); }
java
public static ResolvableType forArrayComponent(ResolvableType componentType) { LettuceAssert.notNull(componentType, "Component type must not be null"); Class<?> arrayClass = Array.newInstance(componentType.resolve(), 0).getClass(); return new ResolvableType(arrayClass, null, null, componentType); }
[ "public", "static", "ResolvableType", "forArrayComponent", "(", "ResolvableType", "componentType", ")", "{", "LettuceAssert", ".", "notNull", "(", "componentType", ",", "\"Component type must not be null\"", ")", ";", "Class", "<", "?", ">", "arrayClass", "=", "Array"...
Return a {@link ResolvableType} as a array of the specified {@code componentType}. @param componentType the component type @return a {@link ResolvableType} as an array of the specified component type
[ "Return", "a", "{", "@link", "ResolvableType", "}", "as", "a", "array", "of", "the", "specified", "{", "@code", "componentType", "}", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java#L1037-L1041
triceo/splitlog
splitlog-core/src/main/java/com/github/triceo/splitlog/splitters/exceptions/ExceptionParser.java
ExceptionParser.parseLine
private LineType parseLine(final String line, final LineType... allowedLineTypes) throws ExceptionParseException { for (final LineType possibleType : allowedLineTypes) { if ((possibleType == LineType.POST_END) || (possibleType == LineType.PRE_START)) { // this is garbage, all is accepted without parsing return possibleType; } final ExceptionLine parsedLine = possibleType.parse(line); if (parsedLine != null) { if (possibleType == LineType.PRE_STACK_TRACE) { // in case the cause is multi-line, update the cause final ExceptionLine currentTop = this.parsedLines.remove(this.parsedLines.size() - 1); if (!((currentTop instanceof CauseLine) && (parsedLine instanceof PlainTextLine))) { throw new IllegalStateException("Garbage in the exception message."); } this.parsedLines.add(new CauseLine((CauseLine) currentTop, (PlainTextLine) parsedLine)); } else { this.parsedLines.add(parsedLine); } return possibleType; } } throw new ExceptionParseException(line, "Line not any of the expected types: " + Arrays.toString(allowedLineTypes)); }
java
private LineType parseLine(final String line, final LineType... allowedLineTypes) throws ExceptionParseException { for (final LineType possibleType : allowedLineTypes) { if ((possibleType == LineType.POST_END) || (possibleType == LineType.PRE_START)) { // this is garbage, all is accepted without parsing return possibleType; } final ExceptionLine parsedLine = possibleType.parse(line); if (parsedLine != null) { if (possibleType == LineType.PRE_STACK_TRACE) { // in case the cause is multi-line, update the cause final ExceptionLine currentTop = this.parsedLines.remove(this.parsedLines.size() - 1); if (!((currentTop instanceof CauseLine) && (parsedLine instanceof PlainTextLine))) { throw new IllegalStateException("Garbage in the exception message."); } this.parsedLines.add(new CauseLine((CauseLine) currentTop, (PlainTextLine) parsedLine)); } else { this.parsedLines.add(parsedLine); } return possibleType; } } throw new ExceptionParseException(line, "Line not any of the expected types: " + Arrays.toString(allowedLineTypes)); }
[ "private", "LineType", "parseLine", "(", "final", "String", "line", ",", "final", "LineType", "...", "allowedLineTypes", ")", "throws", "ExceptionParseException", "{", "for", "(", "final", "LineType", "possibleType", ":", "allowedLineTypes", ")", "{", "if", "(", ...
Parse one line in the log, when knowing the types of lines acceptable at this point in the log. @param line Line to parse. @param allowedLineTypes Possible line types, in the order of evaluation. (Possible transitions.) If evaluation matches for a type, transition will be made and any subsequent types will be ignored. @return Identified type of this line. @throws ExceptionParseException If no allowed types match.
[ "Parse", "one", "line", "in", "the", "log", "when", "knowing", "the", "types", "of", "lines", "acceptable", "at", "this", "point", "in", "the", "log", "." ]
train
https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-core/src/main/java/com/github/triceo/splitlog/splitters/exceptions/ExceptionParser.java#L146-L169
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.getGather
public Gather getGather(final String gatherId) throws Exception { final String gatherPath = StringUtils.join(new String[]{ getUri(), "gather", gatherId }, '/'); final JSONObject jsonObject = toJSONObject(client.get(gatherPath, null)); return new Gather(client,jsonObject); }
java
public Gather getGather(final String gatherId) throws Exception { final String gatherPath = StringUtils.join(new String[]{ getUri(), "gather", gatherId }, '/'); final JSONObject jsonObject = toJSONObject(client.get(gatherPath, null)); return new Gather(client,jsonObject); }
[ "public", "Gather", "getGather", "(", "final", "String", "gatherId", ")", "throws", "Exception", "{", "final", "String", "gatherPath", "=", "StringUtils", ".", "join", "(", "new", "String", "[", "]", "{", "getUri", "(", ")", ",", "\"gather\"", ",", "gather...
Gets the gather DTMF parameters and results. @param gatherId gather id @return gather DTMF parameters and results @throws IOException unexpected error.
[ "Gets", "the", "gather", "DTMF", "parameters", "and", "results", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L514-L522
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/yaml/YamlUtil.java
YamlUtil.isOfSameType
public static boolean isOfSameType(YamlNode left, YamlNode right) { return left instanceof YamlMapping && right instanceof YamlMapping || left instanceof YamlSequence && right instanceof YamlSequence || left instanceof YamlScalar && right instanceof YamlScalar; }
java
public static boolean isOfSameType(YamlNode left, YamlNode right) { return left instanceof YamlMapping && right instanceof YamlMapping || left instanceof YamlSequence && right instanceof YamlSequence || left instanceof YamlScalar && right instanceof YamlScalar; }
[ "public", "static", "boolean", "isOfSameType", "(", "YamlNode", "left", ",", "YamlNode", "right", ")", "{", "return", "left", "instanceof", "YamlMapping", "&&", "right", "instanceof", "YamlMapping", "||", "left", "instanceof", "YamlSequence", "&&", "right", "insta...
Checks if the two provided {@code nodes} are of the same type @param left The left-side node of the check @param right The right-side node of the check @return {@code true} if the provided nodes are of the same type
[ "Checks", "if", "the", "two", "provided", "{", "@code", "nodes", "}", "are", "of", "the", "same", "type" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/yaml/YamlUtil.java#L161-L165
rey5137/material
material/src/main/java/com/rey/material/widget/ListPopupWindow.java
ListPopupWindow.onKeyUp
public boolean onKeyUp(int keyCode, KeyEvent event) { if (isShowing() && mDropDownList.getSelectedItemPosition() >= 0) { boolean consumed = mDropDownList.onKeyUp(keyCode, event); if (consumed && isConfirmKey(keyCode)) { // if the list accepts the key events and the key event was a click, the text view // gets the selected item from the drop down as its content dismiss(); } return consumed; } return false; }
java
public boolean onKeyUp(int keyCode, KeyEvent event) { if (isShowing() && mDropDownList.getSelectedItemPosition() >= 0) { boolean consumed = mDropDownList.onKeyUp(keyCode, event); if (consumed && isConfirmKey(keyCode)) { // if the list accepts the key events and the key event was a click, the text view // gets the selected item from the drop down as its content dismiss(); } return consumed; } return false; }
[ "public", "boolean", "onKeyUp", "(", "int", "keyCode", ",", "KeyEvent", "event", ")", "{", "if", "(", "isShowing", "(", ")", "&&", "mDropDownList", ".", "getSelectedItemPosition", "(", ")", ">=", "0", ")", "{", "boolean", "consumed", "=", "mDropDownList", ...
Filter key down events. By forwarding key up events to this function, views using non-modal ListPopupWindow can have it handle key selection of items. @param keyCode keyCode param passed to the host view's onKeyUp @param event event param passed to the host view's onKeyUp @return true if the event was handled, false if it was ignored. @see #setModal(boolean)
[ "Filter", "key", "down", "events", ".", "By", "forwarding", "key", "up", "events", "to", "this", "function", "views", "using", "non", "-", "modal", "ListPopupWindow", "can", "have", "it", "handle", "key", "selection", "of", "items", "." ]
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/ListPopupWindow.java#L987-L998
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.getLocalTransaction
public final LocalTransaction getLocalTransaction() throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "getLocalTransaction"); localTran = localTran == null ? new WSRdbSpiLocalTransactionImpl(this, sqlConn) : localTran; if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getLocalTransaction", localTran); return localTran; }
java
public final LocalTransaction getLocalTransaction() throws ResourceException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "getLocalTransaction"); localTran = localTran == null ? new WSRdbSpiLocalTransactionImpl(this, sqlConn) : localTran; if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "getLocalTransaction", localTran); return localTran; }
[ "public", "final", "LocalTransaction", "getLocalTransaction", "(", ")", "throws", "ResourceException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", ...
Returns an javax.resource.spi.LocalTransaction instance. The LocalTransaction interface is used by the container to manage local transactions for a RM instance. @return a LocalTransaction instance @exception ResourceException - There should not be an exception thrown in this case. We just need to declare it as it is part of the interface.
[ "Returns", "an", "javax", ".", "resource", ".", "spi", ".", "LocalTransaction", "instance", ".", "The", "LocalTransaction", "interface", "is", "used", "by", "the", "container", "to", "manage", "local", "transactions", "for", "a", "RM", "instance", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3819-L3832
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.writeFile
public CmsFile writeFile(CmsDbContext dbc, CmsFile resource) throws CmsException { resource.setUserLastModified(dbc.currentUser().getId()); resource.setContents(resource.getContents()); // to be sure the content date is updated getVfsDriver(dbc).writeResource(dbc, dbc.currentProject().getUuid(), resource, UPDATE_RESOURCE_STATE); byte[] contents = resource.getContents(); getVfsDriver(dbc).writeContent(dbc, resource.getResourceId(), contents); // log it log( dbc, new CmsLogEntry( dbc, resource.getStructureId(), CmsLogEntryType.RESOURCE_CONTENT_MODIFIED, new String[] {resource.getRootPath()}), false); // read the file back from db resource = new CmsFile(readResource(dbc, resource.getStructureId(), CmsResourceFilter.ALL)); resource.setContents(contents); deleteRelationsWithSiblings(dbc, resource); // update the cache m_monitor.clearResourceCache(); Map<String, Object> data = new HashMap<String, Object>(2); data.put(I_CmsEventListener.KEY_RESOURCE, resource); data.put(I_CmsEventListener.KEY_CHANGE, new Integer(CHANGED_CONTENT)); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data)); return resource; }
java
public CmsFile writeFile(CmsDbContext dbc, CmsFile resource) throws CmsException { resource.setUserLastModified(dbc.currentUser().getId()); resource.setContents(resource.getContents()); // to be sure the content date is updated getVfsDriver(dbc).writeResource(dbc, dbc.currentProject().getUuid(), resource, UPDATE_RESOURCE_STATE); byte[] contents = resource.getContents(); getVfsDriver(dbc).writeContent(dbc, resource.getResourceId(), contents); // log it log( dbc, new CmsLogEntry( dbc, resource.getStructureId(), CmsLogEntryType.RESOURCE_CONTENT_MODIFIED, new String[] {resource.getRootPath()}), false); // read the file back from db resource = new CmsFile(readResource(dbc, resource.getStructureId(), CmsResourceFilter.ALL)); resource.setContents(contents); deleteRelationsWithSiblings(dbc, resource); // update the cache m_monitor.clearResourceCache(); Map<String, Object> data = new HashMap<String, Object>(2); data.put(I_CmsEventListener.KEY_RESOURCE, resource); data.put(I_CmsEventListener.KEY_CHANGE, new Integer(CHANGED_CONTENT)); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data)); return resource; }
[ "public", "CmsFile", "writeFile", "(", "CmsDbContext", "dbc", ",", "CmsFile", "resource", ")", "throws", "CmsException", "{", "resource", ".", "setUserLastModified", "(", "dbc", ".", "currentUser", "(", ")", ".", "getId", "(", ")", ")", ";", "resource", ".",...
Writes a resource to the OpenCms VFS, including it's content.<p> Applies only to resources of type <code>{@link CmsFile}</code> i.e. resources that have a binary content attached.<p> Certain resource types might apply content validation or transformation rules before the resource is actually written to the VFS. The returned result might therefore be a modified version from the provided original.<p> @param dbc the current database context @param resource the resource to apply this operation to @return the written resource (may have been modified) @throws CmsException if something goes wrong @see CmsObject#writeFile(CmsFile) @see I_CmsResourceType#writeFile(CmsObject, CmsSecurityManager, CmsFile)
[ "Writes", "a", "resource", "to", "the", "OpenCms", "VFS", "including", "it", "s", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L9793-L9827
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createScrollButtonTogetherDecrease
public Shape createScrollButtonTogetherDecrease(int x, int y, int w, int h) { path.reset(); path.moveTo(x + w, y); path.lineTo(x + w, y + h); path.lineTo(x, y + h); addScrollGapPath(x, y, w, h, false); path.closePath(); return path; }
java
public Shape createScrollButtonTogetherDecrease(int x, int y, int w, int h) { path.reset(); path.moveTo(x + w, y); path.lineTo(x + w, y + h); path.lineTo(x, y + h); addScrollGapPath(x, y, w, h, false); path.closePath(); return path; }
[ "public", "Shape", "createScrollButtonTogetherDecrease", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "x", "+", "w", ",", "y", ")", ";", "path", "."...
Return a path for a scroll bar decrease button. This is used when the buttons are placed together at one end of the scroll bar. @param x the X coordinate of the upper-left corner of the button @param y the Y coordinate of the upper-left corner of the button @param w the width of the button @param h the height of the button @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "scroll", "bar", "decrease", "button", ".", "This", "is", "used", "when", "the", "buttons", "are", "placed", "together", "at", "one", "end", "of", "the", "scroll", "bar", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L690-L699
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.createLabel
protected Label createLabel(Composite parent, String text, boolean bold) { Label label= new Label(parent, SWT.NONE); if (bold) label.setFont(JFaceResources.getBannerFont()); label.setText(text); GridData gridData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false); label.setLayoutData(gridData); return label; }
java
protected Label createLabel(Composite parent, String text, boolean bold) { Label label= new Label(parent, SWT.NONE); if (bold) label.setFont(JFaceResources.getBannerFont()); label.setText(text); GridData gridData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false); label.setLayoutData(gridData); return label; }
[ "protected", "Label", "createLabel", "(", "Composite", "parent", ",", "String", "text", ",", "boolean", "bold", ")", "{", "Label", "label", "=", "new", "Label", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", "if", "(", "bold", ")", "label", ".", "...
Creates a new label with an optional bold font. @param parent the parent control @param text the label text @param bold bold or not @return the new label control
[ "Creates", "a", "new", "label", "with", "an", "optional", "bold", "font", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L315-L323
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/StandardContextSpaceService.java
StandardContextSpaceService.fireSpaceDestroyed
protected void fireSpaceDestroyed(Space space, boolean isLocalDestruction) { for (final SpaceRepositoryListener listener : this.listeners.getListeners(SpaceRepositoryListener.class)) { listener.spaceDestroyed(space, isLocalDestruction); } }
java
protected void fireSpaceDestroyed(Space space, boolean isLocalDestruction) { for (final SpaceRepositoryListener listener : this.listeners.getListeners(SpaceRepositoryListener.class)) { listener.spaceDestroyed(space, isLocalDestruction); } }
[ "protected", "void", "fireSpaceDestroyed", "(", "Space", "space", ",", "boolean", "isLocalDestruction", ")", "{", "for", "(", "final", "SpaceRepositoryListener", "listener", ":", "this", ".", "listeners", ".", "getListeners", "(", "SpaceRepositoryListener", ".", "cl...
Notifies the listeners on the space destruction. @param space reference to the destroyed space. @param isLocalDestruction indicates if the space was destroyed in the current kernel.
[ "Notifies", "the", "listeners", "on", "the", "space", "destruction", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/StandardContextSpaceService.java#L358-L362
hal/core
gui/src/main/java/org/jboss/as/console/client/widgets/nav/v3/FinderColumn.java
FinderColumn.applySecurity
private void applySecurity(final SecurityContext securityContext, boolean update) { // System.out.println("<< Process SecurityContext on column "+title+": "+securityContext+">>"); // calculate accessible menu items filterNonPrivilegeOperations(securityContext, accessibleTopMenuItems, topMenuItems); filterNonPrivilegeOperations(securityContext,accessibleMenuItems, menuItems); // the top menu is build here if(!plain) buildTopMenu(headerMenu); // the row level menu is build when the celltable is filled // hence we need to refresh it toggleRowLevelTools(() -> true); // hide it Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { dataProvider.refresh(); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { toggleRowLevelTools(() -> selectionModel.getSelectedObject() == null); // show when selected } }); } }); }
java
private void applySecurity(final SecurityContext securityContext, boolean update) { // System.out.println("<< Process SecurityContext on column "+title+": "+securityContext+">>"); // calculate accessible menu items filterNonPrivilegeOperations(securityContext, accessibleTopMenuItems, topMenuItems); filterNonPrivilegeOperations(securityContext,accessibleMenuItems, menuItems); // the top menu is build here if(!plain) buildTopMenu(headerMenu); // the row level menu is build when the celltable is filled // hence we need to refresh it toggleRowLevelTools(() -> true); // hide it Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { dataProvider.refresh(); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { toggleRowLevelTools(() -> selectionModel.getSelectedObject() == null); // show when selected } }); } }); }
[ "private", "void", "applySecurity", "(", "final", "SecurityContext", "securityContext", ",", "boolean", "update", ")", "{", "// System.out.println(\"<< Process SecurityContext on column \"+title+\": \"+securityContext+\">>\");", "// calculate accessible menu items", "filterNonPrivilegeOp...
Central point for security context changes This will be called when: a) the widget is attached (default) b) the security context changes (i.e. scoped roles)
[ "Central", "point", "for", "security", "context", "changes", "This", "will", "be", "called", "when", ":" ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/widgets/nav/v3/FinderColumn.java#L331-L360
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BeanRegistry.java
BeanRegistry.postProcessAfterInitialization
@SuppressWarnings("unchecked") @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (clazz.isInstance(bean)) { register((V) bean); } return bean; }
java
@SuppressWarnings("unchecked") @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (clazz.isInstance(bean)) { register((V) bean); } return bean; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "Object", "postProcessAfterInitialization", "(", "Object", "bean", ",", "String", "beanName", ")", "throws", "BeansException", "{", "if", "(", "clazz", ".", "isInstance", "(", "bean", ...
If the managed bean is of the desired type, add it to the registry.
[ "If", "the", "managed", "bean", "is", "of", "the", "desired", "type", "add", "it", "to", "the", "registry", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BeanRegistry.java#L61-L69
rnorth/visible-assertions
src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java
VisibleAssertions.assertNotEquals
public static void assertNotEquals(String message, Object expected, Object actual) { if (areBothNull(expected, actual)) { fail(message); } else if (isObjectEquals(expected, actual)) { fail(message); } else { pass(message); } }
java
public static void assertNotEquals(String message, Object expected, Object actual) { if (areBothNull(expected, actual)) { fail(message); } else if (isObjectEquals(expected, actual)) { fail(message); } else { pass(message); } }
[ "public", "static", "void", "assertNotEquals", "(", "String", "message", ",", "Object", "expected", ",", "Object", "actual", ")", "{", "if", "(", "areBothNull", "(", "expected", ",", "actual", ")", ")", "{", "fail", "(", "message", ")", ";", "}", "else",...
Assert that an actual value is not equal to an expected value. <p> Equality is tested with the standard Object equals() method, unless both values are null. <p> If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown. @param message message to display alongside the assertion outcome @param expected the expected value @param actual the actual value
[ "Assert", "that", "an", "actual", "value", "is", "not", "equal", "to", "an", "expected", "value", ".", "<p", ">", "Equality", "is", "tested", "with", "the", "standard", "Object", "equals", "()", "method", "unless", "both", "values", "are", "null", ".", "...
train
https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L237-L245
rzwitserloot/lombok
src/core/lombok/Lombok.java
Lombok.checkNotNull
public static <T> T checkNotNull(T value, String message) { if (value == null) throw new NullPointerException(message); return value; }
java
public static <T> T checkNotNull(T value, String message) { if (value == null) throw new NullPointerException(message); return value; }
[ "public", "static", "<", "T", ">", "T", "checkNotNull", "(", "T", "value", ",", "String", "message", ")", "{", "if", "(", "value", "==", "null", ")", "throw", "new", "NullPointerException", "(", "message", ")", ";", "return", "value", ";", "}" ]
Ensures that the {@code value} is not {@code null}. @param <T> Type of the parameter. @param value the value to test for null. @param message the message of the {@link NullPointerException}. @return the value if it is not null. @throws NullPointerException with the {@code message} if the value is null.
[ "Ensures", "that", "the", "{", "@code", "value", "}", "is", "not", "{", "@code", "null", "}", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/Lombok.java#L81-L84
rythmengine/rythmengine
src/main/java/org/rythmengine/RythmEngine.java
RythmEngine.invokeTemplate
public void invokeTemplate(int line, String name, ITemplate caller, ITag.__ParameterList params, ITag.__Body body, ITag.__Body context) { invokeTemplate(line, name, caller, params, body, context, false); }
java
public void invokeTemplate(int line, String name, ITemplate caller, ITag.__ParameterList params, ITag.__Body body, ITag.__Body context) { invokeTemplate(line, name, caller, params, body, context, false); }
[ "public", "void", "invokeTemplate", "(", "int", "line", ",", "String", "name", ",", "ITemplate", "caller", ",", "ITag", ".", "__ParameterList", "params", ",", "ITag", ".", "__Body", "body", ",", "ITag", ".", "__Body", "context", ")", "{", "invokeTemplate", ...
Invoke a template <p/> <p>Not an API for user application</p> @param line @param name @param caller @param params @param body @param context
[ "Invoke", "a", "template", "<p", "/", ">", "<p", ">", "Not", "an", "API", "for", "user", "application<", "/", "p", ">" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/RythmEngine.java#L1674-L1676
messagebird/java-rest-api
api/src/main/java/com/messagebird/MessageBirdClient.java
MessageBirdClient.listConversationWebhooks
ConversationWebhookList listConversationWebhooks(final int offset, final int limit) throws UnauthorizedException, GeneralException { String url = CONVERSATIONS_BASE_URL + CONVERSATION_WEBHOOK_PATH; return messageBirdService.requestList(url, offset, limit, ConversationWebhookList.class); }
java
ConversationWebhookList listConversationWebhooks(final int offset, final int limit) throws UnauthorizedException, GeneralException { String url = CONVERSATIONS_BASE_URL + CONVERSATION_WEBHOOK_PATH; return messageBirdService.requestList(url, offset, limit, ConversationWebhookList.class); }
[ "ConversationWebhookList", "listConversationWebhooks", "(", "final", "int", "offset", ",", "final", "int", "limit", ")", "throws", "UnauthorizedException", ",", "GeneralException", "{", "String", "url", "=", "CONVERSATIONS_BASE_URL", "+", "CONVERSATION_WEBHOOK_PATH", ";",...
Gets a ConversationWebhook listing with the specified pagination options. @param offset Number of objects to skip. @param limit Number of objects to skip. @return List of webhooks.
[ "Gets", "a", "ConversationWebhook", "listing", "with", "the", "specified", "pagination", "options", "." ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L882-L886
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/Directories.java
Directories.getKSChildDirectories
public static List<File> getKSChildDirectories(String ksName) { List<File> result = new ArrayList<>(); for (DataDirectory dataDirectory : dataDirectories) { File ksDir = new File(dataDirectory.location, ksName); File[] cfDirs = ksDir.listFiles(); if (cfDirs == null) continue; for (File cfDir : cfDirs) { if (cfDir.isDirectory()) result.add(cfDir); } } return result; }
java
public static List<File> getKSChildDirectories(String ksName) { List<File> result = new ArrayList<>(); for (DataDirectory dataDirectory : dataDirectories) { File ksDir = new File(dataDirectory.location, ksName); File[] cfDirs = ksDir.listFiles(); if (cfDirs == null) continue; for (File cfDir : cfDirs) { if (cfDir.isDirectory()) result.add(cfDir); } } return result; }
[ "public", "static", "List", "<", "File", ">", "getKSChildDirectories", "(", "String", "ksName", ")", "{", "List", "<", "File", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "DataDirectory", "dataDirectory", ":", "dataDirectories", ...
Recursively finds all the sub directories in the KS directory.
[ "Recursively", "finds", "all", "the", "sub", "directories", "in", "the", "KS", "directory", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Directories.java#L665-L681
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java
ProxyDataSourceBuilder.logSlowQueryByCommons
public ProxyDataSourceBuilder logSlowQueryByCommons(long thresholdTime, TimeUnit timeUnit, String logName) { return logSlowQueryByCommons(thresholdTime, timeUnit, null, logName); }
java
public ProxyDataSourceBuilder logSlowQueryByCommons(long thresholdTime, TimeUnit timeUnit, String logName) { return logSlowQueryByCommons(thresholdTime, timeUnit, null, logName); }
[ "public", "ProxyDataSourceBuilder", "logSlowQueryByCommons", "(", "long", "thresholdTime", ",", "TimeUnit", "timeUnit", ",", "String", "logName", ")", "{", "return", "logSlowQueryByCommons", "(", "thresholdTime", ",", "timeUnit", ",", "null", ",", "logName", ")", ";...
Register {@link CommonsSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @param logName commons logger name @return builder @since 1.4.1
[ "Register", "{", "@link", "CommonsSlowQueryListener", "}", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L259-L261
apereo/cas
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java
LdapUtils.newLdaptiveSearchExecutor
public static SearchExecutor newLdaptiveSearchExecutor(final String baseDn, final String filterQuery, final List<String> params, final List<String> returnAttributes) { return newLdaptiveSearchExecutor(baseDn, filterQuery, params, returnAttributes.toArray(ArrayUtils.EMPTY_STRING_ARRAY)); }
java
public static SearchExecutor newLdaptiveSearchExecutor(final String baseDn, final String filterQuery, final List<String> params, final List<String> returnAttributes) { return newLdaptiveSearchExecutor(baseDn, filterQuery, params, returnAttributes.toArray(ArrayUtils.EMPTY_STRING_ARRAY)); }
[ "public", "static", "SearchExecutor", "newLdaptiveSearchExecutor", "(", "final", "String", "baseDn", ",", "final", "String", "filterQuery", ",", "final", "List", "<", "String", ">", "params", ",", "final", "List", "<", "String", ">", "returnAttributes", ")", "{"...
New ldaptive search executor search executor. @param baseDn the base dn @param filterQuery the filter query @param params the params @param returnAttributes the return attributes @return the search executor
[ "New", "ldaptive", "search", "executor", "search", "executor", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L589-L593
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDRandom.java
SDRandom.normalTruncated
public SDVariable normalTruncated(String name, double mean, double stddev, long... shape) { SDVariable ret = f().randomNormalTruncated(mean, stddev, shape); return updateVariableNameAndReference(ret, name); }
java
public SDVariable normalTruncated(String name, double mean, double stddev, long... shape) { SDVariable ret = f().randomNormalTruncated(mean, stddev, shape); return updateVariableNameAndReference(ret, name); }
[ "public", "SDVariable", "normalTruncated", "(", "String", "name", ",", "double", "mean", ",", "double", "stddev", ",", "long", "...", "shape", ")", "{", "SDVariable", "ret", "=", "f", "(", ")", ".", "randomNormalTruncated", "(", "mean", ",", "stddev", ",",...
Generate a new random SDVariable, where values are randomly sampled according to a Gaussian (normal) distribution, N(mean, stdev). However, any values more than 1 standard deviation from the mean are dropped and re-sampled<br> @param name Name of the new SDVariable @param mean Mean value for the random array @param stddev Standard deviation for the random array @param shape Shape of the new random SDVariable @return New SDVariable
[ "Generate", "a", "new", "random", "SDVariable", "where", "values", "are", "randomly", "sampled", "according", "to", "a", "Gaussian", "(", "normal", ")", "distribution", "N", "(", "mean", "stdev", ")", ".", "However", "any", "values", "more", "than", "1", "...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDRandom.java#L212-L215
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/utils/IoUtils.java
IoUtils.copyStream
public static boolean copyStream(InputStream is, OutputStream os, CopyListener listener, int bufferSize) throws IOException { int current = 0; int total = is.available(); if (total <= 0) { total = DEFAULT_IMAGE_TOTAL_SIZE; } final byte[] bytes = new byte[bufferSize]; int count; if (shouldStopLoading(listener, current, total)) return false; while ((count = is.read(bytes, 0, bufferSize)) != -1) { os.write(bytes, 0, count); current += count; if (shouldStopLoading(listener, current, total)) return false; } os.flush(); return true; }
java
public static boolean copyStream(InputStream is, OutputStream os, CopyListener listener, int bufferSize) throws IOException { int current = 0; int total = is.available(); if (total <= 0) { total = DEFAULT_IMAGE_TOTAL_SIZE; } final byte[] bytes = new byte[bufferSize]; int count; if (shouldStopLoading(listener, current, total)) return false; while ((count = is.read(bytes, 0, bufferSize)) != -1) { os.write(bytes, 0, count); current += count; if (shouldStopLoading(listener, current, total)) return false; } os.flush(); return true; }
[ "public", "static", "boolean", "copyStream", "(", "InputStream", "is", ",", "OutputStream", "os", ",", "CopyListener", "listener", ",", "int", "bufferSize", ")", "throws", "IOException", "{", "int", "current", "=", "0", ";", "int", "total", "=", "is", ".", ...
Copies stream, fires progress events by listener, can be interrupted by listener. @param is Input stream @param os Output stream @param listener null-ok; Listener of copying progress and controller of copying interrupting @param bufferSize Buffer size for copying, also represents a step for firing progress listener callback, i.e. progress event will be fired after every copied <b>bufferSize</b> bytes @return <b>true</b> - if stream copied successfully; <b>false</b> - if copying was interrupted by listener @throws IOException
[ "Copies", "stream", "fires", "progress", "events", "by", "listener", "can", "be", "interrupted", "by", "listener", "." ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/utils/IoUtils.java#L66-L84
NoraUi/NoraUi
src/main/java/com/github/noraui/utils/Utilities.java
Utilities.findElement
public static WebElement findElement(WebDriver webDriver, String applicationKey, String code, Object... args) { return webDriver.findElement(getLocator(applicationKey, code, args)); }
java
public static WebElement findElement(WebDriver webDriver, String applicationKey, String code, Object... args) { return webDriver.findElement(getLocator(applicationKey, code, args)); }
[ "public", "static", "WebElement", "findElement", "(", "WebDriver", "webDriver", ",", "String", "applicationKey", ",", "String", "code", ",", "Object", "...", "args", ")", "{", "return", "webDriver", ".", "findElement", "(", "getLocator", "(", "applicationKey", "...
Find the first {@link WebElement} using the given method. This method is affected by the 'implicit wait' times in force at the time of execution. The findElement(..) invocation will return a matching row, or try again repeatedly until the configured timeout is reached. @param webDriver instance of webDriver @param applicationKey key of application @param code Name of element on the web Page. @param args can be a index i @return the first {@link WebElement} using the given method
[ "Find", "the", "first", "{", "@link", "WebElement", "}", "using", "the", "given", "method", ".", "This", "method", "is", "affected", "by", "the", "implicit", "wait", "times", "in", "force", "at", "the", "time", "of", "execution", ".", "The", "findElement",...
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/utils/Utilities.java#L159-L161
oasp/oasp4j
modules/security/src/main/java/io/oasp/module/security/common/base/accesscontrol/AbstractAccessControlProvider.java
AbstractAccessControlProvider.checkForCyclicDependencies
protected void checkForCyclicDependencies(AccessControlGroup group, List<AccessControlGroup> groupList) { for (AccessControlGroup inheritedGroup : group.getInherits()) { if (groupList.contains(inheritedGroup)) { StringBuilder sb = new StringBuilder("A cyclic dependency of access control groups has been detected: \n"); for (int i = groupList.size() - 1; i >= 0; i--) { AccessControlGroup node = groupList.get(i); sb.append(node); if (i > 0) { sb.append("-->"); } } throw new IllegalStateException(sb.toString()); } groupList.add(inheritedGroup); checkForCyclicDependencies(inheritedGroup, groupList); AccessControlGroup removed = groupList.remove(groupList.size() - 1); assert (removed == inheritedGroup); } }
java
protected void checkForCyclicDependencies(AccessControlGroup group, List<AccessControlGroup> groupList) { for (AccessControlGroup inheritedGroup : group.getInherits()) { if (groupList.contains(inheritedGroup)) { StringBuilder sb = new StringBuilder("A cyclic dependency of access control groups has been detected: \n"); for (int i = groupList.size() - 1; i >= 0; i--) { AccessControlGroup node = groupList.get(i); sb.append(node); if (i > 0) { sb.append("-->"); } } throw new IllegalStateException(sb.toString()); } groupList.add(inheritedGroup); checkForCyclicDependencies(inheritedGroup, groupList); AccessControlGroup removed = groupList.remove(groupList.size() - 1); assert (removed == inheritedGroup); } }
[ "protected", "void", "checkForCyclicDependencies", "(", "AccessControlGroup", "group", ",", "List", "<", "AccessControlGroup", ">", "groupList", ")", "{", "for", "(", "AccessControlGroup", "inheritedGroup", ":", "group", ".", "getInherits", "(", ")", ")", "{", "if...
Checks that the given {@link AccessControlGroup} has no cyclic {@link AccessControlGroup#getInherits() inheritance graph}. @param group is the {@link AccessControlGroup} to check. @param groupList the {@link List} of visited {@link AccessControlGroup}s used to detect cycles.
[ "Checks", "that", "the", "given", "{", "@link", "AccessControlGroup", "}", "has", "no", "cyclic", "{", "@link", "AccessControlGroup#getInherits", "()", "inheritance", "graph", "}", "." ]
train
https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/security/src/main/java/io/oasp/module/security/common/base/accesscontrol/AbstractAccessControlProvider.java#L70-L89
alkacon/opencms-core
src-gwt/org/opencms/ade/contenteditor/client/CmsEntityObserver.java
CmsEntityObserver.safeExecuteChangeListener
protected void safeExecuteChangeListener(CmsEntity entity, I_CmsEntityChangeListener listener) { try { listener.onEntityChange(entity); } catch (Exception e) { String stack = CmsClientStringUtil.getStackTrace(e, "<br />"); CmsDebugLog.getInstance().printLine("<br />" + e.getMessage() + "<br />" + stack); } }
java
protected void safeExecuteChangeListener(CmsEntity entity, I_CmsEntityChangeListener listener) { try { listener.onEntityChange(entity); } catch (Exception e) { String stack = CmsClientStringUtil.getStackTrace(e, "<br />"); CmsDebugLog.getInstance().printLine("<br />" + e.getMessage() + "<br />" + stack); } }
[ "protected", "void", "safeExecuteChangeListener", "(", "CmsEntity", "entity", ",", "I_CmsEntityChangeListener", "listener", ")", "{", "try", "{", "listener", ".", "onEntityChange", "(", "entity", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String",...
Calls an entity change listener, catching any errors.<p> @param entity the entity with which the change listener should be called @param listener the change listener
[ "Calls", "an", "entity", "change", "listener", "catching", "any", "errors", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/contenteditor/client/CmsEntityObserver.java#L145-L153
haifengl/smile
graph/src/main/java/smile/graph/AdjacencyMatrix.java
AdjacencyMatrix.dfs
private void dfs(int v, int[] cc, int id) { cc[v] = id; for (int t = 0; t < n; t++) { if (graph[v][t] != 0.0) { if (cc[t] == -1) { dfs(t, cc, id); } } } }
java
private void dfs(int v, int[] cc, int id) { cc[v] = id; for (int t = 0; t < n; t++) { if (graph[v][t] != 0.0) { if (cc[t] == -1) { dfs(t, cc, id); } } } }
[ "private", "void", "dfs", "(", "int", "v", ",", "int", "[", "]", "cc", ",", "int", "id", ")", "{", "cc", "[", "v", "]", "=", "id", ";", "for", "(", "int", "t", "=", "0", ";", "t", "<", "n", ";", "t", "++", ")", "{", "if", "(", "graph", ...
Depth-first search connected components of graph. @param v the start vertex. @param cc the array to store the connected component id of vertices. @param id the current component id.
[ "Depth", "-", "first", "search", "connected", "components", "of", "graph", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/graph/src/main/java/smile/graph/AdjacencyMatrix.java#L296-L305
structurizr/java
structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java
TypeUtils.getCategory
public static TypeCategory getCategory(TypeRepository typeRepository, String typeName) { try { Class<?> type = typeRepository.loadClass(typeName); if (type.isInterface()) { return TypeCategory.INTERFACE; } else if (type.isEnum()) { return TypeCategory.ENUM; } else { if (Modifier.isAbstract(type.getModifiers())) { return TypeCategory.ABSTRACT_CLASS; } else{ return TypeCategory.CLASS; } } } catch (ClassNotFoundException e) { log.warn("Category for type " + typeName + " could not be found."); return null; } }
java
public static TypeCategory getCategory(TypeRepository typeRepository, String typeName) { try { Class<?> type = typeRepository.loadClass(typeName); if (type.isInterface()) { return TypeCategory.INTERFACE; } else if (type.isEnum()) { return TypeCategory.ENUM; } else { if (Modifier.isAbstract(type.getModifiers())) { return TypeCategory.ABSTRACT_CLASS; } else{ return TypeCategory.CLASS; } } } catch (ClassNotFoundException e) { log.warn("Category for type " + typeName + " could not be found."); return null; } }
[ "public", "static", "TypeCategory", "getCategory", "(", "TypeRepository", "typeRepository", ",", "String", "typeName", ")", "{", "try", "{", "Class", "<", "?", ">", "type", "=", "typeRepository", ".", "loadClass", "(", "typeName", ")", ";", "if", "(", "type"...
Finds the category of a given type. @param typeRepository the repository where types should be loaded from @param typeName the fully qualified type name @return a TypeCategory object representing the category (e.g. class, interface, enum, etc)
[ "Finds", "the", "category", "of", "a", "given", "type", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/TypeUtils.java#L51-L69
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ExtensionScript.java
ExtensionScript.handleUnspecifiedScriptError
private void handleUnspecifiedScriptError(ScriptWrapper script, Writer writer, String errorMessage) { try { writer.append(errorMessage); } catch (IOException e) { if (logger.isDebugEnabled()) { logger.debug("Failed to append script error message because of an exception:", e); } logger.warn("Failed to append error message: " + errorMessage); } this.setError(script, errorMessage); this.setEnabled(script, false); }
java
private void handleUnspecifiedScriptError(ScriptWrapper script, Writer writer, String errorMessage) { try { writer.append(errorMessage); } catch (IOException e) { if (logger.isDebugEnabled()) { logger.debug("Failed to append script error message because of an exception:", e); } logger.warn("Failed to append error message: " + errorMessage); } this.setError(script, errorMessage); this.setEnabled(script, false); }
[ "private", "void", "handleUnspecifiedScriptError", "(", "ScriptWrapper", "script", ",", "Writer", "writer", ",", "String", "errorMessage", ")", "{", "try", "{", "writer", ".", "append", "(", "errorMessage", ")", ";", "}", "catch", "(", "IOException", "e", ")",...
Handles an unspecified error that occurred while calling or invoking a script. <p> The given {@code errorMessage} will be written to the given {@code writer} and the given {@code script} will be disabled and flagged that has an error. @param script the script that failed to be called/invoked, must not be {@code null} @param writer the writer associated with the script, must not be {@code null} @param errorMessage the message that will be written to the given {@code writer} @see #setError(ScriptWrapper, String) @see #setEnabled(ScriptWrapper, boolean)
[ "Handles", "an", "unspecified", "error", "that", "occurred", "while", "calling", "or", "invoking", "a", "script", ".", "<p", ">", "The", "given", "{", "@code", "errorMessage", "}", "will", "be", "written", "to", "the", "given", "{", "@code", "writer", "}",...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ExtensionScript.java#L1455-L1466
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.setSecret
public SecretBundle setSecret(String vaultBaseUrl, String secretName, String value, Map<String, String> tags, String contentType, SecretAttributes secretAttributes) { return setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value, tags, contentType, secretAttributes).toBlocking().single().body(); }
java
public SecretBundle setSecret(String vaultBaseUrl, String secretName, String value, Map<String, String> tags, String contentType, SecretAttributes secretAttributes) { return setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value, tags, contentType, secretAttributes).toBlocking().single().body(); }
[ "public", "SecretBundle", "setSecret", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ",", "String", "value", ",", "Map", "<", "String", ",", "String", ">", "tags", ",", "String", "contentType", ",", "SecretAttributes", "secretAttributes", ")", "{",...
Sets a secret in a specified key vault. The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. This operation requires the secrets/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param value The value of the secret. @param tags Application specific metadata in the form of key-value pairs. @param contentType Type of the secret value such as a password. @param secretAttributes The secret management attributes. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SecretBundle object if successful.
[ "Sets", "a", "secret", "in", "a", "specified", "key", "vault", ".", "The", "SET", "operation", "adds", "a", "secret", "to", "the", "Azure", "Key", "Vault", ".", "If", "the", "named", "secret", "already", "exists", "Azure", "Key", "Vault", "creates", "a",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3421-L3423
primefaces/primefaces
src/main/java/org/primefaces/application/exceptionhandler/PrimeExceptionHandler.java
PrimeExceptionHandler.findHandlerComponent
protected AjaxExceptionHandler findHandlerComponent(FacesContext context, Throwable rootCause) { AjaxExceptionHandlerVisitCallback visitCallback = new AjaxExceptionHandlerVisitCallback(rootCause); context.getViewRoot().visitTree(VisitContext.createVisitContext(context), visitCallback); Map<String, AjaxExceptionHandler> handlers = visitCallback.getHandlers(); // get handler by exception type AjaxExceptionHandler handler = handlers.get(rootCause.getClass().getName()); // lookup by inheritance hierarchy if (handler == null) { Class throwableClass = rootCause.getClass(); while (handler == null && throwableClass.getSuperclass() != Object.class) { throwableClass = throwableClass.getSuperclass(); handler = handlers.get(throwableClass.getName()); } } // get default handler if (handler == null) { handler = handlers.get(null); } return handler; }
java
protected AjaxExceptionHandler findHandlerComponent(FacesContext context, Throwable rootCause) { AjaxExceptionHandlerVisitCallback visitCallback = new AjaxExceptionHandlerVisitCallback(rootCause); context.getViewRoot().visitTree(VisitContext.createVisitContext(context), visitCallback); Map<String, AjaxExceptionHandler> handlers = visitCallback.getHandlers(); // get handler by exception type AjaxExceptionHandler handler = handlers.get(rootCause.getClass().getName()); // lookup by inheritance hierarchy if (handler == null) { Class throwableClass = rootCause.getClass(); while (handler == null && throwableClass.getSuperclass() != Object.class) { throwableClass = throwableClass.getSuperclass(); handler = handlers.get(throwableClass.getName()); } } // get default handler if (handler == null) { handler = handlers.get(null); } return handler; }
[ "protected", "AjaxExceptionHandler", "findHandlerComponent", "(", "FacesContext", "context", ",", "Throwable", "rootCause", ")", "{", "AjaxExceptionHandlerVisitCallback", "visitCallback", "=", "new", "AjaxExceptionHandlerVisitCallback", "(", "rootCause", ")", ";", "context", ...
Finds the proper {@link AjaxExceptionHandler} for the given {@link Throwable}. @param context The {@link FacesContext}. @param rootCause The occurred {@link Throwable}. @return The {@link AjaxExceptionHandler} or <code>null</code>.
[ "Finds", "the", "proper", "{", "@link", "AjaxExceptionHandler", "}", "for", "the", "given", "{", "@link", "Throwable", "}", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/application/exceptionhandler/PrimeExceptionHandler.java#L282-L307
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java
DefaultInstalledExtensionRepository.removeInstalledFeature
private void removeInstalledFeature(String feature, String namespace) { // Extensions namespaces by feature if (namespace == null) { this.extensionNamespaceByFeature.remove(feature); } else { Map<String, InstalledFeature> namespaceInstalledExtension = this.extensionNamespaceByFeature.get(feature); namespaceInstalledExtension.remove(namespace); } }
java
private void removeInstalledFeature(String feature, String namespace) { // Extensions namespaces by feature if (namespace == null) { this.extensionNamespaceByFeature.remove(feature); } else { Map<String, InstalledFeature> namespaceInstalledExtension = this.extensionNamespaceByFeature.get(feature); namespaceInstalledExtension.remove(namespace); } }
[ "private", "void", "removeInstalledFeature", "(", "String", "feature", ",", "String", "namespace", ")", "{", "// Extensions namespaces by feature", "if", "(", "namespace", "==", "null", ")", "{", "this", ".", "extensionNamespaceByFeature", ".", "remove", "(", "featu...
Uninstall provided extension. @param feature the feature to uninstall @param namespace the namespace @see #uninstallExtension(LocalExtension, String)
[ "Uninstall", "provided", "extension", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java#L452-L463
mcxiaoke/Android-Next
recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java
HeaderFooterRecyclerAdapter.notifyHeaderItemRangeInserted
public final void notifyHeaderItemRangeInserted(int positionStart, int itemCount) { int newHeaderItemCount = getHeaderItemCount(); if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > newHeaderItemCount) { throw new IndexOutOfBoundsException("The given range [" + positionStart + " - " + (positionStart + itemCount - 1) + "] is not within the position bounds for header items [0 - " + (newHeaderItemCount - 1) + "]."); } notifyItemRangeInserted(positionStart, itemCount); }
java
public final void notifyHeaderItemRangeInserted(int positionStart, int itemCount) { int newHeaderItemCount = getHeaderItemCount(); if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > newHeaderItemCount) { throw new IndexOutOfBoundsException("The given range [" + positionStart + " - " + (positionStart + itemCount - 1) + "] is not within the position bounds for header items [0 - " + (newHeaderItemCount - 1) + "]."); } notifyItemRangeInserted(positionStart, itemCount); }
[ "public", "final", "void", "notifyHeaderItemRangeInserted", "(", "int", "positionStart", ",", "int", "itemCount", ")", "{", "int", "newHeaderItemCount", "=", "getHeaderItemCount", "(", ")", ";", "if", "(", "positionStart", "<", "0", "||", "itemCount", "<", "0", ...
Notifies that multiple header items are inserted. @param positionStart the position. @param itemCount the item count.
[ "Notifies", "that", "multiple", "header", "items", "are", "inserted", "." ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L132-L138
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.argb_bounded
public static final int argb_bounded(final int a, final int r, final int g, final int b){ return argb_fast( a > 255 ? 255: a < 0 ? 0:a, r > 255 ? 255: r < 0 ? 0:r, g > 255 ? 255: g < 0 ? 0:g, b > 255 ? 255: b < 0 ? 0:b); }
java
public static final int argb_bounded(final int a, final int r, final int g, final int b){ return argb_fast( a > 255 ? 255: a < 0 ? 0:a, r > 255 ? 255: r < 0 ? 0:r, g > 255 ? 255: g < 0 ? 0:g, b > 255 ? 255: b < 0 ? 0:b); }
[ "public", "static", "final", "int", "argb_bounded", "(", "final", "int", "a", ",", "final", "int", "r", ",", "final", "int", "g", ",", "final", "int", "b", ")", "{", "return", "argb_fast", "(", "a", ">", "255", "?", "255", ":", "a", "<", "0", "?"...
Packs 8bit ARGB color components into a single 32bit integer value. Components are clamped to [0,255]. @param a alpha @param r red @param g green @param b blue @return packed ARGB value @see #argb(int, int, int, int) @see #argb_fast(int, int, int, int) @see #rgb_bounded(int, int, int) @see #rgb(int, int, int) @see #rgb_fast(int, int, int) @see #a(int) @see #r(int) @see #g(int) @see #b(int) @since 1.0
[ "Packs", "8bit", "ARGB", "color", "components", "into", "a", "single", "32bit", "integer", "value", ".", "Components", "are", "clamped", "to", "[", "0", "255", "]", ".", "@param", "a", "alpha", "@param", "r", "red", "@param", "g", "green", "@param", "b",...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L717-L723
infinispan/infinispan
cdi/common/src/main/java/org/infinispan/cdi/common/util/Beans.java
Beans.createInjectionPoints
public static <X> List<InjectionPoint> createInjectionPoints(AnnotatedMethod<X> method, Bean<?> declaringBean, BeanManager beanManager) { List<InjectionPoint> injectionPoints = new ArrayList<InjectionPoint>(); for (AnnotatedParameter<X> parameter : method.getParameters()) { InjectionPoint injectionPoint = new ImmutableInjectionPoint(parameter, beanManager, declaringBean, false, false); injectionPoints.add(injectionPoint); } return injectionPoints; }
java
public static <X> List<InjectionPoint> createInjectionPoints(AnnotatedMethod<X> method, Bean<?> declaringBean, BeanManager beanManager) { List<InjectionPoint> injectionPoints = new ArrayList<InjectionPoint>(); for (AnnotatedParameter<X> parameter : method.getParameters()) { InjectionPoint injectionPoint = new ImmutableInjectionPoint(parameter, beanManager, declaringBean, false, false); injectionPoints.add(injectionPoint); } return injectionPoints; }
[ "public", "static", "<", "X", ">", "List", "<", "InjectionPoint", ">", "createInjectionPoints", "(", "AnnotatedMethod", "<", "X", ">", "method", ",", "Bean", "<", "?", ">", "declaringBean", ",", "BeanManager", "beanManager", ")", "{", "List", "<", "Injection...
Given a method, and the bean on which the method is declared, create a collection of injection points representing the parameters of the method. @param <X> the type declaring the method @param method the method @param declaringBean the bean on which the method is declared @param beanManager the bean manager to use to create the injection points @return the injection points
[ "Given", "a", "method", "and", "the", "bean", "on", "which", "the", "method", "is", "declared", "create", "a", "collection", "of", "injection", "points", "representing", "the", "parameters", "of", "the", "method", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/Beans.java#L85-L92
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.canEditPermissionsForRoles
public static boolean canEditPermissionsForRoles(CmsObject cms, String path) { return OpenCms.getRoleManager().hasRoleForResource(cms, CmsRole.VFS_MANAGER, path) && path.startsWith(VFS_PATH_SYSTEM); }
java
public static boolean canEditPermissionsForRoles(CmsObject cms, String path) { return OpenCms.getRoleManager().hasRoleForResource(cms, CmsRole.VFS_MANAGER, path) && path.startsWith(VFS_PATH_SYSTEM); }
[ "public", "static", "boolean", "canEditPermissionsForRoles", "(", "CmsObject", "cms", ",", "String", "path", ")", "{", "return", "OpenCms", ".", "getRoleManager", "(", ")", ".", "hasRoleForResource", "(", "cms", ",", "CmsRole", ".", "VFS_MANAGER", ",", "path", ...
Checks if permissions for roles should be editable for the current user on the resource with the given path.<p> @param cms the CMS context @param path the path of a resource @return <code>true</code> if permissions for roles should be editable for the current user on the resource with the given path
[ "Checks", "if", "permissions", "for", "roles", "should", "be", "editable", "for", "the", "current", "user", "on", "the", "resource", "with", "the", "given", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L423-L427
alkacon/opencms-core
src/org/opencms/ade/containerpage/CmsContainerpageService.java
CmsContainerpageService.saveInheritanceGroup
private void saveInheritanceGroup(CmsResource resource, CmsInheritanceContainer inheritanceContainer) throws CmsException { CmsObject cms = getCmsObject(); CmsFile file = cms.readFile(resource); CmsXmlContent document = CmsXmlContentFactory.unmarshal(cms, file); for (Locale docLocale : document.getLocales()) { document.removeLocale(docLocale); } Locale locale = Locale.ENGLISH; document.addLocale(cms, locale); document.getValue("Title", locale).setStringValue(cms, inheritanceContainer.getTitle()); document.getValue("Description", locale).setStringValue(cms, inheritanceContainer.getDescription()); document.getValue("ConfigName", locale).setStringValue(cms, inheritanceContainer.getName()); byte[] content = document.marshal(); file.setContents(content); cms.writeFile(file); }
java
private void saveInheritanceGroup(CmsResource resource, CmsInheritanceContainer inheritanceContainer) throws CmsException { CmsObject cms = getCmsObject(); CmsFile file = cms.readFile(resource); CmsXmlContent document = CmsXmlContentFactory.unmarshal(cms, file); for (Locale docLocale : document.getLocales()) { document.removeLocale(docLocale); } Locale locale = Locale.ENGLISH; document.addLocale(cms, locale); document.getValue("Title", locale).setStringValue(cms, inheritanceContainer.getTitle()); document.getValue("Description", locale).setStringValue(cms, inheritanceContainer.getDescription()); document.getValue("ConfigName", locale).setStringValue(cms, inheritanceContainer.getName()); byte[] content = document.marshal(); file.setContents(content); cms.writeFile(file); }
[ "private", "void", "saveInheritanceGroup", "(", "CmsResource", "resource", ",", "CmsInheritanceContainer", "inheritanceContainer", ")", "throws", "CmsException", "{", "CmsObject", "cms", "=", "getCmsObject", "(", ")", ";", "CmsFile", "file", "=", "cms", ".", "readFi...
Saves the inheritance group.<p> @param resource the inheritance group resource @param inheritanceContainer the inherited group container data @throws CmsException if something goes wrong
[ "Saves", "the", "inheritance", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsContainerpageService.java#L2810-L2828
adyliu/jafka
src/main/java/io/jafka/consumer/StringConsumers.java
StringConsumers.buildConsumer
public static StringConsumers buildConsumer( final String zookeeperConfig,// final String topic,// final String groupId, // final IMessageListener<String> listener) { return buildConsumer(zookeeperConfig, topic, groupId, listener, 2); }
java
public static StringConsumers buildConsumer( final String zookeeperConfig,// final String topic,// final String groupId, // final IMessageListener<String> listener) { return buildConsumer(zookeeperConfig, topic, groupId, listener, 2); }
[ "public", "static", "StringConsumers", "buildConsumer", "(", "final", "String", "zookeeperConfig", ",", "//", "final", "String", "topic", ",", "//", "final", "String", "groupId", ",", "//", "final", "IMessageListener", "<", "String", ">", "listener", ")", "{", ...
create a consumer @param zookeeperConfig connect config of zookeeper; ex: 127.0.0.1:2181/jafka @param topic the topic to be watched @param groupId grouping the consumer clients @param listener message listener @return the real consumer
[ "create", "a", "consumer" ]
train
https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/consumer/StringConsumers.java#L126-L132