repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
BlueBrain/bluima
modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/cleanup/HyphenRemover.java
HyphenRemover.dehyphenate
public static String dehyphenate(String text, String docId) { return dehyphenate(new LineNumberReader(new StringReader(text)), docId); }
java
public static String dehyphenate(String text, String docId) { return dehyphenate(new LineNumberReader(new StringReader(text)), docId); }
[ "public", "static", "String", "dehyphenate", "(", "String", "text", ",", "String", "docId", ")", "{", "return", "dehyphenate", "(", "new", "LineNumberReader", "(", "new", "StringReader", "(", "text", ")", ")", ",", "docId", ")", ";", "}" ]
Removes ligatures, multiple spaces and hypens from a text file
[ "Removes", "ligatures", "multiple", "spaces", "and", "hypens", "from", "a", "text", "file" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/cleanup/HyphenRemover.java#L152-L154
Red5/red5-io
src/main/java/org/red5/io/matroska/ParserUtils.java
ParserUtils.parseString
public static String parseString(InputStream inputStream, final int size) throws IOException { if (0 == size) { return ""; } byte[] buffer = new byte[size]; int numberOfReadsBytes = inputStream.read(buffer, 0, size); assert numberOfReadsBytes == size; return new String(buffer, "UTF-8"); }
java
public static String parseString(InputStream inputStream, final int size) throws IOException { if (0 == size) { return ""; } byte[] buffer = new byte[size]; int numberOfReadsBytes = inputStream.read(buffer, 0, size); assert numberOfReadsBytes == size; return new String(buffer, "UTF-8"); }
[ "public", "static", "String", "parseString", "(", "InputStream", "inputStream", ",", "final", "int", "size", ")", "throws", "IOException", "{", "if", "(", "0", "==", "size", ")", "{", "return", "\"\"", ";", "}", "byte", "[", "]", "buffer", "=", "new", ...
method used to parse string @param inputStream - stream to get value @param size - size of the value in bytes @return - parsed value as {@link String} @throws IOException - in case of IO error
[ "method", "used", "to", "parse", "string" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/ParserUtils.java#L77-L87
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/optics/OPTICSXi.java
OPTICSXi.updateFilterSDASet
private static void updateFilterSDASet(double mib, List<SteepDownArea> sdaset, double ixi) { Iterator<SteepDownArea> iter = sdaset.iterator(); while(iter.hasNext()) { SteepDownArea sda = iter.next(); if(sda.getMaximum() * ixi <= mib) { iter.remove(); } else { // Update if(mib > sda.getMib()) { sda.setMib(mib); } } } }
java
private static void updateFilterSDASet(double mib, List<SteepDownArea> sdaset, double ixi) { Iterator<SteepDownArea> iter = sdaset.iterator(); while(iter.hasNext()) { SteepDownArea sda = iter.next(); if(sda.getMaximum() * ixi <= mib) { iter.remove(); } else { // Update if(mib > sda.getMib()) { sda.setMib(mib); } } } }
[ "private", "static", "void", "updateFilterSDASet", "(", "double", "mib", ",", "List", "<", "SteepDownArea", ">", "sdaset", ",", "double", "ixi", ")", "{", "Iterator", "<", "SteepDownArea", ">", "iter", "=", "sdaset", ".", "iterator", "(", ")", ";", "while"...
Update the mib values of SteepDownAreas, and remove obsolete areas. @param mib Maximum in-between value @param sdaset Set of steep down areas.
[ "Update", "the", "mib", "values", "of", "SteepDownAreas", "and", "remove", "obsolete", "areas", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/optics/OPTICSXi.java#L380-L394
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java
MutableBigInteger.divide
long divide(long v, MutableBigInteger quotient) { if (v == 0) throw new ArithmeticException("BigInteger divide by zero"); // Dividend is zero if (intLen == 0) { quotient.intLen = quotient.offset = 0; return 0; } if (v < 0) v = -v; int d = (int)(v >>> 32); quotient.clear(); // Special case on word divisor if (d == 0) return divideOneWord((int)v, quotient) & LONG_MASK; else { return divideLongMagnitude(v, quotient).toLong(); } }
java
long divide(long v, MutableBigInteger quotient) { if (v == 0) throw new ArithmeticException("BigInteger divide by zero"); // Dividend is zero if (intLen == 0) { quotient.intLen = quotient.offset = 0; return 0; } if (v < 0) v = -v; int d = (int)(v >>> 32); quotient.clear(); // Special case on word divisor if (d == 0) return divideOneWord((int)v, quotient) & LONG_MASK; else { return divideLongMagnitude(v, quotient).toLong(); } }
[ "long", "divide", "(", "long", "v", ",", "MutableBigInteger", "quotient", ")", "{", "if", "(", "v", "==", "0", ")", "throw", "new", "ArithmeticException", "(", "\"BigInteger divide by zero\"", ")", ";", "// Dividend is zero", "if", "(", "intLen", "==", "0", ...
Internally used to calculate the quotient of this div v and places the quotient in the provided MutableBigInteger object and the remainder is returned. @return the remainder of the division will be returned.
[ "Internally", "used", "to", "calculate", "the", "quotient", "of", "this", "div", "v", "and", "places", "the", "quotient", "in", "the", "provided", "MutableBigInteger", "object", "and", "the", "remainder", "is", "returned", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1437-L1457
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java
KeyVaultClientImpl.deleteKey
public KeyBundle deleteKey(String vaultBaseUrl, String keyName) { return deleteKeyWithServiceResponseAsync(vaultBaseUrl, keyName).toBlocking().single().body(); }
java
public KeyBundle deleteKey(String vaultBaseUrl, String keyName) { return deleteKeyWithServiceResponseAsync(vaultBaseUrl, keyName).toBlocking().single().body(); }
[ "public", "KeyBundle", "deleteKey", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ")", "{", "return", "deleteKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "...
Deletes a key of any type from storage in Azure Key Vault. The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. Authorization: Requires the keys/delete permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the key to delete. @return the KeyBundle object if successful.
[ "Deletes", "a", "key", "of", "any", "type", "from", "storage", "in", "Azure", "Key", "Vault", ".", "The", "delete", "key", "operation", "cannot", "be", "used", "to", "remove", "individual", "versions", "of", "a", "key", ".", "This", "operation", "removes",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java#L836-L838
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.timeToInternal
public static int timeToInternal(java.sql.Time time, TimeZone tz) { long ts = time.getTime() + tz.getOffset(time.getTime()); return (int) (ts % MILLIS_PER_DAY); }
java
public static int timeToInternal(java.sql.Time time, TimeZone tz) { long ts = time.getTime() + tz.getOffset(time.getTime()); return (int) (ts % MILLIS_PER_DAY); }
[ "public", "static", "int", "timeToInternal", "(", "java", ".", "sql", ".", "Time", "time", ",", "TimeZone", "tz", ")", "{", "long", "ts", "=", "time", ".", "getTime", "(", ")", "+", "tz", ".", "getOffset", "(", "time", ".", "getTime", "(", ")", ")"...
Converts the Java type used for UDF parameters of SQL TIME type ({@link java.sql.Time}) to internal representation (int). <p>Converse of {@link #internalToTime(int)}.
[ "Converts", "the", "Java", "type", "used", "for", "UDF", "parameters", "of", "SQL", "TIME", "type", "(", "{", "@link", "java", ".", "sql", ".", "Time", "}", ")", "to", "internal", "representation", "(", "int", ")", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L197-L200
spring-projects/spring-boot
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/ConnectionInputStream.java
ConnectionInputStream.checkedRead
public int checkedRead(byte[] buffer, int offset, int length) throws IOException { int amountRead = read(buffer, offset, length); if (amountRead == -1) { throw new IOException("End of stream"); } return amountRead; }
java
public int checkedRead(byte[] buffer, int offset, int length) throws IOException { int amountRead = read(buffer, offset, length); if (amountRead == -1) { throw new IOException("End of stream"); } return amountRead; }
[ "public", "int", "checkedRead", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "int", "amountRead", "=", "read", "(", "buffer", ",", "offset", ",", "length", ")", ";", "if", "(", "amountR...
Read a number of bytes from the stream (checking that the end of the stream hasn't been reached). @param buffer the destination buffer @param offset the buffer offset @param length the length to read @return the amount of data read @throws IOException in case of I/O errors
[ "Read", "a", "number", "of", "bytes", "from", "the", "stream", "(", "checking", "that", "the", "end", "of", "the", "stream", "hasn", "t", "been", "reached", ")", "." ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/ConnectionInputStream.java#L94-L100
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java
StructureTools.getAtomsCAInContact
public static AtomContactSet getAtomsCAInContact(Chain chain, double cutoff) { Grid grid = new Grid(cutoff); Atom[] atoms = getAtomCAArray(chain); grid.addAtoms(atoms); return grid.getAtomContacts(); }
java
public static AtomContactSet getAtomsCAInContact(Chain chain, double cutoff) { Grid grid = new Grid(cutoff); Atom[] atoms = getAtomCAArray(chain); grid.addAtoms(atoms); return grid.getAtomContacts(); }
[ "public", "static", "AtomContactSet", "getAtomsCAInContact", "(", "Chain", "chain", ",", "double", "cutoff", ")", "{", "Grid", "grid", "=", "new", "Grid", "(", "cutoff", ")", ";", "Atom", "[", "]", "atoms", "=", "getAtomCAArray", "(", "chain", ")", ";", ...
Returns the set of intra-chain contacts for the given chain for C-alpha atoms (including non-standard aminoacids appearing as HETATM groups), i.e. the contact map. Uses a geometric hashing algorithm that speeds up the calculation without need of full distance matrix. The parsing mode {@link FileParsingParameters#setAlignSeqRes(boolean)} needs to be set to true for this to work. @param chain @param cutoff @return @see {@link #getRepresentativeAtomsInContact(Chain, double)}
[ "Returns", "the", "set", "of", "intra", "-", "chain", "contacts", "for", "the", "given", "chain", "for", "C", "-", "alpha", "atoms", "(", "including", "non", "-", "standard", "aminoacids", "appearing", "as", "HETATM", "groups", ")", "i", ".", "e", ".", ...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java#L1452-L1460
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ConfigurableEmitter.java
ConfigurableEmitter.setPosition
public void setPosition(float x, float y, boolean moveParticles) { if (moveParticles) { adjust = true; adjustx -= this.x - x; adjusty -= this.y - y; } this.x = x; this.y = y; }
java
public void setPosition(float x, float y, boolean moveParticles) { if (moveParticles) { adjust = true; adjustx -= this.x - x; adjusty -= this.y - y; } this.x = x; this.y = y; }
[ "public", "void", "setPosition", "(", "float", "x", ",", "float", "y", ",", "boolean", "moveParticles", ")", "{", "if", "(", "moveParticles", ")", "{", "adjust", "=", "true", ";", "adjustx", "-=", "this", ".", "x", "-", "x", ";", "adjusty", "-=", "th...
Set the position of this particle source @param x The x coodinate of that this emitter should spawn at @param y The y coodinate of that this emitter should spawn at @param moveParticles True if particles should be moved with the emitter
[ "Set", "the", "position", "of", "this", "particle", "source" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ConfigurableEmitter.java#L234-L242
oglimmer/utils
src/main/java/de/oglimmer/utils/random/RandomString.java
RandomString.getRandomString
public static String getRandomString(final int size, final int start, final int length) { final StringBuilder buff = new StringBuilder(size); for (int i = 0; i < size; i++) { buff.append((char) (RAN.nextInt(length) + start)); } return buff.toString(); }
java
public static String getRandomString(final int size, final int start, final int length) { final StringBuilder buff = new StringBuilder(size); for (int i = 0; i < size; i++) { buff.append((char) (RAN.nextInt(length) + start)); } return buff.toString(); }
[ "public", "static", "String", "getRandomString", "(", "final", "int", "size", ",", "final", "int", "start", ",", "final", "int", "length", ")", "{", "final", "StringBuilder", "buff", "=", "new", "StringBuilder", "(", "size", ")", ";", "for", "(", "int", ...
Creates a size byte long unicode string. All codes are &gt;= start and &lt; start+length @param size number of characters in the return string @param start start code @param length all generated codes are within this range @return
[ "Creates", "a", "size", "byte", "long", "unicode", "string", ".", "All", "codes", "are", "&gt", ";", "=", "start", "and", "&lt", ";", "start", "+", "length" ]
train
https://github.com/oglimmer/utils/blob/bc46c57a24e60c9dbda4c73a810c163b0ce407ea/src/main/java/de/oglimmer/utils/random/RandomString.java#L26-L33
h2oai/h2o-2
src/main/java/water/ga/GoogleAnalytics.java
GoogleAnalytics.processCustomMetricParameters
private void processCustomMetricParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) { Map<String, String> customMetricParms = new HashMap<String, String>(); for (String defaultCustomMetricKey : defaultRequest.custommMetrics().keySet()) { customMetricParms.put(defaultCustomMetricKey, defaultRequest.custommMetrics().get(defaultCustomMetricKey)); } @SuppressWarnings("unchecked") Map<String, String> requestCustomMetrics = request.custommMetrics(); for (String requestCustomDimKey : requestCustomMetrics.keySet()) { customMetricParms.put(requestCustomDimKey, requestCustomMetrics.get(requestCustomDimKey)); } for (String key : customMetricParms.keySet()) { postParms.add(new BasicNameValuePair(key, customMetricParms.get(key))); } }
java
private void processCustomMetricParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) { Map<String, String> customMetricParms = new HashMap<String, String>(); for (String defaultCustomMetricKey : defaultRequest.custommMetrics().keySet()) { customMetricParms.put(defaultCustomMetricKey, defaultRequest.custommMetrics().get(defaultCustomMetricKey)); } @SuppressWarnings("unchecked") Map<String, String> requestCustomMetrics = request.custommMetrics(); for (String requestCustomDimKey : requestCustomMetrics.keySet()) { customMetricParms.put(requestCustomDimKey, requestCustomMetrics.get(requestCustomDimKey)); } for (String key : customMetricParms.keySet()) { postParms.add(new BasicNameValuePair(key, customMetricParms.get(key))); } }
[ "private", "void", "processCustomMetricParameters", "(", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "GoogleAnalyticsRequest", "request", ",", "List", "<", "NameValuePair", ">", "postParms", ")", "{", "Map", "<", "String", ",", "String", ">", "customMetricPar...
Processes the custom metrics and adds the values to list of parameters, which would be posted to GA. @param request @param postParms
[ "Processes", "the", "custom", "metrics", "and", "adds", "the", "values", "to", "list", "of", "parameters", "which", "would", "be", "posted", "to", "GA", "." ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/ga/GoogleAnalytics.java#L240-L255
FasterXML/jackson-jr
jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONObjectException.java
JSONObjectException.wrapWithPath
public static JSONObjectException wrapWithPath(Throwable src, Object refFrom, int index) { return wrapWithPath(src, new Reference(refFrom, index)); }
java
public static JSONObjectException wrapWithPath(Throwable src, Object refFrom, int index) { return wrapWithPath(src, new Reference(refFrom, index)); }
[ "public", "static", "JSONObjectException", "wrapWithPath", "(", "Throwable", "src", ",", "Object", "refFrom", ",", "int", "index", ")", "{", "return", "wrapWithPath", "(", "src", ",", "new", "Reference", "(", "refFrom", ",", "index", ")", ")", ";", "}" ]
Method that can be called to either create a new JsonMappingException (if underlying exception is not a JsonMappingException), or augment given exception with given path/reference information. This version of method is called when the reference is through an index, which happens with arrays and Collections.
[ "Method", "that", "can", "be", "called", "to", "either", "create", "a", "new", "JsonMappingException", "(", "if", "underlying", "exception", "is", "not", "a", "JsonMappingException", ")", "or", "augment", "given", "exception", "with", "given", "path", "/", "re...
train
https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONObjectException.java#L215-L219
apache/flink
flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/RecoverableMultiPartUploadImpl.java
RecoverableMultiPartUploadImpl.uploadPart
@Override public void uploadPart(RefCountedFSOutputStream file) throws IOException { // this is to guarantee that nobody is // writing to the file we are uploading. checkState(file.isClosed()); final CompletableFuture<PartETag> future = new CompletableFuture<>(); uploadsInProgress.add(future); final long partLength = file.getPos(); currentUploadInfo.registerNewPart(partLength); file.retain(); // keep the file while the async upload still runs uploadThreadPool.execute(new UploadTask(s3AccessHelper, currentUploadInfo, file, future)); }
java
@Override public void uploadPart(RefCountedFSOutputStream file) throws IOException { // this is to guarantee that nobody is // writing to the file we are uploading. checkState(file.isClosed()); final CompletableFuture<PartETag> future = new CompletableFuture<>(); uploadsInProgress.add(future); final long partLength = file.getPos(); currentUploadInfo.registerNewPart(partLength); file.retain(); // keep the file while the async upload still runs uploadThreadPool.execute(new UploadTask(s3AccessHelper, currentUploadInfo, file, future)); }
[ "@", "Override", "public", "void", "uploadPart", "(", "RefCountedFSOutputStream", "file", ")", "throws", "IOException", "{", "// this is to guarantee that nobody is", "// writing to the file we are uploading.", "checkState", "(", "file", ".", "isClosed", "(", ")", ")", ";...
Adds a part to the uploads without any size limitations. <p>This method is non-blocking and does not wait for the part upload to complete. @param file The file with the part data. @throws IOException If this method throws an exception, the RecoverableS3MultiPartUpload should not be used any more, but recovered instead.
[ "Adds", "a", "part", "to", "the", "uploads", "without", "any", "size", "limitations", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/RecoverableMultiPartUploadImpl.java#L100-L114
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/PropertyChangeSupport.java
PropertyChangeSupport.firePropertyChange
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { firePropertyChange(new PropertyChangeEvent(source, propertyName, oldValue, newValue)); }
java
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { firePropertyChange(new PropertyChangeEvent(source, propertyName, oldValue, newValue)); }
[ "public", "void", "firePropertyChange", "(", "String", "propertyName", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "{", "firePropertyChange", "(", "new", "PropertyChangeEvent", "(", "source", ",", "propertyName", ",", "oldValue", ",", "newValue", ")...
Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null. @param propertyName The programmatic name of the property that was changed. @param oldValue The old value of the property. @param newValue The new value of the property.
[ "Report", "a", "bound", "property", "update", "to", "any", "registered", "listeners", ".", "No", "event", "is", "fired", "if", "old", "and", "new", "are", "equal", "and", "non", "-", "null", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/PropertyChangeSupport.java#L217-L219
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java
TmdbTV.getTVVideos
public ResultList<Video> getTVVideos(int tvID, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.VIDEOS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class); ResultList<Video> results = new ResultList<>(wrapper.getVideos()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get videos", url, ex); } }
java
public ResultList<Video> getTVVideos(int tvID, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.VIDEOS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class); ResultList<Video> results = new ResultList<>(wrapper.getVideos()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get videos", url, ex); } }
[ "public", "ResultList", "<", "Video", ">", "getTVVideos", "(", "int", "tvID", ",", "String", "language", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param"...
Get the videos that have been added to a TV series (trailers, opening credits, etc...) @param tvID @param language @return @throws com.omertron.themoviedbapi.MovieDbException
[ "Get", "the", "videos", "that", "have", "been", "added", "to", "a", "TV", "series", "(", "trailers", "opening", "credits", "etc", "...", ")" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java#L346-L362
apache/flink
flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java
FieldParser.endsWithDelimiter
public static final boolean endsWithDelimiter(byte[] bytes, int endPos, byte[] delim) { if (endPos < delim.length - 1) { return false; } for (int pos = 0; pos < delim.length; ++pos) { if (delim[pos] != bytes[endPos - delim.length + 1 + pos]) { return false; } } return true; }
java
public static final boolean endsWithDelimiter(byte[] bytes, int endPos, byte[] delim) { if (endPos < delim.length - 1) { return false; } for (int pos = 0; pos < delim.length; ++pos) { if (delim[pos] != bytes[endPos - delim.length + 1 + pos]) { return false; } } return true; }
[ "public", "static", "final", "boolean", "endsWithDelimiter", "(", "byte", "[", "]", "bytes", ",", "int", "endPos", ",", "byte", "[", "]", "delim", ")", "{", "if", "(", "endPos", "<", "delim", ".", "length", "-", "1", ")", "{", "return", "false", ";",...
Checks if the given bytes ends with the delimiter at the given end position. @param bytes The byte array that holds the value. @param endPos The index of the byte array where the check for the delimiter ends. @param delim The delimiter to check for. @return true if a delimiter ends at the given end position, false otherwise.
[ "Checks", "if", "the", "given", "bytes", "ends", "with", "the", "delimiter", "at", "the", "given", "end", "position", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java#L169-L179
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
AbstractSSTableSimpleWriter.addColumn
public void addColumn(ByteBuffer name, ByteBuffer value, long timestamp) throws IOException { addColumn(new BufferCell(metadata.comparator.cellFromByteBuffer(name), value, timestamp)); }
java
public void addColumn(ByteBuffer name, ByteBuffer value, long timestamp) throws IOException { addColumn(new BufferCell(metadata.comparator.cellFromByteBuffer(name), value, timestamp)); }
[ "public", "void", "addColumn", "(", "ByteBuffer", "name", ",", "ByteBuffer", "value", ",", "long", "timestamp", ")", "throws", "IOException", "{", "addColumn", "(", "new", "BufferCell", "(", "metadata", ".", "comparator", ".", "cellFromByteBuffer", "(", "name", ...
Insert a new "regular" column to the current row (and super column if applicable). @param name the column name @param value the column value @param timestamp the column timestamp
[ "Insert", "a", "new", "regular", "column", "to", "the", "current", "row", "(", "and", "super", "column", "if", "applicable", ")", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java#L141-L144
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java
WrapperManager.unregisterHome
public void unregisterHome(J2EEName homeName, EJSHome homeObj) throws CSIException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "unregisterHome"); J2EEName cacheHomeName; int numEnumerated = 0, numRemoved = 0; // d103404.2 Enumeration<?> enumerate = wrapperCache.enumerateElements(); while (enumerate.hasMoreElements()) { // need to get the beanid from either the remote or local wrapper, // whichever is available, the beanid must be the same for both wrappers EJSWrapperCommon wCommon = (EJSWrapperCommon) // f111627 ((CacheElement) enumerate.nextElement()).getObject(); // f111627 BeanId cacheMemberBeanId = wCommon.getBeanId(); // d181569 cacheHomeName = cacheMemberBeanId.getJ2EEName(); numEnumerated++; // If the cache has homeObj as it's home or is itself the home, // remove it. If the wrapper has been removed since it was found // (above), then the call to unregister() will just return false. // Note that the enumeration can handle elements being removed // from the cache while enumerating. d103404.2 if (cacheHomeName.equals(homeName) || cacheMemberBeanId.equals(homeObj.getId())) { unregister(cacheMemberBeanId, true); // d181217 d181569 numRemoved++; } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // d103404.1 d103404.2 Tr.debug(tc, "Unregistered " + numRemoved + " wrappers (total = " + numEnumerated + ")"); } // Now remove any cached BeanIds for this home. d152323 beanIdCache.removeAll(homeObj); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "unregisterHome"); }
java
public void unregisterHome(J2EEName homeName, EJSHome homeObj) throws CSIException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "unregisterHome"); J2EEName cacheHomeName; int numEnumerated = 0, numRemoved = 0; // d103404.2 Enumeration<?> enumerate = wrapperCache.enumerateElements(); while (enumerate.hasMoreElements()) { // need to get the beanid from either the remote or local wrapper, // whichever is available, the beanid must be the same for both wrappers EJSWrapperCommon wCommon = (EJSWrapperCommon) // f111627 ((CacheElement) enumerate.nextElement()).getObject(); // f111627 BeanId cacheMemberBeanId = wCommon.getBeanId(); // d181569 cacheHomeName = cacheMemberBeanId.getJ2EEName(); numEnumerated++; // If the cache has homeObj as it's home or is itself the home, // remove it. If the wrapper has been removed since it was found // (above), then the call to unregister() will just return false. // Note that the enumeration can handle elements being removed // from the cache while enumerating. d103404.2 if (cacheHomeName.equals(homeName) || cacheMemberBeanId.equals(homeObj.getId())) { unregister(cacheMemberBeanId, true); // d181217 d181569 numRemoved++; } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // d103404.1 d103404.2 Tr.debug(tc, "Unregistered " + numRemoved + " wrappers (total = " + numEnumerated + ")"); } // Now remove any cached BeanIds for this home. d152323 beanIdCache.removeAll(homeObj); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "unregisterHome"); }
[ "public", "void", "unregisterHome", "(", "J2EEName", "homeName", ",", "EJSHome", "homeObj", ")", "throws", "CSIException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "e...
unregisterHome removes from cache homeObj and all Objects that have homeObj as it's home. It also unregisters these objects from from the orb object adapter.
[ "unregisterHome", "removes", "from", "cache", "homeObj", "and", "all", "Objects", "that", "have", "homeObj", "as", "it", "s", "home", ".", "It", "also", "unregisters", "these", "objects", "from", "from", "the", "orb", "object", "adapter", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java#L422-L466
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java
PhotosGeoApi.batchCorrectLocation
public Response batchCorrectLocation(Float lat, Float lon, Integer accuracy, String placeId, String woeId) throws JinxException { JinxUtils.validateParams(lat, lon, accuracy); if (JinxUtils.isNullOrEmpty(placeId)) { JinxUtils.validateParams(woeId); } Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.geo.batchCorrectLocation"); params.put("lat", lat.toString()); params.put("lon", lon.toString()); params.put("accuracy", accuracy.toString()); if (!JinxUtils.isNullOrEmpty(placeId)) { params.put("place_id", placeId); } if (!JinxUtils.isNullOrEmpty(woeId)) { params.put("woe_id", woeId); } return jinx.flickrPost(params, Response.class); }
java
public Response batchCorrectLocation(Float lat, Float lon, Integer accuracy, String placeId, String woeId) throws JinxException { JinxUtils.validateParams(lat, lon, accuracy); if (JinxUtils.isNullOrEmpty(placeId)) { JinxUtils.validateParams(woeId); } Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.geo.batchCorrectLocation"); params.put("lat", lat.toString()); params.put("lon", lon.toString()); params.put("accuracy", accuracy.toString()); if (!JinxUtils.isNullOrEmpty(placeId)) { params.put("place_id", placeId); } if (!JinxUtils.isNullOrEmpty(woeId)) { params.put("woe_id", woeId); } return jinx.flickrPost(params, Response.class); }
[ "public", "Response", "batchCorrectLocation", "(", "Float", "lat", ",", "Float", "lon", ",", "Integer", "accuracy", ",", "String", "placeId", ",", "String", "woeId", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "lat", ",", "lon...
Correct the places hierarchy for all the photos for a user at a given latitude, longitude and accuracy. <br> Batch corrections are processed in a delayed queue so it may take a few minutes before the changes are reflected in a user's photos. <br> This method requires authentication with 'write' permission. <br> Note: This method requires an HTTP POST request. @param lat (Required) The latitude of the photos to be update whose valid range is -90 to 90. Anything more than 6 decimal places will be truncated. @param lon (Required) The longitude of the photos to be updated whose valid range is -180 to 180. Anything more than 6 decimal places will be truncated. @param accuracy (Required) Recorded accuracy level of the photos to be updated. World level is 1, Country is ~3, Region ~6, City ~11, Street ~16. Current range is 1-16. @param placeId A Flickr Places ID. (While optional, you must pass either a valid Places ID or a WOE ID.) @param woeId A Where On Earth (WOE) ID. (While optional, you must pass either a valid Places ID or a WOE ID.) @return object with the status of the requested operation. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.geo.batchCorrectLocation.html">flickr.photos.geo.batchCorrectLocation</a>
[ "Correct", "the", "places", "hierarchy", "for", "all", "the", "photos", "for", "a", "user", "at", "a", "given", "latitude", "longitude", "and", "accuracy", ".", "<br", ">", "Batch", "corrections", "are", "processed", "in", "a", "delayed", "queue", "so", "i...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java#L64-L81
julianhyde/sqlline
src/main/java/sqlline/Application.java
Application.getOutputFormats
public Map<String, OutputFormat> getOutputFormats(SqlLine sqlLine) { final Map<String, OutputFormat> outputFormats = new HashMap<>(); outputFormats.put("vertical", new VerticalOutputFormat(sqlLine)); outputFormats.put("table", new TableOutputFormat(sqlLine)); outputFormats.put("csv", new SeparatedValuesOutputFormat(sqlLine, ",")); outputFormats.put("tsv", new SeparatedValuesOutputFormat(sqlLine, "\t")); XmlAttributeOutputFormat xmlAttrs = new XmlAttributeOutputFormat(sqlLine); // leave "xmlattr" name for backward compatibility, // "xmlattrs" should be used instead outputFormats.put("xmlattr", xmlAttrs); outputFormats.put("xmlattrs", xmlAttrs); outputFormats.put("xmlelements", new XmlElementOutputFormat(sqlLine)); outputFormats.put("json", new JsonOutputFormat(sqlLine)); return Collections.unmodifiableMap(outputFormats); }
java
public Map<String, OutputFormat> getOutputFormats(SqlLine sqlLine) { final Map<String, OutputFormat> outputFormats = new HashMap<>(); outputFormats.put("vertical", new VerticalOutputFormat(sqlLine)); outputFormats.put("table", new TableOutputFormat(sqlLine)); outputFormats.put("csv", new SeparatedValuesOutputFormat(sqlLine, ",")); outputFormats.put("tsv", new SeparatedValuesOutputFormat(sqlLine, "\t")); XmlAttributeOutputFormat xmlAttrs = new XmlAttributeOutputFormat(sqlLine); // leave "xmlattr" name for backward compatibility, // "xmlattrs" should be used instead outputFormats.put("xmlattr", xmlAttrs); outputFormats.put("xmlattrs", xmlAttrs); outputFormats.put("xmlelements", new XmlElementOutputFormat(sqlLine)); outputFormats.put("json", new JsonOutputFormat(sqlLine)); return Collections.unmodifiableMap(outputFormats); }
[ "public", "Map", "<", "String", ",", "OutputFormat", ">", "getOutputFormats", "(", "SqlLine", "sqlLine", ")", "{", "final", "Map", "<", "String", ",", "OutputFormat", ">", "outputFormats", "=", "new", "HashMap", "<>", "(", ")", ";", "outputFormats", ".", "...
Override this method to modify known output formats implementations. <p>If method is not overridden, current state of formats will be reset to default ({@code super.getOutputFormats(sqlLine)}). <p>To update / leave current state, override this method and use {@code sqlLine.getOutputFormats()}. <p>When overriding output formats outputformat command should be re-initialized unless default commands handlers are used. @param sqlLine SQLLine instance @return Map of output formats by name
[ "Override", "this", "method", "to", "modify", "known", "output", "formats", "implementations", "." ]
train
https://github.com/julianhyde/sqlline/blob/7577f3ebaca0897a9ff01d1553d4576487e1d2c3/src/main/java/sqlline/Application.java#L180-L194
facebookarchive/nifty
nifty-client/src/main/java/com/facebook/nifty/client/socks/Socks4ClientBootstrap.java
Socks4ClientBootstrap.socksConnect
private static ChannelFuture socksConnect(Channel channel, InetSocketAddress remoteAddress) { channel.write(createHandshake(remoteAddress)); return ((Socks4HandshakeHandler) channel.getPipeline().get("handshake")).getChannelFuture(); }
java
private static ChannelFuture socksConnect(Channel channel, InetSocketAddress remoteAddress) { channel.write(createHandshake(remoteAddress)); return ((Socks4HandshakeHandler) channel.getPipeline().get("handshake")).getChannelFuture(); }
[ "private", "static", "ChannelFuture", "socksConnect", "(", "Channel", "channel", ",", "InetSocketAddress", "remoteAddress", ")", "{", "channel", ".", "write", "(", "createHandshake", "(", "remoteAddress", ")", ")", ";", "return", "(", "(", "Socks4HandshakeHandler", ...
try to look at the remoteAddress and decide to use SOCKS4 or SOCKS4a handshake packet.
[ "try", "to", "look", "at", "the", "remoteAddress", "and", "decide", "to", "use", "SOCKS4", "or", "SOCKS4a", "handshake", "packet", "." ]
train
https://github.com/facebookarchive/nifty/blob/ccacff7f0a723abe0b9ed399bcc3bc85784e7396/nifty-client/src/main/java/com/facebook/nifty/client/socks/Socks4ClientBootstrap.java#L133-L137
alkacon/opencms-core
src/org/opencms/file/CmsRequestContext.java
CmsRequestContext.getAdjustedSiteRoot
public static String getAdjustedSiteRoot(String siteRoot, String resourcename) { if (resourcename.startsWith(CmsWorkplace.VFS_PATH_SYSTEM) || OpenCms.getSiteManager().startsWithShared(resourcename) || (resourcename.startsWith(CmsWorkplace.VFS_PATH_SITES) && !resourcename.startsWith(siteRoot))) { return ""; } else { return siteRoot; } }
java
public static String getAdjustedSiteRoot(String siteRoot, String resourcename) { if (resourcename.startsWith(CmsWorkplace.VFS_PATH_SYSTEM) || OpenCms.getSiteManager().startsWithShared(resourcename) || (resourcename.startsWith(CmsWorkplace.VFS_PATH_SITES) && !resourcename.startsWith(siteRoot))) { return ""; } else { return siteRoot; } }
[ "public", "static", "String", "getAdjustedSiteRoot", "(", "String", "siteRoot", ",", "String", "resourcename", ")", "{", "if", "(", "resourcename", ".", "startsWith", "(", "CmsWorkplace", ".", "VFS_PATH_SYSTEM", ")", "||", "OpenCms", ".", "getSiteManager", "(", ...
Returns the adjusted site root for a resource using the provided site root as a base.<p> Usually, this would be the site root for the current site. However, if a resource from the <code>/system/</code> folder is requested, this will be the empty String.<p> @param siteRoot the site root of the current site @param resourcename the resource name to get the adjusted site root for @return the adjusted site root for the resource
[ "Returns", "the", "adjusted", "site", "root", "for", "a", "resource", "using", "the", "provided", "site", "root", "as", "a", "base", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsRequestContext.java#L171-L180
zaproxy/zaproxy
src/org/zaproxy/zap/extension/spider/SpiderPanelTableModel.java
SpiderPanelTableModel.removesScanResult
public void removesScanResult(String uri, String method) { SpiderScanResult toRemove = new SpiderScanResult(uri, method); int index = scanResults.indexOf(toRemove); if (index >= 0) { scanResults.remove(index); fireTableRowsDeleted(index, index); } }
java
public void removesScanResult(String uri, String method) { SpiderScanResult toRemove = new SpiderScanResult(uri, method); int index = scanResults.indexOf(toRemove); if (index >= 0) { scanResults.remove(index); fireTableRowsDeleted(index, index); } }
[ "public", "void", "removesScanResult", "(", "String", "uri", ",", "String", "method", ")", "{", "SpiderScanResult", "toRemove", "=", "new", "SpiderScanResult", "(", "uri", ",", "method", ")", ";", "int", "index", "=", "scanResults", ".", "indexOf", "(", "toR...
Removes the scan result for a particular uri and method. Method is synchronized internally. @param uri the uri @param method the method
[ "Removes", "the", "scan", "result", "for", "a", "particular", "uri", "and", "method", ".", "Method", "is", "synchronized", "internally", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/spider/SpiderPanelTableModel.java#L133-L140
alkacon/opencms-core
src-modules/org/opencms/workplace/CmsLogin.java
CmsLogin.getDirectEditPath
public static String getDirectEditPath(CmsObject cms, CmsUserSettings userSettings) { if (userSettings.getStartView().equals(CmsWorkplace.VIEW_DIRECT_EDIT) | userSettings.getStartView().equals(CmsPageEditorConfiguration.APP_ID)) { try { CmsObject cloneCms = OpenCms.initCmsObject(cms); String startSite = CmsWorkplace.getStartSiteRoot(cloneCms, userSettings); cloneCms.getRequestContext().setSiteRoot(startSite); String projectName = userSettings.getStartProject(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(projectName)) { cloneCms.getRequestContext().setCurrentProject(cloneCms.readProject(projectName)); } String folder = userSettings.getStartFolder(); CmsResource targetRes = cloneCms.readDefaultFile(folder); if (targetRes != null) { return cloneCms.getSitePath(targetRes); } } catch (Exception e) { LOG.debug(e); } } return null; }
java
public static String getDirectEditPath(CmsObject cms, CmsUserSettings userSettings) { if (userSettings.getStartView().equals(CmsWorkplace.VIEW_DIRECT_EDIT) | userSettings.getStartView().equals(CmsPageEditorConfiguration.APP_ID)) { try { CmsObject cloneCms = OpenCms.initCmsObject(cms); String startSite = CmsWorkplace.getStartSiteRoot(cloneCms, userSettings); cloneCms.getRequestContext().setSiteRoot(startSite); String projectName = userSettings.getStartProject(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(projectName)) { cloneCms.getRequestContext().setCurrentProject(cloneCms.readProject(projectName)); } String folder = userSettings.getStartFolder(); CmsResource targetRes = cloneCms.readDefaultFile(folder); if (targetRes != null) { return cloneCms.getSitePath(targetRes); } } catch (Exception e) { LOG.debug(e); } } return null; }
[ "public", "static", "String", "getDirectEditPath", "(", "CmsObject", "cms", ",", "CmsUserSettings", "userSettings", ")", "{", "if", "(", "userSettings", ".", "getStartView", "(", ")", ".", "equals", "(", "CmsWorkplace", ".", "VIEW_DIRECT_EDIT", ")", "|", "userSe...
Returns the direct edit path from the user settings, or <code>null</code> if not set.<p> @param cms the CMS context to use @param userSettings the user settings @return the direct edit path
[ "Returns", "the", "direct", "edit", "path", "from", "the", "user", "settings", "or", "<code", ">", "null<", "/", "code", ">", "if", "not", "set", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsLogin.java#L230-L253
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java
ContentSpecValidator.validateContentSpec
public boolean validateContentSpec(final ContentSpec contentSpec, final String username) { boolean valid = preValidateContentSpec(contentSpec); if (!postValidateContentSpec(contentSpec, username)) { valid = false; } return valid; }
java
public boolean validateContentSpec(final ContentSpec contentSpec, final String username) { boolean valid = preValidateContentSpec(contentSpec); if (!postValidateContentSpec(contentSpec, username)) { valid = false; } return valid; }
[ "public", "boolean", "validateContentSpec", "(", "final", "ContentSpec", "contentSpec", ",", "final", "String", "username", ")", "{", "boolean", "valid", "=", "preValidateContentSpec", "(", "contentSpec", ")", ";", "if", "(", "!", "postValidateContentSpec", "(", "...
Validates that a Content Specification is valid by checking the META data, child levels and topics. This method is a wrapper to first call PreValidate and then PostValidate. @param contentSpec The content specification to be validated. @param username The user who requested the content spec validation. @return True if the content specification is valid, otherwise false.
[ "Validates", "that", "a", "Content", "Specification", "is", "valid", "by", "checking", "the", "META", "data", "child", "levels", "and", "topics", ".", "This", "method", "is", "a", "wrapper", "to", "first", "call", "PreValidate", "and", "then", "PostValidate", ...
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java#L179-L187
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/Record.java
Record.handleRemoteCriteria
public boolean handleRemoteCriteria(StringBuffer strFilter, boolean bIncludeFileName, Vector<BaseField> vParamList) { BaseListener nextListener = this.getNextEnabledListener(); if (nextListener != null) return ((FileListener)nextListener).doRemoteCriteria(strFilter, bIncludeFileName, vParamList); else return this.doRemoteCriteria(strFilter, bIncludeFileName, vParamList); }
java
public boolean handleRemoteCriteria(StringBuffer strFilter, boolean bIncludeFileName, Vector<BaseField> vParamList) { BaseListener nextListener = this.getNextEnabledListener(); if (nextListener != null) return ((FileListener)nextListener).doRemoteCriteria(strFilter, bIncludeFileName, vParamList); else return this.doRemoteCriteria(strFilter, bIncludeFileName, vParamList); }
[ "public", "boolean", "handleRemoteCriteria", "(", "StringBuffer", "strFilter", ",", "boolean", "bIncludeFileName", ",", "Vector", "<", "BaseField", ">", "vParamList", ")", "{", "BaseListener", "nextListener", "=", "this", ".", "getNextEnabledListener", "(", ")", ";"...
Check to see if this record should be skipped. @param strFilter The current SQL WHERE string. @param bIncludeFileName Include the Filename.fieldName in the string. @param vParamList The list of params. @return true if the criteria passes. @return false if the criteria fails, and returns without checking further.
[ "Check", "to", "see", "if", "this", "record", "should", "be", "skipped", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L1680-L1687
ow2-chameleon/fuchsia
importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java
ZWaveMultiInstanceCommandClass.getMultiChannelEncapMessage
public SerialMessage getMultiChannelEncapMessage(SerialMessage serialMessage, ZWaveEndpoint endpoint) { logger.debug("Creating new message for application command MULTI_CHANNEL_ENCAP for node {} and endpoint {}", this.getNode().getNodeId(), endpoint.getEndpointId()); byte[] payload = serialMessage.getMessagePayload(); byte[] newPayload = new byte[payload.length + 4]; System.arraycopy(payload, 0, newPayload, 0, 2); System.arraycopy(payload, 0, newPayload, 4, payload.length); newPayload[1] += 4; newPayload[2] = (byte) this.getCommandClass().getKey(); newPayload[3] = MULTI_CHANNEL_ENCAP; newPayload[4] = 0x01; newPayload[5] = (byte) endpoint.getEndpointId(); serialMessage.setMessagePayload(newPayload); return serialMessage; }
java
public SerialMessage getMultiChannelEncapMessage(SerialMessage serialMessage, ZWaveEndpoint endpoint) { logger.debug("Creating new message for application command MULTI_CHANNEL_ENCAP for node {} and endpoint {}", this.getNode().getNodeId(), endpoint.getEndpointId()); byte[] payload = serialMessage.getMessagePayload(); byte[] newPayload = new byte[payload.length + 4]; System.arraycopy(payload, 0, newPayload, 0, 2); System.arraycopy(payload, 0, newPayload, 4, payload.length); newPayload[1] += 4; newPayload[2] = (byte) this.getCommandClass().getKey(); newPayload[3] = MULTI_CHANNEL_ENCAP; newPayload[4] = 0x01; newPayload[5] = (byte) endpoint.getEndpointId(); serialMessage.setMessagePayload(newPayload); return serialMessage; }
[ "public", "SerialMessage", "getMultiChannelEncapMessage", "(", "SerialMessage", "serialMessage", ",", "ZWaveEndpoint", "endpoint", ")", "{", "logger", ".", "debug", "(", "\"Creating new message for application command MULTI_CHANNEL_ENCAP for node {} and endpoint {}\"", ",", "this",...
Gets a SerialMessage with the MULTI INSTANCE ENCAP command. Encapsulates a message for a specific instance. @param serialMessage the serial message to encapsulate @param endpoint the endpoint to encapsulate the message for. @return the encapsulated serial message.
[ "Gets", "a", "SerialMessage", "with", "the", "MULTI", "INSTANCE", "ENCAP", "command", ".", "Encapsulates", "a", "message", "for", "a", "specific", "instance", "." ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java#L514-L529
gallandarakhneorg/afc
advanced/bootique/bootique-synopsishelp/src/main/java/org/arakhne/afc/bootique/synopsishelp/modules/SynopsisHelpGeneratorModule.java
SynopsisHelpGeneratorModule.provideHelpGenerator
@SuppressWarnings("static-method") @Provides @Singleton public HelpGenerator provideHelpGenerator( ApplicationMetadata metadata, Injector injector, Terminal terminal) { int maxColumns = terminal.getColumns(); if (maxColumns < TTY_MIN_COLUMNS) { maxColumns = TTY_DEFAULT_COLUMNS; } String argumentSynopsis; try { argumentSynopsis = injector.getInstance(Key.get(String.class, ApplicationArgumentSynopsis.class)); } catch (Exception exception) { argumentSynopsis = null; } String detailedDescription; try { detailedDescription = injector.getInstance(Key.get(String.class, ApplicationDetailedDescription.class)); } catch (Exception exception) { detailedDescription = null; } return new SynopsisHelpGenerator(metadata, argumentSynopsis, detailedDescription, maxColumns); }
java
@SuppressWarnings("static-method") @Provides @Singleton public HelpGenerator provideHelpGenerator( ApplicationMetadata metadata, Injector injector, Terminal terminal) { int maxColumns = terminal.getColumns(); if (maxColumns < TTY_MIN_COLUMNS) { maxColumns = TTY_DEFAULT_COLUMNS; } String argumentSynopsis; try { argumentSynopsis = injector.getInstance(Key.get(String.class, ApplicationArgumentSynopsis.class)); } catch (Exception exception) { argumentSynopsis = null; } String detailedDescription; try { detailedDescription = injector.getInstance(Key.get(String.class, ApplicationDetailedDescription.class)); } catch (Exception exception) { detailedDescription = null; } return new SynopsisHelpGenerator(metadata, argumentSynopsis, detailedDescription, maxColumns); }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "@", "Provides", "@", "Singleton", "public", "HelpGenerator", "provideHelpGenerator", "(", "ApplicationMetadata", "metadata", ",", "Injector", "injector", ",", "Terminal", "terminal", ")", "{", "int", "maxColumns...
Provide the help generator with synopsis. @param metadata the application metadata. @param injector the injector. @param terminal the terminal description. @return the help generator.
[ "Provide", "the", "help", "generator", "with", "synopsis", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-synopsishelp/src/main/java/org/arakhne/afc/bootique/synopsishelp/modules/SynopsisHelpGeneratorModule.java#L62-L84
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/ClusteringConfigurationBuilder.java
ClusteringConfigurationBuilder.biasLifespan
public ClusteringConfigurationBuilder biasLifespan(long l, TimeUnit unit) { attributes.attribute(BIAS_LIFESPAN).set(unit.toMillis(l)); return this; }
java
public ClusteringConfigurationBuilder biasLifespan(long l, TimeUnit unit) { attributes.attribute(BIAS_LIFESPAN).set(unit.toMillis(l)); return this; }
[ "public", "ClusteringConfigurationBuilder", "biasLifespan", "(", "long", "l", ",", "TimeUnit", "unit", ")", "{", "attributes", ".", "attribute", "(", "BIAS_LIFESPAN", ")", ".", "set", "(", "unit", ".", "toMillis", "(", "l", ")", ")", ";", "return", "this", ...
Used in scattered cache. Specifies how long can be the acquired bias held; while the reads will never be stale, tracking that information consumes memory on primary owner.
[ "Used", "in", "scattered", "cache", ".", "Specifies", "how", "long", "can", "be", "the", "acquired", "bias", "held", ";", "while", "the", "reads", "will", "never", "be", "stale", "tracking", "that", "information", "consumes", "memory", "on", "primary", "owne...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/ClusteringConfigurationBuilder.java#L112-L115
alkacon/opencms-core
src/org/opencms/search/A_CmsSearchIndex.java
A_CmsSearchIndex.getIndexWriter
public I_CmsIndexWriter getIndexWriter(I_CmsReport report, boolean create) throws CmsIndexException { // note - create will be: // true if the index is to be fully rebuild, // false if the index is to be incrementally updated if (m_indexWriter != null) { if (!create) { // re-use existing index writer return m_indexWriter; } // need to close the index writer if create is "true" try { m_indexWriter.close(); m_indexWriter = null; } catch (IOException e) { // if we can't close the index we are busted! throw new CmsIndexException( Messages.get().container(Messages.LOG_IO_INDEX_WRITER_CLOSE_2, getPath(), getName()), e); } } // now create is true of false, but the index writer is definitely null / closed I_CmsIndexWriter indexWriter = createIndexWriter(create, report); if (!create) { m_indexWriter = indexWriter; } return indexWriter; }
java
public I_CmsIndexWriter getIndexWriter(I_CmsReport report, boolean create) throws CmsIndexException { // note - create will be: // true if the index is to be fully rebuild, // false if the index is to be incrementally updated if (m_indexWriter != null) { if (!create) { // re-use existing index writer return m_indexWriter; } // need to close the index writer if create is "true" try { m_indexWriter.close(); m_indexWriter = null; } catch (IOException e) { // if we can't close the index we are busted! throw new CmsIndexException( Messages.get().container(Messages.LOG_IO_INDEX_WRITER_CLOSE_2, getPath(), getName()), e); } } // now create is true of false, but the index writer is definitely null / closed I_CmsIndexWriter indexWriter = createIndexWriter(create, report); if (!create) { m_indexWriter = indexWriter; } return indexWriter; }
[ "public", "I_CmsIndexWriter", "getIndexWriter", "(", "I_CmsReport", "report", ",", "boolean", "create", ")", "throws", "CmsIndexException", "{", "// note - create will be:", "// true if the index is to be fully rebuild,", "// false if the index is to be incrementally updated", "i...
Returns a new index writer for this index.<p> @param report the report to write error messages on @param create if <code>true</code> a whole new index is created, if <code>false</code> an existing index is updated @return a new instance of IndexWriter @throws CmsIndexException if the index can not be opened
[ "Returns", "a", "new", "index", "writer", "for", "this", "index", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/A_CmsSearchIndex.java#L349-L380
m-m-m/util
cli/src/main/java/net/sf/mmm/util/cli/base/CliClassContainer.java
CliClassContainer.initializeModeRecursive
protected List<String> initializeModeRecursive(CliModeContainer mode) { InitializationState state = mode.getState(); if (!state.isInitialized()) { if (state.isInitializing()) { // cycle detected List<String> cycle = new ArrayList<>(); cycle.add(mode.getId()); return cycle; } else { state.setInitializing(); } for (String parentId : mode.getMode().parentIds()) { CliModeContainer parentContainer = this.id2ModeMap.get(parentId); if (parentContainer == null) { throw new ObjectNotFoundException(CliMode.class, parentId); } List<String> cycle = initializeModeRecursive(parentContainer); if (cycle != null) { cycle.add(mode.getId()); return cycle; } mode.getExtendedModes().addAll(parentContainer.getExtendedModes()); } state.setInitialized(); } return null; }
java
protected List<String> initializeModeRecursive(CliModeContainer mode) { InitializationState state = mode.getState(); if (!state.isInitialized()) { if (state.isInitializing()) { // cycle detected List<String> cycle = new ArrayList<>(); cycle.add(mode.getId()); return cycle; } else { state.setInitializing(); } for (String parentId : mode.getMode().parentIds()) { CliModeContainer parentContainer = this.id2ModeMap.get(parentId); if (parentContainer == null) { throw new ObjectNotFoundException(CliMode.class, parentId); } List<String> cycle = initializeModeRecursive(parentContainer); if (cycle != null) { cycle.add(mode.getId()); return cycle; } mode.getExtendedModes().addAll(parentContainer.getExtendedModes()); } state.setInitialized(); } return null; }
[ "protected", "List", "<", "String", ">", "initializeModeRecursive", "(", "CliModeContainer", "mode", ")", "{", "InitializationState", "state", "=", "mode", ".", "getState", "(", ")", ";", "if", "(", "!", "state", ".", "isInitialized", "(", ")", ")", "{", "...
This method initializes the given {@link CliModeContainer}. @param mode is the {@link CliModeContainer} to initialize. @return a {@link List} of {@link CliModeContainer#getId() CLI mode IDs} (in reverse order) of a cyclic dependency that was detected, or {@code null} if the initialization was successful.
[ "This", "method", "initializes", "the", "given", "{", "@link", "CliModeContainer", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliClassContainer.java#L123-L150
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java
CPDefinitionLinkPersistenceImpl.removeByCP_T
@Override public void removeByCP_T(long CProductId, String type) { for (CPDefinitionLink cpDefinitionLink : findByCP_T(CProductId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionLink); } }
java
@Override public void removeByCP_T(long CProductId, String type) { for (CPDefinitionLink cpDefinitionLink : findByCP_T(CProductId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionLink); } }
[ "@", "Override", "public", "void", "removeByCP_T", "(", "long", "CProductId", ",", "String", "type", ")", "{", "for", "(", "CPDefinitionLink", "cpDefinitionLink", ":", "findByCP_T", "(", "CProductId", ",", "type", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryU...
Removes all the cp definition links where CProductId = &#63; and type = &#63; from the database. @param CProductId the c product ID @param type the type
[ "Removes", "all", "the", "cp", "definition", "links", "where", "CProductId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L3612-L3618
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java
CmsContainerpageController.updateGalleryData
void updateGalleryData(final boolean viewChanged, final Runnable nextAction) { CmsRpcAction<CmsContainerPageGalleryData> dataAction = new CmsRpcAction<CmsContainerPageGalleryData>() { @Override public void execute() { getContainerpageService().getGalleryDataForPage( getEditableContainers(), getElementView().getElementViewId(), CmsCoreProvider.get().getUri(), getData().getLocale(), this); } @Override protected void onResponse(CmsContainerPageGalleryData result) { m_handler.m_editor.getAdd().updateGalleryData(result, viewChanged); if (nextAction != null) { nextAction.run(); } } }; dataAction.execute(); }
java
void updateGalleryData(final boolean viewChanged, final Runnable nextAction) { CmsRpcAction<CmsContainerPageGalleryData> dataAction = new CmsRpcAction<CmsContainerPageGalleryData>() { @Override public void execute() { getContainerpageService().getGalleryDataForPage( getEditableContainers(), getElementView().getElementViewId(), CmsCoreProvider.get().getUri(), getData().getLocale(), this); } @Override protected void onResponse(CmsContainerPageGalleryData result) { m_handler.m_editor.getAdd().updateGalleryData(result, viewChanged); if (nextAction != null) { nextAction.run(); } } }; dataAction.execute(); }
[ "void", "updateGalleryData", "(", "final", "boolean", "viewChanged", ",", "final", "Runnable", "nextAction", ")", "{", "CmsRpcAction", "<", "CmsContainerPageGalleryData", ">", "dataAction", "=", "new", "CmsRpcAction", "<", "CmsContainerPageGalleryData", ">", "(", ")",...
Updates the gallery data according to the current element view and the editable containers.<p> This method should only be called from the gallery update timer to avoid unnecessary requests.<p> @param viewChanged <code>true</code> in case the element view changed @param nextAction the action to execute after updating the gallery data
[ "Updates", "the", "gallery", "data", "according", "to", "the", "current", "element", "view", "and", "the", "editable", "containers", ".", "<p", ">", "This", "method", "should", "only", "be", "called", "from", "the", "gallery", "update", "timer", "to", "avoid...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L3839-L3864
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.getFrameSource
public String getFrameSource(String frameName, String uri) { String frameString = "name=\"" + frameName + "\" src=\"" + uri + "\""; int paramIndex = uri.indexOf("?"); if (paramIndex != -1) { // remove request parameters from URI before putting it to Map uri = uri.substring(0, uri.indexOf("?")); } getSettings().getFrameUris().put(frameName, uri); return frameString; }
java
public String getFrameSource(String frameName, String uri) { String frameString = "name=\"" + frameName + "\" src=\"" + uri + "\""; int paramIndex = uri.indexOf("?"); if (paramIndex != -1) { // remove request parameters from URI before putting it to Map uri = uri.substring(0, uri.indexOf("?")); } getSettings().getFrameUris().put(frameName, uri); return frameString; }
[ "public", "String", "getFrameSource", "(", "String", "frameName", ",", "String", "uri", ")", "{", "String", "frameString", "=", "\"name=\\\"\"", "+", "frameName", "+", "\"\\\" src=\\\"\"", "+", "uri", "+", "\"\\\"\"", ";", "int", "paramIndex", "=", "uri", ".",...
Returns the html for the frame name and source and stores this information in the workplace settings.<p> @param frameName the name of the frame @param uri the absolute path of the frame @return the html for the frame name and source
[ "Returns", "the", "html", "for", "the", "frame", "name", "and", "source", "and", "stores", "this", "information", "in", "the", "workplace", "settings", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L1638-L1648
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Transform.java
Transform.createRotateTransform
public static Transform createRotateTransform(float angle, float x, float y) { Transform temp = Transform.createRotateTransform(angle); float sinAngle = temp.matrixPosition[3]; float oneMinusCosAngle = 1.0f - temp.matrixPosition[4]; temp.matrixPosition[2] = x * oneMinusCosAngle + y * sinAngle; temp.matrixPosition[5] = y * oneMinusCosAngle - x * sinAngle; return temp; }
java
public static Transform createRotateTransform(float angle, float x, float y) { Transform temp = Transform.createRotateTransform(angle); float sinAngle = temp.matrixPosition[3]; float oneMinusCosAngle = 1.0f - temp.matrixPosition[4]; temp.matrixPosition[2] = x * oneMinusCosAngle + y * sinAngle; temp.matrixPosition[5] = y * oneMinusCosAngle - x * sinAngle; return temp; }
[ "public", "static", "Transform", "createRotateTransform", "(", "float", "angle", ",", "float", "x", ",", "float", "y", ")", "{", "Transform", "temp", "=", "Transform", ".", "createRotateTransform", "(", "angle", ")", ";", "float", "sinAngle", "=", "temp", "....
Create a new rotation Transform around the specified point @param angle The angle in radians to set the transform. @param x The x coordinate around which to rotate. @param y The y coordinate around which to rotate. @return The resulting Transform
[ "Create", "a", "new", "rotation", "Transform", "around", "the", "specified", "point" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Transform.java#L184-L192
soi-toolkit/soi-toolkit-mule
tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/util/MiscUtil.java
MiscUtil.convertStreamToString
public static String convertStreamToString(InputStream is, String charset) { if (is == null) return null; StringBuilder sb = new StringBuilder(); String line; try { // TODO: Can this be a performance killer if many many lines or is BufferedReader handling that in a good way? BufferedReader reader = new BufferedReader(new InputStreamReader(is, charset)); while ((line = reader.readLine()) != null) { sb.append(line).append("\n"); } } catch (IOException e) { throw new RuntimeException(e); } finally { // Ignore exceptions on call to the close method try {is.close();} catch (IOException e) {} } return SourceFormatterUtil.formatSource(sb.toString()); }
java
public static String convertStreamToString(InputStream is, String charset) { if (is == null) return null; StringBuilder sb = new StringBuilder(); String line; try { // TODO: Can this be a performance killer if many many lines or is BufferedReader handling that in a good way? BufferedReader reader = new BufferedReader(new InputStreamReader(is, charset)); while ((line = reader.readLine()) != null) { sb.append(line).append("\n"); } } catch (IOException e) { throw new RuntimeException(e); } finally { // Ignore exceptions on call to the close method try {is.close();} catch (IOException e) {} } return SourceFormatterUtil.formatSource(sb.toString()); }
[ "public", "static", "String", "convertStreamToString", "(", "InputStream", "is", ",", "String", "charset", ")", "{", "if", "(", "is", "==", "null", ")", "return", "null", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "String", "li...
To convert an InputStream to a String we use the BufferedReader.readLine() method. We iterate until the BufferedReader return null which means there's no more data to read. Each line will appended to a StringBuilder and returned as String. @param is @return
[ "To", "convert", "an", "InputStream", "to", "a", "String", "we", "use", "the", "BufferedReader", ".", "readLine", "()", "method", ".", "We", "iterate", "until", "the", "BufferedReader", "return", "null", "which", "means", "there", "s", "no", "more", "data", ...
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/util/MiscUtil.java#L47-L67
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.writeToStream
public static void writeToStream(String fullFilePath, OutputStream out) throws IORuntimeException { writeToStream(touch(fullFilePath), out); }
java
public static void writeToStream(String fullFilePath, OutputStream out) throws IORuntimeException { writeToStream(touch(fullFilePath), out); }
[ "public", "static", "void", "writeToStream", "(", "String", "fullFilePath", ",", "OutputStream", "out", ")", "throws", "IORuntimeException", "{", "writeToStream", "(", "touch", "(", "fullFilePath", ")", ",", "out", ")", ";", "}" ]
将流的内容写入文件<br> @param fullFilePath 文件绝对路径 @param out 输出流 @throws IORuntimeException IO异常
[ "将流的内容写入文件<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3188-L3190
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.HEADING
public static HtmlTree HEADING(HtmlTag headingTag, Content body) { return HEADING(headingTag, false, null, body); }
java
public static HtmlTree HEADING(HtmlTag headingTag, Content body) { return HEADING(headingTag, false, null, body); }
[ "public", "static", "HtmlTree", "HEADING", "(", "HtmlTag", "headingTag", ",", "Content", "body", ")", "{", "return", "HEADING", "(", "headingTag", ",", "false", ",", "null", ",", "body", ")", ";", "}" ]
Generates a heading tag (h1 to h6) with some content. @param headingTag the heading tag to be generated @param body content for the tag @return an HtmlTree object for the tag
[ "Generates", "a", "heading", "tag", "(", "h1", "to", "h6", ")", "with", "some", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L437-L439
minio/minio-java
api/src/main/java/io/minio/ServerSideEncryption.java
ServerSideEncryption.withCustomerKey
public static ServerSideEncryption withCustomerKey(SecretKey key) throws InvalidKeyException, NoSuchAlgorithmException { if (!isCustomerKeyValid(key)) { throw new InvalidKeyException("The secret key is not a 256 bit AES key"); } return new ServerSideEncryptionWithCustomerKey(key, MessageDigest.getInstance(("MD5"))); }
java
public static ServerSideEncryption withCustomerKey(SecretKey key) throws InvalidKeyException, NoSuchAlgorithmException { if (!isCustomerKeyValid(key)) { throw new InvalidKeyException("The secret key is not a 256 bit AES key"); } return new ServerSideEncryptionWithCustomerKey(key, MessageDigest.getInstance(("MD5"))); }
[ "public", "static", "ServerSideEncryption", "withCustomerKey", "(", "SecretKey", "key", ")", "throws", "InvalidKeyException", ",", "NoSuchAlgorithmException", "{", "if", "(", "!", "isCustomerKeyValid", "(", "key", ")", ")", "{", "throw", "new", "InvalidKeyException", ...
Create a new server-side-encryption object for encryption with customer provided keys (a.k.a. SSE-C). @param key The secret AES-256 key. @return An instance of ServerSideEncryption implementing SSE-C. @throws InvalidKeyException if the provided secret key is not a 256 bit AES key. @throws NoSuchAlgorithmException if the crypto provider does not implement MD5.
[ "Create", "a", "new", "server", "-", "side", "-", "encryption", "object", "for", "encryption", "with", "customer", "provided", "keys", "(", "a", ".", "k", ".", "a", ".", "SSE", "-", "C", ")", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/ServerSideEncryption.java#L100-L106
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/CreateJobRequest.java
CreateJobRequest.withDefaultArguments
public CreateJobRequest withDefaultArguments(java.util.Map<String, String> defaultArguments) { setDefaultArguments(defaultArguments); return this; }
java
public CreateJobRequest withDefaultArguments(java.util.Map<String, String> defaultArguments) { setDefaultArguments(defaultArguments); return this; }
[ "public", "CreateJobRequest", "withDefaultArguments", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "defaultArguments", ")", "{", "setDefaultArguments", "(", "defaultArguments", ")", ";", "return", "this", ";", "}" ]
<p> The default arguments for this job. </p> <p> You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue itself consumes. </p> <p> For information about how to specify and consume your own Job arguments, see the <a href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue APIs in Python</a> topic in the developer guide. </p> <p> For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters Used by AWS Glue</a> topic in the developer guide. </p> @param defaultArguments The default arguments for this job.</p> <p> You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue itself consumes. </p> <p> For information about how to specify and consume your own Job arguments, see the <a href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue APIs in Python</a> topic in the developer guide. </p> <p> For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters Used by AWS Glue</a> topic in the developer guide. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "default", "arguments", "for", "this", "job", ".", "<", "/", "p", ">", "<p", ">", "You", "can", "specify", "arguments", "here", "that", "your", "own", "job", "-", "execution", "script", "consumes", "as", "well", "as", "arguments", "th...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/CreateJobRequest.java#L557-L560
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/android/support/v7/widget/ChatLinearLayoutManager.java
ChatLinearLayoutManager.findFirstVisibleChildClosestToEnd
private View findFirstVisibleChildClosestToEnd(boolean completelyVisible, boolean acceptPartiallyVisible) { if (mShouldReverseLayout) { return findOneVisibleChild(0, getChildCount(), completelyVisible, acceptPartiallyVisible); } else { return findOneVisibleChild(getChildCount() - 1, -1, completelyVisible, acceptPartiallyVisible); } }
java
private View findFirstVisibleChildClosestToEnd(boolean completelyVisible, boolean acceptPartiallyVisible) { if (mShouldReverseLayout) { return findOneVisibleChild(0, getChildCount(), completelyVisible, acceptPartiallyVisible); } else { return findOneVisibleChild(getChildCount() - 1, -1, completelyVisible, acceptPartiallyVisible); } }
[ "private", "View", "findFirstVisibleChildClosestToEnd", "(", "boolean", "completelyVisible", ",", "boolean", "acceptPartiallyVisible", ")", "{", "if", "(", "mShouldReverseLayout", ")", "{", "return", "findOneVisibleChild", "(", "0", ",", "getChildCount", "(", ")", ","...
Convenience method to find the visible child closes to end. Caller should check if it has enough children. @param completelyVisible Whether child should be completely visible or not @return The first visible child closest to end of the layout from user's perspective.
[ "Convenience", "method", "to", "find", "the", "visible", "child", "closes", "to", "end", ".", "Caller", "should", "check", "if", "it", "has", "enough", "children", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/android/support/v7/widget/ChatLinearLayoutManager.java#L1507-L1516
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/JodaBeanSer.java
JodaBeanSer.withIteratorFactory
public JodaBeanSer withIteratorFactory(SerIteratorFactory iteratorFactory) { JodaBeanUtils.notNull(iteratorFactory, "iteratorFactory"); return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived); }
java
public JodaBeanSer withIteratorFactory(SerIteratorFactory iteratorFactory) { JodaBeanUtils.notNull(iteratorFactory, "iteratorFactory"); return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived); }
[ "public", "JodaBeanSer", "withIteratorFactory", "(", "SerIteratorFactory", "iteratorFactory", ")", "{", "JodaBeanUtils", ".", "notNull", "(", "iteratorFactory", ",", "\"iteratorFactory\"", ")", ";", "return", "new", "JodaBeanSer", "(", "indent", ",", "newLine", ",", ...
Returns a copy of this serializer with the specified iterator factory. @param iteratorFactory the iterator factory, not null @return a copy of this object with the iterator factory changed, not null
[ "Returns", "a", "copy", "of", "this", "serializer", "with", "the", "specified", "iterator", "factory", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/JodaBeanSer.java#L181-L184
RKumsher/utils
src/main/java/com/github/rkumsher/date/RandomDateUtils.java
RandomDateUtils.randomBefore
public static long randomBefore(TemporalField field, long before) { long min = field.range().getMinimum(); long max = field.range().getMaximum(); checkArgument(before > min, "Before must be after %s", min); checkArgument(before <= max, "Before must be on or before %s", max); return randomLong(min, before); }
java
public static long randomBefore(TemporalField field, long before) { long min = field.range().getMinimum(); long max = field.range().getMaximum(); checkArgument(before > min, "Before must be after %s", min); checkArgument(before <= max, "Before must be on or before %s", max); return randomLong(min, before); }
[ "public", "static", "long", "randomBefore", "(", "TemporalField", "field", ",", "long", "before", ")", "{", "long", "min", "=", "field", ".", "range", "(", ")", ".", "getMinimum", "(", ")", ";", "long", "max", "=", "field", ".", "range", "(", ")", "....
Returns a random valid value for the given {@link TemporalField} between <code> TemporalField.range().min()</code> and <code>before</code>. For example, <code> randomBefore({@link ChronoField#HOUR_OF_DAY}, 13)</code> will return a random value between 0-12. @param field the {@link TemporalField} to return a valid value for @param before the value that the returned value must be before @return the random value @throws IllegalArgumentException if before is after <code> TemporalField.range().max() </code> or if before is on or before <code>TemporalField.range().min()</code>
[ "Returns", "a", "random", "valid", "value", "for", "the", "given", "{", "@link", "TemporalField", "}", "between", "<code", ">", "TemporalField", ".", "range", "()", ".", "min", "()", "<", "/", "code", ">", "and", "<code", ">", "before<", "/", "code", "...
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L646-L652
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendClose
public static void sendClose(final ByteBuffer data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) { CloseMessage sm = new CloseMessage(data); sendClose(sm, wsChannel, callback); }
java
public static void sendClose(final ByteBuffer data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) { CloseMessage sm = new CloseMessage(data); sendClose(sm, wsChannel, callback); }
[ "public", "static", "void", "sendClose", "(", "final", "ByteBuffer", "data", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "Void", ">", "callback", ")", "{", "CloseMessage", "sm", "=", "new", "CloseMessage", "(", "data", ...
Sends a complete close message, invoking the callback when complete @param data The data to send @param wsChannel The web socket channel @param callback The callback to invoke on completion
[ "Sends", "a", "complete", "close", "message", "invoking", "the", "callback", "when", "complete" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L768-L771
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_boostHistory_date_GET
public OvhBoostHistory serviceName_boostHistory_date_GET(String serviceName, java.util.Date date) throws IOException { String qPath = "/hosting/web/{serviceName}/boostHistory/{date}"; StringBuilder sb = path(qPath, serviceName, date); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBoostHistory.class); }
java
public OvhBoostHistory serviceName_boostHistory_date_GET(String serviceName, java.util.Date date) throws IOException { String qPath = "/hosting/web/{serviceName}/boostHistory/{date}"; StringBuilder sb = path(qPath, serviceName, date); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBoostHistory.class); }
[ "public", "OvhBoostHistory", "serviceName_boostHistory_date_GET", "(", "String", "serviceName", ",", "java", ".", "util", ".", "Date", "date", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/boostHistory/{date}\"", ";", "StringBuil...
Get this object properties REST: GET /hosting/web/{serviceName}/boostHistory/{date} @param serviceName [required] The internal name of your hosting @param date [required] The date when the change has been requested
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L246-L251
Azure/azure-sdk-for-java
redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java
RedisInner.beginExportData
public void beginExportData(String resourceGroupName, String name, ExportRDBParameters parameters) { beginExportDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); }
java
public void beginExportData(String resourceGroupName, String name, ExportRDBParameters parameters) { beginExportDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); }
[ "public", "void", "beginExportData", "(", "String", "resourceGroupName", ",", "String", "name", ",", "ExportRDBParameters", "parameters", ")", "{", "beginExportDataWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "parameters", ")", ".", "toBlocking...
Export data from the redis cache to blobs in a container. @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param parameters Parameters for Redis export operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Export", "data", "from", "the", "redis", "cache", "to", "blobs", "in", "a", "container", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L1584-L1586
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java
AuditorFactory.getAuditor
public static IHEAuditor getAuditor(Class<? extends IHEAuditor> clazz, boolean useGlobalConfig, boolean useGlobalContext) { AuditorModuleConfig config = AuditorModuleContext.getContext().getConfig(); if (!useGlobalConfig) { config = config.clone(); } return getAuditor(clazz, config, useGlobalContext); }
java
public static IHEAuditor getAuditor(Class<? extends IHEAuditor> clazz, boolean useGlobalConfig, boolean useGlobalContext) { AuditorModuleConfig config = AuditorModuleContext.getContext().getConfig(); if (!useGlobalConfig) { config = config.clone(); } return getAuditor(clazz, config, useGlobalContext); }
[ "public", "static", "IHEAuditor", "getAuditor", "(", "Class", "<", "?", "extends", "IHEAuditor", ">", "clazz", ",", "boolean", "useGlobalConfig", ",", "boolean", "useGlobalContext", ")", "{", "AuditorModuleConfig", "config", "=", "AuditorModuleContext", ".", "getCon...
Get an auditor instance for the specified auditor class. Auditor will use a standalone configuration or context if a non-global configuration / context is requested. If a standalone configuration is requested, the existing global configuration is cloned and used as the base configuration. @param clazz Class to instantiate @param useGlobalConfig Whether to use the global (true) or standalone (false) config @param useGlobalContext Whether to use the global (true) or standalone (false) context @return Instance of an IHE Auditor
[ "Get", "an", "auditor", "instance", "for", "the", "specified", "auditor", "class", ".", "Auditor", "will", "use", "a", "standalone", "configuration", "or", "context", "if", "a", "non", "-", "global", "configuration", "/", "context", "is", "requested", ".", "...
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L87-L95
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ApplicationOperations.java
ApplicationOperations.getApplication
public ApplicationSummary getApplication(String applicationId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { ApplicationGetOptions options = new ApplicationGetOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); return this.parentBatchClient.protocolLayer().applications().get(applicationId, options); }
java
public ApplicationSummary getApplication(String applicationId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { ApplicationGetOptions options = new ApplicationGetOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); return this.parentBatchClient.protocolLayer().applications().get(applicationId, options); }
[ "public", "ApplicationSummary", "getApplication", "(", "String", "applicationId", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "ApplicationGetOptions", "options", "=", "new", "Appli...
Gets information about the specified application. @param applicationId The ID of the application to get. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @return An {@link ApplicationSummary} containing information about the specified application. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Gets", "information", "about", "the", "specified", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ApplicationOperations.java#L101-L107
linkedin/linkedin-zookeeper
org.linkedin.zookeeper-impl/src/main/java/org/linkedin/zookeeper/tracker/ZKStringDataReader.java
ZKStringDataReader.isEqual
@Override public boolean isEqual(String data1, String data2) { return LangUtils.isEqual(data1, data2); }
java
@Override public boolean isEqual(String data1, String data2) { return LangUtils.isEqual(data1, data2); }
[ "@", "Override", "public", "boolean", "isEqual", "(", "String", "data1", ",", "String", "data2", ")", "{", "return", "LangUtils", ".", "isEqual", "(", "data1", ",", "data2", ")", ";", "}" ]
Compare 2 data equality @return <code>true</code> if equal (in the {@link Object#equals(Object)} definition)
[ "Compare", "2", "data", "equality" ]
train
https://github.com/linkedin/linkedin-zookeeper/blob/600b1d01318594ed425ede566bbbdc94b026a53e/org.linkedin.zookeeper-impl/src/main/java/org/linkedin/zookeeper/tracker/ZKStringDataReader.java#L51-L55
jsonld-java/jsonld-java
core/src/main/java/com/github/jsonldjava/core/DocumentLoader.java
DocumentLoader.addInjectedDoc
public DocumentLoader addInjectedDoc(String url, String doc) throws JsonLdError { try { m_injectedDocs.put(url, JsonUtils.fromString(doc)); return this; } catch (final Exception e) { throw new JsonLdError(JsonLdError.Error.LOADING_INJECTED_CONTEXT_FAILED, url, e); } }
java
public DocumentLoader addInjectedDoc(String url, String doc) throws JsonLdError { try { m_injectedDocs.put(url, JsonUtils.fromString(doc)); return this; } catch (final Exception e) { throw new JsonLdError(JsonLdError.Error.LOADING_INJECTED_CONTEXT_FAILED, url, e); } }
[ "public", "DocumentLoader", "addInjectedDoc", "(", "String", "url", ",", "String", "doc", ")", "throws", "JsonLdError", "{", "try", "{", "m_injectedDocs", ".", "put", "(", "url", ",", "JsonUtils", ".", "fromString", "(", "doc", ")", ")", ";", "return", "th...
Avoid resolving a document by instead using the given serialised representation. @param url The URL this document represents. @param doc The serialised document as a String @return This object for fluent addition of other injected documents. @throws JsonLdError If loading of the document failed for any reason.
[ "Avoid", "resolving", "a", "document", "by", "instead", "using", "the", "given", "serialised", "representation", "." ]
train
https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/DocumentLoader.java#L37-L44
sdl/Testy
src/main/java/com/sdl/selenium/extjs6/grid/Grid.java
Grid.setHeaders
public <T extends Table> T setHeaders(boolean strictPosition, final String... headers) { List<WebLocator> list = new ArrayList<>(); for (int i = 0; i < headers.length; i++) { WebLocator headerEL = new WebLocator(this).setClasses("x-column-header"). setText(headers[i], SearchType.DEEP_CHILD_NODE_OR_SELF, SearchType.EQUALS); if (strictPosition) { headerEL.setTag("*[" + (i + 1) + "]"); } list.add(headerEL); } setChildNodes(list.toArray(new WebLocator[0])); return (T) this; }
java
public <T extends Table> T setHeaders(boolean strictPosition, final String... headers) { List<WebLocator> list = new ArrayList<>(); for (int i = 0; i < headers.length; i++) { WebLocator headerEL = new WebLocator(this).setClasses("x-column-header"). setText(headers[i], SearchType.DEEP_CHILD_NODE_OR_SELF, SearchType.EQUALS); if (strictPosition) { headerEL.setTag("*[" + (i + 1) + "]"); } list.add(headerEL); } setChildNodes(list.toArray(new WebLocator[0])); return (T) this; }
[ "public", "<", "T", "extends", "Table", ">", "T", "setHeaders", "(", "boolean", "strictPosition", ",", "final", "String", "...", "headers", ")", "{", "List", "<", "WebLocator", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int...
<pre>{@code Grid grid = new Grid().setHeaders(true, "Company", "Price", "Change"); }</pre> @param strictPosition true if grid's headers is order @param headers grid's headers in order, if grid has no header put empty string @param <T> element which extended the Table @return this Grid
[ "<pre", ">", "{", "@code", "Grid", "grid", "=", "new", "Grid", "()", ".", "setHeaders", "(", "true", "Company", "Price", "Change", ")", ";", "}", "<", "/", "pre", ">" ]
train
https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/extjs6/grid/Grid.java#L66-L78
JodaOrg/joda-time
src/main/java/org/joda/time/convert/AbstractConverter.java
AbstractConverter.getPartialValues
public int[] getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono, DateTimeFormatter parser) { return getPartialValues(fieldSource, object, chrono); }
java
public int[] getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono, DateTimeFormatter parser) { return getPartialValues(fieldSource, object, chrono); }
[ "public", "int", "[", "]", "getPartialValues", "(", "ReadablePartial", "fieldSource", ",", "Object", "object", ",", "Chronology", "chrono", ",", "DateTimeFormatter", "parser", ")", "{", "return", "getPartialValues", "(", "fieldSource", ",", "object", ",", "chrono"...
Extracts the values of the partial from an object of this converter's type. The chrono parameter is a hint to the converter, should it require a chronology to aid in conversion. <p> This implementation calls {@link #getPartialValues(ReadablePartial, Object, Chronology)}. @param fieldSource a partial that provides access to the fields. This partial may be incomplete and only getFieldType(int) should be used @param object the object to convert @param chrono the chronology to use, which is the non-null result of getChronology() @param parser if converting from a String, the given parser is preferred @return the array of field values that match the fieldSource, must be non-null valid @throws ClassCastException if the object is invalid @since 1.3
[ "Extracts", "the", "values", "of", "the", "partial", "from", "an", "object", "of", "this", "converter", "s", "type", ".", "The", "chrono", "parameter", "is", "a", "hint", "to", "the", "converter", "should", "it", "require", "a", "chronology", "to", "aid", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/convert/AbstractConverter.java#L121-L124
jbossas/remoting-jmx
src/main/java/org/jboss/remotingjmx/protocol/v1/Common.java
Common.getUnMarshaller
private Unmarshaller getUnMarshaller(final MarshallerFactory marshallerFactory, final ClassResolver classResolver) throws IOException { final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); marshallingConfiguration.setClassResolver(classResolver); return marshallerFactory.createUnmarshaller(marshallingConfiguration); }
java
private Unmarshaller getUnMarshaller(final MarshallerFactory marshallerFactory, final ClassResolver classResolver) throws IOException { final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); marshallingConfiguration.setClassResolver(classResolver); return marshallerFactory.createUnmarshaller(marshallingConfiguration); }
[ "private", "Unmarshaller", "getUnMarshaller", "(", "final", "MarshallerFactory", "marshallerFactory", ",", "final", "ClassResolver", "classResolver", ")", "throws", "IOException", "{", "final", "MarshallingConfiguration", "marshallingConfiguration", "=", "new", "MarshallingCo...
Creates and returns a {@link Unmarshaller} @param marshallerFactory The marshaller factory @return @throws IOException
[ "Creates", "and", "returns", "a", "{", "@link", "Unmarshaller", "}" ]
train
https://github.com/jbossas/remoting-jmx/blob/dbc87bfed47e5bb9e37c355a77ca0ae9a6ea1363/src/main/java/org/jboss/remotingjmx/protocol/v1/Common.java#L178-L184
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.findByCPDefinitionId
@Override public List<CPInstance> findByCPDefinitionId(long CPDefinitionId, int start, int end) { return findByCPDefinitionId(CPDefinitionId, start, end, null); }
java
@Override public List<CPInstance> findByCPDefinitionId(long CPDefinitionId, int start, int end) { return findByCPDefinitionId(CPDefinitionId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPInstance", ">", "findByCPDefinitionId", "(", "long", "CPDefinitionId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCPDefinitionId", "(", "CPDefinitionId", ",", "start", ",", "end", ",", "null", ...
Returns a range of all the cp instances where CPDefinitionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPInstanceModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPDefinitionId the cp definition ID @param start the lower bound of the range of cp instances @param end the upper bound of the range of cp instances (not inclusive) @return the range of matching cp instances
[ "Returns", "a", "range", "of", "all", "the", "cp", "instances", "where", "CPDefinitionId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L2535-L2539
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java
XMLAssert.assertXMLNotEqual
public static void assertXMLNotEqual(String err, Reader control, Reader test) throws SAXException, IOException { Diff diff = new Diff(control, test); assertXMLEqual(err, diff, false); }
java
public static void assertXMLNotEqual(String err, Reader control, Reader test) throws SAXException, IOException { Diff diff = new Diff(control, test); assertXMLEqual(err, diff, false); }
[ "public", "static", "void", "assertXMLNotEqual", "(", "String", "err", ",", "Reader", "control", ",", "Reader", "test", ")", "throws", "SAXException", ",", "IOException", "{", "Diff", "diff", "=", "new", "Diff", "(", "control", ",", "test", ")", ";", "asse...
Assert that two XML documents are NOT similar @param err Message to be displayed on assertion failure @param control XML to be compared against @param test XML to be tested @throws SAXException @throws IOException
[ "Assert", "that", "two", "XML", "documents", "are", "NOT", "similar" ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L356-L360
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/FmtNumber.java
FmtNumber.execute
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Number) ) { throw new SuperCsvCellProcessorException(Number.class, value, context, this); } // create a new DecimalFormat if one is not supplied final DecimalFormat decimalFormatter; try { decimalFormatter = formatter != null ? formatter : new DecimalFormat(decimalFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException( String.format("'%s' is not a valid decimal format", decimalFormat), context, this, e); } final String result = decimalFormatter.format(value); return next.execute(result, context); }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Number) ) { throw new SuperCsvCellProcessorException(Number.class, value, context, this); } // create a new DecimalFormat if one is not supplied final DecimalFormat decimalFormatter; try { decimalFormatter = formatter != null ? formatter : new DecimalFormat(decimalFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException( String.format("'%s' is not a valid decimal format", decimalFormat), context, this, e); } final String result = decimalFormatter.format(value); return next.execute(result, context); }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "if", "(", "!", "(", "value", "instanceof", "Number", ")", ")", "{", "throw", ...
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null or not a Number, or if an invalid decimalFormat String was supplied
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/FmtNumber.java#L160-L179
spring-projects/spring-social-facebook
spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java
FqlResult.getInteger
public Integer getInteger(String fieldName) { try { return hasValue(fieldName) ? Integer.valueOf(String.valueOf(resultMap.get(fieldName))) : null; } catch (NumberFormatException e) { throw new FqlException("Field '" + fieldName +"' is not a number.", e); } }
java
public Integer getInteger(String fieldName) { try { return hasValue(fieldName) ? Integer.valueOf(String.valueOf(resultMap.get(fieldName))) : null; } catch (NumberFormatException e) { throw new FqlException("Field '" + fieldName +"' is not a number.", e); } }
[ "public", "Integer", "getInteger", "(", "String", "fieldName", ")", "{", "try", "{", "return", "hasValue", "(", "fieldName", ")", "?", "Integer", ".", "valueOf", "(", "String", ".", "valueOf", "(", "resultMap", ".", "get", "(", "fieldName", ")", ")", ")"...
Returns the value of the identified field as an Integer. @param fieldName the name of the field @return the value of the field as an Integer @throws FqlException if the field cannot be expressed as an Integer
[ "Returns", "the", "value", "of", "the", "identified", "field", "as", "an", "Integer", "." ]
train
https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L55-L61
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SendUsersMessageRequest.java
SendUsersMessageRequest.withContext
public SendUsersMessageRequest withContext(java.util.Map<String, String> context) { setContext(context); return this; }
java
public SendUsersMessageRequest withContext(java.util.Map<String, String> context) { setContext(context); return this; }
[ "public", "SendUsersMessageRequest", "withContext", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "context", ")", "{", "setContext", "(", "context", ")", ";", "return", "this", ";", "}" ]
A map of custom attribute-value pairs. Amazon Pinpoint adds these attributes to the data.pinpoint object in the body of the push notification payload. Amazon Pinpoint also provides these attributes in the events that it generates for users-messages deliveries. @param context A map of custom attribute-value pairs. Amazon Pinpoint adds these attributes to the data.pinpoint object in the body of the push notification payload. Amazon Pinpoint also provides these attributes in the events that it generates for users-messages deliveries. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "map", "of", "custom", "attribute", "-", "value", "pairs", ".", "Amazon", "Pinpoint", "adds", "these", "attributes", "to", "the", "data", ".", "pinpoint", "object", "in", "the", "body", "of", "the", "push", "notification", "payload", ".", "Amazon", "P...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SendUsersMessageRequest.java#L86-L89
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/JobHistory.java
JobHistory.parseLine
private static void parseLine(String line, Listener l, boolean isEscaped) throws IOException{ // extract the record type int idx = line.indexOf(' '); String recType = line.substring(0, idx); String data = line.substring(idx+1, line.length()); Matcher matcher = pattern.matcher(data); Map<Keys,String> parseBuffer = new HashMap<Keys, String>(); while(matcher.find()){ String tuple = matcher.group(0); String []parts = StringUtils.split(tuple, StringUtils.ESCAPE_CHAR, '='); String value = parts[1].substring(1, parts[1].length() -1); if (isEscaped) { value = StringUtils.unEscapeString(value, StringUtils.ESCAPE_CHAR, charsToEscape); } parseBuffer.put(Keys.valueOf(parts[0]), value); } l.handle(RecordTypes.valueOf(recType), parseBuffer); parseBuffer.clear(); }
java
private static void parseLine(String line, Listener l, boolean isEscaped) throws IOException{ // extract the record type int idx = line.indexOf(' '); String recType = line.substring(0, idx); String data = line.substring(idx+1, line.length()); Matcher matcher = pattern.matcher(data); Map<Keys,String> parseBuffer = new HashMap<Keys, String>(); while(matcher.find()){ String tuple = matcher.group(0); String []parts = StringUtils.split(tuple, StringUtils.ESCAPE_CHAR, '='); String value = parts[1].substring(1, parts[1].length() -1); if (isEscaped) { value = StringUtils.unEscapeString(value, StringUtils.ESCAPE_CHAR, charsToEscape); } parseBuffer.put(Keys.valueOf(parts[0]), value); } l.handle(RecordTypes.valueOf(recType), parseBuffer); parseBuffer.clear(); }
[ "private", "static", "void", "parseLine", "(", "String", "line", ",", "Listener", "l", ",", "boolean", "isEscaped", ")", "throws", "IOException", "{", "// extract the record type ", "int", "idx", "=", "line", ".", "indexOf", "(", "'", "'", ")", ";", "String"...
Parse a single line of history. @param line @param l @throws IOException
[ "Parse", "a", "single", "line", "of", "history", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobHistory.java#L619-L643
biezhi/anima
src/main/java/io/github/biezhi/anima/Anima.java
Anima.open
public static Anima open(DataSource dataSource, Quirks quirks) { return open(new Sql2o(dataSource, quirks)); }
java
public static Anima open(DataSource dataSource, Quirks quirks) { return open(new Sql2o(dataSource, quirks)); }
[ "public", "static", "Anima", "open", "(", "DataSource", "dataSource", ",", "Quirks", "quirks", ")", "{", "return", "open", "(", "new", "Sql2o", "(", "dataSource", ",", "quirks", ")", ")", ";", "}" ]
Create anima with datasource and quirks @param dataSource datasource instance @return Anima
[ "Create", "anima", "with", "datasource", "and", "quirks" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/Anima.java#L187-L189
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/StringUtils.java
StringUtils.readBytes
private static byte[] readBytes(final File aFile) throws IOException { final FileInputStream fileStream = new FileInputStream(aFile); final ByteBuffer buf = ByteBuffer.allocate((int) aFile.length()); final int read = fileStream.getChannel().read(buf); if (read != aFile.length()) { fileStream.close(); throw new IOException(LOGGER.getI18n(MessageCodes.UTIL_044, aFile)); } fileStream.close(); return buf.array(); }
java
private static byte[] readBytes(final File aFile) throws IOException { final FileInputStream fileStream = new FileInputStream(aFile); final ByteBuffer buf = ByteBuffer.allocate((int) aFile.length()); final int read = fileStream.getChannel().read(buf); if (read != aFile.length()) { fileStream.close(); throw new IOException(LOGGER.getI18n(MessageCodes.UTIL_044, aFile)); } fileStream.close(); return buf.array(); }
[ "private", "static", "byte", "[", "]", "readBytes", "(", "final", "File", "aFile", ")", "throws", "IOException", "{", "final", "FileInputStream", "fileStream", "=", "new", "FileInputStream", "(", "aFile", ")", ";", "final", "ByteBuffer", "buf", "=", "ByteBuffe...
Reads the contents of a file into a byte array. @param aFile The file from which to read @return The bytes read from the file @throws IOException If the supplied file could not be read in its entirety
[ "Reads", "the", "contents", "of", "a", "file", "into", "a", "byte", "array", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/StringUtils.java#L481-L493
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/Configs.java
Configs.getHavePathSelfConfigDecimal
public static BigDecimal getHavePathSelfConfigDecimal(String keyPrefix, IConfigKeyWithPath key) { String configAbsoluteClassPath = key.getConfigPath(); return getSelfConfigDecimal(configAbsoluteClassPath, keyPrefix, key); }
java
public static BigDecimal getHavePathSelfConfigDecimal(String keyPrefix, IConfigKeyWithPath key) { String configAbsoluteClassPath = key.getConfigPath(); return getSelfConfigDecimal(configAbsoluteClassPath, keyPrefix, key); }
[ "public", "static", "BigDecimal", "getHavePathSelfConfigDecimal", "(", "String", "keyPrefix", ",", "IConfigKeyWithPath", "key", ")", "{", "String", "configAbsoluteClassPath", "=", "key", ".", "getConfigPath", "(", ")", ";", "return", "getSelfConfigDecimal", "(", "conf...
Get self config decimal. Config key include prefix. Example:<br> If key.getKeyString() is "test", <br> getSelfConfigDecimal("1.", key); will return "1.test" config value in {@linkplain IConfigKeyWithPath#getConfigPath() path} set in key. @param keyPrefix config key prefix @param key config key with configAbsoluteClassPath in config file @return config BigDecimal value. Return null if not add config file or not config in config file. @see #addSelfConfigs(String, OneProperties)
[ "Get", "self", "config", "decimal", ".", "Config", "key", "include", "prefix", ".", "Example", ":", "<br", ">", "If", "key", ".", "getKeyString", "()", "is", "test", "<br", ">", "getSelfConfigDecimal", "(", "1", ".", "key", ")", ";", "will", "return", ...
train
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L411-L414
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java
SVGUtil.makeMarginTransform
public static String makeMarginTransform(double owidth, double oheight, double iwidth, double iheight, double margin) { return makeMarginTransform(owidth, oheight, iwidth, iheight, margin, margin, margin, margin); }
java
public static String makeMarginTransform(double owidth, double oheight, double iwidth, double iheight, double margin) { return makeMarginTransform(owidth, oheight, iwidth, iheight, margin, margin, margin, margin); }
[ "public", "static", "String", "makeMarginTransform", "(", "double", "owidth", ",", "double", "oheight", ",", "double", "iwidth", ",", "double", "iheight", ",", "double", "margin", ")", "{", "return", "makeMarginTransform", "(", "owidth", ",", "oheight", ",", "...
Make a transform string to add margins @param owidth Width of outer (embedding) canvas @param oheight Height of outer (embedding) canvas @param iwidth Width of inner (embedded) canvas @param iheight Height of inner (embedded) canvas @param margin Margin (in inner canvas' units) @return Transform string
[ "Make", "a", "transform", "string", "to", "add", "margins" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L614-L616
dustin/java-memcached-client
src/main/java/net/spy/memcached/MemcachedClient.java
MemcachedClient.getAndTouch
@Override public <T> CASValue<T> getAndTouch(String key, int exp, Transcoder<T> tc) { try { return asyncGetAndTouch(key, exp, tc).get(operationTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException("Interrupted waiting for value", e); } catch (ExecutionException e) { if(e.getCause() instanceof CancellationException) { throw (CancellationException) e.getCause(); } else { throw new RuntimeException("Exception waiting for value", e); } } catch (TimeoutException e) { throw new OperationTimeoutException("Timeout waiting for value", e); } }
java
@Override public <T> CASValue<T> getAndTouch(String key, int exp, Transcoder<T> tc) { try { return asyncGetAndTouch(key, exp, tc).get(operationTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException("Interrupted waiting for value", e); } catch (ExecutionException e) { if(e.getCause() instanceof CancellationException) { throw (CancellationException) e.getCause(); } else { throw new RuntimeException("Exception waiting for value", e); } } catch (TimeoutException e) { throw new OperationTimeoutException("Timeout waiting for value", e); } }
[ "@", "Override", "public", "<", "T", ">", "CASValue", "<", "T", ">", "getAndTouch", "(", "String", "key", ",", "int", "exp", ",", "Transcoder", "<", "T", ">", "tc", ")", "{", "try", "{", "return", "asyncGetAndTouch", "(", "key", ",", "exp", ",", "t...
Get with a single key and reset its expiration. @param <T> @param key the key to get @param exp the new expiration for the key @param tc the transcoder to serialize and unserialize value @return the result from the cache (null if there is none) @throws OperationTimeoutException if the global operation timeout is exceeded @throws CancellationException if operation was canceled @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests
[ "Get", "with", "a", "single", "key", "and", "reset", "its", "expiration", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1164-L1180
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/common/Similarity.java
Similarity.cosineSimilarity
public static double cosineSimilarity(double[] a, double[] b) { check(a,b); double dotProduct = 0.0; double aMagnitude = 0.0; double bMagnitude = 0.0; for (int i = 0; i < b.length ; i++) { double aValue = a[i]; double bValue = b[i]; aMagnitude += aValue * aValue; bMagnitude += bValue * bValue; dotProduct += aValue * bValue; } aMagnitude = Math.sqrt(aMagnitude); bMagnitude = Math.sqrt(bMagnitude); return (aMagnitude == 0 || bMagnitude == 0) ? 0 : dotProduct / (aMagnitude * bMagnitude); }
java
public static double cosineSimilarity(double[] a, double[] b) { check(a,b); double dotProduct = 0.0; double aMagnitude = 0.0; double bMagnitude = 0.0; for (int i = 0; i < b.length ; i++) { double aValue = a[i]; double bValue = b[i]; aMagnitude += aValue * aValue; bMagnitude += bValue * bValue; dotProduct += aValue * bValue; } aMagnitude = Math.sqrt(aMagnitude); bMagnitude = Math.sqrt(bMagnitude); return (aMagnitude == 0 || bMagnitude == 0) ? 0 : dotProduct / (aMagnitude * bMagnitude); }
[ "public", "static", "double", "cosineSimilarity", "(", "double", "[", "]", "a", ",", "double", "[", "]", "b", ")", "{", "check", "(", "a", ",", "b", ")", ";", "double", "dotProduct", "=", "0.0", ";", "double", "aMagnitude", "=", "0.0", ";", "double",...
Returns the cosine similarity of the two arrays. @throws IllegalArgumentException when the length of the two vectors are not the same.
[ "Returns", "the", "cosine", "similarity", "of", "the", "two", "arrays", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L325-L342
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/GridMemoryFieldTable.java
GridMemoryFieldTable.init
public void init(Rec record, PTable tableRemote, PhysicalDatabaseParent dbOwner) { super.init(record, tableRemote, dbOwner); m_iPhysicalIndex = NO_INDEX; m_iLogicalIndex = NO_INDEX; }
java
public void init(Rec record, PTable tableRemote, PhysicalDatabaseParent dbOwner) { super.init(record, tableRemote, dbOwner); m_iPhysicalIndex = NO_INDEX; m_iLogicalIndex = NO_INDEX; }
[ "public", "void", "init", "(", "Rec", "record", ",", "PTable", "tableRemote", ",", "PhysicalDatabaseParent", "dbOwner", ")", "{", "super", ".", "init", "(", "record", ",", "tableRemote", ",", "dbOwner", ")", ";", "m_iPhysicalIndex", "=", "NO_INDEX", ";", "m_...
Constructor. @param record The record to handle. @param tableRemote The remote table. @param server The remote server (only used for synchronization).
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/GridMemoryFieldTable.java#L77-L82
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java
DynamicJasperHelper.generateJasperPrint
public static JasperPrint generateJasperPrint(DynamicReport dr, LayoutManager layoutManager, JRDataSource ds, Map<String, Object> _parameters) throws JRException { log.info("generating JasperPrint"); JasperPrint jp; JasperReport jr = DynamicJasperHelper.generateJasperReport(dr, layoutManager, _parameters); jp = JasperFillManager.fillReport(jr, _parameters, ds); return jp; }
java
public static JasperPrint generateJasperPrint(DynamicReport dr, LayoutManager layoutManager, JRDataSource ds, Map<String, Object> _parameters) throws JRException { log.info("generating JasperPrint"); JasperPrint jp; JasperReport jr = DynamicJasperHelper.generateJasperReport(dr, layoutManager, _parameters); jp = JasperFillManager.fillReport(jr, _parameters, ds); return jp; }
[ "public", "static", "JasperPrint", "generateJasperPrint", "(", "DynamicReport", "dr", ",", "LayoutManager", "layoutManager", ",", "JRDataSource", "ds", ",", "Map", "<", "String", ",", "Object", ">", "_parameters", ")", "throws", "JRException", "{", "log", ".", "...
Compiles and fills the reports design. @param dr the DynamicReport @param layoutManager the object in charge of doing the layout @param ds The datasource @param _parameters Map with parameters that the report may need @return @throws JRException
[ "Compiles", "and", "fills", "the", "reports", "design", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java#L238-L247
elki-project/elki
elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/invertedlist/InMemoryInvertedIndex.java
InMemoryInvertedIndex.indexSparse
private void indexSparse(DBIDRef ref, SparseNumberVector obj) { double len = 0.; for(int iter = obj.iter(); obj.iterValid(iter); iter = obj.iterAdvance(iter)) { final int dim = obj.iterDim(iter); final double val = obj.iterDoubleValue(iter); if(val == 0. || val != val) { continue; } len += val * val; getOrCreateColumn(dim).add(val, ref); } length.put(ref, len); }
java
private void indexSparse(DBIDRef ref, SparseNumberVector obj) { double len = 0.; for(int iter = obj.iter(); obj.iterValid(iter); iter = obj.iterAdvance(iter)) { final int dim = obj.iterDim(iter); final double val = obj.iterDoubleValue(iter); if(val == 0. || val != val) { continue; } len += val * val; getOrCreateColumn(dim).add(val, ref); } length.put(ref, len); }
[ "private", "void", "indexSparse", "(", "DBIDRef", "ref", ",", "SparseNumberVector", "obj", ")", "{", "double", "len", "=", "0.", ";", "for", "(", "int", "iter", "=", "obj", ".", "iter", "(", ")", ";", "obj", ".", "iterValid", "(", "iter", ")", ";", ...
Index a single (sparse) instance. @param ref Object reference @param obj Object to index.
[ "Index", "a", "single", "(", "sparse", ")", "instance", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/invertedlist/InMemoryInvertedIndex.java#L126-L138
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/EntryStream.java
EntryStream.collapseByKey
@SequentialOnly public <R, A> Stream<R> collapseByKey(final BiPredicate<? super K, ? super K> collapsible, final Collector<? super V, A, R> collector) { final BiPredicate<? super Entry<K, V>, ? super Entry<K, V>> collapsible2 = new BiPredicate<Entry<K, V>, Entry<K, V>>() { @Override public boolean test(Entry<K, V> t, Entry<K, V> u) { return collapsible.test(t.getKey(), u.getKey()); } }; final Function<Entry<K, V>, V> mapper = Fn.value(); return s.collapse(collapsible2, Collectors.mapping(mapper, collector)); }
java
@SequentialOnly public <R, A> Stream<R> collapseByKey(final BiPredicate<? super K, ? super K> collapsible, final Collector<? super V, A, R> collector) { final BiPredicate<? super Entry<K, V>, ? super Entry<K, V>> collapsible2 = new BiPredicate<Entry<K, V>, Entry<K, V>>() { @Override public boolean test(Entry<K, V> t, Entry<K, V> u) { return collapsible.test(t.getKey(), u.getKey()); } }; final Function<Entry<K, V>, V> mapper = Fn.value(); return s.collapse(collapsible2, Collectors.mapping(mapper, collector)); }
[ "@", "SequentialOnly", "public", "<", "R", ",", "A", ">", "Stream", "<", "R", ">", "collapseByKey", "(", "final", "BiPredicate", "<", "?", "super", "K", ",", "?", "super", "K", ">", "collapsible", ",", "final", "Collector", "<", "?", "super", "V", ",...
Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream. <br /> This method only run sequentially, even in parallel stream. @param collapsible @param collector @return
[ "Merge", "series", "of", "adjacent", "elements", "which", "satisfy", "the", "given", "predicate", "using", "the", "merger", "function", "and", "return", "a", "new", "stream", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/EntryStream.java#L651-L663
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Bidi.java
Bidi.writeReverse
public static String writeReverse(String src, int options) { /* error checking */ if (src == null) { throw new IllegalArgumentException(); } if (src.length() > 0) { return BidiWriter.writeReverse(src, options); } else { /* nothing to do */ return ""; } }
java
public static String writeReverse(String src, int options) { /* error checking */ if (src == null) { throw new IllegalArgumentException(); } if (src.length() > 0) { return BidiWriter.writeReverse(src, options); } else { /* nothing to do */ return ""; } }
[ "public", "static", "String", "writeReverse", "(", "String", "src", ",", "int", "options", ")", "{", "/* error checking */", "if", "(", "src", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "src", ".", ...
Reverse a Right-To-Left run of Unicode text. This method preserves the integrity of characters with multiple code units and (optionally) combining characters. Characters can be replaced by mirror-image characters in the destination buffer. Note that "real" mirroring has to be done in a rendering engine by glyph selection and that for many "mirrored" characters there are no Unicode characters as mirror-image equivalents. There are also options to insert or remove Bidi control characters. This method is the implementation for reversing RTL runs as part of <code>writeReordered()</code>. For detailed descriptions of the parameters, see there. Since no Bidi controls are inserted here, the output string length will never exceed <code>src.length()</code>. @see #writeReordered @param src The RTL run text. @param options A bit set of options for the reordering that control how the reordered text is written. See the <code>options</code> parameter in <code>writeReordered()</code>. @return The reordered text. If the <code>REMOVE_BIDI_CONTROLS</code> option is set, then the length of the returned string may be less than <code>src.length()</code>. If this option is not set, then the length of the returned string will be exactly <code>src.length()</code>. @throws IllegalArgumentException if <code>src</code> is null.
[ "Reverse", "a", "Right", "-", "To", "-", "Left", "run", "of", "Unicode", "text", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Bidi.java#L5661-L5674
forge/core
addons/impl/src/main/java/org/jboss/forge/addon/addons/project/AddonProjectConfiguratorImpl.java
AddonProjectConfiguratorImpl.setupComplexAddonProject
@Override public void setupComplexAddonProject(Project project, Iterable<AddonId> dependencyAddons) throws FileNotFoundException, FacetNotFoundException { FacetFactory facetFactory = getFacetFactory(); DependencyInstaller dependencyInstaller = getDependencyInstaller(); generateReadme(project); MetadataFacet metadata = project.getFacet(MetadataFacet.class); String projectName = metadata.getProjectName(); metadata.setProjectName(projectName + "-parent"); project.getFacet(PackagingFacet.class).setPackagingType("pom"); facetFactory.install(project, AddonParentFacet.class); facetFactory.install(project, ForgeBOMFacet.class); Project addonProject = createSubmoduleProject(project, "addon", projectName, AddonAddonFacet.class); Project apiProject = createSubmoduleProject(project, "api", projectName + "-api", AddonAPIFacet.class, CDIFacet_1_1.class); Project implProject = createSubmoduleProject(project, "impl", projectName + "-impl", AddonImplFacet.class, CDIFacet_1_1.class); Project spiProject = createSubmoduleProject(project, "spi", projectName + "-spi", AddonSPIFacet.class); Project testsProject = createSubmoduleProject(project, "tests", projectName + "-tests", AddonTestFacet.class); Dependency apiProjectDependency = apiProject.getFacet(MetadataFacet.class).getOutputDependency(); Dependency implProjectDependency = implProject.getFacet(MetadataFacet.class).getOutputDependency(); Dependency spiProjectDependency = DependencyBuilder.create( spiProject.getFacet(MetadataFacet.class).getOutputDependency()) .setClassifier(FORGE_ADDON_CLASSIFIER); Dependency addonProjectDependency = DependencyBuilder.create( addonProject.getFacet(MetadataFacet.class).getOutputDependency()) .setClassifier(FORGE_ADDON_CLASSIFIER); dependencyInstaller.installManaged(project, DependencyBuilder.create(addonProjectDependency).setVersion("${project.version}")); dependencyInstaller.installManaged(project, DependencyBuilder.create(apiProjectDependency).setVersion("${project.version}")); dependencyInstaller.installManaged(project, DependencyBuilder.create(implProjectDependency).setVersion("${project.version}")); dependencyInstaller.installManaged(project, DependencyBuilder.create(spiProjectDependency).setVersion("${project.version}")); for (Project p : Arrays.asList(addonProject, apiProject, implProject, spiProject)) { JavaSourceFacet javaSource = p.getFacet(JavaSourceFacet.class); javaSource.saveJavaSource(Roaster.create(JavaPackageInfoSource.class).setPackage(javaSource.getBasePackage())); } installSelectedAddons(project, dependencyAddons, true); installSelectedAddons(addonProject, dependencyAddons, false); installSelectedAddons(apiProject, dependencyAddons, false); installSelectedAddons(testsProject, dependencyAddons, false); dependencyInstaller.install(addonProject, DependencyBuilder.create(apiProjectDependency)); dependencyInstaller.install(addonProject, DependencyBuilder.create(implProjectDependency) .setOptional(true) .setScopeType("runtime")); dependencyInstaller.install(addonProject, DependencyBuilder.create(spiProjectDependency)); dependencyInstaller.install(implProject, DependencyBuilder.create(apiProjectDependency).setScopeType("provided")); dependencyInstaller.install(implProject, DependencyBuilder.create(spiProjectDependency).setScopeType("provided")); dependencyInstaller.install(apiProject, DependencyBuilder.create(spiProjectDependency).setScopeType("provided")); dependencyInstaller.install(testsProject, addonProjectDependency); }
java
@Override public void setupComplexAddonProject(Project project, Iterable<AddonId> dependencyAddons) throws FileNotFoundException, FacetNotFoundException { FacetFactory facetFactory = getFacetFactory(); DependencyInstaller dependencyInstaller = getDependencyInstaller(); generateReadme(project); MetadataFacet metadata = project.getFacet(MetadataFacet.class); String projectName = metadata.getProjectName(); metadata.setProjectName(projectName + "-parent"); project.getFacet(PackagingFacet.class).setPackagingType("pom"); facetFactory.install(project, AddonParentFacet.class); facetFactory.install(project, ForgeBOMFacet.class); Project addonProject = createSubmoduleProject(project, "addon", projectName, AddonAddonFacet.class); Project apiProject = createSubmoduleProject(project, "api", projectName + "-api", AddonAPIFacet.class, CDIFacet_1_1.class); Project implProject = createSubmoduleProject(project, "impl", projectName + "-impl", AddonImplFacet.class, CDIFacet_1_1.class); Project spiProject = createSubmoduleProject(project, "spi", projectName + "-spi", AddonSPIFacet.class); Project testsProject = createSubmoduleProject(project, "tests", projectName + "-tests", AddonTestFacet.class); Dependency apiProjectDependency = apiProject.getFacet(MetadataFacet.class).getOutputDependency(); Dependency implProjectDependency = implProject.getFacet(MetadataFacet.class).getOutputDependency(); Dependency spiProjectDependency = DependencyBuilder.create( spiProject.getFacet(MetadataFacet.class).getOutputDependency()) .setClassifier(FORGE_ADDON_CLASSIFIER); Dependency addonProjectDependency = DependencyBuilder.create( addonProject.getFacet(MetadataFacet.class).getOutputDependency()) .setClassifier(FORGE_ADDON_CLASSIFIER); dependencyInstaller.installManaged(project, DependencyBuilder.create(addonProjectDependency).setVersion("${project.version}")); dependencyInstaller.installManaged(project, DependencyBuilder.create(apiProjectDependency).setVersion("${project.version}")); dependencyInstaller.installManaged(project, DependencyBuilder.create(implProjectDependency).setVersion("${project.version}")); dependencyInstaller.installManaged(project, DependencyBuilder.create(spiProjectDependency).setVersion("${project.version}")); for (Project p : Arrays.asList(addonProject, apiProject, implProject, spiProject)) { JavaSourceFacet javaSource = p.getFacet(JavaSourceFacet.class); javaSource.saveJavaSource(Roaster.create(JavaPackageInfoSource.class).setPackage(javaSource.getBasePackage())); } installSelectedAddons(project, dependencyAddons, true); installSelectedAddons(addonProject, dependencyAddons, false); installSelectedAddons(apiProject, dependencyAddons, false); installSelectedAddons(testsProject, dependencyAddons, false); dependencyInstaller.install(addonProject, DependencyBuilder.create(apiProjectDependency)); dependencyInstaller.install(addonProject, DependencyBuilder.create(implProjectDependency) .setOptional(true) .setScopeType("runtime")); dependencyInstaller.install(addonProject, DependencyBuilder.create(spiProjectDependency)); dependencyInstaller.install(implProject, DependencyBuilder.create(apiProjectDependency).setScopeType("provided")); dependencyInstaller.install(implProject, DependencyBuilder.create(spiProjectDependency).setScopeType("provided")); dependencyInstaller.install(apiProject, DependencyBuilder.create(spiProjectDependency).setScopeType("provided")); dependencyInstaller.install(testsProject, addonProjectDependency); }
[ "@", "Override", "public", "void", "setupComplexAddonProject", "(", "Project", "project", ",", "Iterable", "<", "AddonId", ">", "dependencyAddons", ")", "throws", "FileNotFoundException", ",", "FacetNotFoundException", "{", "FacetFactory", "facetFactory", "=", "getFacet...
Create a Furnace Project with the full structure (api,impl,tests,spi and addon) @throws FacetNotFoundException @throws FileNotFoundException
[ "Create", "a", "Furnace", "Project", "with", "the", "full", "structure", "(", "api", "impl", "tests", "spi", "and", "addon", ")" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/addons/impl/src/main/java/org/jboss/forge/addon/addons/project/AddonProjectConfiguratorImpl.java#L90-L157
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java
EnumHelper.getFromNameOrNull
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasName> ENUMTYPE getFromNameOrNull (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sName) { return getFromNameOrDefault (aClass, sName, null); }
java
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasName> ENUMTYPE getFromNameOrNull (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sName) { return getFromNameOrDefault (aClass, sName, null); }
[ "@", "Nullable", "public", "static", "<", "ENUMTYPE", "extends", "Enum", "<", "ENUMTYPE", ">", "&", "IHasName", ">", "ENUMTYPE", "getFromNameOrNull", "(", "@", "Nonnull", "final", "Class", "<", "ENUMTYPE", ">", "aClass", ",", "@", "Nullable", "final", "Strin...
Get the enum value with the passed name @param <ENUMTYPE> The enum type @param aClass The enum class @param sName The name to search @return <code>null</code> if no enum item with the given name is present.
[ "Get", "the", "enum", "value", "with", "the", "passed", "name" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java#L350-L355
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnectionFactoryImpl.java
JmsJcaManagedConnectionFactoryImpl.getReference
Reference getReference() { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "getReference"); } // Create a reference object describing this class final Reference reference = new Reference(getConnectionType(), getClass().getName(), null); // Make sure no-one can pull the rug from beneath us. synchronized (_properties) { // Convert the map of properties into an encoded form, where the // keys have the necessary prefix on the front, and the values are // all Strings. final Map encodedMap = JmsJcaReferenceUtils.getInstance() .getStringEncodedMap(_properties, defaultJNDIProperties); // Now turn the encoded map into the reference items. for (final Iterator iterator = encodedMap.entrySet().iterator(); iterator .hasNext();) { final Map.Entry entry = (Map.Entry) iterator.next(); final String prefixedKey = (String) entry.getKey(); final String stringForm = (String) entry.getValue(); // Store the prefixed key and value in string form. reference.add(new StringRefAddr(prefixedKey, stringForm)); } } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(TRACE, "getReference", reference); } return reference; }
java
Reference getReference() { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "getReference"); } // Create a reference object describing this class final Reference reference = new Reference(getConnectionType(), getClass().getName(), null); // Make sure no-one can pull the rug from beneath us. synchronized (_properties) { // Convert the map of properties into an encoded form, where the // keys have the necessary prefix on the front, and the values are // all Strings. final Map encodedMap = JmsJcaReferenceUtils.getInstance() .getStringEncodedMap(_properties, defaultJNDIProperties); // Now turn the encoded map into the reference items. for (final Iterator iterator = encodedMap.entrySet().iterator(); iterator .hasNext();) { final Map.Entry entry = (Map.Entry) iterator.next(); final String prefixedKey = (String) entry.getKey(); final String stringForm = (String) entry.getValue(); // Store the prefixed key and value in string form. reference.add(new StringRefAddr(prefixedKey, stringForm)); } } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(TRACE, "getReference", reference); } return reference; }
[ "Reference", "getReference", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "this", ",", "TRACE", ",", "\"getReference\"", ")", ";", ...
Returns a reference for this managed connection factory. @return a reference for this managed connection factory
[ "Returns", "a", "reference", "for", "this", "managed", "connection", "factory", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaManagedConnectionFactoryImpl.java#L1779-L1818
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.identity_group_group_GET
public OvhGroup identity_group_group_GET(String group) throws IOException { String qPath = "/me/identity/group/{group}"; StringBuilder sb = path(qPath, group); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhGroup.class); }
java
public OvhGroup identity_group_group_GET(String group) throws IOException { String qPath = "/me/identity/group/{group}"; StringBuilder sb = path(qPath, group); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhGroup.class); }
[ "public", "OvhGroup", "identity_group_group_GET", "(", "String", "group", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/identity/group/{group}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "group", ")", ";", "String", "resp", ...
Get this object properties REST: GET /me/identity/group/{group} @param group [required] Group's name
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L272-L277
apache/incubator-atlas
webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
EntityREST.validateUniqueAttribute
private void validateUniqueAttribute(AtlasEntityType entityType, Map<String, Object> attributes) throws AtlasBaseException { if (MapUtils.isEmpty(attributes)) { throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_UNIQUE_INVALID, entityType.getTypeName(), ""); } for (String attributeName : attributes.keySet()) { AtlasAttributeDef attribute = entityType.getAttributeDef(attributeName); if (attribute == null || !attribute.getIsUnique()) { throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_UNIQUE_INVALID, entityType.getTypeName(), attributeName); } } }
java
private void validateUniqueAttribute(AtlasEntityType entityType, Map<String, Object> attributes) throws AtlasBaseException { if (MapUtils.isEmpty(attributes)) { throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_UNIQUE_INVALID, entityType.getTypeName(), ""); } for (String attributeName : attributes.keySet()) { AtlasAttributeDef attribute = entityType.getAttributeDef(attributeName); if (attribute == null || !attribute.getIsUnique()) { throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_UNIQUE_INVALID, entityType.getTypeName(), attributeName); } } }
[ "private", "void", "validateUniqueAttribute", "(", "AtlasEntityType", "entityType", ",", "Map", "<", "String", ",", "Object", ">", "attributes", ")", "throws", "AtlasBaseException", "{", "if", "(", "MapUtils", ".", "isEmpty", "(", "attributes", ")", ")", "{", ...
Validate that each attribute given is an unique attribute @param entityType the entity type @param attributes attributes
[ "Validate", "that", "each", "attribute", "given", "is", "an", "unique", "attribute" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java#L557-L569
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java
Tools.showErrorMessage
static void showErrorMessage(Exception e, Component parent) { String msg = e.getMessage(); JOptionPane.showMessageDialog(parent, msg, "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); }
java
static void showErrorMessage(Exception e, Component parent) { String msg = e.getMessage(); JOptionPane.showMessageDialog(parent, msg, "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); }
[ "static", "void", "showErrorMessage", "(", "Exception", "e", ",", "Component", "parent", ")", "{", "String", "msg", "=", "e", ".", "getMessage", "(", ")", ";", "JOptionPane", ".", "showMessageDialog", "(", "parent", ",", "msg", ",", "\"Error\"", ",", "JOpt...
Show the exception (message without stacktrace) in a dialog and print the stacktrace to STDERR.
[ "Show", "the", "exception", "(", "message", "without", "stacktrace", ")", "in", "a", "dialog", "and", "print", "the", "stacktrace", "to", "STDERR", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java#L107-L111
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.readLines
public static List<String> readLines(InputStream stream, String charset) throws IOException { return readLines(newReader(stream, charset)); }
java
public static List<String> readLines(InputStream stream, String charset) throws IOException { return readLines(newReader(stream, charset)); }
[ "public", "static", "List", "<", "String", ">", "readLines", "(", "InputStream", "stream", ",", "String", "charset", ")", "throws", "IOException", "{", "return", "readLines", "(", "newReader", "(", "stream", ",", "charset", ")", ")", ";", "}" ]
Reads the stream into a list, with one element for each line. @param stream a stream @param charset opens the stream with a specified charset @return a List of lines @throws IOException if an IOException occurs. @see #readLines(java.io.Reader) @since 1.6.8
[ "Reads", "the", "stream", "into", "a", "list", "with", "one", "element", "for", "each", "line", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L783-L785
twilio/twilio-java
src/main/java/com/twilio/rest/proxy/v1/service/session/participant/MessageInteractionReader.java
MessageInteractionReader.firstPage
@Override @SuppressWarnings("checkstyle:linelength") public Page<MessageInteraction> firstPage(final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, Domains.PROXY.toString(), "/v1/Services/" + this.pathServiceSid + "/Sessions/" + this.pathSessionSid + "/Participants/" + this.pathParticipantSid + "/MessageInteractions", client.getRegion() ); addQueryParams(request); return pageForRequest(client, request); }
java
@Override @SuppressWarnings("checkstyle:linelength") public Page<MessageInteraction> firstPage(final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, Domains.PROXY.toString(), "/v1/Services/" + this.pathServiceSid + "/Sessions/" + this.pathSessionSid + "/Participants/" + this.pathParticipantSid + "/MessageInteractions", client.getRegion() ); addQueryParams(request); return pageForRequest(client, request); }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"checkstyle:linelength\"", ")", "public", "Page", "<", "MessageInteraction", ">", "firstPage", "(", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", "....
Make the request to the Twilio API to perform the read. @param client TwilioRestClient with which to make the request @return MessageInteraction ResourceSet
[ "Make", "the", "request", "to", "the", "Twilio", "API", "to", "perform", "the", "read", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/proxy/v1/service/session/participant/MessageInteractionReader.java#L63-L75
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2CodecUtil.java
Http2CodecUtil.streamableBytes
public static int streamableBytes(StreamByteDistributor.StreamState state) { return max(0, (int) min(state.pendingBytes(), state.windowSize())); }
java
public static int streamableBytes(StreamByteDistributor.StreamState state) { return max(0, (int) min(state.pendingBytes(), state.windowSize())); }
[ "public", "static", "int", "streamableBytes", "(", "StreamByteDistributor", ".", "StreamState", "state", ")", "{", "return", "max", "(", "0", ",", "(", "int", ")", "min", "(", "state", ".", "pendingBytes", "(", ")", ",", "state", ".", "windowSize", "(", ...
Calculate the amount of bytes that can be sent by {@code state}. The lower bound is {@code 0}.
[ "Calculate", "the", "amount", "of", "bytes", "that", "can", "be", "sent", "by", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2CodecUtil.java#L214-L216
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java
NamespacesInner.patchAsync
public Observable<NamespaceResourceInner> patchAsync(String resourceGroupName, String namespaceName, NamespacePatchParameters parameters) { return patchWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1<ServiceResponse<NamespaceResourceInner>, NamespaceResourceInner>() { @Override public NamespaceResourceInner call(ServiceResponse<NamespaceResourceInner> response) { return response.body(); } }); }
java
public Observable<NamespaceResourceInner> patchAsync(String resourceGroupName, String namespaceName, NamespacePatchParameters parameters) { return patchWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1<ServiceResponse<NamespaceResourceInner>, NamespaceResourceInner>() { @Override public NamespaceResourceInner call(ServiceResponse<NamespaceResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NamespaceResourceInner", ">", "patchAsync", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "NamespacePatchParameters", "parameters", ")", "{", "return", "patchWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Patches the existing namespace. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param parameters Parameters supplied to patch a Namespace Resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NamespaceResourceInner object
[ "Patches", "the", "existing", "namespace", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java#L357-L364
deeplearning4j/deeplearning4j
nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/AeronUtil.java
AeronUtil.subscriberLoop
public static Consumer<Subscription> subscriberLoop(final FragmentHandler fragmentHandler, final int limit, final AtomicBoolean running, final AtomicBoolean launched) { final IdleStrategy idleStrategy = new BusySpinIdleStrategy(); return subscriberLoop(fragmentHandler, limit, running, idleStrategy, launched); }
java
public static Consumer<Subscription> subscriberLoop(final FragmentHandler fragmentHandler, final int limit, final AtomicBoolean running, final AtomicBoolean launched) { final IdleStrategy idleStrategy = new BusySpinIdleStrategy(); return subscriberLoop(fragmentHandler, limit, running, idleStrategy, launched); }
[ "public", "static", "Consumer", "<", "Subscription", ">", "subscriberLoop", "(", "final", "FragmentHandler", "fragmentHandler", ",", "final", "int", "limit", ",", "final", "AtomicBoolean", "running", ",", "final", "AtomicBoolean", "launched", ")", "{", "final", "I...
Return a reusable, parametrized event loop that calls a default idler when no messages are received @param fragmentHandler to be called back for each message. @param limit passed to {@link Subscription#poll(FragmentHandler, int)} @param running indication for loop @return loop function
[ "Return", "a", "reusable", "parametrized", "event", "loop", "that", "calls", "a", "default", "idler", "when", "no", "messages", "are", "received" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/AeronUtil.java#L89-L93
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeLockList.java
InodeLockList.lockEdgeInternal
public void lockEdgeInternal(String childName, LockMode mode) { Preconditions.checkState(endsInInode()); Inode lastInode = get(numLockedInodes() - 1); Edge edge = new Edge(lastInode.getId(), childName); mEntries.add(new EdgeEntry(mInodeLockManager.lockEdge(edge, mode), edge)); }
java
public void lockEdgeInternal(String childName, LockMode mode) { Preconditions.checkState(endsInInode()); Inode lastInode = get(numLockedInodes() - 1); Edge edge = new Edge(lastInode.getId(), childName); mEntries.add(new EdgeEntry(mInodeLockManager.lockEdge(edge, mode), edge)); }
[ "public", "void", "lockEdgeInternal", "(", "String", "childName", ",", "LockMode", "mode", ")", "{", "Preconditions", ".", "checkState", "(", "endsInInode", "(", ")", ")", ";", "Inode", "lastInode", "=", "get", "(", "numLockedInodes", "(", ")", "-", "1", "...
Locks the next edge without checking or updating the mode. @param childName the child to lock @param mode the mode to lock in
[ "Locks", "the", "next", "edge", "without", "checking", "or", "updating", "the", "mode", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockList.java#L124-L130
alkacon/opencms-core
src/org/opencms/search/CmsSearchIndexSource.java
CmsSearchIndexSource.isIndexing
public boolean isIndexing(String rootPath, String documentType) { return m_documentTypes.contains(documentType) && isContaining(rootPath); }
java
public boolean isIndexing(String rootPath, String documentType) { return m_documentTypes.contains(documentType) && isContaining(rootPath); }
[ "public", "boolean", "isIndexing", "(", "String", "rootPath", ",", "String", "documentType", ")", "{", "return", "m_documentTypes", ".", "contains", "(", "documentType", ")", "&&", "isContaining", "(", "rootPath", ")", ";", "}" ]
Returns <code>true</code> in case the given resource root path is contained in the list of configured resource names, and the given document type name is contained in the list if configured document type names of this index source.<p> @param rootPath the resource root path to check @param documentType the document type factory name to check @return <code>true</code> in case the given resource root path is contained in the list of configured resource names, and the given document type name is contained in the list if configured document type names of this index source @see #isContaining(String) @see #getDocumentTypes()
[ "Returns", "<code", ">", "true<", "/", "code", ">", "in", "case", "the", "given", "resource", "root", "path", "is", "contained", "in", "the", "list", "of", "configured", "resource", "names", "and", "the", "given", "document", "type", "name", "is", "contain...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchIndexSource.java#L278-L281
oglimmer/utils
src/main/java/de/oglimmer/utils/date/DateHelper.java
DateHelper.formatDateDifference
public static String formatDateDifference(Date d1, Date d2) { long[] td = DateHelper.getTimeDifference(d1, d2); if (td[0] > 0) { return td[0] + " day(s), " + td[1] + " hour(s)"; } if (td[1] > 0) { return td[1] + " hour(s), " + td[2] + " minute(s)"; } if (td[2] > 0) { return td[2] + " minute(s), " + td[3] + " second(s)"; } return td[3] + " second(s)"; }
java
public static String formatDateDifference(Date d1, Date d2) { long[] td = DateHelper.getTimeDifference(d1, d2); if (td[0] > 0) { return td[0] + " day(s), " + td[1] + " hour(s)"; } if (td[1] > 0) { return td[1] + " hour(s), " + td[2] + " minute(s)"; } if (td[2] > 0) { return td[2] + " minute(s), " + td[3] + " second(s)"; } return td[3] + " second(s)"; }
[ "public", "static", "String", "formatDateDifference", "(", "Date", "d1", ",", "Date", "d2", ")", "{", "long", "[", "]", "td", "=", "DateHelper", ".", "getTimeDifference", "(", "d1", ",", "d2", ")", ";", "if", "(", "td", "[", "0", "]", ">", "0", ")"...
Calculates a human readable date/time difference. @param d1 a starting date @param d2 an end date @return a string which reads like x days, y hours, z minutes ...
[ "Calculates", "a", "human", "readable", "date", "/", "time", "difference", "." ]
train
https://github.com/oglimmer/utils/blob/bc46c57a24e60c9dbda4c73a810c163b0ce407ea/src/main/java/de/oglimmer/utils/date/DateHelper.java#L27-L39
pravega/pravega
common/src/main/java/io/pravega/common/util/BitConverter.java
BitConverter.writeShort
public static int writeShort(byte[] target, int offset, short value) { target[offset] = (byte) (value >>> 8 & 255); target[offset + 1] = (byte) (value & 255); return Short.BYTES; }
java
public static int writeShort(byte[] target, int offset, short value) { target[offset] = (byte) (value >>> 8 & 255); target[offset + 1] = (byte) (value & 255); return Short.BYTES; }
[ "public", "static", "int", "writeShort", "(", "byte", "[", "]", "target", ",", "int", "offset", ",", "short", "value", ")", "{", "target", "[", "offset", "]", "=", "(", "byte", ")", "(", "value", ">>>", "8", "&", "255", ")", ";", "target", "[", "...
Writes the given 16-bit Short to the given byte array at the given offset. @param target The byte array to write to. @param offset The offset within the byte array to write at. @param value The value to write. @return The number of bytes written.
[ "Writes", "the", "given", "16", "-", "bit", "Short", "to", "the", "given", "byte", "array", "at", "the", "given", "offset", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L42-L46
hawkular/hawkular-apm
client/collector/src/main/java/org/hawkular/apm/client/collector/internal/DefaultTraceCollector.java
DefaultTraceCollector.processOutContent
protected void processOutContent(String location, FragmentBuilder builder, int hashCode) { if (builder.isOutBufferActive(hashCode)) { processOut(location, null, builder.getOutData(hashCode)); } else if (log.isLoggable(Level.FINEST)) { log.finest("processOutContent: location=[" + location + "] hashCode=" + hashCode + " out buffer is not active"); } }
java
protected void processOutContent(String location, FragmentBuilder builder, int hashCode) { if (builder.isOutBufferActive(hashCode)) { processOut(location, null, builder.getOutData(hashCode)); } else if (log.isLoggable(Level.FINEST)) { log.finest("processOutContent: location=[" + location + "] hashCode=" + hashCode + " out buffer is not active"); } }
[ "protected", "void", "processOutContent", "(", "String", "location", ",", "FragmentBuilder", "builder", ",", "int", "hashCode", ")", "{", "if", "(", "builder", ".", "isOutBufferActive", "(", "hashCode", ")", ")", "{", "processOut", "(", "location", ",", "null"...
This method processes the out content if available. @param location The instrumentation location @param builder The builder @param hashCode The hash code, or -1 to ignore the hash code
[ "This", "method", "processes", "the", "out", "content", "if", "available", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/DefaultTraceCollector.java#L1002-L1009
phax/ph-css
ph-css/src/main/java/com/helger/css/utils/CSSURLHelper.java
CSSURLHelper.getEscapedCSSURL
@Nonnull @Nonempty public static String getEscapedCSSURL (@Nonnull final String sURL, final char cQuoteChar) { ValueEnforcer.notNull (sURL, "URL"); if (sURL.indexOf (cQuoteChar) < 0 && sURL.indexOf (CSSParseHelper.URL_ESCAPE_CHAR) < 0) { // Found nothing to quote return sURL; } final StringBuilder aSB = new StringBuilder (sURL.length () * 2); for (final char c : sURL.toCharArray ()) { // Escape the quote char and the escape char itself if (c == cQuoteChar || c == CSSParseHelper.URL_ESCAPE_CHAR) aSB.append (CSSParseHelper.URL_ESCAPE_CHAR); aSB.append (c); } return aSB.toString (); }
java
@Nonnull @Nonempty public static String getEscapedCSSURL (@Nonnull final String sURL, final char cQuoteChar) { ValueEnforcer.notNull (sURL, "URL"); if (sURL.indexOf (cQuoteChar) < 0 && sURL.indexOf (CSSParseHelper.URL_ESCAPE_CHAR) < 0) { // Found nothing to quote return sURL; } final StringBuilder aSB = new StringBuilder (sURL.length () * 2); for (final char c : sURL.toCharArray ()) { // Escape the quote char and the escape char itself if (c == cQuoteChar || c == CSSParseHelper.URL_ESCAPE_CHAR) aSB.append (CSSParseHelper.URL_ESCAPE_CHAR); aSB.append (c); } return aSB.toString (); }
[ "@", "Nonnull", "@", "Nonempty", "public", "static", "String", "getEscapedCSSURL", "(", "@", "Nonnull", "final", "String", "sURL", ",", "final", "char", "cQuoteChar", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sURL", ",", "\"URL\"", ")", ";", "if", "...
Internal method to escape a CSS URL. Because this method is only called for quoted URLs, only the quote character itself needs to be quoted. @param sURL The URL to be escaped. May not be <code>null</code>. @param cQuoteChar The quote char that is used. Either '\'' or '"' @return The escaped string. Never <code>null</code>.
[ "Internal", "method", "to", "escape", "a", "CSS", "URL", ".", "Because", "this", "method", "is", "only", "called", "for", "quoted", "URLs", "only", "the", "quote", "character", "itself", "needs", "to", "be", "quoted", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/utils/CSSURLHelper.java#L158-L179
Wikidata/Wikidata-Toolkit
wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java
ApiConnection.fillCookies
@Deprecated void fillCookies(Map<String, List<String>> headerFields) { List<String> headerCookies = headerFields .get(ApiConnection.HEADER_FIELD_SET_COOKIE); if (headerCookies != null) { for (String cookie : headerCookies) { String[] cookieResponse = cookie.split(";\\p{Space}??"); for (String cookieLine : cookieResponse) { String[] entry = cookieLine.split("="); if (entry.length == 2) { this.cookies.put(entry[0], entry[1]); } if (entry.length == 1) { this.cookies.put(entry[0], ""); } } } } }
java
@Deprecated void fillCookies(Map<String, List<String>> headerFields) { List<String> headerCookies = headerFields .get(ApiConnection.HEADER_FIELD_SET_COOKIE); if (headerCookies != null) { for (String cookie : headerCookies) { String[] cookieResponse = cookie.split(";\\p{Space}??"); for (String cookieLine : cookieResponse) { String[] entry = cookieLine.split("="); if (entry.length == 2) { this.cookies.put(entry[0], entry[1]); } if (entry.length == 1) { this.cookies.put(entry[0], ""); } } } } }
[ "@", "Deprecated", "void", "fillCookies", "(", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "headerFields", ")", "{", "List", "<", "String", ">", "headerCookies", "=", "headerFields", ".", "get", "(", "ApiConnection", ".", "HEADER_FIELD_SET_CO...
Reads out the Set-Cookie Header Fields and fills the cookie map of the API connection with it. @deprecated to be migrated to {@class PasswordApiConnection}
[ "Reads", "out", "the", "Set", "-", "Cookie", "Header", "Fields", "and", "fills", "the", "cookie", "map", "of", "the", "API", "connection", "with", "it", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java#L643-L661
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
DirectoryHelper.deleteDstAndRename
public static void deleteDstAndRename(File srcFile, File dstFile) throws IOException { if (dstFile.exists()) { if (!dstFile.delete()) { throw new IOException("Cannot delete " + dstFile); } } renameFile(srcFile, dstFile); }
java
public static void deleteDstAndRename(File srcFile, File dstFile) throws IOException { if (dstFile.exists()) { if (!dstFile.delete()) { throw new IOException("Cannot delete " + dstFile); } } renameFile(srcFile, dstFile); }
[ "public", "static", "void", "deleteDstAndRename", "(", "File", "srcFile", ",", "File", "dstFile", ")", "throws", "IOException", "{", "if", "(", "dstFile", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "dstFile", ".", "delete", "(", ")", ")", "{", ...
Rename file. Trying to remove destination first. If file can't be renamed in standard way the coping data will be used instead. @param srcFile source file @param dstFile destination file @throws IOException if any exception occurred
[ "Rename", "file", ".", "Trying", "to", "remove", "destination", "first", ".", "If", "file", "can", "t", "be", "renamed", "in", "standard", "way", "the", "coping", "data", "will", "be", "used", "instead", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java#L384-L395
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java
CPOptionPersistenceImpl.findByUUID_G
@Override public CPOption findByUUID_G(String uuid, long groupId) throws NoSuchCPOptionException { CPOption cpOption = fetchByUUID_G(uuid, groupId); if (cpOption == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPOptionException(msg.toString()); } return cpOption; }
java
@Override public CPOption findByUUID_G(String uuid, long groupId) throws NoSuchCPOptionException { CPOption cpOption = fetchByUUID_G(uuid, groupId); if (cpOption == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPOptionException(msg.toString()); } return cpOption; }
[ "@", "Override", "public", "CPOption", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCPOptionException", "{", "CPOption", "cpOption", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(", "cpOption", "==...
Returns the cp option where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPOptionException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp option @throws NoSuchCPOptionException if a matching cp option could not be found
[ "Returns", "the", "cp", "option", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPOptionException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L659-L685
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.readString
public static String readString(File file, String charsetName) throws IORuntimeException { return readString(file, CharsetUtil.charset(charsetName)); }
java
public static String readString(File file, String charsetName) throws IORuntimeException { return readString(file, CharsetUtil.charset(charsetName)); }
[ "public", "static", "String", "readString", "(", "File", "file", ",", "String", "charsetName", ")", "throws", "IORuntimeException", "{", "return", "readString", "(", "file", ",", "CharsetUtil", ".", "charset", "(", "charsetName", ")", ")", ";", "}" ]
读取文件内容 @param file 文件 @param charsetName 字符集 @return 内容 @throws IORuntimeException IO异常
[ "读取文件内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2090-L2092
alkacon/opencms-core
src/org/opencms/ade/configuration/formatters/CmsFormatterConfigurationCache.java
CmsFormatterConfigurationCache.checkIfUpdateIsNeeded
private void checkIfUpdateIsNeeded(CmsUUID structureId, String path, int resourceType) { if (CmsResource.isTemporaryFileName(path)) { return; } CmsResourceManager manager = OpenCms.getResourceManager(); if (manager.matchResourceType(TYPE_SETTINGS_CONFIG, resourceType)) { // for each formatter configuration, only the combined settings are stored, not // the reference to the settings config. So we need to reload everything when a setting configuration // changes. markForUpdate(RELOAD_MARKER); return; } if (manager.matchResourceType(TYPE_FORMATTER_CONFIG, resourceType) || manager.matchResourceType(TYPE_MACRO_FORMATTER, resourceType) || manager.matchResourceType(TYPE_FLEX_FORMATTER, resourceType) || manager.matchResourceType(CmsResourceTypeFunctionConfig.TYPE_NAME, resourceType)) { markForUpdate(structureId); } }
java
private void checkIfUpdateIsNeeded(CmsUUID structureId, String path, int resourceType) { if (CmsResource.isTemporaryFileName(path)) { return; } CmsResourceManager manager = OpenCms.getResourceManager(); if (manager.matchResourceType(TYPE_SETTINGS_CONFIG, resourceType)) { // for each formatter configuration, only the combined settings are stored, not // the reference to the settings config. So we need to reload everything when a setting configuration // changes. markForUpdate(RELOAD_MARKER); return; } if (manager.matchResourceType(TYPE_FORMATTER_CONFIG, resourceType) || manager.matchResourceType(TYPE_MACRO_FORMATTER, resourceType) || manager.matchResourceType(TYPE_FLEX_FORMATTER, resourceType) || manager.matchResourceType(CmsResourceTypeFunctionConfig.TYPE_NAME, resourceType)) { markForUpdate(structureId); } }
[ "private", "void", "checkIfUpdateIsNeeded", "(", "CmsUUID", "structureId", ",", "String", "path", ",", "int", "resourceType", ")", "{", "if", "(", "CmsResource", ".", "isTemporaryFileName", "(", "path", ")", ")", "{", "return", ";", "}", "CmsResourceManager", ...
Checks if an update of the formatter is needed and if so, adds its structure id to the update set.<p> @param structureId the structure id of the formatter @param path the path of the formatter @param resourceType the resource type
[ "Checks", "if", "an", "update", "of", "the", "formatter", "is", "needed", "and", "if", "so", "adds", "its", "structure", "id", "to", "the", "update", "set", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/formatters/CmsFormatterConfigurationCache.java#L368-L389
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java
NumberCodeGenerator.addCurrencyInfoMethod
private void addCurrencyInfoMethod(TypeSpec.Builder type, String name, Map<String, String> mapping) { MethodSpec.Builder method = MethodSpec.methodBuilder(name) .addModifiers(PUBLIC) .addParameter(Types.CLDR_CURRENCY_ENUM, "code") .returns(String.class); method.beginControlFlow("if (code == null)"); method.addStatement("return $S", ""); method.endControlFlow(); method.beginControlFlow("switch (code)"); for (Map.Entry<String, String> entry : mapping.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); if (!key.equals(val)) { method.addStatement("case $L: return $S", key, val); } } method.addStatement("default: return code.name()"); method.endControlFlow(); type.addMethod(method.build()); }
java
private void addCurrencyInfoMethod(TypeSpec.Builder type, String name, Map<String, String> mapping) { MethodSpec.Builder method = MethodSpec.methodBuilder(name) .addModifiers(PUBLIC) .addParameter(Types.CLDR_CURRENCY_ENUM, "code") .returns(String.class); method.beginControlFlow("if (code == null)"); method.addStatement("return $S", ""); method.endControlFlow(); method.beginControlFlow("switch (code)"); for (Map.Entry<String, String> entry : mapping.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); if (!key.equals(val)) { method.addStatement("case $L: return $S", key, val); } } method.addStatement("default: return code.name()"); method.endControlFlow(); type.addMethod(method.build()); }
[ "private", "void", "addCurrencyInfoMethod", "(", "TypeSpec", ".", "Builder", "type", ",", "String", "name", ",", "Map", "<", "String", ",", "String", ">", "mapping", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilder", "...
Adds a method to return the symbol or display name for a currency.
[ "Adds", "a", "method", "to", "return", "the", "symbol", "or", "display", "name", "for", "a", "currency", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java#L475-L497
gitblit/fathom
fathom-mailer/src/main/java/fathom/mailer/Mailer.java
Mailer.newHtmlMailRequest
public MailRequest newHtmlMailRequest(String subject, String body) { return createMailRequest(generateRequestId(), true, subject, body); }
java
public MailRequest newHtmlMailRequest(String subject, String body) { return createMailRequest(generateRequestId(), true, subject, body); }
[ "public", "MailRequest", "newHtmlMailRequest", "(", "String", "subject", ",", "String", "body", ")", "{", "return", "createMailRequest", "(", "generateRequestId", "(", ")", ",", "true", ",", "subject", ",", "body", ")", ";", "}" ]
Creates an html MailRequest with the specified subject and body. The request id is automatically generated. @param subject @param body @return an html mail request
[ "Creates", "an", "html", "MailRequest", "with", "the", "specified", "subject", "and", "body", ".", "The", "request", "id", "is", "automatically", "generated", "." ]
train
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-mailer/src/main/java/fathom/mailer/Mailer.java#L122-L124
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.eachByte
public static void eachByte(Byte[] self, @ClosureParams(FirstParam.Component.class) Closure closure) { each(self, closure); }
java
public static void eachByte(Byte[] self, @ClosureParams(FirstParam.Component.class) Closure closure) { each(self, closure); }
[ "public", "static", "void", "eachByte", "(", "Byte", "[", "]", "self", ",", "@", "ClosureParams", "(", "FirstParam", ".", "Component", ".", "class", ")", "Closure", "closure", ")", "{", "each", "(", "self", ",", "closure", ")", ";", "}" ]
Traverse through each byte of this Byte array. Alias for each. @param self a Byte array @param closure a closure @see #each(java.lang.Object, groovy.lang.Closure) @since 1.5.5
[ "Traverse", "through", "each", "byte", "of", "this", "Byte", "array", ".", "Alias", "for", "each", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16669-L16671
feedzai/pdb
src/main/java/com/feedzai/commons/sql/abstraction/dml/Expression.java
Expression.leftOuterJoin
public Expression leftOuterJoin(final Expression table, final Expression expr) { if (table instanceof Query) { table.enclose(); } joins.add(new Join("LEFT OUTER JOIN", table, expr)); return this; }
java
public Expression leftOuterJoin(final Expression table, final Expression expr) { if (table instanceof Query) { table.enclose(); } joins.add(new Join("LEFT OUTER JOIN", table, expr)); return this; }
[ "public", "Expression", "leftOuterJoin", "(", "final", "Expression", "table", ",", "final", "Expression", "expr", ")", "{", "if", "(", "table", "instanceof", "Query", ")", "{", "table", ".", "enclose", "(", ")", ";", "}", "joins", ".", "add", "(", "new",...
Sets a left outer join with the current table. @param table The table to join. @param expr The expressions to join. @return This expression.
[ "Sets", "a", "left", "outer", "join", "with", "the", "current", "table", "." ]
train
https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/Expression.java#L182-L190
unbescape/unbescape
src/main/java/org/unbescape/html/HtmlEscape.java
HtmlEscape.escapeHtml5Xml
public static void escapeHtml5Xml(final String text, final Writer writer) throws IOException { escapeHtml(text, writer, HtmlEscapeType.HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
java
public static void escapeHtml5Xml(final String text, final Writer writer) throws IOException { escapeHtml(text, writer, HtmlEscapeType.HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeHtml5Xml", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeHtml", "(", "text", ",", "writer", ",", "HtmlEscapeType", ".", "HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL", ",",...
<p> Perform an HTML5 level 1 (XML-style) <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 five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. It is called <em>XML-style</em> in order to link it with JSP's <tt>escapeXml</tt> attribute in JSTL's <tt>&lt;c:out ... /&gt;</tt> tags. </p> <p> Note this method may <strong>not</strong> produce the same results as {@link #escapeHtml4Xml(String, Writer)} because it will escape the apostrophe as <tt>&amp;apos;</tt>, whereas in HTML 4 such NCR does not exist (the decimal numeric reference <tt>&amp;#39;</tt> is used instead). </p> <p> This method calls {@link #escapeHtml(String, Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</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", "an", "HTML5", "level", "1", "(", "XML", "-", "style", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "W...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L449-L453
m-m-m/util
gwt/src/main/resources/net/sf/mmm/util/gwt/supersource/net/sf/mmm/util/lang/api/ComparatorHelper.java
ComparatorHelper.evalComparable
@SuppressWarnings({ "rawtypes", "unchecked" }) static boolean evalComparable(CompareOperator comparator, Comparable arg1, Comparable arg2) { int delta; try { delta = signum(arg1.compareTo(arg2)); } catch (ClassCastException e) { // delta = -arg2.compareTo(arg1); // incompatible comparables return ((arg1.equals(arg2)) == comparator.isTrueIfEquals()); } return comparator.eval(delta); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) static boolean evalComparable(CompareOperator comparator, Comparable arg1, Comparable arg2) { int delta; try { delta = signum(arg1.compareTo(arg2)); } catch (ClassCastException e) { // delta = -arg2.compareTo(arg1); // incompatible comparables return ((arg1.equals(arg2)) == comparator.isTrueIfEquals()); } return comparator.eval(delta); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "static", "boolean", "evalComparable", "(", "CompareOperator", "comparator", ",", "Comparable", "arg1", ",", "Comparable", "arg2", ")", "{", "int", "delta", ";", "try", "{", "de...
Logic for {@link CompareOperator#eval(Object, Object)} with {@link Comparable} arguments. @param comparator is the {@link CompareOperator}. @param arg1 is the first argument. @param arg2 is the second argument. @return the result of the {@link Comparator} applied to the given arguments.
[ "Logic", "for", "{", "@link", "CompareOperator#eval", "(", "Object", "Object", ")", "}", "with", "{", "@link", "Comparable", "}", "arguments", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/gwt/src/main/resources/net/sf/mmm/util/gwt/supersource/net/sf/mmm/util/lang/api/ComparatorHelper.java#L49-L62
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.toTimestamp
public static Long toTimestamp(String dateStr, String format, TimeZone tz) { SimpleDateFormat formatter = FORMATTER_CACHE.get(format); formatter.setTimeZone(tz); try { return formatter.parse(dateStr).getTime(); } catch (ParseException e) { return null; } }
java
public static Long toTimestamp(String dateStr, String format, TimeZone tz) { SimpleDateFormat formatter = FORMATTER_CACHE.get(format); formatter.setTimeZone(tz); try { return formatter.parse(dateStr).getTime(); } catch (ParseException e) { return null; } }
[ "public", "static", "Long", "toTimestamp", "(", "String", "dateStr", ",", "String", "format", ",", "TimeZone", "tz", ")", "{", "SimpleDateFormat", "formatter", "=", "FORMATTER_CACHE", ".", "get", "(", "format", ")", ";", "formatter", ".", "setTimeZone", "(", ...
Parse date time string to timestamp based on the given time zone and format. Returns null if parsing failed. @param dateStr the date time string @param format date time string format @param tz the time zone
[ "Parse", "date", "time", "string", "to", "timestamp", "based", "on", "the", "given", "time", "zone", "and", "format", ".", "Returns", "null", "if", "parsing", "failed", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L271-L279
tvesalainen/util
util/src/main/java/d3/env/TSAGeoMag.java
TSAGeoMag.getDipAngle
public double getDipAngle( double dlat, double dlong, double year, double altitude ) { calcGeoMag( dlat, dlong, year, altitude ); return dip; }
java
public double getDipAngle( double dlat, double dlong, double year, double altitude ) { calcGeoMag( dlat, dlong, year, altitude ); return dip; }
[ "public", "double", "getDipAngle", "(", "double", "dlat", ",", "double", "dlong", ",", "double", "year", ",", "double", "altitude", ")", "{", "calcGeoMag", "(", "dlat", ",", "dlong", ",", "year", ",", "altitude", ")", ";", "return", "dip", ";", "}" ]
Returns the magnetic field dip angle from the Department of Defense geomagnetic model and data, in degrees. @param dlat Latitude in decimal degrees. @param dlong Longitude in decimal degrees. @param year Date of the calculation in decimal years. @param altitude Altitude of the calculation in kilometers. @return The magnetic field dip angle, in degrees.
[ "Returns", "the", "magnetic", "field", "dip", "angle", "from", "the", "Department", "of", "Defense", "geomagnetic", "model", "and", "data", "in", "degrees", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1143-L1147