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
czyzby/gdx-lml
autumn/src/main/java/com/github/czyzby/autumn/context/ContextInitializer.java
ContextInitializer.processFields
private void processFields(final Object component, final Context context, final ContextDestroyer contextDestroyer) { Class<?> componentClass = component.getClass(); while (componentClass != null && !componentClass.equals(Object.class)) { final Field[] fields = ClassReflection.getDeclaredFields(componentClass); if (fields != null && fields.length > 0) { processFields(component, fields, context, contextDestroyer); } componentClass = componentClass.getSuperclass(); } }
java
private void processFields(final Object component, final Context context, final ContextDestroyer contextDestroyer) { Class<?> componentClass = component.getClass(); while (componentClass != null && !componentClass.equals(Object.class)) { final Field[] fields = ClassReflection.getDeclaredFields(componentClass); if (fields != null && fields.length > 0) { processFields(component, fields, context, contextDestroyer); } componentClass = componentClass.getSuperclass(); } }
[ "private", "void", "processFields", "(", "final", "Object", "component", ",", "final", "Context", "context", ",", "final", "ContextDestroyer", "contextDestroyer", ")", "{", "Class", "<", "?", ">", "componentClass", "=", "component", ".", "getClass", "(", ")", ...
Scans class tree of component to process all its fields. @param component all fields of its class tree will be processed. @param context used to resolve dependencies. @param contextDestroyer used to register destruction callbacks.
[ "Scans", "class", "tree", "of", "component", "to", "process", "all", "its", "fields", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/autumn/src/main/java/com/github/czyzby/autumn/context/ContextInitializer.java#L635-L644
tropo/tropo-webapi-java
src/main/java/com/voxeo/tropo/Key.java
Key.MACHINE_DETECTION
public static Key MACHINE_DETECTION(String introduction, Voice voice) { Map<String, String> map = new LinkedHashMap<String, String>(); map.put("introduction", introduction); if (voice != null) { map.put("voice", voice.toString()); } return createKey("machineDetection", map); }
java
public static Key MACHINE_DETECTION(String introduction, Voice voice) { Map<String, String> map = new LinkedHashMap<String, String>(); map.put("introduction", introduction); if (voice != null) { map.put("voice", voice.toString()); } return createKey("machineDetection", map); }
[ "public", "static", "Key", "MACHINE_DETECTION", "(", "String", "introduction", ",", "Voice", "voice", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "LinkedHashMap", "<", "String", ",", "String", ">", "(", ")", ";", "map", ".", ...
<p> If introduction is set, Tropo plays the TTS string using voice or plays the audio file if a URL is defined (same behavior as say) during this wait. Tropo will not return until introduction is done playing, even if it has determined a human voice or machine response before the introduction is complete. </p> <p> For the most accurate results, the "introduction" should be long enough to give Tropo time to detect a human or machine. The longer the introduction, the more time we have to determine how the call was answered. If the introduction is long enough to play until the voicemail "beep" plays, Tropo will have the most accurate detection. It takes a minimum of four seconds to determine if a call was answered by a human or machine, so introductions four seconds or shorter will always return HUMAN. </p>
[ "<p", ">", "If", "introduction", "is", "set", "Tropo", "plays", "the", "TTS", "string", "using", "voice", "or", "plays", "the", "audio", "file", "if", "a", "URL", "is", "defined", "(", "same", "behavior", "as", "say", ")", "during", "this", "wait", "."...
train
https://github.com/tropo/tropo-webapi-java/blob/96af1fa292c1d4b6321d85a559d9718d33eec7e0/src/main/java/com/voxeo/tropo/Key.java#L726-L735
seedstack/i18n-addon
rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeyResource.java
KeyResource.getKey
@GET @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.KEY_READ) public KeyRepresentation getKey() { KeyRepresentation keyRepresentation = keyFinder.findKeyWithName(keyName); if (keyRepresentation == null) { throw new NotFoundException(String.format(KEY_NOT_FOUND, keyName)); } return keyRepresentation; }
java
@GET @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.KEY_READ) public KeyRepresentation getKey() { KeyRepresentation keyRepresentation = keyFinder.findKeyWithName(keyName); if (keyRepresentation == null) { throw new NotFoundException(String.format(KEY_NOT_FOUND, keyName)); } return keyRepresentation; }
[ "@", "GET", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "RequiresPermissions", "(", "I18nPermissions", ".", "KEY_READ", ")", "public", "KeyRepresentation", "getKey", "(", ")", "{", "KeyRepresentation", "keyRepresentation", "=", "keyFinder",...
Returns a key with the default translation. @return translated key
[ "Returns", "a", "key", "with", "the", "default", "translation", "." ]
train
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeyResource.java#L66-L75
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java
BytecodeHelper.isSameCompilationUnit
public static boolean isSameCompilationUnit(ClassNode a, ClassNode b) { CompileUnit cu1 = a.getCompileUnit(); CompileUnit cu2 = b.getCompileUnit(); return cu1 != null && cu1 == cu2; }
java
public static boolean isSameCompilationUnit(ClassNode a, ClassNode b) { CompileUnit cu1 = a.getCompileUnit(); CompileUnit cu2 = b.getCompileUnit(); return cu1 != null && cu1 == cu2; }
[ "public", "static", "boolean", "isSameCompilationUnit", "(", "ClassNode", "a", ",", "ClassNode", "b", ")", "{", "CompileUnit", "cu1", "=", "a", ".", "getCompileUnit", "(", ")", ";", "CompileUnit", "cu2", "=", "b", ".", "getCompileUnit", "(", ")", ";", "ret...
Returns true if the two classes share the same compilation unit. @param a class a @param b class b @return true if both classes share the same compilation unit
[ "Returns", "true", "if", "the", "two", "classes", "share", "the", "same", "compilation", "unit", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java#L565-L569
fommil/matrix-toolkits-java
src/main/java/no/uib/cipr/matrix/io/MatrixVectorReader.java
MatrixVectorReader.readArray
public void readArray(double[] dataR, double[] dataI) throws IOException { int size = dataR.length; if (size != dataI.length) throw new IllegalArgumentException( "All arrays must be of the same size"); for (int i = 0; i < size; ++i) { dataR[i] = getDouble(); dataI[i] = getDouble(); } }
java
public void readArray(double[] dataR, double[] dataI) throws IOException { int size = dataR.length; if (size != dataI.length) throw new IllegalArgumentException( "All arrays must be of the same size"); for (int i = 0; i < size; ++i) { dataR[i] = getDouble(); dataI[i] = getDouble(); } }
[ "public", "void", "readArray", "(", "double", "[", "]", "dataR", ",", "double", "[", "]", "dataI", ")", "throws", "IOException", "{", "int", "size", "=", "dataR", ".", "length", ";", "if", "(", "size", "!=", "dataI", ".", "length", ")", "throw", "new...
Reads the array data. The first array will contain real entries, while the second contain imaginary entries
[ "Reads", "the", "array", "data", ".", "The", "first", "array", "will", "contain", "real", "entries", "while", "the", "second", "contain", "imaginary", "entries" ]
train
https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/io/MatrixVectorReader.java#L364-L373
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/LogMetadata.java
LogMetadata.asDisabled
LogMetadata asDisabled() { return this.enabled ? new LogMetadata(this.epoch, false, this.ledgers, this.truncationAddress, this.updateVersion.get()) : this; }
java
LogMetadata asDisabled() { return this.enabled ? new LogMetadata(this.epoch, false, this.ledgers, this.truncationAddress, this.updateVersion.get()) : this; }
[ "LogMetadata", "asDisabled", "(", ")", "{", "return", "this", ".", "enabled", "?", "new", "LogMetadata", "(", "this", ".", "epoch", ",", "false", ",", "this", ".", "ledgers", ",", "this", ".", "truncationAddress", ",", "this", ".", "updateVersion", ".", ...
Returns a LogMetadata class with the exact contents of this instance, but the enabled flag set to false. No changes are performed on this instance. @return This instance, if isEnabled() == false, of a new instance of the LogMetadata class which will have isEnabled() == false, otherwise.
[ "Returns", "a", "LogMetadata", "class", "with", "the", "exact", "contents", "of", "this", "instance", "but", "the", "enabled", "flag", "set", "to", "false", ".", "No", "changes", "are", "performed", "on", "this", "instance", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/LogMetadata.java#L254-L256
cdk/cdk
tool/pcore/src/main/java/org/openscience/cdk/pharmacophore/PharmacophoreUtils.java
PharmacophoreUtils.writePharmacophoreDefinition
public static void writePharmacophoreDefinition(List<PharmacophoreQuery> queries, OutputStream out) throws IOException { writePharmacophoreDefinition(queries.toArray(new PharmacophoreQuery[]{}), out); }
java
public static void writePharmacophoreDefinition(List<PharmacophoreQuery> queries, OutputStream out) throws IOException { writePharmacophoreDefinition(queries.toArray(new PharmacophoreQuery[]{}), out); }
[ "public", "static", "void", "writePharmacophoreDefinition", "(", "List", "<", "PharmacophoreQuery", ">", "queries", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "writePharmacophoreDefinition", "(", "queries", ".", "toArray", "(", "new", "Pharmacophor...
Write out one or more pharmacophore queries in the CDK XML format. @param queries The pharmacophore queries @param out The OutputStream to write to @throws IOException if there is a problem writing the XML document
[ "Write", "out", "one", "or", "more", "pharmacophore", "queries", "in", "the", "CDK", "XML", "format", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/pcore/src/main/java/org/openscience/cdk/pharmacophore/PharmacophoreUtils.java#L166-L169
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java
MatrixFeatures_DSCC.isSymmetric
public static boolean isSymmetric( DMatrixSparseCSC A , double tol ) { if( A.numRows != A.numCols ) return false; int N = A.numCols; for (int i = 0; i < N; i++) { int idx0 = A.col_idx[i]; int idx1 = A.col_idx[i+1]; for (int index = idx0; index < idx1; index++) { int j = A.nz_rows[index]; double value_ji = A.nz_values[index]; double value_ij = A.get(i,j); if( Math.abs(value_ij-value_ji) > tol ) return false; } } return true; }
java
public static boolean isSymmetric( DMatrixSparseCSC A , double tol ) { if( A.numRows != A.numCols ) return false; int N = A.numCols; for (int i = 0; i < N; i++) { int idx0 = A.col_idx[i]; int idx1 = A.col_idx[i+1]; for (int index = idx0; index < idx1; index++) { int j = A.nz_rows[index]; double value_ji = A.nz_values[index]; double value_ij = A.get(i,j); if( Math.abs(value_ij-value_ji) > tol ) return false; } } return true; }
[ "public", "static", "boolean", "isSymmetric", "(", "DMatrixSparseCSC", "A", ",", "double", "tol", ")", "{", "if", "(", "A", ".", "numRows", "!=", "A", ".", "numCols", ")", "return", "false", ";", "int", "N", "=", "A", ".", "numCols", ";", "for", "(",...
Checks to see if the matrix is symmetric to within tolerance. @param A Matrix being tested. Not modified. @param tol Tolerance that defines how similar two values must be to be considered identical @return true if symmetric or false if not
[ "Checks", "to", "see", "if", "the", "matrix", "is", "symmetric", "to", "within", "tolerance", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java#L230-L251
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java
SphereUtil.sphericalVincentyFormulaRad
@Reference(authors = "T. Vincenty", // title = "Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations", // booktitle = "Survey Review 23:176", // url = "https://doi.org/10.1179/sre.1975.23.176.88", // bibkey = "doi:10.1179/sre.1975.23.176.88") public static double sphericalVincentyFormulaRad(double lat1, double lon1, double lat2, double lon2) { // Half delta longitude. final double dlnh = (lon1 > lon2) ? (lon1 - lon2) : (lon2 - lon1); // Spherical special case of Vincenty's formula - no iterations needed final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine final double slat1 = sinAndCos(lat1, tmp), clat1 = tmp.value; final double slat2 = sinAndCos(lat2, tmp), clat2 = tmp.value; final double slond = sinAndCos(dlnh, tmp), clond = tmp.value; final double a = clat2 * slond; final double b = (clat1 * slat2) - (slat1 * clat2 * clond); return atan2(sqrt(a * a + b * b), slat1 * slat2 + clat1 * clat2 * clond); }
java
@Reference(authors = "T. Vincenty", // title = "Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations", // booktitle = "Survey Review 23:176", // url = "https://doi.org/10.1179/sre.1975.23.176.88", // bibkey = "doi:10.1179/sre.1975.23.176.88") public static double sphericalVincentyFormulaRad(double lat1, double lon1, double lat2, double lon2) { // Half delta longitude. final double dlnh = (lon1 > lon2) ? (lon1 - lon2) : (lon2 - lon1); // Spherical special case of Vincenty's formula - no iterations needed final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine final double slat1 = sinAndCos(lat1, tmp), clat1 = tmp.value; final double slat2 = sinAndCos(lat2, tmp), clat2 = tmp.value; final double slond = sinAndCos(dlnh, tmp), clond = tmp.value; final double a = clat2 * slond; final double b = (clat1 * slat2) - (slat1 * clat2 * clond); return atan2(sqrt(a * a + b * b), slat1 * slat2 + clat1 * clat2 * clond); }
[ "@", "Reference", "(", "authors", "=", "\"T. Vincenty\"", ",", "//", "title", "=", "\"Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations\"", ",", "//", "booktitle", "=", "\"Survey Review 23:176\"", ",", "//", "url", "=", "\"https:/...
Compute the approximate great-circle distance of two points. Uses Vincenty's Formula for the spherical case, which does not require iterations. <p> Complexity: 7 trigonometric functions, 1 sqrt. <p> Reference: <p> T. Vincenty<br> Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations<br> Survey review 23 176, 1975 @param lat1 Latitude of first point in degree @param lon1 Longitude of first point in degree @param lat2 Latitude of second point in degree @param lon2 Longitude of second point in degree @return Distance on unit sphere
[ "Compute", "the", "approximate", "great", "-", "circle", "distance", "of", "two", "points", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L279-L296
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/ServerSecurityInterceptor.java
ServerSecurityInterceptor.acceptTransportContext
private Subject acceptTransportContext(ServerRequestInfo ri, TSSConfig tssPolicy) throws SASException { Subject subject = tssPolicy.check(SSLSessionManager.getSSLSession(ri.request_id()), null, codec); if (subject != null) { // Set caller subject only, the EJBSecurityCollaboratorImpl will set the delegation subject if needed. subjectManager.setCallerSubject(subject); } return subject; }
java
private Subject acceptTransportContext(ServerRequestInfo ri, TSSConfig tssPolicy) throws SASException { Subject subject = tssPolicy.check(SSLSessionManager.getSSLSession(ri.request_id()), null, codec); if (subject != null) { // Set caller subject only, the EJBSecurityCollaboratorImpl will set the delegation subject if needed. subjectManager.setCallerSubject(subject); } return subject; }
[ "private", "Subject", "acceptTransportContext", "(", "ServerRequestInfo", "ri", ",", "TSSConfig", "tssPolicy", ")", "throws", "SASException", "{", "Subject", "subject", "=", "tssPolicy", ".", "check", "(", "SSLSessionManager", ".", "getSSLSession", "(", "ri", ".", ...
/* Per spec., "This action validates that a request that arrives without a SAS protocol message; that is, EstablishContext or MessageInContext satisfies the CSIv2 security requirements of the target object. This routine returns true if the transport layer security context (including none) over which the request was delivered satisfies the security requirements of the target object. Otherwise, accept_transport_context returns false. When accept_transport_context returns false, the TSS shall reject the request and send a NO_PERMISSION exception." True or false is not being returned by this implementation. A NO_PERMISSION will be thrown instead from the check TSSConfig.check(...) method if the requirements are not met.
[ "/", "*", "Per", "spec", ".", "This", "action", "validates", "that", "a", "request", "that", "arrives", "without", "a", "SAS", "protocol", "message", ";", "that", "is", "EstablishContext", "or", "MessageInContext", "satisfies", "the", "CSIv2", "security", "req...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/ServerSecurityInterceptor.java#L230-L238
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.getStaticFieldValue
public static Object getStaticFieldValue(Class<?> clazz, String name) { Field field = ReflectionUtils.findField(clazz, name); if (field != null) { ReflectionUtils.makeAccessible(field); try { return field.get(clazz); } catch (IllegalAccessException ignored) {} } return null; }
java
public static Object getStaticFieldValue(Class<?> clazz, String name) { Field field = ReflectionUtils.findField(clazz, name); if (field != null) { ReflectionUtils.makeAccessible(field); try { return field.get(clazz); } catch (IllegalAccessException ignored) {} } return null; }
[ "public", "static", "Object", "getStaticFieldValue", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ")", "{", "Field", "field", "=", "ReflectionUtils", ".", "findField", "(", "clazz", ",", "name", ")", ";", "if", "(", "field", "!=", "null",...
<p>Get a static field value.</p> @param clazz The class to check for static property @param name The field name @return The value if there is one, or null if unset OR there is no such field
[ "<p", ">", "Get", "a", "static", "field", "value", ".", "<", "/", "p", ">" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L580-L589
jcustenborder/connect-utils
connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java
ConfigUtils.passwordBytes
public static byte[] passwordBytes(AbstractConfig config, String key) { return passwordBytes(config, key, Charsets.UTF_8); }
java
public static byte[] passwordBytes(AbstractConfig config, String key) { return passwordBytes(config, key, Charsets.UTF_8); }
[ "public", "static", "byte", "[", "]", "passwordBytes", "(", "AbstractConfig", "config", ",", "String", "key", ")", "{", "return", "passwordBytes", "(", "config", ",", "key", ",", "Charsets", ".", "UTF_8", ")", ";", "}" ]
Method is used to return an array of bytes representing the password stored in the config. @param config Config to read from @param key Key to read from @return byte array containing the password
[ "Method", "is", "used", "to", "return", "an", "array", "of", "bytes", "representing", "the", "password", "stored", "in", "the", "config", "." ]
train
https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java#L329-L331
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/events/CacheEventDispatcherImpl.java
CacheEventDispatcherImpl.registerCacheEventListener
private synchronized void registerCacheEventListener(EventListenerWrapper<K, V> wrapper) { if(aSyncListenersList.contains(wrapper) || syncListenersList.contains(wrapper)) { throw new IllegalStateException("Cache Event Listener already registered: " + wrapper.getListener()); } if (wrapper.isOrdered() && orderedListenerCount++ == 0) { storeEventSource.setEventOrdering(true); } switch (wrapper.getFiringMode()) { case ASYNCHRONOUS: aSyncListenersList.add(wrapper); break; case SYNCHRONOUS: syncListenersList.add(wrapper); break; default: throw new AssertionError("Unhandled EventFiring value: " + wrapper.getFiringMode()); } if (listenersCount++ == 0) { storeEventSource.addEventListener(eventListener); } }
java
private synchronized void registerCacheEventListener(EventListenerWrapper<K, V> wrapper) { if(aSyncListenersList.contains(wrapper) || syncListenersList.contains(wrapper)) { throw new IllegalStateException("Cache Event Listener already registered: " + wrapper.getListener()); } if (wrapper.isOrdered() && orderedListenerCount++ == 0) { storeEventSource.setEventOrdering(true); } switch (wrapper.getFiringMode()) { case ASYNCHRONOUS: aSyncListenersList.add(wrapper); break; case SYNCHRONOUS: syncListenersList.add(wrapper); break; default: throw new AssertionError("Unhandled EventFiring value: " + wrapper.getFiringMode()); } if (listenersCount++ == 0) { storeEventSource.addEventListener(eventListener); } }
[ "private", "synchronized", "void", "registerCacheEventListener", "(", "EventListenerWrapper", "<", "K", ",", "V", ">", "wrapper", ")", "{", "if", "(", "aSyncListenersList", ".", "contains", "(", "wrapper", ")", "||", "syncListenersList", ".", "contains", "(", "w...
Synchronized to make sure listener addition is atomic in order to prevent having the same listener registered under multiple configurations @param wrapper the listener wrapper to register
[ "Synchronized", "to", "make", "sure", "listener", "addition", "is", "atomic", "in", "order", "to", "prevent", "having", "the", "same", "listener", "registered", "under", "multiple", "configurations" ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/events/CacheEventDispatcherImpl.java#L96-L119
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/SecureAction.java
SecureAction.getFileOutputStream
public FileOutputStream getFileOutputStream(final File file, final boolean append) throws FileNotFoundException { if (System.getSecurityManager() == null) return new FileOutputStream(file.getAbsolutePath(), append); try { return AccessController.doPrivileged(new PrivilegedExceptionAction<FileOutputStream>() { @Override public FileOutputStream run() throws FileNotFoundException { return new FileOutputStream(file.getAbsolutePath(), append); } }, controlContext); } catch (PrivilegedActionException e) { if (e.getException() instanceof FileNotFoundException) throw (FileNotFoundException) e.getException(); throw (RuntimeException) e.getException(); } }
java
public FileOutputStream getFileOutputStream(final File file, final boolean append) throws FileNotFoundException { if (System.getSecurityManager() == null) return new FileOutputStream(file.getAbsolutePath(), append); try { return AccessController.doPrivileged(new PrivilegedExceptionAction<FileOutputStream>() { @Override public FileOutputStream run() throws FileNotFoundException { return new FileOutputStream(file.getAbsolutePath(), append); } }, controlContext); } catch (PrivilegedActionException e) { if (e.getException() instanceof FileNotFoundException) throw (FileNotFoundException) e.getException(); throw (RuntimeException) e.getException(); } }
[ "public", "FileOutputStream", "getFileOutputStream", "(", "final", "File", "file", ",", "final", "boolean", "append", ")", "throws", "FileNotFoundException", "{", "if", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "return", "new", "File...
Creates a FileInputStream from a File. Same as calling new FileOutputStream(File,boolean). @param file the File to create a FileOutputStream from. @param append indicates if the OutputStream should append content. @return The FileOutputStream. @throws FileNotFoundException if the File does not exist.
[ "Creates", "a", "FileInputStream", "from", "a", "File", ".", "Same", "as", "calling", "new", "FileOutputStream", "(", "File", "boolean", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/SecureAction.java#L171-L186
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/helper/AuthenticateUserHelper.java
AuthenticateUserHelper.validateInput
private void validateInput(AuthenticationService authenticationService, String username) throws AuthenticationException { if (authenticationService == null) { throw new AuthenticationException("authenticationService cannot be null."); } else if (username == null) { throw new AuthenticationException("username cannot be null."); } }
java
private void validateInput(AuthenticationService authenticationService, String username) throws AuthenticationException { if (authenticationService == null) { throw new AuthenticationException("authenticationService cannot be null."); } else if (username == null) { throw new AuthenticationException("username cannot be null."); } }
[ "private", "void", "validateInput", "(", "AuthenticationService", "authenticationService", ",", "String", "username", ")", "throws", "AuthenticationException", "{", "if", "(", "authenticationService", "==", "null", ")", "{", "throw", "new", "AuthenticationException", "(...
Validate that the input parameters are not null. @param authenticationService the service to authenticate a user @param username the user to authenticate @throws AuthenticationException when either input is null
[ "Validate", "that", "the", "input", "parameters", "are", "not", "null", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/helper/AuthenticateUserHelper.java#L94-L100
openengsb/openengsb
api/edb/src/main/java/org/openengsb/core/edb/api/EDBObject.java
EDBObject.getObject
@SuppressWarnings("unchecked") public <T> T getObject(String key, Class<T> clazz) { EDBObjectEntry entry = get(key); return entry == null ? null : (T) entry.getValue(); }
java
@SuppressWarnings("unchecked") public <T> T getObject(String key, Class<T> clazz) { EDBObjectEntry entry = get(key); return entry == null ? null : (T) entry.getValue(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getObject", "(", "String", "key", ",", "Class", "<", "T", ">", "clazz", ")", "{", "EDBObjectEntry", "entry", "=", "get", "(", "key", ")", ";", "return", "entry", "==", ...
Returns the value of the EDBObjectEntry for the given key, casted as the given class. Returns null if there is no element for the given key, or the value for the given key is null.
[ "Returns", "the", "value", "of", "the", "EDBObjectEntry", "for", "the", "given", "key", "casted", "as", "the", "given", "class", ".", "Returns", "null", "if", "there", "is", "no", "element", "for", "the", "given", "key", "or", "the", "value", "for", "the...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/edb/src/main/java/org/openengsb/core/edb/api/EDBObject.java#L154-L158
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readStaticExportPublishedResourceParameters
public String readStaticExportPublishedResourceParameters(CmsRequestContext context, String rfsName) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); String result = null; try { result = m_driverManager.readStaticExportPublishedResourceParameters(dbc, rfsName); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_STATEXP_PUBLISHED_RESOURCE_PARAMS_1, rfsName), e); } finally { dbc.clear(); } return result; }
java
public String readStaticExportPublishedResourceParameters(CmsRequestContext context, String rfsName) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); String result = null; try { result = m_driverManager.readStaticExportPublishedResourceParameters(dbc, rfsName); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_STATEXP_PUBLISHED_RESOURCE_PARAMS_1, rfsName), e); } finally { dbc.clear(); } return result; }
[ "public", "String", "readStaticExportPublishedResourceParameters", "(", "CmsRequestContext", "context", ",", "String", "rfsName", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "String...
Returns the parameters of a resource in the table of all published template resources.<p> @param context the current request context @param rfsName the rfs name of the resource @return the parameter string of the requested resource @throws CmsException if something goes wrong
[ "Returns", "the", "parameters", "of", "a", "resource", "in", "the", "table", "of", "all", "published", "template", "resources", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L5290-L5306
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java
DiscreteFourierTransformOps.realToComplex
public static void realToComplex(GrayF32 real , InterleavedF32 complex ) { checkImageArguments(real,complex); for( int y = 0; y < complex.height; y++ ) { int indexReal = real.startIndex + y*real.stride; int indexComplex = complex.startIndex + y*complex.stride; for( int x = 0; x < real.width; x++, indexReal++ , indexComplex += 2 ) { complex.data[indexComplex] = real.data[indexReal]; complex.data[indexComplex+1] = 0; } } }
java
public static void realToComplex(GrayF32 real , InterleavedF32 complex ) { checkImageArguments(real,complex); for( int y = 0; y < complex.height; y++ ) { int indexReal = real.startIndex + y*real.stride; int indexComplex = complex.startIndex + y*complex.stride; for( int x = 0; x < real.width; x++, indexReal++ , indexComplex += 2 ) { complex.data[indexComplex] = real.data[indexReal]; complex.data[indexComplex+1] = 0; } } }
[ "public", "static", "void", "realToComplex", "(", "GrayF32", "real", ",", "InterleavedF32", "complex", ")", "{", "checkImageArguments", "(", "real", ",", "complex", ")", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "complex", ".", "height", ";",...
Converts a regular image into a complex interleaved image with the imaginary component set to zero. @param real (Input) Regular image. @param complex (Output) Equivalent complex image.
[ "Converts", "a", "regular", "image", "into", "a", "complex", "interleaved", "image", "with", "the", "imaginary", "component", "set", "to", "zero", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java#L354-L366
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parsePersistTimeout
private void parsePersistTimeout(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_PERSIST_TIMEOUT); if (null != value) { try { this.persistTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Persist timeout is " + getPersistTimeout()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parsePersistTimeout", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid persist timeout; " + value); } } } }
java
private void parsePersistTimeout(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_PERSIST_TIMEOUT); if (null != value) { try { this.persistTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Persist timeout is " + getPersistTimeout()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parsePersistTimeout", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid persist timeout; " + value); } } } }
[ "private", "void", "parsePersistTimeout", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_PERSIST_TIMEOUT", ")", ";", "if", "(", "null", "!=", "value", ...
Check the input configuration for the timeout to use in between persistent requests. @param props
[ "Check", "the", "input", "configuration", "for", "the", "timeout", "to", "use", "in", "between", "persistent", "requests", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L635-L650
micronaut-projects/micronaut-core
inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java
AnnotationUtils.getAnnotationMetadata
public AnnotationMetadata getAnnotationMetadata(Element parent, Element element) { return newAnnotationBuilder().buildForParent(parent, element); }
java
public AnnotationMetadata getAnnotationMetadata(Element parent, Element element) { return newAnnotationBuilder().buildForParent(parent, element); }
[ "public", "AnnotationMetadata", "getAnnotationMetadata", "(", "Element", "parent", ",", "Element", "element", ")", "{", "return", "newAnnotationBuilder", "(", ")", ".", "buildForParent", "(", "parent", ",", "element", ")", ";", "}" ]
Get the annotation metadata for the given element. @param parent The parent @param element The element @return The {@link AnnotationMetadata}
[ "Get", "the", "annotation", "metadata", "for", "the", "given", "element", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java#L210-L212
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/spatialite/GTSpatialiteThreadsafeDb.java
GTSpatialiteThreadsafeDb.executeSqlFile
public void executeSqlFile( File file, int chunks, boolean eachLineAnSql ) throws Exception { execOnConnection(mConn -> { boolean autoCommit = mConn.getAutoCommit(); mConn.setAutoCommit(false); Predicate<String> validSqlLine = s -> s.length() != 0 // && !s.startsWith("BEGIN") // && !s.startsWith("COMMIT") // ; Predicate<String> commentPredicate = s -> !s.startsWith("--"); try (IHMStatement pStmt = mConn.createStatement()) { final int[] counter = {1}; Stream<String> linesStream = null; if (eachLineAnSql) { linesStream = Files.lines(Paths.get(file.getAbsolutePath())).map(s -> s.trim()).filter(commentPredicate) .filter(validSqlLine); } else { linesStream = Arrays.stream(Files.lines(Paths.get(file.getAbsolutePath())).filter(commentPredicate) .collect(Collectors.joining()).split(";")).filter(validSqlLine); } Consumer<String> executeAction = s -> { try { pStmt.executeUpdate(s); counter[0]++; if (counter[0] % chunks == 0) { mConn.commit(); } } catch (Exception e) { throw new RuntimeException(e); } }; linesStream.forEach(executeAction); mConn.commit(); } mConn.setAutoCommit(autoCommit); return null; }); }
java
public void executeSqlFile( File file, int chunks, boolean eachLineAnSql ) throws Exception { execOnConnection(mConn -> { boolean autoCommit = mConn.getAutoCommit(); mConn.setAutoCommit(false); Predicate<String> validSqlLine = s -> s.length() != 0 // && !s.startsWith("BEGIN") // && !s.startsWith("COMMIT") // ; Predicate<String> commentPredicate = s -> !s.startsWith("--"); try (IHMStatement pStmt = mConn.createStatement()) { final int[] counter = {1}; Stream<String> linesStream = null; if (eachLineAnSql) { linesStream = Files.lines(Paths.get(file.getAbsolutePath())).map(s -> s.trim()).filter(commentPredicate) .filter(validSqlLine); } else { linesStream = Arrays.stream(Files.lines(Paths.get(file.getAbsolutePath())).filter(commentPredicate) .collect(Collectors.joining()).split(";")).filter(validSqlLine); } Consumer<String> executeAction = s -> { try { pStmt.executeUpdate(s); counter[0]++; if (counter[0] % chunks == 0) { mConn.commit(); } } catch (Exception e) { throw new RuntimeException(e); } }; linesStream.forEach(executeAction); mConn.commit(); } mConn.setAutoCommit(autoCommit); return null; }); }
[ "public", "void", "executeSqlFile", "(", "File", "file", ",", "int", "chunks", ",", "boolean", "eachLineAnSql", ")", "throws", "Exception", "{", "execOnConnection", "(", "mConn", "->", "{", "boolean", "autoCommit", "=", "mConn", ".", "getAutoCommit", "(", ")",...
Execute a insert/update sql file. @param file the file to run on this db. @param chunks commit interval. @throws Exception
[ "Execute", "a", "insert", "/", "update", "sql", "file", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/spatialite/GTSpatialiteThreadsafeDb.java#L106-L147
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java
UpdateBuilder.set
@Nonnull public T set(@Nonnull DocumentReference documentReference, @Nonnull Map<String, Object> fields) { return set(documentReference, fields, SetOptions.OVERWRITE); }
java
@Nonnull public T set(@Nonnull DocumentReference documentReference, @Nonnull Map<String, Object> fields) { return set(documentReference, fields, SetOptions.OVERWRITE); }
[ "@", "Nonnull", "public", "T", "set", "(", "@", "Nonnull", "DocumentReference", "documentReference", ",", "@", "Nonnull", "Map", "<", "String", ",", "Object", ">", "fields", ")", "{", "return", "set", "(", "documentReference", ",", "fields", ",", "SetOptions...
Overwrites the document referred to by this DocumentReference. If the document doesn't exist yet, it will be created. If a document already exists, it will be overwritten. @param documentReference The DocumentReference to overwrite. @param fields A map of the field paths and values for the document. @return The instance for chaining.
[ "Overwrites", "the", "document", "referred", "to", "by", "this", "DocumentReference", ".", "If", "the", "document", "doesn", "t", "exist", "yet", "it", "will", "be", "created", ".", "If", "a", "document", "already", "exists", "it", "will", "be", "overwritten...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java#L173-L176
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.updateTagsAsync
public Observable<VirtualNetworkGatewayConnectionInner> updateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionInner>, VirtualNetworkGatewayConnectionInner>() { @Override public VirtualNetworkGatewayConnectionInner call(ServiceResponse<VirtualNetworkGatewayConnectionInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkGatewayConnectionInner> updateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionInner>, VirtualNetworkGatewayConnectionInner>() { @Override public VirtualNetworkGatewayConnectionInner call(ServiceResponse<VirtualNetworkGatewayConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkGatewayConnectionInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsW...
Updates a virtual network gateway connection tags. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "virtual", "network", "gateway", "connection", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L638-L645
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/FinanceUtils.java
FinanceUtils.toGrowthFactorFromAnnualReturn
public static double toGrowthFactorFromAnnualReturn(double annualReturn, CalendarDateUnit growthFactorUnit) { double tmpAnnualGrowthFactor = PrimitiveMath.ONE + annualReturn; double tmpYearsPerGrowthFactorUnit = CalendarDateUnit.YEAR.convert(growthFactorUnit); return PrimitiveMath.POW.invoke(tmpAnnualGrowthFactor, tmpYearsPerGrowthFactorUnit); }
java
public static double toGrowthFactorFromAnnualReturn(double annualReturn, CalendarDateUnit growthFactorUnit) { double tmpAnnualGrowthFactor = PrimitiveMath.ONE + annualReturn; double tmpYearsPerGrowthFactorUnit = CalendarDateUnit.YEAR.convert(growthFactorUnit); return PrimitiveMath.POW.invoke(tmpAnnualGrowthFactor, tmpYearsPerGrowthFactorUnit); }
[ "public", "static", "double", "toGrowthFactorFromAnnualReturn", "(", "double", "annualReturn", ",", "CalendarDateUnit", "growthFactorUnit", ")", "{", "double", "tmpAnnualGrowthFactor", "=", "PrimitiveMath", ".", "ONE", "+", "annualReturn", ";", "double", "tmpYearsPerGrowt...
GrowthFactor = exp(GrowthRate) @param annualReturn Annualised return (percentage per year) @param growthFactorUnit A growth factor unit @return A growth factor per unit (day, week, month, year...)
[ "GrowthFactor", "=", "exp", "(", "GrowthRate", ")" ]
train
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/FinanceUtils.java#L444-L448
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureFromHomographies.java
ProjectiveStructureFromHomographies.proccess
public boolean proccess(List<DMatrixRMaj> homographies_view0_to_viewI, List<List<PointIndex2D_F64>> observations , int totalFeatures ) { if( homographies_view0_to_viewI.size() != observations.size() ) { throw new IllegalArgumentException("Number of homographies and observations do not match"); } LowLevelMultiViewOps.computeNormalizationLL((List)observations,N); // Apply normalization to homographies this.homographies = homographies_view0_to_viewI; filterPointsOnPlaneAtInfinity(homographies, observations,totalFeatures); // compute some internal working variables and determine if there are enough observations to compute a // solution computeConstants(homographies_view0_to_viewI, filtered, totalFeatures); // Solve the problem constructLinearSystem(homographies, filtered); if( !svd.decompose(A)) return false; // get null vector. camera matrices and scene structure are extracted from B as requested SingularOps_DDRM.nullVector(svd,true,B); return true; }
java
public boolean proccess(List<DMatrixRMaj> homographies_view0_to_viewI, List<List<PointIndex2D_F64>> observations , int totalFeatures ) { if( homographies_view0_to_viewI.size() != observations.size() ) { throw new IllegalArgumentException("Number of homographies and observations do not match"); } LowLevelMultiViewOps.computeNormalizationLL((List)observations,N); // Apply normalization to homographies this.homographies = homographies_view0_to_viewI; filterPointsOnPlaneAtInfinity(homographies, observations,totalFeatures); // compute some internal working variables and determine if there are enough observations to compute a // solution computeConstants(homographies_view0_to_viewI, filtered, totalFeatures); // Solve the problem constructLinearSystem(homographies, filtered); if( !svd.decompose(A)) return false; // get null vector. camera matrices and scene structure are extracted from B as requested SingularOps_DDRM.nullVector(svd,true,B); return true; }
[ "public", "boolean", "proccess", "(", "List", "<", "DMatrixRMaj", ">", "homographies_view0_to_viewI", ",", "List", "<", "List", "<", "PointIndex2D_F64", ">", ">", "observations", ",", "int", "totalFeatures", ")", "{", "if", "(", "homographies_view0_to_viewI", ".",...
<p>Solves for camera matrices and scene structure.</p> Homographies from view i to 0:<br> x[0] = H*x[i] @param homographies_view0_to_viewI (Input) Homographies matching pixels from view i to view 0. @param observations (Input) Observed features in each view, except view 0. Indexes of points must be from 0 to totalFeatures-1 @param totalFeatures (Input) total number of features being solved for. Uses to sanity check input @return true if successful or false if it failed
[ "<p", ">", "Solves", "for", "camera", "matrices", "and", "scene", "structure", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureFromHomographies.java#L108-L136
Harium/keel
src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java
PerlinNoise.Function2D
public double Function2D(double x, double y) { double frequency = initFrequency; double amplitude = initAmplitude; double sum = 0; // octaves for (int i = 0; i < octaves; i++) { sum += SmoothedNoise(x * frequency, y * frequency) * amplitude; frequency *= 2; amplitude *= persistence; } return sum; }
java
public double Function2D(double x, double y) { double frequency = initFrequency; double amplitude = initAmplitude; double sum = 0; // octaves for (int i = 0; i < octaves; i++) { sum += SmoothedNoise(x * frequency, y * frequency) * amplitude; frequency *= 2; amplitude *= persistence; } return sum; }
[ "public", "double", "Function2D", "(", "double", "x", ",", "double", "y", ")", "{", "double", "frequency", "=", "initFrequency", ";", "double", "amplitude", "=", "initAmplitude", ";", "double", "sum", "=", "0", ";", "// octaves", "for", "(", "int", "i", ...
2-D Perlin noise function. @param x X Value. @param y Y Value. @return Returns function's value at point xy.
[ "2", "-", "D", "Perlin", "noise", "function", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java#L170-L183
jenkinsci/jenkins
core/src/main/java/hudson/Util.java
Util.fixNull
@Nonnull public static <T> T fixNull(@CheckForNull T s, @Nonnull T defaultValue) { return s != null ? s : defaultValue; }
java
@Nonnull public static <T> T fixNull(@CheckForNull T s, @Nonnull T defaultValue) { return s != null ? s : defaultValue; }
[ "@", "Nonnull", "public", "static", "<", "T", ">", "T", "fixNull", "(", "@", "CheckForNull", "T", "s", ",", "@", "Nonnull", "T", "defaultValue", ")", "{", "return", "s", "!=", "null", "?", "s", ":", "defaultValue", ";", "}" ]
Convert {@code null} to a default value. @param defaultValue Default value. It may be immutable or not, depending on the implementation. @since 2.144
[ "Convert", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L1002-L1005
canhnt/sne-xacml
sne-xacml/src/main/java/nl/uva/sne/midd/builders/MIDDCombiner.java
MIDDCombiner.combineExternalNodes
private ExternalNode3 combineExternalNodes(ExternalNode3 n1, ExternalNode3 n2) { if (n1 == null || n2 == null) { throw new IllegalArgumentException("Input nodes must not be null"); } DecisionType combinedDecision = algo.combine(n1.getDecision(), n2.getDecision()); ExternalNode3 n = new ExternalNode3(combinedDecision); // only accept OE that match with combined decision. List<ObligationExpression> oes1 = getFulfilledObligationExpressions(n1.getObligationExpressions(), combinedDecision); List<ObligationExpression> oes2 = getFulfilledObligationExpressions(n2.getObligationExpressions(), combinedDecision); n.getObligationExpressions().addAll(oes1); n.getObligationExpressions().addAll(oes2); return n; }
java
private ExternalNode3 combineExternalNodes(ExternalNode3 n1, ExternalNode3 n2) { if (n1 == null || n2 == null) { throw new IllegalArgumentException("Input nodes must not be null"); } DecisionType combinedDecision = algo.combine(n1.getDecision(), n2.getDecision()); ExternalNode3 n = new ExternalNode3(combinedDecision); // only accept OE that match with combined decision. List<ObligationExpression> oes1 = getFulfilledObligationExpressions(n1.getObligationExpressions(), combinedDecision); List<ObligationExpression> oes2 = getFulfilledObligationExpressions(n2.getObligationExpressions(), combinedDecision); n.getObligationExpressions().addAll(oes1); n.getObligationExpressions().addAll(oes2); return n; }
[ "private", "ExternalNode3", "combineExternalNodes", "(", "ExternalNode3", "n1", ",", "ExternalNode3", "n2", ")", "{", "if", "(", "n1", "==", "null", "||", "n2", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Input nodes must not be nul...
Combine two external nodes following the algorithm in this.algo @param n1 @param n2 @return
[ "Combine", "two", "external", "nodes", "following", "the", "algorithm", "in", "this", ".", "algo" ]
train
https://github.com/canhnt/sne-xacml/blob/7ffca16bf558d2c3ee16181d926f066ab1de75b2/sne-xacml/src/main/java/nl/uva/sne/midd/builders/MIDDCombiner.java#L200-L217
geomajas/geomajas-project-geometry
core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java
GeometryIndexService.isChildOf
public boolean isChildOf(GeometryIndex parentIndex, GeometryIndex childIndex) { if (parentIndex.getValue() != childIndex.getValue()) { return false; } if (parentIndex.hasChild() && childIndex.hasChild()) { return isChildOf(parentIndex.getChild(), childIndex.getChild()); } else if (!parentIndex.hasChild() && childIndex.hasChild()) { return true; } return false; }
java
public boolean isChildOf(GeometryIndex parentIndex, GeometryIndex childIndex) { if (parentIndex.getValue() != childIndex.getValue()) { return false; } if (parentIndex.hasChild() && childIndex.hasChild()) { return isChildOf(parentIndex.getChild(), childIndex.getChild()); } else if (!parentIndex.hasChild() && childIndex.hasChild()) { return true; } return false; }
[ "public", "boolean", "isChildOf", "(", "GeometryIndex", "parentIndex", ",", "GeometryIndex", "childIndex", ")", "{", "if", "(", "parentIndex", ".", "getValue", "(", ")", "!=", "childIndex", ".", "getValue", "(", ")", ")", "{", "return", "false", ";", "}", ...
Checks to see if a given index is the child of another index. @param parentIndex The so-called parent index. @param childIndex The so-called child index. @return Is the second index really a child of the first index?
[ "Checks", "to", "see", "if", "a", "given", "index", "is", "the", "child", "of", "another", "index", "." ]
train
https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java#L337-L347
osglworks/java-tool
src/main/java/org/osgl/util/KVStore.java
KVStore.putValue
@Override public KVStore putValue(String key, Object val) { put(key, ValueObject.of(val)); return this; }
java
@Override public KVStore putValue(String key, Object val) { put(key, ValueObject.of(val)); return this; }
[ "@", "Override", "public", "KVStore", "putValue", "(", "String", "key", ",", "Object", "val", ")", "{", "put", "(", "key", ",", "ValueObject", ".", "of", "(", "val", ")", ")", ";", "return", "this", ";", "}" ]
Put a simple data into the store with a key. The type of simple data should be allowed by {@link ValueObject} @param key the key @param val the value @return this store instance after the put operation finished @see ValueObject
[ "Put", "a", "simple", "data", "into", "the", "store", "with", "a", "key", ".", "The", "type", "of", "simple", "data", "should", "be", "allowed", "by", "{" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/KVStore.java#L62-L66
forge/javaee-descriptors
impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/facespartialresponse20/WebFacesPartialResponseDescriptorImpl.java
WebFacesPartialResponseDescriptorImpl.addNamespace
public WebFacesPartialResponseDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
java
public WebFacesPartialResponseDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
[ "public", "WebFacesPartialResponseDescriptor", "addNamespace", "(", "String", "name", ",", "String", "value", ")", "{", "model", ".", "attribute", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a new namespace @return the current instance of <code>WebFacesPartialResponseDescriptor</code>
[ "Adds", "a", "new", "namespace" ]
train
https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/facespartialresponse20/WebFacesPartialResponseDescriptorImpl.java#L85-L89
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteMember
public Response deleteMember(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/members/" + jid, new HashMap<String, String>()); }
java
public Response deleteMember(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/members/" + jid, new HashMap<String, String>()); }
[ "public", "Response", "deleteMember", "(", "String", "roomName", ",", "String", "jid", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/members/\"", "+", "jid", ",", "new", "HashMap", "<", "String", ",", "Stri...
Delete member from chatroom. @param roomName the room name @param jid the jid @return the response
[ "Delete", "member", "from", "chatroom", "." ]
train
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L315-L318
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java
SyncAgentsInner.getAsync
public Observable<SyncAgentInner> getAsync(String resourceGroupName, String serverName, String syncAgentName) { return getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1<ServiceResponse<SyncAgentInner>, SyncAgentInner>() { @Override public SyncAgentInner call(ServiceResponse<SyncAgentInner> response) { return response.body(); } }); }
java
public Observable<SyncAgentInner> getAsync(String resourceGroupName, String serverName, String syncAgentName) { return getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1<ServiceResponse<SyncAgentInner>, SyncAgentInner>() { @Override public SyncAgentInner call(ServiceResponse<SyncAgentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SyncAgentInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "syncAgentName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "syncA...
Gets a sync agent. @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 on which the sync agent is hosted. @param syncAgentName The name of the sync agent. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SyncAgentInner object
[ "Gets", "a", "sync", "agent", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java#L144-L151
unbescape/unbescape
src/main/java/org/unbescape/json/JsonEscape.java
JsonEscape.escapeJsonMinimal
public static void escapeJsonMinimal(final String text, final Writer writer) throws IOException { escapeJson(text, writer, JsonEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA, JsonEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
java
public static void escapeJsonMinimal(final String text, final Writer writer) throws IOException { escapeJson(text, writer, JsonEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA, JsonEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapeJsonMinimal", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeJson", "(", "text", ",", "writer", ",", "JsonEscapeType", ".", "SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA", ",", ...
<p> Perform a JSON level 1 (only basic set) <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the JSON basic escape set: </p> <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;b</tt> (<tt>U+0008</tt>), <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&quot;</tt> (<tt>U+0022</tt>), <tt>&#92;&#92;</tt> (<tt>U+005C</tt>) and <tt>&#92;&#47;</tt> (<tt>U+002F</tt>). Note that <tt>&#92;&#47;</tt> is optional, and will only be used when the <tt>&#47;</tt> symbol appears after <tt>&lt;</tt>, as in <tt>&lt;&#47;</tt>. This is to avoid accidentally closing <tt>&lt;script&gt;</tt> tags in HTML. </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> (required by the JSON spec) and <tt>U+007F</tt> to <tt>U+009F</tt> (additional). </li> </ul> <p> This method calls {@link #escapeJson(String, Writer, JsonEscapeType, JsonEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link JsonEscapeType#SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA}</li> <li><tt>level</tt>: {@link JsonEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "JSON", "level", "1", "(", "only", "basic", "set", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/json/JsonEscape.java#L374-L379
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/io/Files.java
Files.readLines
public static List<String> readLines(File file, Charset charset) throws IOException { InputStream in = null; try { in = new FileInputStream(file); if (null == charset) { return IOs.readLines(new InputStreamReader(in)); } else { InputStreamReader reader = new InputStreamReader(in, charset.name()); return IOs.readLines(reader); } } finally { IOs.close(in); } }
java
public static List<String> readLines(File file, Charset charset) throws IOException { InputStream in = null; try { in = new FileInputStream(file); if (null == charset) { return IOs.readLines(new InputStreamReader(in)); } else { InputStreamReader reader = new InputStreamReader(in, charset.name()); return IOs.readLines(reader); } } finally { IOs.close(in); } }
[ "public", "static", "List", "<", "String", ">", "readLines", "(", "File", "file", ",", "Charset", "charset", ")", "throws", "IOException", "{", "InputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "FileInputStream", "(", "file", ")", ";",...
Reads the contents of a file line by line to a List of Strings. The file is always closed.
[ "Reads", "the", "contents", "of", "a", "file", "line", "by", "line", "to", "a", "List", "of", "Strings", ".", "The", "file", "is", "always", "closed", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/io/Files.java#L76-L89
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/DoubleStream.java
DoubleStream.scan
@NotNull public DoubleStream scan(@NotNull final DoubleBinaryOperator accumulator) { Objects.requireNonNull(accumulator); return new DoubleStream(params, new DoubleScan(iterator, accumulator)); }
java
@NotNull public DoubleStream scan(@NotNull final DoubleBinaryOperator accumulator) { Objects.requireNonNull(accumulator); return new DoubleStream(params, new DoubleScan(iterator, accumulator)); }
[ "@", "NotNull", "public", "DoubleStream", "scan", "(", "@", "NotNull", "final", "DoubleBinaryOperator", "accumulator", ")", "{", "Objects", ".", "requireNonNull", "(", "accumulator", ")", ";", "return", "new", "DoubleStream", "(", "params", ",", "new", "DoubleSc...
Returns a {@code DoubleStream} produced by iterative application of a accumulation function to reduction value and next element of the current stream. Produces a {@code DoubleStream} consisting of {@code value1}, {@code acc(value1, value2)}, {@code acc(acc(value1, value2), value3)}, etc. <p>This is an intermediate operation. <p>Example: <pre> accumulator: (a, b) -&gt; a + b stream: [1, 2, 3, 4, 5] result: [1, 3, 6, 10, 15] </pre> @param accumulator the accumulation function @return the new stream @throws NullPointerException if {@code accumulator} is null @since 1.1.6
[ "Returns", "a", "{", "@code", "DoubleStream", "}", "produced", "by", "iterative", "application", "of", "a", "accumulation", "function", "to", "reduction", "value", "and", "next", "element", "of", "the", "current", "stream", ".", "Produces", "a", "{", "@code", ...
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/DoubleStream.java#L646-L650
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.deleteUser
public void deleteUser(CmsRequestContext context, String username) throws CmsException { CmsUser user = readUser(context, username); deleteUser(context, user, null); }
java
public void deleteUser(CmsRequestContext context, String username) throws CmsException { CmsUser user = readUser(context, username); deleteUser(context, user, null); }
[ "public", "void", "deleteUser", "(", "CmsRequestContext", "context", ",", "String", "username", ")", "throws", "CmsException", "{", "CmsUser", "user", "=", "readUser", "(", "context", ",", "username", ")", ";", "deleteUser", "(", "context", ",", "user", ",", ...
Deletes a user.<p> @param context the current request context @param username the name of the user to be deleted @throws CmsException if something goes wrong
[ "Deletes", "a", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1697-L1701
SeleniumHQ/fluent-selenium
java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java
FluentSelect.deselectByIndex
public FluentSelect deselectByIndex(final int index) { executeAndWrapReThrowIfNeeded(new DeselectByIndex(index), Context.singular(context, "deselectByIndex", null, index), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
java
public FluentSelect deselectByIndex(final int index) { executeAndWrapReThrowIfNeeded(new DeselectByIndex(index), Context.singular(context, "deselectByIndex", null, index), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
[ "public", "FluentSelect", "deselectByIndex", "(", "final", "int", "index", ")", "{", "executeAndWrapReThrowIfNeeded", "(", "new", "DeselectByIndex", "(", "index", ")", ",", "Context", ".", "singular", "(", "context", ",", "\"deselectByIndex\"", ",", "null", ",", ...
Deselect the option at the given index. This is done by examining the "index" attribute of an element, and not merely by counting. @param index The option at this index will be deselected
[ "Deselect", "the", "option", "at", "the", "given", "index", ".", "This", "is", "done", "by", "examining", "the", "index", "attribute", "of", "an", "element", "and", "not", "merely", "by", "counting", "." ]
train
https://github.com/SeleniumHQ/fluent-selenium/blob/fcb171471a7d1abb2800bcbca21b3ae3e6c12472/java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java#L152-L155
Atmosphere/wasync
wasync/src/main/java/org/atmosphere/wasync/RequestBuilder.java
RequestBuilder.queryString
public T queryString(String name, String value) { List<String> l = queryString.get(name); if (l == null) { l = new ArrayList<String>(); } l.add(value); queryString.put(name, l); return derived.cast(this); }
java
public T queryString(String name, String value) { List<String> l = queryString.get(name); if (l == null) { l = new ArrayList<String>(); } l.add(value); queryString.put(name, l); return derived.cast(this); }
[ "public", "T", "queryString", "(", "String", "name", ",", "String", "value", ")", "{", "List", "<", "String", ">", "l", "=", "queryString", ".", "get", "(", "name", ")", ";", "if", "(", "l", "==", "null", ")", "{", "l", "=", "new", "ArrayList", "...
Add a query param. @param name header name @param value header value @return this
[ "Add", "a", "query", "param", "." ]
train
https://github.com/Atmosphere/wasync/blob/0146828b2f5138d4cbb4872fcbfe7d6e1887ac14/wasync/src/main/java/org/atmosphere/wasync/RequestBuilder.java#L125-L133
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractFieldValidator.java
AbstractFieldValidator.error
public void error(final CellField<T> cellField, final String messageKey) { error(cellField, messageKey, getMessageVariables(cellField)); }
java
public void error(final CellField<T> cellField, final String messageKey) { error(cellField, messageKey, getMessageVariables(cellField)); }
[ "public", "void", "error", "(", "final", "CellField", "<", "T", ">", "cellField", ",", "final", "String", "messageKey", ")", "{", "error", "(", "cellField", ",", "messageKey", ",", "getMessageVariables", "(", "cellField", ")", ")", ";", "}" ]
メッセージキーを指定して、エラー情報を追加します。 <p>エラーメッセージ中の変数は、{@link #getMessageVariables(CellField)}の値を使用します。</p> @param cellField フィールド情報 @param messageKey メッセージキー @throws IllegalArgumentException {@literal cellField == null or messageKey == null} @throws IllegalArgumentException {@literal messageKey.length() == 0}
[ "メッセージキーを指定して、エラー情報を追加します。", "<p", ">", "エラーメッセージ中の変数は、", "{" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractFieldValidator.java#L101-L103
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteProjectMember
public void deleteProjectMember(GitlabProject project, GitlabUser user) throws IOException { deleteProjectMember(project.getId(), user.getId()); }
java
public void deleteProjectMember(GitlabProject project, GitlabUser user) throws IOException { deleteProjectMember(project.getId(), user.getId()); }
[ "public", "void", "deleteProjectMember", "(", "GitlabProject", "project", ",", "GitlabUser", "user", ")", "throws", "IOException", "{", "deleteProjectMember", "(", "project", ".", "getId", "(", ")", ",", "user", ".", "getId", "(", ")", ")", ";", "}" ]
Delete a project team member. @param project the GitlabProject @param user the GitlabUser @throws IOException on gitlab api call error
[ "Delete", "a", "project", "team", "member", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3057-L3059
googleapis/google-cloud-java
google-cloud-clients/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2beta2/CloudTasksClient.java
CloudTasksClient.renewLease
public final Task renewLease(TaskName name, Timestamp scheduleTime, Duration leaseDuration) { RenewLeaseRequest request = RenewLeaseRequest.newBuilder() .setName(name == null ? null : name.toString()) .setScheduleTime(scheduleTime) .setLeaseDuration(leaseDuration) .build(); return renewLease(request); }
java
public final Task renewLease(TaskName name, Timestamp scheduleTime, Duration leaseDuration) { RenewLeaseRequest request = RenewLeaseRequest.newBuilder() .setName(name == null ? null : name.toString()) .setScheduleTime(scheduleTime) .setLeaseDuration(leaseDuration) .build(); return renewLease(request); }
[ "public", "final", "Task", "renewLease", "(", "TaskName", "name", ",", "Timestamp", "scheduleTime", ",", "Duration", "leaseDuration", ")", "{", "RenewLeaseRequest", "request", "=", "RenewLeaseRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "=...
Renew the current lease of a pull task. <p>The worker can use this method to extend the lease by a new duration, starting from now. The new task lease will be returned in the task's [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time]. <p>Sample code: <pre><code> try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]"); Timestamp scheduleTime = Timestamp.newBuilder().build(); Duration leaseDuration = Duration.newBuilder().build(); Task response = cloudTasksClient.renewLease(name, scheduleTime, leaseDuration); } </code></pre> @param name Required. <p>The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` @param scheduleTime Required. <p>The task's current schedule time, available in the [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response. This restriction is to ensure that your worker currently holds the lease. @param leaseDuration Required. <p>The desired new lease duration, starting from now. <p>The maximum lease duration is 1 week. `lease_duration` will be truncated to the nearest second. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Renew", "the", "current", "lease", "of", "a", "pull", "task", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2beta2/CloudTasksClient.java#L2357-L2366
lets-blade/blade
src/main/java/com/blade/kit/EncryptKit.java
EncryptKit.desTemplate
public static byte[] desTemplate(byte[] data, byte[] key, String algorithm, String transformation, boolean isEncrypt) { if (data == null || data.length == 0 || key == null || key.length == 0) return null; try { SecretKeySpec keySpec = new SecretKeySpec(key, algorithm); Cipher cipher = Cipher.getInstance(transformation); SecureRandom random = new SecureRandom(); cipher.init(isEncrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, keySpec, random); return cipher.doFinal(data); } catch (Throwable e) { e.printStackTrace(); return null; } }
java
public static byte[] desTemplate(byte[] data, byte[] key, String algorithm, String transformation, boolean isEncrypt) { if (data == null || data.length == 0 || key == null || key.length == 0) return null; try { SecretKeySpec keySpec = new SecretKeySpec(key, algorithm); Cipher cipher = Cipher.getInstance(transformation); SecureRandom random = new SecureRandom(); cipher.init(isEncrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, keySpec, random); return cipher.doFinal(data); } catch (Throwable e) { e.printStackTrace(); return null; } }
[ "public", "static", "byte", "[", "]", "desTemplate", "(", "byte", "[", "]", "data", ",", "byte", "[", "]", "key", ",", "String", "algorithm", ",", "String", "transformation", ",", "boolean", "isEncrypt", ")", "{", "if", "(", "data", "==", "null", "||",...
DES加密模板 @param data 数据 @param key 秘钥 @param algorithm 加密算法 @param transformation 转变 @param isEncrypt {@code true}: 加密 {@code false}: 解密 @return 密文或者明文,适用于DES,3DES,AES
[ "DES加密模板" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/EncryptKit.java#L682-L694
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/mult/VectorVectorMult_DDRM.java
VectorVectorMult_DDRM.innerProd
public static double innerProd(DMatrixD1 x, DMatrixD1 y ) { int m = x.getNumElements(); double total = 0; for( int i = 0; i < m; i++ ) { total += x.get(i) * y.get(i); } return total; }
java
public static double innerProd(DMatrixD1 x, DMatrixD1 y ) { int m = x.getNumElements(); double total = 0; for( int i = 0; i < m; i++ ) { total += x.get(i) * y.get(i); } return total; }
[ "public", "static", "double", "innerProd", "(", "DMatrixD1", "x", ",", "DMatrixD1", "y", ")", "{", "int", "m", "=", "x", ".", "getNumElements", "(", ")", ";", "double", "total", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m",...
<p> Computes the inner product of the two vectors. In geometry this is known as the dot product.<br> <br> &sum;<sub>k=1:n</sub> x<sub>k</sub> * y<sub>k</sub><br> where x and y are vectors with n elements. </p> <p> These functions are often used inside of highly optimized code and therefor sanity checks are kept to a minimum. It is not recommended that any of these functions be used directly. </p> @param x A vector with n elements. Not modified. @param y A vector with n elements. Not modified. @return The inner product of the two vectors.
[ "<p", ">", "Computes", "the", "inner", "product", "of", "the", "two", "vectors", ".", "In", "geometry", "this", "is", "known", "as", "the", "dot", "product", ".", "<br", ">", "<br", ">", "&sum", ";", "<sub", ">", "k", "=", "1", ":", "n<", "/", "s...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/mult/VectorVectorMult_DDRM.java#L50-L60
icode/ameba
src/main/java/ameba/mvc/template/internal/TemplateModelProcessor.java
TemplateModelProcessor.processModel
private ResourceModel processModel(final ResourceModel resourceModel, final boolean subResourceModel) { ResourceModel.Builder newModelBuilder = processTemplateAnnotatedInvocables(resourceModel, subResourceModel); for (RuntimeResource resource : resourceModel.getRuntimeResourceModel().getRuntimeResources()) { ModelProcessorUtil.enhanceResource(resource, newModelBuilder, getEnhancingMethods(resource), false); } return newModelBuilder.build(); }
java
private ResourceModel processModel(final ResourceModel resourceModel, final boolean subResourceModel) { ResourceModel.Builder newModelBuilder = processTemplateAnnotatedInvocables(resourceModel, subResourceModel); for (RuntimeResource resource : resourceModel.getRuntimeResourceModel().getRuntimeResources()) { ModelProcessorUtil.enhanceResource(resource, newModelBuilder, getEnhancingMethods(resource), false); } return newModelBuilder.build(); }
[ "private", "ResourceModel", "processModel", "(", "final", "ResourceModel", "resourceModel", ",", "final", "boolean", "subResourceModel", ")", "{", "ResourceModel", ".", "Builder", "newModelBuilder", "=", "processTemplateAnnotatedInvocables", "(", "resourceModel", ",", "su...
Enhance {@link org.glassfish.jersey.server.model.RuntimeResource runtime resources} of given {@link org.glassfish.jersey.server.model.ResourceModel resource model} with methods obtained with {@link #getEnhancingMethods(org.glassfish.jersey.server.model.RuntimeResource)}. @param resourceModel resource model to enhance runtime resources of. @param subResourceModel determines whether the resource model represents sub-resource. @return enhanced resource model.
[ "Enhance", "{", "@link", "org", ".", "glassfish", ".", "jersey", ".", "server", ".", "model", ".", "RuntimeResource", "runtime", "resources", "}", "of", "given", "{", "@link", "org", ".", "glassfish", ".", "jersey", ".", "server", ".", "model", ".", "Res...
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/mvc/template/internal/TemplateModelProcessor.java#L96-L104
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
JQMList.addItem
public JQMListItem addItem(String text, JQMPage page) { return addItem(text, "#" + page.getId()); }
java
public JQMListItem addItem(String text, JQMPage page) { return addItem(text, "#" + page.getId()); }
[ "public", "JQMListItem", "addItem", "(", "String", "text", ",", "JQMPage", "page", ")", "{", "return", "addItem", "(", "text", ",", "\"#\"", "+", "page", ".", "getId", "(", ")", ")", ";", "}" ]
Adds a new {@link JQMListItem} that contains the given @param text as the heading element. <br> The list item is made linkable to the given page @param text the text to use as the content of the header element @param page the page to make the list item link to
[ "Adds", "a", "new", "{", "@link", "JQMListItem", "}", "that", "contains", "the", "given", "@param", "text", "as", "the", "heading", "element", ".", "<br", ">", "The", "list", "item", "is", "made", "linkable", "to", "the", "given", "page" ]
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L277-L279
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java
RuntimeUtil.execForStr
public static String execForStr(Charset charset, String... cmds) throws IORuntimeException { return getResult(exec(cmds), charset); }
java
public static String execForStr(Charset charset, String... cmds) throws IORuntimeException { return getResult(exec(cmds), charset); }
[ "public", "static", "String", "execForStr", "(", "Charset", "charset", ",", "String", "...", "cmds", ")", "throws", "IORuntimeException", "{", "return", "getResult", "(", "exec", "(", "cmds", ")", ",", "charset", ")", ";", "}" ]
执行系统命令,使用系统默认编码 @param charset 编码 @param cmds 命令列表,每个元素代表一条命令 @return 执行结果 @throws IORuntimeException IO异常 @since 3.1.2
[ "执行系统命令,使用系统默认编码" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java#L41-L43
aws/aws-sdk-java
aws-java-sdk-iam/src/main/java/com/amazonaws/services/identitymanagement/model/GetContextKeysForPrincipalPolicyRequest.java
GetContextKeysForPrincipalPolicyRequest.getPolicyInputList
public java.util.List<String> getPolicyInputList() { if (policyInputList == null) { policyInputList = new com.amazonaws.internal.SdkInternalList<String>(); } return policyInputList; }
java
public java.util.List<String> getPolicyInputList() { if (policyInputList == null) { policyInputList = new com.amazonaws.internal.SdkInternalList<String>(); } return policyInputList; }
[ "public", "java", ".", "util", ".", "List", "<", "String", ">", "getPolicyInputList", "(", ")", "{", "if", "(", "policyInputList", "==", "null", ")", "{", "policyInputList", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<",...
<p> An optional list of additional policies for which you want the list of context keys that are referenced. </p> <p> The <a href="http://wikipedia.org/wiki/regex">regex pattern</a> used to validate this parameter is a string of characters consisting of the following: </p> <ul> <li> <p> Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character range </p> </li> <li> <p> The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF) </p> </li> <li> <p> The special characters tab ( ), line feed ( ), and carriage return ( ) </p> </li> </ul> @return An optional list of additional policies for which you want the list of context keys that are referenced.</p> <p> The <a href="http://wikipedia.org/wiki/regex">regex pattern</a> used to validate this parameter is a string of characters consisting of the following: </p> <ul> <li> <p> Any printable ASCII character ranging from the space character ( ) through the end of the ASCII character range </p> </li> <li> <p> The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF) </p> </li> <li> <p> The special characters tab ( ), line feed ( ), and carriage return ( ) </p> </li>
[ "<p", ">", "An", "optional", "list", "of", "additional", "policies", "for", "which", "you", "want", "the", "list", "of", "context", "keys", "that", "are", "referenced", ".", "<", "/", "p", ">", "<p", ">", "The", "<a", "href", "=", "http", ":", "//", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iam/src/main/java/com/amazonaws/services/identitymanagement/model/GetContextKeysForPrincipalPolicyRequest.java#L216-L221
grpc/grpc-java
alts/src/main/java/io/grpc/alts/AltsChannelBuilder.java
AltsChannelBuilder.forAddress
public static AltsChannelBuilder forAddress(String name, int port) { return forTarget(GrpcUtil.authorityFromHostAndPort(name, port)); }
java
public static AltsChannelBuilder forAddress(String name, int port) { return forTarget(GrpcUtil.authorityFromHostAndPort(name, port)); }
[ "public", "static", "AltsChannelBuilder", "forAddress", "(", "String", "name", ",", "int", "port", ")", "{", "return", "forTarget", "(", "GrpcUtil", ".", "authorityFromHostAndPort", "(", "name", ",", "port", ")", ")", ";", "}" ]
"Overrides" the static method in {@link ManagedChannelBuilder}.
[ "Overrides", "the", "static", "method", "in", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/AltsChannelBuilder.java#L71-L73
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java
WriteQueue.calculateFillRatio
private static double calculateFillRatio(long totalLength, int size) { if (size > 0) { return Math.min(1, (double) totalLength / size / BookKeeperConfig.MAX_APPEND_LENGTH); } else { return 0; } }
java
private static double calculateFillRatio(long totalLength, int size) { if (size > 0) { return Math.min(1, (double) totalLength / size / BookKeeperConfig.MAX_APPEND_LENGTH); } else { return 0; } }
[ "private", "static", "double", "calculateFillRatio", "(", "long", "totalLength", ",", "int", "size", ")", "{", "if", "(", "size", ">", "0", ")", "{", "return", "Math", ".", "min", "(", "1", ",", "(", "double", ")", "totalLength", "/", "size", "/", "B...
Calculates the FillRatio, which is a number between [0, 1] that represents the average fill of each write with respect to the maximum BookKeeper write allowance. @param totalLength Total length of the writes. @param size Total number of writes.
[ "Calculates", "the", "FillRatio", "which", "is", "a", "number", "between", "[", "0", "1", "]", "that", "represents", "the", "average", "fill", "of", "each", "write", "with", "respect", "to", "the", "maximum", "BookKeeper", "write", "allowance", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java#L204-L210
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/execution/impl/JobExecutionHelper.java
JobExecutionHelper.createJobStartExecution
public RuntimeJobExecution createJobStartExecution(final WSJobInstance jobInstance, IJobXMLSource jslSource, Properties jobParameters, long executionId) throws JobStartException { // TODO - redesign to avoid cast? final JobInstanceEntity jobInstanceImpl = (JobInstanceEntity) jobInstance; long instanceId = jobInstance.getInstanceId(); ModelNavigator<JSLJob> navigator = createFirstExecution(jobInstanceImpl, jslSource, jobParameters); JobExecutionEntity jobExec = null; try { jobExec = getPersistenceManagerService().getJobExecutionMostRecent(instanceId); // Check to make sure the executionId belongs to the most recent execution. // If not, a restart may have occurred. So, fail the start. // Also check to make sure a stop did not come in while the start was on the queue. BatchStatus currentBatchStatus = jobExec.getBatchStatus(); if (jobExec.getExecutionId() != executionId || currentBatchStatus.equals(BatchStatus.STOPPING) || currentBatchStatus.equals(BatchStatus.STOPPED)) { throw new JobStartException(); } } catch (IllegalStateException ie) { // If no execution exists, request came from old dispatch path. jobExec = getPersistenceManagerService().createJobExecution(instanceId, jobParameters, new Date()); BatchEventsPublisher eventsPublisher = batchKernelImpl.getBatchEventsPublisher(); if (eventsPublisher != null) { String correlationId = getCorrelationId(jobParameters); eventsPublisher.publishJobExecutionEvent(jobExec, BatchEventsPublisher.TOPIC_EXECUTION_STARTING, correlationId); } } TopLevelNameInstanceExecutionInfo topLevelInfo = new TopLevelNameInstanceExecutionInfo(jobInstanceImpl.getJobName(), instanceId, jobExec.getExecutionId()); return new RuntimeJobExecution(topLevelInfo, jobParameters, navigator); }
java
public RuntimeJobExecution createJobStartExecution(final WSJobInstance jobInstance, IJobXMLSource jslSource, Properties jobParameters, long executionId) throws JobStartException { // TODO - redesign to avoid cast? final JobInstanceEntity jobInstanceImpl = (JobInstanceEntity) jobInstance; long instanceId = jobInstance.getInstanceId(); ModelNavigator<JSLJob> navigator = createFirstExecution(jobInstanceImpl, jslSource, jobParameters); JobExecutionEntity jobExec = null; try { jobExec = getPersistenceManagerService().getJobExecutionMostRecent(instanceId); // Check to make sure the executionId belongs to the most recent execution. // If not, a restart may have occurred. So, fail the start. // Also check to make sure a stop did not come in while the start was on the queue. BatchStatus currentBatchStatus = jobExec.getBatchStatus(); if (jobExec.getExecutionId() != executionId || currentBatchStatus.equals(BatchStatus.STOPPING) || currentBatchStatus.equals(BatchStatus.STOPPED)) { throw new JobStartException(); } } catch (IllegalStateException ie) { // If no execution exists, request came from old dispatch path. jobExec = getPersistenceManagerService().createJobExecution(instanceId, jobParameters, new Date()); BatchEventsPublisher eventsPublisher = batchKernelImpl.getBatchEventsPublisher(); if (eventsPublisher != null) { String correlationId = getCorrelationId(jobParameters); eventsPublisher.publishJobExecutionEvent(jobExec, BatchEventsPublisher.TOPIC_EXECUTION_STARTING, correlationId); } } TopLevelNameInstanceExecutionInfo topLevelInfo = new TopLevelNameInstanceExecutionInfo(jobInstanceImpl.getJobName(), instanceId, jobExec.getExecutionId()); return new RuntimeJobExecution(topLevelInfo, jobParameters, navigator); }
[ "public", "RuntimeJobExecution", "createJobStartExecution", "(", "final", "WSJobInstance", "jobInstance", ",", "IJobXMLSource", "jslSource", ",", "Properties", "jobParameters", ",", "long", "executionId", ")", "throws", "JobStartException", "{", "// TODO - redesign to avoid c...
Note: this method is called on the job submission thread. Updates the jobinstance record with the jobXML and jobname (jobid in jobxml). @return a new RuntimeJobExecution record, ready to be dispatched.
[ "Note", ":", "this", "method", "is", "called", "on", "the", "job", "submission", "thread", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/execution/impl/JobExecutionHelper.java#L86-L122
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java
XmlIO.save
public static void save(final AnnotationMappingInfo xmlInfo, final File file, final String encoding) throws XmlOperateException { ArgUtils.notNull(xmlInfo, "xmlInfo"); ArgUtils.notNull(file, "file"); ArgUtils.notEmpty(encoding, "encoding"); final Marshaller marshaller; try { JAXBContext context = JAXBContext.newInstance(xmlInfo.getClass()); marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); } catch (JAXBException e) { throw new XmlOperateException("fail setting JAXB context.", e); } File dir = file.getParentFile(); if(dir != null && !dir.exists()) { dir.mkdirs(); } try(Writer writer = new OutputStreamWriter(new FileOutputStream(file), encoding)) { marshaller.marshal(xmlInfo, writer); } catch(JAXBException | IOException e) { throw new XmlOperateException(String.format("fail save xml file '%s'.", file.getPath()), e); } }
java
public static void save(final AnnotationMappingInfo xmlInfo, final File file, final String encoding) throws XmlOperateException { ArgUtils.notNull(xmlInfo, "xmlInfo"); ArgUtils.notNull(file, "file"); ArgUtils.notEmpty(encoding, "encoding"); final Marshaller marshaller; try { JAXBContext context = JAXBContext.newInstance(xmlInfo.getClass()); marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); } catch (JAXBException e) { throw new XmlOperateException("fail setting JAXB context.", e); } File dir = file.getParentFile(); if(dir != null && !dir.exists()) { dir.mkdirs(); } try(Writer writer = new OutputStreamWriter(new FileOutputStream(file), encoding)) { marshaller.marshal(xmlInfo, writer); } catch(JAXBException | IOException e) { throw new XmlOperateException(String.format("fail save xml file '%s'.", file.getPath()), e); } }
[ "public", "static", "void", "save", "(", "final", "AnnotationMappingInfo", "xmlInfo", ",", "final", "File", "file", ",", "final", "String", "encoding", ")", "throws", "XmlOperateException", "{", "ArgUtils", ".", "notNull", "(", "xmlInfo", ",", "\"xmlInfo\"", ")"...
XMLをファイルに保存する。 @since 1.1 @param xmlInfo XML情報。 @param file 書き込み先 @param encoding ファイルの文字コード。 @throws XmlOperateException XMLの書き込みに失敗した場合。 @throws IllegalArgumentException xmlInfo is null. @throws IllegalArgumentException file is null or encoding is empty.
[ "XMLをファイルに保存する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java#L154-L183
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/TriggerBuilder.java
TriggerBuilder.withIdentity
@Nonnull public TriggerBuilder <T> withIdentity (final String name) { m_aKey = new TriggerKey (name, null); return this; }
java
@Nonnull public TriggerBuilder <T> withIdentity (final String name) { m_aKey = new TriggerKey (name, null); return this; }
[ "@", "Nonnull", "public", "TriggerBuilder", "<", "T", ">", "withIdentity", "(", "final", "String", "name", ")", "{", "m_aKey", "=", "new", "TriggerKey", "(", "name", ",", "null", ")", ";", "return", "this", ";", "}" ]
Use a <code>TriggerKey</code> with the given name and default group to identify the Trigger. <p> If none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated. </p> @param name the name element for the Trigger's TriggerKey @return the updated TriggerBuilder @see TriggerKey @see ITrigger#getKey()
[ "Use", "a", "<code", ">", "TriggerKey<", "/", "code", ">", "with", "the", "given", "name", "and", "default", "group", "to", "identify", "the", "Trigger", ".", "<p", ">", "If", "none", "of", "the", "withIdentity", "methods", "are", "set", "on", "the", "...
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/TriggerBuilder.java#L132-L137
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.forEachFuture
public static <T> FutureTask<Void> forEachFuture( Observable<? extends T> source, Action1<? super T> onNext) { return OperatorForEachFuture.forEachFuture(source, onNext); }
java
public static <T> FutureTask<Void> forEachFuture( Observable<? extends T> source, Action1<? super T> onNext) { return OperatorForEachFuture.forEachFuture(source, onNext); }
[ "public", "static", "<", "T", ">", "FutureTask", "<", "Void", ">", "forEachFuture", "(", "Observable", "<", "?", "extends", "T", ">", "source", ",", "Action1", "<", "?", "super", "T", ">", "onNext", ")", "{", "return", "OperatorForEachFuture", ".", "forE...
Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future. <p> <em>Important note:</em> The returned task blocks indefinitely unless the {@code run()} method is called or the task is scheduled on an Executor. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/forEachFuture.png" alt=""> @param <T> the source value type @param source the source Observable @param onNext the action to call with each emitted element @return the Future representing the entire for-each operation @see #forEachFuture(rx.Observable, rx.functions.Action1, rx.Scheduler) @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-foreachfuture">RxJava Wiki: forEachFuture()</a>
[ "Subscribes", "to", "the", "given", "source", "and", "calls", "the", "callback", "for", "each", "emitted", "item", "and", "surfaces", "the", "completion", "or", "error", "through", "a", "Future", ".", "<p", ">", "<em", ">", "Important", "note", ":", "<", ...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1838-L1842
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/RaftNodeImpl.java
RaftNodeImpl.runQueryOperation
public void runQueryOperation(Object operation, SimpleCompletableFuture resultFuture) { long commitIndex = state.commitIndex(); Object result = raftIntegration.runOperation(operation, commitIndex); resultFuture.setResult(result); }
java
public void runQueryOperation(Object operation, SimpleCompletableFuture resultFuture) { long commitIndex = state.commitIndex(); Object result = raftIntegration.runOperation(operation, commitIndex); resultFuture.setResult(result); }
[ "public", "void", "runQueryOperation", "(", "Object", "operation", ",", "SimpleCompletableFuture", "resultFuture", ")", "{", "long", "commitIndex", "=", "state", ".", "commitIndex", "(", ")", ";", "Object", "result", "=", "raftIntegration", ".", "runOperation", "(...
Executes query operation sets execution result to the future.
[ "Executes", "query", "operation", "sets", "execution", "result", "to", "the", "future", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/RaftNodeImpl.java#L639-L643
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/util/LayerUtil.java
LayerUtil.getUpperLeft
public static Tile getUpperLeft(BoundingBox boundingBox, byte zoomLevel, int tileSize) { int tileLeft = MercatorProjection.longitudeToTileX(boundingBox.minLongitude, zoomLevel); int tileTop = MercatorProjection.latitudeToTileY(boundingBox.maxLatitude, zoomLevel); return new Tile(tileLeft, tileTop, zoomLevel, tileSize); }
java
public static Tile getUpperLeft(BoundingBox boundingBox, byte zoomLevel, int tileSize) { int tileLeft = MercatorProjection.longitudeToTileX(boundingBox.minLongitude, zoomLevel); int tileTop = MercatorProjection.latitudeToTileY(boundingBox.maxLatitude, zoomLevel); return new Tile(tileLeft, tileTop, zoomLevel, tileSize); }
[ "public", "static", "Tile", "getUpperLeft", "(", "BoundingBox", "boundingBox", ",", "byte", "zoomLevel", ",", "int", "tileSize", ")", "{", "int", "tileLeft", "=", "MercatorProjection", ".", "longitudeToTileX", "(", "boundingBox", ".", "minLongitude", ",", "zoomLev...
Upper left tile for an area. @param boundingBox the area boundingBox @param zoomLevel the zoom level. @param tileSize the tile size. @return the tile at the upper left of the bbox.
[ "Upper", "left", "tile", "for", "an", "area", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/util/LayerUtil.java#L64-L68
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/TaskClient.java
TaskClient.getPendingTasksByType
public List<Task> getPendingTasksByType(String taskType, String startKey, Integer count) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Object[] params = new Object[]{"startKey", startKey, "count", count}; return getForEntity("tasks/in_progress/{taskType}", params, taskList, taskType); }
java
public List<Task> getPendingTasksByType(String taskType, String startKey, Integer count) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Object[] params = new Object[]{"startKey", startKey, "count", count}; return getForEntity("tasks/in_progress/{taskType}", params, taskList, taskType); }
[ "public", "List", "<", "Task", ">", "getPendingTasksByType", "(", "String", "taskType", ",", "String", "startKey", ",", "Integer", "count", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "taskType", ")", ",", "\"Ta...
Retrieve pending tasks by type @param taskType Type of task @param startKey id of the task from where to return the results. NULL to start from the beginning. @param count number of tasks to retrieve @return Returns the list of PENDING tasks by type, starting with a given task Id.
[ "Retrieve", "pending", "tasks", "by", "type" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/TaskClient.java#L194-L199
citrusframework/citrus
modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java
PurgeJmsQueuesAction.purgeQueue
private void purgeQueue(Queue queue, Session session) throws JMSException { purgeDestination(queue, session, queue.getQueueName()); }
java
private void purgeQueue(Queue queue, Session session) throws JMSException { purgeDestination(queue, session, queue.getQueueName()); }
[ "private", "void", "purgeQueue", "(", "Queue", "queue", ",", "Session", "session", ")", "throws", "JMSException", "{", "purgeDestination", "(", "queue", ",", "session", ",", "queue", ".", "getQueueName", "(", ")", ")", ";", "}" ]
Purges a queue destination. @param queue @param session @throws JMSException
[ "Purges", "a", "queue", "destination", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java#L117-L119
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java
MessageArgsUnitParser.selectFactorSet
protected static UnitFactorSet selectFactorSet(String compact, UnitConverter converter) { if (compact != null) { switch (compact) { case "angle": case "angles": return UnitFactorSets.ANGLE; case "area": return converter.areaFactors(); case "bit": case "bits": return UnitFactorSets.DIGITAL_BITS; case "byte": case "bytes": return UnitFactorSets.DIGITAL_BYTES; case "duration": return UnitFactorSets.DURATION; case "duration-large": return UnitFactorSets.DURATION_LARGE; case "duration-small": return UnitFactorSets.DURATION_SMALL; case "electric": return UnitFactorSets.ELECTRIC; case "energy": return UnitFactorSets.ENERGY; case "frequency": return UnitFactorSets.FREQUENCY; case "length": return converter.lengthFactors(); case "mass": return converter.massFactors(); case "power": return UnitFactorSets.POWER; case "volume": return converter.volumeFactors(); case "liquid": return converter.volumeLiquidFactors(); default: break; } } return null; }
java
protected static UnitFactorSet selectFactorSet(String compact, UnitConverter converter) { if (compact != null) { switch (compact) { case "angle": case "angles": return UnitFactorSets.ANGLE; case "area": return converter.areaFactors(); case "bit": case "bits": return UnitFactorSets.DIGITAL_BITS; case "byte": case "bytes": return UnitFactorSets.DIGITAL_BYTES; case "duration": return UnitFactorSets.DURATION; case "duration-large": return UnitFactorSets.DURATION_LARGE; case "duration-small": return UnitFactorSets.DURATION_SMALL; case "electric": return UnitFactorSets.ELECTRIC; case "energy": return UnitFactorSets.ENERGY; case "frequency": return UnitFactorSets.FREQUENCY; case "length": return converter.lengthFactors(); case "mass": return converter.massFactors(); case "power": return UnitFactorSets.POWER; case "volume": return converter.volumeFactors(); case "liquid": return converter.volumeLiquidFactors(); default: break; } } return null; }
[ "protected", "static", "UnitFactorSet", "selectFactorSet", "(", "String", "compact", ",", "UnitConverter", "converter", ")", "{", "if", "(", "compact", "!=", "null", ")", "{", "switch", "(", "compact", ")", "{", "case", "\"angle\"", ":", "case", "\"angles\"", ...
Select a factor set based on a name, used to format compact units. For example, if compact="bytes" we return a factor set DIGITAL_BYTES. This set is then used to produce the most compact form for a given value, e.g. "1.2MB", "37TB", etc.
[ "Select", "a", "factor", "set", "based", "on", "a", "name", "used", "to", "format", "compact", "units", ".", "For", "example", "if", "compact", "=", "bytes", "we", "return", "a", "factor", "set", "DIGITAL_BYTES", ".", "This", "set", "is", "then", "used",...
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java#L117-L158
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java
ContextedRuntimeException.setContextValue
@Override public ContextedRuntimeException setContextValue(final String label, final Object value) { exceptionContext.setContextValue(label, value); return this; }
java
@Override public ContextedRuntimeException setContextValue(final String label, final Object value) { exceptionContext.setContextValue(label, value); return this; }
[ "@", "Override", "public", "ContextedRuntimeException", "setContextValue", "(", "final", "String", "label", ",", "final", "Object", "value", ")", "{", "exceptionContext", ".", "setContextValue", "(", "label", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets information helpful to a developer in diagnosing and correcting the problem. For the information to be meaningful, the value passed should have a reasonable toString() implementation. Any existing values with the same labels are removed before the new one is added. <p> Note: This exception is only serializable if the object added as value is serializable. </p> @param label a textual label associated with information, {@code null} not recommended @param value information needed to understand exception, may be {@code null} @return {@code this}, for method chaining, not {@code null}
[ "Sets", "information", "helpful", "to", "a", "developer", "in", "diagnosing", "and", "correcting", "the", "problem", ".", "For", "the", "information", "to", "be", "meaningful", "the", "value", "passed", "should", "have", "a", "reasonable", "toString", "()", "i...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java#L191-L195
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputs.java
MultipleOutputs.getCollector
@SuppressWarnings({"unchecked"}) public OutputCollector getCollector(String namedOutput, Reporter reporter) throws IOException { return getCollector(namedOutput, null, reporter); }
java
@SuppressWarnings({"unchecked"}) public OutputCollector getCollector(String namedOutput, Reporter reporter) throws IOException { return getCollector(namedOutput, null, reporter); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "public", "OutputCollector", "getCollector", "(", "String", "namedOutput", ",", "Reporter", "reporter", ")", "throws", "IOException", "{", "return", "getCollector", "(", "namedOutput", ",", "null", ",",...
Gets the output collector for a named output. <p/> @param namedOutput the named output name @param reporter the reporter @return the output collector for the given named output @throws IOException thrown if output collector could not be created
[ "Gets", "the", "output", "collector", "for", "a", "named", "output", ".", "<p", "/", ">" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputs.java#L473-L477
VoltDB/voltdb
src/frontend/org/voltcore/messaging/SocketJoiner.java
SocketJoiner.initializeSocket
private SslHandshakeResult initializeSocket(SocketChannel sc, boolean clientMode, List<Long> clockSkews) throws IOException { ByteBuffer timeBuffer = ByteBuffer.allocate(Long.BYTES); if (clientMode) { synchronized (sc.blockingLock()) { boolean isBlocking = sc.isBlocking(); // Just being lazy and using blocking mode here to get the server's current timestamp sc.configureBlocking(true); do { sc.read(timeBuffer); } while (timeBuffer.hasRemaining()); sc.configureBlocking(isBlocking); } if (clockSkews != null) { clockSkews.add(System.currentTimeMillis() - ((ByteBuffer) timeBuffer.flip()).getLong()); } } else { timeBuffer.putLong(System.currentTimeMillis()); timeBuffer.flip(); do { sc.write(timeBuffer); } while (timeBuffer.hasRemaining()); } return setupSSLIfNeeded(sc, clientMode); }
java
private SslHandshakeResult initializeSocket(SocketChannel sc, boolean clientMode, List<Long> clockSkews) throws IOException { ByteBuffer timeBuffer = ByteBuffer.allocate(Long.BYTES); if (clientMode) { synchronized (sc.blockingLock()) { boolean isBlocking = sc.isBlocking(); // Just being lazy and using blocking mode here to get the server's current timestamp sc.configureBlocking(true); do { sc.read(timeBuffer); } while (timeBuffer.hasRemaining()); sc.configureBlocking(isBlocking); } if (clockSkews != null) { clockSkews.add(System.currentTimeMillis() - ((ByteBuffer) timeBuffer.flip()).getLong()); } } else { timeBuffer.putLong(System.currentTimeMillis()); timeBuffer.flip(); do { sc.write(timeBuffer); } while (timeBuffer.hasRemaining()); } return setupSSLIfNeeded(sc, clientMode); }
[ "private", "SslHandshakeResult", "initializeSocket", "(", "SocketChannel", "sc", ",", "boolean", "clientMode", ",", "List", "<", "Long", ">", "clockSkews", ")", "throws", "IOException", "{", "ByteBuffer", "timeBuffer", "=", "ByteBuffer", ".", "allocate", "(", "Lon...
Initialize a new {@link SocketChannel} either as a client or server @return {@link SslHandshakeResult} instance. Never {@code null}
[ "Initialize", "a", "new", "{", "@link", "SocketChannel", "}", "either", "as", "a", "client", "or", "server" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/messaging/SocketJoiner.java#L440-L464
google/closure-compiler
src/com/google/javascript/jscomp/RenameProperties.java
RenameProperties.generateNames
private void generateNames(Set<Property> props, Set<String> reservedNames) { nameGenerator.reset(reservedNames, "", reservedFirstCharacters, reservedNonFirstCharacters); for (Property p : props) { if (generatePseudoNames) { p.newName = "$" + p.oldName + "$"; } else { // If we haven't already given this property a reusable name. if (p.newName == null) { p.newName = nameGenerator.generateNextName(); } } reservedNames.add(p.newName); } }
java
private void generateNames(Set<Property> props, Set<String> reservedNames) { nameGenerator.reset(reservedNames, "", reservedFirstCharacters, reservedNonFirstCharacters); for (Property p : props) { if (generatePseudoNames) { p.newName = "$" + p.oldName + "$"; } else { // If we haven't already given this property a reusable name. if (p.newName == null) { p.newName = nameGenerator.generateNextName(); } } reservedNames.add(p.newName); } }
[ "private", "void", "generateNames", "(", "Set", "<", "Property", ">", "props", ",", "Set", "<", "String", ">", "reservedNames", ")", "{", "nameGenerator", ".", "reset", "(", "reservedNames", ",", "\"\"", ",", "reservedFirstCharacters", ",", "reservedNonFirstChar...
Generates new names for properties. @param props Properties to generate new names for @param reservedNames A set of names to which properties should not be renamed
[ "Generates", "new", "names", "for", "properties", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RenameProperties.java#L293-L306
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/util/BridgeUtils.java
BridgeUtils.createPropertyControlDataObject
protected void createPropertyControlDataObject(Root inputRootDataObject, String inputProperty) { // use the root DataGraph to create a PropertyControl DataGraph List<Control> propertyControls = inputRootDataObject.getControls(); PropertyControl propCtrl = null; if (propertyControls != null) { propCtrl = new PropertyControl(); propertyControls.add(propCtrl); } // add the requested property to the return list of properties if (propCtrl != null) { propCtrl.getProperties().add(inputProperty); } }
java
protected void createPropertyControlDataObject(Root inputRootDataObject, String inputProperty) { // use the root DataGraph to create a PropertyControl DataGraph List<Control> propertyControls = inputRootDataObject.getControls(); PropertyControl propCtrl = null; if (propertyControls != null) { propCtrl = new PropertyControl(); propertyControls.add(propCtrl); } // add the requested property to the return list of properties if (propCtrl != null) { propCtrl.getProperties().add(inputProperty); } }
[ "protected", "void", "createPropertyControlDataObject", "(", "Root", "inputRootDataObject", ",", "String", "inputProperty", ")", "{", "// use the root DataGraph to create a PropertyControl DataGraph", "List", "<", "Control", ">", "propertyControls", "=", "inputRootDataObject", ...
Create a DataObject for the property request. @param inputRootDataObject The root DataObject. @param inputProperty The property to request @pre inputRootDataObject != null @pre inputProperty != null @pre inputProperty != ""
[ "Create", "a", "DataObject", "for", "the", "property", "request", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/util/BridgeUtils.java#L370-L382
aws/aws-sdk-java
aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/model/SendMessageBatchRequestEntry.java
SendMessageBatchRequestEntry.withMessageAttributes
public SendMessageBatchRequestEntry withMessageAttributes(java.util.Map<String, MessageAttributeValue> messageAttributes) { setMessageAttributes(messageAttributes); return this; }
java
public SendMessageBatchRequestEntry withMessageAttributes(java.util.Map<String, MessageAttributeValue> messageAttributes) { setMessageAttributes(messageAttributes); return this; }
[ "public", "SendMessageBatchRequestEntry", "withMessageAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "MessageAttributeValue", ">", "messageAttributes", ")", "{", "setMessageAttributes", "(", "messageAttributes", ")", ";", "return", "this", ";",...
<p> Each message attribute consists of a <code>Name</code>, <code>Type</code>, and <code>Value</code>. For more information, see <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html" >Amazon SQS Message Attributes</a> in the <i>Amazon Simple Queue Service Developer Guide</i>. </p> @param messageAttributes Each message attribute consists of a <code>Name</code>, <code>Type</code>, and <code>Value</code>. For more information, see <a href= "http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html" >Amazon SQS Message Attributes</a> in the <i>Amazon Simple Queue Service Developer Guide</i>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Each", "message", "attribute", "consists", "of", "a", "<code", ">", "Name<", "/", "code", ">", "<code", ">", "Type<", "/", "code", ">", "and", "<code", ">", "Value<", "/", "code", ">", ".", "For", "more", "information", "see", "<a", "href...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/model/SendMessageBatchRequestEntry.java#L498-L501
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java
AccumuloClient.renameIndexTables
private void renameIndexTables(AccumuloTable oldTable, AccumuloTable newTable) { if (!oldTable.isIndexed()) { return; } if (!tableManager.exists(oldTable.getIndexTableName())) { throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getIndexTableName())); } if (tableManager.exists(newTable.getIndexTableName())) { throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getIndexTableName())); } if (!tableManager.exists(oldTable.getMetricsTableName())) { throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getMetricsTableName())); } if (tableManager.exists(newTable.getMetricsTableName())) { throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getMetricsTableName())); } tableManager.renameAccumuloTable(oldTable.getIndexTableName(), newTable.getIndexTableName()); tableManager.renameAccumuloTable(oldTable.getMetricsTableName(), newTable.getMetricsTableName()); }
java
private void renameIndexTables(AccumuloTable oldTable, AccumuloTable newTable) { if (!oldTable.isIndexed()) { return; } if (!tableManager.exists(oldTable.getIndexTableName())) { throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getIndexTableName())); } if (tableManager.exists(newTable.getIndexTableName())) { throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getIndexTableName())); } if (!tableManager.exists(oldTable.getMetricsTableName())) { throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getMetricsTableName())); } if (tableManager.exists(newTable.getMetricsTableName())) { throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getMetricsTableName())); } tableManager.renameAccumuloTable(oldTable.getIndexTableName(), newTable.getIndexTableName()); tableManager.renameAccumuloTable(oldTable.getMetricsTableName(), newTable.getMetricsTableName()); }
[ "private", "void", "renameIndexTables", "(", "AccumuloTable", "oldTable", ",", "AccumuloTable", "newTable", ")", "{", "if", "(", "!", "oldTable", ".", "isIndexed", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "tableManager", ".", "exists", "(", ...
Renames the index tables (if applicable) for the old table to the new table. @param oldTable Old AccumuloTable @param newTable New AccumuloTable
[ "Renames", "the", "index", "tables", "(", "if", "applicable", ")", "for", "the", "old", "table", "to", "the", "new", "table", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java#L515-L539
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java
StateUtils.main
public static void main (String[] args) throws UnsupportedEncodingException { byte[] bytes = encode(args[0].getBytes(ZIP_CHARSET)); System.out.println(new String(bytes, ZIP_CHARSET)); }
java
public static void main (String[] args) throws UnsupportedEncodingException { byte[] bytes = encode(args[0].getBytes(ZIP_CHARSET)); System.out.println(new String(bytes, ZIP_CHARSET)); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "UnsupportedEncodingException", "{", "byte", "[", "]", "bytes", "=", "encode", "(", "args", "[", "0", "]", ".", "getBytes", "(", "ZIP_CHARSET", ")", ")", ";", "System", ...
Utility method for generating base 64 encoded strings. @param args @throws UnsupportedEncodingException
[ "Utility", "method", "for", "generating", "base", "64", "encoded", "strings", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java#L654-L658
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
AnnotationTypeRequiredMemberBuilder.buildTagInfo
public void buildTagInfo(XMLNode node, Content annotationDocTree) { writer.addTags((MemberDoc) members.get(currentMemberIndex), annotationDocTree); }
java
public void buildTagInfo(XMLNode node, Content annotationDocTree) { writer.addTags((MemberDoc) members.get(currentMemberIndex), annotationDocTree); }
[ "public", "void", "buildTagInfo", "(", "XMLNode", "node", ",", "Content", "annotationDocTree", ")", "{", "writer", ".", "addTags", "(", "(", "MemberDoc", ")", "members", ".", "get", "(", "currentMemberIndex", ")", ",", "annotationDocTree", ")", ";", "}" ]
Build the tag information. @param node the XML element that specifies which components to document @param annotationDocTree the content tree to which the documentation will be added
[ "Build", "the", "tag", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java#L227-L230
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java
DatabaseVulnerabilityAssessmentRuleBaselinesInner.delete
public void delete(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toBlocking().single().body(); }
java
public void delete(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toBlocking().single().body(); }
[ "public", "void", "delete", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "ruleId", ",", "VulnerabilityAssessmentPolicyBaselineName", "baselineName", ")", "{", "deleteWithServiceResponseAsync", "(", "resourc...
Removes the database's vulnerability assessment rule baseline. @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 for which the vulnerability assessment rule baseline is defined. @param ruleId The vulnerability assessment rule ID. @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' @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
[ "Removes", "the", "database", "s", "vulnerability", "assessment", "rule", "baseline", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java#L313-L315
michael-rapp/AndroidMaterialDialog
example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java
PreferenceFragment.createPositiveButtonListener
private OnClickListener createPositiveButtonListener() { return new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), R.string.positive_button_toast, Toast.LENGTH_SHORT) .show(); } }; }
java
private OnClickListener createPositiveButtonListener() { return new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), R.string.positive_button_toast, Toast.LENGTH_SHORT) .show(); } }; }
[ "private", "OnClickListener", "createPositiveButtonListener", "(", ")", "{", "return", "new", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "Toast", ".", "makeText...
Creates and returns a listener, which allows to show a toast, when the positive button of a dialog has been clicked. @return The listener, which has been created, as an instance of the class {@link OnClickListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "show", "a", "toast", "when", "the", "positive", "button", "of", "a", "dialog", "has", "been", "clicked", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java#L791-L801
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java
AmazonDynamoDBClient.updateItem
public UpdateItemResult updateItem(UpdateItemRequest updateItemRequest) throws AmazonServiceException, AmazonClientException { ExecutionContext executionContext = createExecutionContext(updateItemRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); Request<UpdateItemRequest> request = marshall(updateItemRequest, new UpdateItemRequestMarshaller(), executionContext.getAwsRequestMetrics()); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); Unmarshaller<UpdateItemResult, JsonUnmarshallerContext> unmarshaller = new UpdateItemResultJsonUnmarshaller(); JsonResponseHandler<UpdateItemResult> responseHandler = new JsonResponseHandler<UpdateItemResult>(unmarshaller); return invoke(request, responseHandler, executionContext); }
java
public UpdateItemResult updateItem(UpdateItemRequest updateItemRequest) throws AmazonServiceException, AmazonClientException { ExecutionContext executionContext = createExecutionContext(updateItemRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); Request<UpdateItemRequest> request = marshall(updateItemRequest, new UpdateItemRequestMarshaller(), executionContext.getAwsRequestMetrics()); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); Unmarshaller<UpdateItemResult, JsonUnmarshallerContext> unmarshaller = new UpdateItemResultJsonUnmarshaller(); JsonResponseHandler<UpdateItemResult> responseHandler = new JsonResponseHandler<UpdateItemResult>(unmarshaller); return invoke(request, responseHandler, executionContext); }
[ "public", "UpdateItemResult", "updateItem", "(", "UpdateItemRequest", "updateItemRequest", ")", "throws", "AmazonServiceException", ",", "AmazonClientException", "{", "ExecutionContext", "executionContext", "=", "createExecutionContext", "(", "updateItemRequest", ")", ";", "A...
<p> Edits an existing item's attributes. </p> <p> You can perform a conditional update (insert a new attribute name-value pair if it doesn't exist, or replace an existing name-value pair if it has certain expected attribute values). </p> @param updateItemRequest Container for the necessary parameters to execute the UpdateItem service method on AmazonDynamoDB. @return The response from the UpdateItem service method, as returned by AmazonDynamoDB. @throws LimitExceededException @throws ProvisionedThroughputExceededException @throws ConditionalCheckFailedException @throws InternalServerErrorException @throws ResourceNotFoundException @throws AmazonClientException If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available. @throws AmazonServiceException If an error response is returned by AmazonDynamoDB indicating either a problem with the data in the request, or a server side issue.
[ "<p", ">", "Edits", "an", "existing", "item", "s", "attributes", ".", "<", "/", "p", ">", "<p", ">", "You", "can", "perform", "a", "conditional", "update", "(", "insert", "a", "new", "attribute", "name", "-", "value", "pair", "if", "it", "doesn", "t"...
train
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L501-L513
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java
POIUtils.getDataFormatIndex
public static short getDataFormatIndex(final Sheet sheet, final String pattern) { ArgUtils.notNull(sheet, "sheet"); ArgUtils.notEmpty(pattern, "pattern"); return sheet.getWorkbook().getCreationHelper().createDataFormat().getFormat(pattern); }
java
public static short getDataFormatIndex(final Sheet sheet, final String pattern) { ArgUtils.notNull(sheet, "sheet"); ArgUtils.notEmpty(pattern, "pattern"); return sheet.getWorkbook().getCreationHelper().createDataFormat().getFormat(pattern); }
[ "public", "static", "short", "getDataFormatIndex", "(", "final", "Sheet", "sheet", ",", "final", "String", "pattern", ")", "{", "ArgUtils", ".", "notNull", "(", "sheet", ",", "\"sheet\"", ")", ";", "ArgUtils", ".", "notEmpty", "(", "pattern", ",", "\"pattern...
指定した書式のインデックス番号を取得する。シートに存在しない場合は、新しく作成する。 @param sheet シート @param pattern 作成する書式のパターン @return 書式のインデックス番号。 @throws IllegalArgumentException {@literal sheet == null.} @throws IllegalArgumentException {@literal pattern == null || pattern.isEmpty().}
[ "指定した書式のインデックス番号を取得する。シートに存在しない場合は、新しく作成する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java#L294-L300
davidmarquis/fluent-interface-proxy
src/main/java/com/fluentinterface/beans/reflect/Property.java
Property.get
public Object get(Object obj) throws ReflectionException { try { if (isPublic(readMethod)) { return readMethod.invoke(obj); } else { throw new ReflectionException("Cannot get the value of " + this + ", as it is write-only."); } } catch (Exception e) { throw new ReflectionException("Cannot get the value of " + this + " in object " + obj, e); } }
java
public Object get(Object obj) throws ReflectionException { try { if (isPublic(readMethod)) { return readMethod.invoke(obj); } else { throw new ReflectionException("Cannot get the value of " + this + ", as it is write-only."); } } catch (Exception e) { throw new ReflectionException("Cannot get the value of " + this + " in object " + obj, e); } }
[ "public", "Object", "get", "(", "Object", "obj", ")", "throws", "ReflectionException", "{", "try", "{", "if", "(", "isPublic", "(", "readMethod", ")", ")", "{", "return", "readMethod", ".", "invoke", "(", "obj", ")", ";", "}", "else", "{", "throw", "ne...
Returns the value of the representation of this property from the specified object. <p> The underlying property's value is obtained trying to invoke the {@code readMethod}. <p> If this {@link Property} object has no public {@code readMethod}, it is considered write-only, and the action will be prevented throwing a {@link ReflectionException}. <p> The value is automatically wrapped in an object if it has a primitive type. @param obj object from which the property's value is to be extracted @return the value of the represented property in object {@code obj} @throws ReflectionException if access to the underlying method throws an exception @throws ReflectionException if this property is write-only (no public readMethod)
[ "Returns", "the", "value", "of", "the", "representation", "of", "this", "property", "from", "the", "specified", "object", "." ]
train
https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/reflect/Property.java#L403-L413
Daytron/SimpleDialogFX
src/main/java/com/github/daytron/simpledialogfx/dialog/Dialog.java
Dialog.setDetailsFont
public void setDetailsFont(String font_family, int font_size) { this.detailsLabel .setStyle("-fx-font-family: \"" + font_family + "\";" + "-fx-font-size:" + Integer.toString(font_size) + "px;"); }
java
public void setDetailsFont(String font_family, int font_size) { this.detailsLabel .setStyle("-fx-font-family: \"" + font_family + "\";" + "-fx-font-size:" + Integer.toString(font_size) + "px;"); }
[ "public", "void", "setDetailsFont", "(", "String", "font_family", ",", "int", "font_size", ")", "{", "this", ".", "detailsLabel", ".", "setStyle", "(", "\"-fx-font-family: \\\"\"", "+", "font_family", "+", "\"\\\";\"", "+", "\"-fx-font-size:\"", "+", "Integer", "....
Sets both details label's font family and size. @param font_family Font family in <code>Strings</code> @param font_size Font size in <code>integer</code> (pixels)
[ "Sets", "both", "details", "label", "s", "font", "family", "and", "size", "." ]
train
https://github.com/Daytron/SimpleDialogFX/blob/54e813dbb0ebabad8e0a81b6b5f05e518747611e/src/main/java/com/github/daytron/simpledialogfx/dialog/Dialog.java#L870-L874
fcrepo3/fcrepo
fcrepo-webapp/fcrepo-webapp-fop/src/main/java/org/fcrepo/localservices/fop/FOPServlet.java
FOPServlet.renderXML
protected void renderXML(String xml, String xslt, HttpServletResponse response) throws FOPException, TransformerException, IOException { //Setup sources Source xmlSrc = convertString2Source(xml); Source xsltSrc = convertString2Source(xslt); //Setup the XSL transformation Transformer transformer = this.transFactory.newTransformer(xsltSrc); transformer.setURIResolver(this.uriResolver); //Start transformation and rendering process render(xmlSrc, transformer, response); }
java
protected void renderXML(String xml, String xslt, HttpServletResponse response) throws FOPException, TransformerException, IOException { //Setup sources Source xmlSrc = convertString2Source(xml); Source xsltSrc = convertString2Source(xslt); //Setup the XSL transformation Transformer transformer = this.transFactory.newTransformer(xsltSrc); transformer.setURIResolver(this.uriResolver); //Start transformation and rendering process render(xmlSrc, transformer, response); }
[ "protected", "void", "renderXML", "(", "String", "xml", ",", "String", "xslt", ",", "HttpServletResponse", "response", ")", "throws", "FOPException", ",", "TransformerException", ",", "IOException", "{", "//Setup sources", "Source", "xmlSrc", "=", "convertString2Sourc...
Renders an XML file into a PDF file by applying a stylesheet that converts the XML to XSL-FO. The PDF is written to a byte array that is returned as the method's result. @param xml the XML file @param xslt the XSLT file @param response HTTP response object @throws FOPException If an error occurs during the rendering of the XSL-FO @throws TransformerException If an error occurs during XSL transformation @throws IOException In case of an I/O problem
[ "Renders", "an", "XML", "file", "into", "a", "PDF", "file", "by", "applying", "a", "stylesheet", "that", "converts", "the", "XML", "to", "XSL", "-", "FO", ".", "The", "PDF", "is", "written", "to", "a", "byte", "array", "that", "is", "returned", "as", ...
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-webapp/fcrepo-webapp-fop/src/main/java/org/fcrepo/localservices/fop/FOPServlet.java#L166-L179
stephanrauh/AngularFaces
AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/transformation/PuiAngularTransformer.java
PuiAngularTransformer.addResourceAfterAngularJS
public static void addResourceAfterAngularJS(String library, String resource) { FacesContext ctx = FacesContext.getCurrentInstance(); UIViewRoot v = ctx.getViewRoot(); Map<String, Object> viewMap = v.getViewMap(); @SuppressWarnings("unchecked") Map<String, String> resourceMap = (Map<String, String>) viewMap.get(RESOURCE_KEY); if (null == resourceMap) { resourceMap = new HashMap<String, String>(); viewMap.put(RESOURCE_KEY, resourceMap); } String key = library + "#" + resource; if (!resourceMap.containsKey(key)) { resourceMap.put(key, resource); } }
java
public static void addResourceAfterAngularJS(String library, String resource) { FacesContext ctx = FacesContext.getCurrentInstance(); UIViewRoot v = ctx.getViewRoot(); Map<String, Object> viewMap = v.getViewMap(); @SuppressWarnings("unchecked") Map<String, String> resourceMap = (Map<String, String>) viewMap.get(RESOURCE_KEY); if (null == resourceMap) { resourceMap = new HashMap<String, String>(); viewMap.put(RESOURCE_KEY, resourceMap); } String key = library + "#" + resource; if (!resourceMap.containsKey(key)) { resourceMap.put(key, resource); } }
[ "public", "static", "void", "addResourceAfterAngularJS", "(", "String", "library", ",", "String", "resource", ")", "{", "FacesContext", "ctx", "=", "FacesContext", ".", "getCurrentInstance", "(", ")", ";", "UIViewRoot", "v", "=", "ctx", ".", "getViewRoot", "(", ...
Registers a JS file that needs to be include in the header of the HTML file, but after jQuery and AngularJS. @param library The name of the sub-folder of the resources folder. @param resource The name of the resource file within the library folder.
[ "Registers", "a", "JS", "file", "that", "needs", "to", "be", "include", "in", "the", "header", "of", "the", "HTML", "file", "but", "after", "jQuery", "and", "AngularJS", "." ]
train
https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/transformation/PuiAngularTransformer.java#L328-L342
adamfisk/littleshoot-util
src/main/java/org/littleshoot/util/JmxUtils.java
JmxUtils.getObjectName
public static <T> ObjectName getObjectName(final Class<T> clazz) { final String domain = clazz.getPackage().getName(); final String className = clazz.getSimpleName(); final String objectName = domain+":type="+className; LOG.debug("Returning object name: {}", objectName); try { return new ObjectName(objectName); } catch (final MalformedObjectNameException e) { // This should never, ever happen. LOG.error("Invalid ObjectName: "+objectName, e); throw new RuntimeException("Could not create ObjectName?", e); } }
java
public static <T> ObjectName getObjectName(final Class<T> clazz) { final String domain = clazz.getPackage().getName(); final String className = clazz.getSimpleName(); final String objectName = domain+":type="+className; LOG.debug("Returning object name: {}", objectName); try { return new ObjectName(objectName); } catch (final MalformedObjectNameException e) { // This should never, ever happen. LOG.error("Invalid ObjectName: "+objectName, e); throw new RuntimeException("Could not create ObjectName?", e); } }
[ "public", "static", "<", "T", ">", "ObjectName", "getObjectName", "(", "final", "Class", "<", "T", ">", "clazz", ")", "{", "final", "String", "domain", "=", "clazz", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ";", "final", "String", "classN...
Returns an {@link ObjectName} for the specified object in standard format, using the package as the domain. @param <T> The type of class. @param clazz The {@link Class} to create an {@link ObjectName} for. @return The new {@link ObjectName}.
[ "Returns", "an", "{", "@link", "ObjectName", "}", "for", "the", "specified", "object", "in", "standard", "format", "using", "the", "package", "as", "the", "domain", "." ]
train
https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/JmxUtils.java#L34-L50
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/AbstractNumberBindTransform.java
AbstractNumberBindTransform.generateParseOnJackson
@Override public void generateParseOnJackson(BindTypeContext context, Builder methodBuilder, String parserName, TypeName beanClass, String beanName, BindProperty property) { if (property.isNullable()) { methodBuilder.beginControlFlow("if ($L.currentToken()!=$T.VALUE_NULL)", parserName, JsonToken.class); } if (property.hasTypeAdapter()) { methodBuilder.addStatement(setter(beanClass, beanName, property, PRE_TYPE_ADAPTER_TO_JAVA + "$T.read($L.getText())" + POST_TYPE_ADAPTER), TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), NUMBER_UTIL_CLAZZ, parserName); } else { methodBuilder.addStatement(setter(beanClass, beanName, property, "$T.read($L.getText())"), NUMBER_UTIL_CLAZZ, parserName); } if (property.isNullable()) { methodBuilder.endControlFlow(); } }
java
@Override public void generateParseOnJackson(BindTypeContext context, Builder methodBuilder, String parserName, TypeName beanClass, String beanName, BindProperty property) { if (property.isNullable()) { methodBuilder.beginControlFlow("if ($L.currentToken()!=$T.VALUE_NULL)", parserName, JsonToken.class); } if (property.hasTypeAdapter()) { methodBuilder.addStatement(setter(beanClass, beanName, property, PRE_TYPE_ADAPTER_TO_JAVA + "$T.read($L.getText())" + POST_TYPE_ADAPTER), TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), NUMBER_UTIL_CLAZZ, parserName); } else { methodBuilder.addStatement(setter(beanClass, beanName, property, "$T.read($L.getText())"), NUMBER_UTIL_CLAZZ, parserName); } if (property.isNullable()) { methodBuilder.endControlFlow(); } }
[ "@", "Override", "public", "void", "generateParseOnJackson", "(", "BindTypeContext", "context", ",", "Builder", "methodBuilder", ",", "String", "parserName", ",", "TypeName", "beanClass", ",", "String", "beanName", ",", "BindProperty", "property", ")", "{", "if", ...
/* (non-Javadoc) @see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateParseOnJackson(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/AbstractNumberBindTransform.java#L63-L80
crawljax/crawljax
core/src/main/java/com/crawljax/oraclecomparator/comparators/EditDistanceComparator.java
EditDistanceComparator.getThreshold
double getThreshold(String x, String y, double p) { return 2 * Math.max(x.length(), y.length()) * (1 - p); }
java
double getThreshold(String x, String y, double p) { return 2 * Math.max(x.length(), y.length()) * (1 - p); }
[ "double", "getThreshold", "(", "String", "x", ",", "String", "y", ",", "double", "p", ")", "{", "return", "2", "*", "Math", ".", "max", "(", "x", ".", "length", "(", ")", ",", "y", ".", "length", "(", ")", ")", "*", "(", "1", "-", "p", ")", ...
Calculate a threshold. @param x first string. @param y second string. @param p the threshold coefficient. @return 2 maxLength(x, y) (1-p)
[ "Calculate", "a", "threshold", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/oraclecomparator/comparators/EditDistanceComparator.java#L73-L75
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/workplace/broadcast/CmsMessageInfo.java
CmsMessageInfo.createInternetAddresses
private List<InternetAddress> createInternetAddresses(String mailAddresses) throws AddressException { if (CmsStringUtil.isNotEmpty(mailAddresses)) { // at least one email address is present, generate list StringTokenizer T = new StringTokenizer(mailAddresses, ";"); List<InternetAddress> addresses = new ArrayList<InternetAddress>(T.countTokens()); while (T.hasMoreTokens()) { InternetAddress address = new InternetAddress(T.nextToken().trim()); addresses.add(address); } return addresses; } else { // no address given, return empty list return Collections.emptyList(); } }
java
private List<InternetAddress> createInternetAddresses(String mailAddresses) throws AddressException { if (CmsStringUtil.isNotEmpty(mailAddresses)) { // at least one email address is present, generate list StringTokenizer T = new StringTokenizer(mailAddresses, ";"); List<InternetAddress> addresses = new ArrayList<InternetAddress>(T.countTokens()); while (T.hasMoreTokens()) { InternetAddress address = new InternetAddress(T.nextToken().trim()); addresses.add(address); } return addresses; } else { // no address given, return empty list return Collections.emptyList(); } }
[ "private", "List", "<", "InternetAddress", ">", "createInternetAddresses", "(", "String", "mailAddresses", ")", "throws", "AddressException", "{", "if", "(", "CmsStringUtil", ".", "isNotEmpty", "(", "mailAddresses", ")", ")", "{", "// at least one email address is prese...
Creates a list of internet addresses (email) from a semicolon separated String.<p> @param mailAddresses a semicolon separated String with email addresses @return list of internet addresses (email) @throws AddressException if an email address is not correct
[ "Creates", "a", "list", "of", "internet", "addresses", "(", "email", ")", "from", "a", "semicolon", "separated", "String", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/workplace/broadcast/CmsMessageInfo.java#L224-L239
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyImpl_CustomFieldSerializer.java
OWLObjectPropertyImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectProperty instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectProperty instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectProperty", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyImpl_CustomFieldSerializer.java#L64-L67
Impetus/Kundera
examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java
ExecutorService.onPersist
static void onPersist(final EntityManager em, final User user) { logger.info(""); logger.info(""); logger.info("#######################Persisting##########################################"); logger.info(""); logger.info(user.toString()); persist(user, em); logger.info(""); System.out.println("#######################Persisting##########################################"); logger.info(""); logger.info(""); }
java
static void onPersist(final EntityManager em, final User user) { logger.info(""); logger.info(""); logger.info("#######################Persisting##########################################"); logger.info(""); logger.info(user.toString()); persist(user, em); logger.info(""); System.out.println("#######################Persisting##########################################"); logger.info(""); logger.info(""); }
[ "static", "void", "onPersist", "(", "final", "EntityManager", "em", ",", "final", "User", "user", ")", "{", "logger", ".", "info", "(", "\"\"", ")", ";", "logger", ".", "info", "(", "\"\"", ")", ";", "logger", ".", "info", "(", "\"#######################...
On persist user. @param em entity manager instance. @param user user object.
[ "On", "persist", "user", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java#L75-L87
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java
RunsInner.getAsync
public Observable<RunInner> getAsync(String resourceGroupName, String registryName, String runId) { return getWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunInner>, RunInner>() { @Override public RunInner call(ServiceResponse<RunInner> response) { return response.body(); } }); }
java
public Observable<RunInner> getAsync(String resourceGroupName, String registryName, String runId) { return getWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunInner>, RunInner>() { @Override public RunInner call(ServiceResponse<RunInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RunInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "runId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "runId", ")", ...
Gets the detailed information for a given run. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param runId The run ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RunInner object
[ "Gets", "the", "detailed", "information", "for", "a", "given", "run", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java#L383-L390
gocd/gocd
util/src/main/java/com/thoughtworks/go/util/Csv.java
Csv.containsRow
public boolean containsRow(Map<String, String> row) { for (CsvRow csvRow : data) { if (csvRow.contains(row)) { return true; } } return false; }
java
public boolean containsRow(Map<String, String> row) { for (CsvRow csvRow : data) { if (csvRow.contains(row)) { return true; } } return false; }
[ "public", "boolean", "containsRow", "(", "Map", "<", "String", ",", "String", ">", "row", ")", "{", "for", "(", "CsvRow", "csvRow", ":", "data", ")", "{", "if", "(", "csvRow", ".", "contains", "(", "row", ")", ")", "{", "return", "true", ";", "}", ...
Test if this Csv contains specified row. Note: Provided row may only contain part of the columns. @param row Each row is represented as a map, with column name as key, and column value as value @return
[ "Test", "if", "this", "Csv", "contains", "specified", "row", ".", "Note", ":", "Provided", "row", "may", "only", "contain", "part", "of", "the", "columns", "." ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/util/src/main/java/com/thoughtworks/go/util/Csv.java#L80-L87
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/utilities/FileUtils.java
FileUtils.copy
public static boolean copy(InputStream source, ByteBuffer destination) { try { byte [] buffer = new byte[4096]; int n = 0; while (-1 != (n = source.read(buffer))) { destination.put(buffer, 0, n); } return true; } catch (IOException e) { return false; } }
java
public static boolean copy(InputStream source, ByteBuffer destination) { try { byte [] buffer = new byte[4096]; int n = 0; while (-1 != (n = source.read(buffer))) { destination.put(buffer, 0, n); } return true; } catch (IOException e) { return false; } }
[ "public", "static", "boolean", "copy", "(", "InputStream", "source", ",", "ByteBuffer", "destination", ")", "{", "try", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "4096", "]", ";", "int", "n", "=", "0", ";", "while", "(", "-", "1", "...
This method should only be used when the ByteBuffer is known to be able to accomodate the input! @param source @param destination @return success of the operation
[ "This", "method", "should", "only", "be", "used", "when", "the", "ByteBuffer", "is", "known", "to", "be", "able", "to", "accomodate", "the", "input!" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/FileUtils.java#L58-L69
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java
Partitioner.getSize
public PartitionSize getSize(Date first, Date last, int maxP) { long diffMS = last.getTime() - first.getTime(); for(PartitionSize pa : sizes) { long maxMS = maxP * pa.intervalMS(); if(maxMS > diffMS) { return pa; } } return twoYearSize; }
java
public PartitionSize getSize(Date first, Date last, int maxP) { long diffMS = last.getTime() - first.getTime(); for(PartitionSize pa : sizes) { long maxMS = maxP * pa.intervalMS(); if(maxMS > diffMS) { return pa; } } return twoYearSize; }
[ "public", "PartitionSize", "getSize", "(", "Date", "first", ",", "Date", "last", ",", "int", "maxP", ")", "{", "long", "diffMS", "=", "last", ".", "getTime", "(", ")", "-", "first", ".", "getTime", "(", ")", ";", "for", "(", "PartitionSize", "pa", ":...
Attempt to find the smallest PartitionSize implementation which, spanning the range first and last specified, produces at most maxP partitions. @param first Date of beginning of time range @param last Date of end of time range @param maxP maximum number of Partitions to use @return a PartitionSize object which will divide the range into at most maxP Partitions
[ "Attempt", "to", "find", "the", "smallest", "PartitionSize", "implementation", "which", "spanning", "the", "range", "first", "and", "last", "specified", "produces", "at", "most", "maxP", "partitions", "." ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java#L135-L144
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/utilities/StringUtility.java
StringUtility.splitAndIndent
@Deprecated public static String splitAndIndent(String str, int indent, int numChars) { final int inputLength = str.length(); // to prevent resizing, we can predict the size of the indented string // the formatting addition is the indent spaces plus a newline // this length is added once for each line boolean perfectFit = (inputLength % numChars == 0); int fullLines = (inputLength / numChars); int formatLength = perfectFit ? (indent + 1) * fullLines : (indent + 1) * (fullLines + 1); int outputLength = inputLength + formatLength; StringBuilder sb = new StringBuilder(outputLength); for (int offset = 0; offset < inputLength; offset += numChars) { SpaceCharacters.indent(indent, sb); sb.append(str, offset, Math.min(offset + numChars,inputLength)); sb.append('\n'); } return sb.toString(); }
java
@Deprecated public static String splitAndIndent(String str, int indent, int numChars) { final int inputLength = str.length(); // to prevent resizing, we can predict the size of the indented string // the formatting addition is the indent spaces plus a newline // this length is added once for each line boolean perfectFit = (inputLength % numChars == 0); int fullLines = (inputLength / numChars); int formatLength = perfectFit ? (indent + 1) * fullLines : (indent + 1) * (fullLines + 1); int outputLength = inputLength + formatLength; StringBuilder sb = new StringBuilder(outputLength); for (int offset = 0; offset < inputLength; offset += numChars) { SpaceCharacters.indent(indent, sb); sb.append(str, offset, Math.min(offset + numChars,inputLength)); sb.append('\n'); } return sb.toString(); }
[ "@", "Deprecated", "public", "static", "String", "splitAndIndent", "(", "String", "str", ",", "int", "indent", ",", "int", "numChars", ")", "{", "final", "int", "inputLength", "=", "str", ".", "length", "(", ")", ";", "// to prevent resizing, we can predict the ...
Method that attempts to break a string up into lines no longer than the specified line length. <p>The string is assumed to a large chunk of undifferentiated text such as base 64 encoded binary data. @param str The input string to be split into lines. @param indent The number of spaces to insert at the start of each line. @param numChars The maximum length of each line (not counting the indent spaces). @return A string split into multiple indented lines whose length is less than the specified length + indent amount.
[ "Method", "that", "attempts", "to", "break", "a", "string", "up", "into", "lines", "no", "longer", "than", "the", "specified", "line", "length", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/utilities/StringUtility.java#L83-L106
googleapis/google-cloud-java
google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java
GroupServiceClient.createGroup
public final Group createGroup(ProjectName name, Group group) { CreateGroupRequest request = CreateGroupRequest.newBuilder() .setName(name == null ? null : name.toString()) .setGroup(group) .build(); return createGroup(request); }
java
public final Group createGroup(ProjectName name, Group group) { CreateGroupRequest request = CreateGroupRequest.newBuilder() .setName(name == null ? null : name.toString()) .setGroup(group) .build(); return createGroup(request); }
[ "public", "final", "Group", "createGroup", "(", "ProjectName", "name", ",", "Group", "group", ")", "{", "CreateGroupRequest", "request", "=", "CreateGroupRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "==", "null", "?", "null", ":", "nam...
Creates a new group. <p>Sample code: <pre><code> try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) { ProjectName name = ProjectName.of("[PROJECT]"); Group group = Group.newBuilder().build(); Group response = groupServiceClient.createGroup(name, group); } </code></pre> @param name The project in which to create the group. The format is `"projects/{project_id_or_number}"`. @param group A group definition. It is an error to define the `name` field because the system assigns the name. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "group", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java#L367-L375
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java
ConfigReader.loadAccessors
public void loadAccessors(Class<?> targetClass, MappedField configuredField, MappedField targetField) { // First checks xml configuration xml.fillMappedField(configuredClass, configuredField) .fillMappedField(targetClass, targetField) // fill target field with custom methods defined in the configured field .fillOppositeField(configuredClass, configuredField, targetField); // If no present custom methods in XML, it checks annotations Annotation.fillMappedField(configuredClass,configuredField); Annotation.fillMappedField(targetClass,targetField); // fill target field with custom methods defined in the configured field Annotation.fillOppositeField(configuredClass,configuredField,targetField); }
java
public void loadAccessors(Class<?> targetClass, MappedField configuredField, MappedField targetField) { // First checks xml configuration xml.fillMappedField(configuredClass, configuredField) .fillMappedField(targetClass, targetField) // fill target field with custom methods defined in the configured field .fillOppositeField(configuredClass, configuredField, targetField); // If no present custom methods in XML, it checks annotations Annotation.fillMappedField(configuredClass,configuredField); Annotation.fillMappedField(targetClass,targetField); // fill target field with custom methods defined in the configured field Annotation.fillOppositeField(configuredClass,configuredField,targetField); }
[ "public", "void", "loadAccessors", "(", "Class", "<", "?", ">", "targetClass", ",", "MappedField", "configuredField", ",", "MappedField", "targetField", ")", "{", "// First checks xml configuration\r", "xml", ".", "fillMappedField", "(", "configuredClass", ",", "confi...
Fill fields with they custom methods. @param targetClass class of the target field @param configuredField configured field @param targetField target field
[ "Fill", "fields", "with", "they", "custom", "methods", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java#L301-L315
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/RandomUtil.java
RandomUtil.randomLowerMaxLength
public String randomLowerMaxLength(int minLength, int maxLength) { int range = maxLength - minLength; int randomLength = 0; if (range > 0) { randomLength = random(range); } return randomLower(minLength + randomLength); }
java
public String randomLowerMaxLength(int minLength, int maxLength) { int range = maxLength - minLength; int randomLength = 0; if (range > 0) { randomLength = random(range); } return randomLower(minLength + randomLength); }
[ "public", "String", "randomLowerMaxLength", "(", "int", "minLength", ",", "int", "maxLength", ")", "{", "int", "range", "=", "maxLength", "-", "minLength", ";", "int", "randomLength", "=", "0", ";", "if", "(", "range", ">", "0", ")", "{", "randomLength", ...
Creates a random string consisting of lowercase letters. @param minLength minimum length of String to create. @param maxLength maximum length (non inclusive) of String to create. @return lowercase letters.
[ "Creates", "a", "random", "string", "consisting", "of", "lowercase", "letters", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/RandomUtil.java#L26-L33
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/EmailApi.java
EmailApi.sendEmail
public ApiSuccessResponse sendEmail(String id, SendData sendData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = sendEmailWithHttpInfo(id, sendData); return resp.getData(); }
java
public ApiSuccessResponse sendEmail(String id, SendData sendData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = sendEmailWithHttpInfo(id, sendData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "sendEmail", "(", "String", "id", ",", "SendData", "sendData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "sendEmailWithHttpInfo", "(", "id", ",", "sendData", ")", ";", "return", ...
Send email Send email interaction specified in the id path parameter @param id id of interaction to send (required) @param sendData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Send", "email", "Send", "email", "interaction", "specified", "in", "the", "id", "path", "parameter" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/EmailApi.java#L890-L893
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java
ADictionary.loadDirectory
public void loadDirectory( String lexDir ) throws IOException { File path = new File(lexDir); if ( ! path.exists() ) { throw new IOException("Lexicon directory ["+lexDir+"] does'n exists."); } /* * load all the lexicon file under the lexicon path * that start with "lex-" and end with ".lex". */ File[] files = path.listFiles(new FilenameFilter(){ @Override public boolean accept(File dir, String name) { return (name.startsWith("lex-") && name.endsWith(".lex")); } }); for ( File file : files ) { load(file); } }
java
public void loadDirectory( String lexDir ) throws IOException { File path = new File(lexDir); if ( ! path.exists() ) { throw new IOException("Lexicon directory ["+lexDir+"] does'n exists."); } /* * load all the lexicon file under the lexicon path * that start with "lex-" and end with ".lex". */ File[] files = path.listFiles(new FilenameFilter(){ @Override public boolean accept(File dir, String name) { return (name.startsWith("lex-") && name.endsWith(".lex")); } }); for ( File file : files ) { load(file); } }
[ "public", "void", "loadDirectory", "(", "String", "lexDir", ")", "throws", "IOException", "{", "File", "path", "=", "new", "File", "(", "lexDir", ")", ";", "if", "(", "!", "path", ".", "exists", "(", ")", ")", "{", "throw", "new", "IOException", "(", ...
load the all the words from all the files under a specified lexicon directory @param lexDir @throws IOException
[ "load", "the", "all", "the", "words", "from", "all", "the", "files", "under", "a", "specified", "lexicon", "directory" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java#L111-L132
SUSE/salt-netapi-client
src/main/java/com/suse/salt/netapi/utils/ClientUtils.java
ClientUtils.parameterizedType
public static ParameterizedType parameterizedType(Type ownerType, Type rawType, Type... typeArguments) { return newParameterizedTypeWithOwner(ownerType, rawType, typeArguments); }
java
public static ParameterizedType parameterizedType(Type ownerType, Type rawType, Type... typeArguments) { return newParameterizedTypeWithOwner(ownerType, rawType, typeArguments); }
[ "public", "static", "ParameterizedType", "parameterizedType", "(", "Type", "ownerType", ",", "Type", "rawType", ",", "Type", "...", "typeArguments", ")", "{", "return", "newParameterizedTypeWithOwner", "(", "ownerType", ",", "rawType", ",", "typeArguments", ")", ";"...
Helper for constructing parameterized types. @param ownerType the owner type @param rawType the raw type @param typeArguments the type arguments @return the parameterized type object @see com.google.gson.internal.$Gson$Types#newParameterizedTypeWithOwner
[ "Helper", "for", "constructing", "parameterized", "types", "." ]
train
https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/utils/ClientUtils.java#L66-L69
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/deregistration/DeregistrationPanel.java
DeregistrationPanel.newContentPanel
protected Component newContentPanel(final String id) { final ContentPanel contentPanel = new ContentPanel("contentPanel", Model .of(ContentModelBean.builder() .headerResourceKey(ResourceBundleKey.builder() .key("sem.main.info.frame.deregistration.user.label") .parameters(ListExtensions.toObjectArray(getDomainName())).build()) .contentResourceKey(ResourceBundleKey.builder() .key("sem.main.info.frame.deregistration.user.label") .parameters(ListExtensions.toObjectArray(getDomainName())).build()) .build())); contentPanel.getHeader().add(new JQueryJsAppenderBehavior("wrap", "<h1></h1>")); contentPanel.getContent() .add(new JQueryJsAppenderBehavior("wrap", "<p class=\"lead\"></p>")); return contentPanel; }
java
protected Component newContentPanel(final String id) { final ContentPanel contentPanel = new ContentPanel("contentPanel", Model .of(ContentModelBean.builder() .headerResourceKey(ResourceBundleKey.builder() .key("sem.main.info.frame.deregistration.user.label") .parameters(ListExtensions.toObjectArray(getDomainName())).build()) .contentResourceKey(ResourceBundleKey.builder() .key("sem.main.info.frame.deregistration.user.label") .parameters(ListExtensions.toObjectArray(getDomainName())).build()) .build())); contentPanel.getHeader().add(new JQueryJsAppenderBehavior("wrap", "<h1></h1>")); contentPanel.getContent() .add(new JQueryJsAppenderBehavior("wrap", "<p class=\"lead\"></p>")); return contentPanel; }
[ "protected", "Component", "newContentPanel", "(", "final", "String", "id", ")", "{", "final", "ContentPanel", "contentPanel", "=", "new", "ContentPanel", "(", "\"contentPanel\"", ",", "Model", ".", "of", "(", "ContentModelBean", ".", "builder", "(", ")", ".", ...
Factory method for creating the new {@link Component} of the content. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} of the content. @param id the id @return the new {@link Component} of the content
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "Component", "}", "of", "the", "content", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/deregistration/DeregistrationPanel.java#L142-L159
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java
AbstractCodeGen.importLogging
protected void importLogging(Definition def, Writer out) throws IOException { if (def.isSupportJbossLogging()) { out.write("import org.jboss.logging.Logger;"); writeEol(out); writeEol(out); } else { out.write("import java.util.logging.Logger;"); writeEol(out); writeEol(out); } }
java
protected void importLogging(Definition def, Writer out) throws IOException { if (def.isSupportJbossLogging()) { out.write("import org.jboss.logging.Logger;"); writeEol(out); writeEol(out); } else { out.write("import java.util.logging.Logger;"); writeEol(out); writeEol(out); } }
[ "protected", "void", "importLogging", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "if", "(", "def", ".", "isSupportJbossLogging", "(", ")", ")", "{", "out", ".", "write", "(", "\"import org.jboss.logging.Logger;\"", ")", ...
import logging @param def definition @param out Writer @throws IOException ioException
[ "import", "logging" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java#L333-L347
lessthanoptimal/ejml
examples/src/org/ejml/example/LevenbergMarquardt.java
LevenbergMarquardt.setConvergence
public void setConvergence( int maxIterations , double ftol , double gtol ) { this.maxIterations = maxIterations; this.ftol = ftol; this.gtol = gtol; }
java
public void setConvergence( int maxIterations , double ftol , double gtol ) { this.maxIterations = maxIterations; this.ftol = ftol; this.gtol = gtol; }
[ "public", "void", "setConvergence", "(", "int", "maxIterations", ",", "double", "ftol", ",", "double", "gtol", ")", "{", "this", ".", "maxIterations", "=", "maxIterations", ";", "this", ".", "ftol", "=", "ftol", ";", "this", ".", "gtol", "=", "gtol", ";"...
Specifies convergence criteria @param maxIterations Maximum number of iterations @param ftol convergence based on change in function value. try 1e-12 @param gtol convergence based on residual magnitude. Try 1e-12
[ "Specifies", "convergence", "criteria" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/LevenbergMarquardt.java#L107-L111
getsentry/sentry-java
sentry/src/main/java/io/sentry/SentryClient.java
SentryClient.setTags
public void setTags(Map<String, String> tags) { if (tags == null) { this.tags = new HashMap<>(); } else { this.tags = tags; } }
java
public void setTags(Map<String, String> tags) { if (tags == null) { this.tags = new HashMap<>(); } else { this.tags = tags; } }
[ "public", "void", "setTags", "(", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "if", "(", "tags", "==", "null", ")", "{", "this", ".", "tags", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "else", "{", "this", ".", "tags", "="...
Set the tags that will be sent with all future {@link Event}s. @param tags Map of tags
[ "Set", "the", "tags", "that", "will", "be", "sent", "with", "all", "future", "{", "@link", "Event", "}", "s", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/SentryClient.java#L315-L321
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java
EsMarshalling.unmarshallContract
public static ContractBean unmarshallContract(Map<String, Object> source) { if (source == null) { return null; } ContractBean bean = new ContractBean(); bean.setId(asLong(source.get("id"))); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); postMarshall(bean); return bean; }
java
public static ContractBean unmarshallContract(Map<String, Object> source) { if (source == null) { return null; } ContractBean bean = new ContractBean(); bean.setId(asLong(source.get("id"))); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); postMarshall(bean); return bean; }
[ "public", "static", "ContractBean", "unmarshallContract", "(", "Map", "<", "String", ",", "Object", ">", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "ContractBean", "bean", "=", "new", "ContractBean", "(", ...
Unmarshals the given map source into a bean. @param source the source @return the contract
[ "Unmarshals", "the", "given", "map", "source", "into", "a", "bean", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L757-L767
ralscha/wampspring
src/main/java/ch/rasc/wampspring/user/UserEventMessenger.java
UserEventMessenger.sendToAllExceptUser
public void sendToAllExceptUser(String topicURI, Object event, String excludeUser) { sendToAllExceptUsers(topicURI, event, Collections.singleton(excludeUser)); }
java
public void sendToAllExceptUser(String topicURI, Object event, String excludeUser) { sendToAllExceptUsers(topicURI, event, Collections.singleton(excludeUser)); }
[ "public", "void", "sendToAllExceptUser", "(", "String", "topicURI", ",", "Object", "event", ",", "String", "excludeUser", ")", "{", "sendToAllExceptUsers", "(", "topicURI", ",", "event", ",", "Collections", ".", "singleton", "(", "excludeUser", ")", ")", ";", ...
Send an {@link EventMessage} to every client that is currently subscribed to the provided topicURI except the one provided with the excludeUser parameter. @param topicURI the name of the topic @param event the payload of the {@link EventMessage} @param user the user that will be excluded
[ "Send", "an", "{", "@link", "EventMessage", "}", "to", "every", "client", "that", "is", "currently", "subscribed", "to", "the", "provided", "topicURI", "except", "the", "one", "provided", "with", "the", "excludeUser", "parameter", "." ]
train
https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/user/UserEventMessenger.java#L104-L106
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/user/QuickAnalysisStrategy.java
QuickAnalysisStrategy.loadFromUserPreferences
public static QuickAnalysisStrategy loadFromUserPreferences(final UserPreferences userPreferences) { final Map<String, String> properties = userPreferences.getAdditionalProperties(); final int columnsPerAnalyzer = MapUtils.getIntValue(properties, USER_PREFERENCES_NAMESPACE + ".columnsPerAnalyzer", 5); final boolean includeValueDistribution = MapUtils.getBooleanValue(properties, USER_PREFERENCES_NAMESPACE + ".includeValueDistribution", false); final boolean includePatternFinder = MapUtils.getBooleanValue(properties, USER_PREFERENCES_NAMESPACE + ".includePatternFinder", false); return new QuickAnalysisStrategy(columnsPerAnalyzer, includeValueDistribution, includePatternFinder); }
java
public static QuickAnalysisStrategy loadFromUserPreferences(final UserPreferences userPreferences) { final Map<String, String> properties = userPreferences.getAdditionalProperties(); final int columnsPerAnalyzer = MapUtils.getIntValue(properties, USER_PREFERENCES_NAMESPACE + ".columnsPerAnalyzer", 5); final boolean includeValueDistribution = MapUtils.getBooleanValue(properties, USER_PREFERENCES_NAMESPACE + ".includeValueDistribution", false); final boolean includePatternFinder = MapUtils.getBooleanValue(properties, USER_PREFERENCES_NAMESPACE + ".includePatternFinder", false); return new QuickAnalysisStrategy(columnsPerAnalyzer, includeValueDistribution, includePatternFinder); }
[ "public", "static", "QuickAnalysisStrategy", "loadFromUserPreferences", "(", "final", "UserPreferences", "userPreferences", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "properties", "=", "userPreferences", ".", "getAdditionalProperties", "(", ")", ";"...
Loads {@link QuickAnalysisStrategy} from a {@link UserPreferences} object. @param userPreferences @return
[ "Loads", "{", "@link", "QuickAnalysisStrategy", "}", "from", "a", "{", "@link", "UserPreferences", "}", "object", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/user/QuickAnalysisStrategy.java#L90-L101