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
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java
GerritConnection.getSubSequence
@IgnoreJRERequirement private CharSequence getSubSequence(CharBuffer cb, int start, int end) { return cb.subSequence(start, end); }
java
@IgnoreJRERequirement private CharSequence getSubSequence(CharBuffer cb, int start, int end) { return cb.subSequence(start, end); }
[ "@", "IgnoreJRERequirement", "private", "CharSequence", "getSubSequence", "(", "CharBuffer", "cb", ",", "int", "start", ",", "int", "end", ")", "{", "return", "cb", ".", "subSequence", "(", "start", ",", "end", ")", ";", "}" ]
Get sub sequence of buffer. This method avoids error in java-api-check. animal-sniffer is confused by the signature of CharBuffer.subSequence() due to declaration of this method has been changed since Java7. (abstract -> non-abstract) @param cb a buffer @param start start of sub sequence @param end end of sub sequence @return sub sequence.
[ "Get", "sub", "sequence", "of", "buffer", "." ]
train
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java#L393-L396
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java
PercentEscaper.nextEscapeIndex
@Override protected int nextEscapeIndex(CharSequence csq, int index, int end) { for (; index < end; index++) { char c = csq.charAt(index); if (c >= safeOctets.length || !safeOctets[c]) { break; } } return index; }
java
@Override protected int nextEscapeIndex(CharSequence csq, int index, int end) { for (; index < end; index++) { char c = csq.charAt(index); if (c >= safeOctets.length || !safeOctets[c]) { break; } } return index; }
[ "@", "Override", "protected", "int", "nextEscapeIndex", "(", "CharSequence", "csq", ",", "int", "index", ",", "int", "end", ")", "{", "for", "(", ";", "index", "<", "end", ";", "index", "++", ")", "{", "char", "c", "=", "csq", ".", "charAt", "(", "...
/* Overridden for performance. For unescaped strings this improved the performance of the uri escaper from ~760ns to ~400ns as measured by {@link CharEscapersBenchmark}.
[ "/", "*", "Overridden", "for", "performance", ".", "For", "unescaped", "strings", "this", "improved", "the", "performance", "of", "the", "uri", "escaper", "from", "~760ns", "to", "~400ns", "as", "measured", "by", "{" ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java#L163-L172
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java
CPDefinitionPersistenceImpl.countByC_S
@Override public int countByC_S(long CProductId, int status) { FinderPath finderPath = FINDER_PATH_COUNT_BY_C_S; Object[] finderArgs = new Object[] { CProductId, status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPDEFINITION_WHERE); query.append(_FINDER_COLUMN_C_S_CPRODUCTID_2); query.append(_FINDER_COLUMN_C_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(CProductId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByC_S(long CProductId, int status) { FinderPath finderPath = FINDER_PATH_COUNT_BY_C_S; Object[] finderArgs = new Object[] { CProductId, status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPDEFINITION_WHERE); query.append(_FINDER_COLUMN_C_S_CPRODUCTID_2); query.append(_FINDER_COLUMN_C_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(CProductId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByC_S", "(", "long", "CProductId", ",", "int", "status", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_C_S", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "CProductId", ...
Returns the number of cp definitions where CProductId = &#63; and status = &#63;. @param CProductId the c product ID @param status the status @return the number of matching cp definitions
[ "Returns", "the", "number", "of", "cp", "definitions", "where", "CProductId", "=", "&#63", ";", "and", "status", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L4563-L4610
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.readFrom
public static ClassFile readFrom(DataInput din, ClassFileDataLoader loader, AttributeFactory attrFactory) throws IOException { return readFrom(din, loader, attrFactory, new HashMap<String, ClassFile>(11), null); }
java
public static ClassFile readFrom(DataInput din, ClassFileDataLoader loader, AttributeFactory attrFactory) throws IOException { return readFrom(din, loader, attrFactory, new HashMap<String, ClassFile>(11), null); }
[ "public", "static", "ClassFile", "readFrom", "(", "DataInput", "din", ",", "ClassFileDataLoader", "loader", ",", "AttributeFactory", "attrFactory", ")", "throws", "IOException", "{", "return", "readFrom", "(", "din", ",", "loader", ",", "attrFactory", ",", "new", ...
Reads a ClassFile from the given DataInput. A {@link ClassFileDataLoader} may be provided, which allows inner class definitions to be loaded. Also, an {@link AttributeFactory} may be provided, which allows non-standard attributes to be read. All remaining unknown attribute types are captured, but are not decoded. @param din source of class file data @param loader optional loader for reading inner class definitions @param attrFactory optional factory for reading custom attributes @throws IOException for I/O error or if classfile is invalid. @throws ArrayIndexOutOfBoundsException if a constant pool index is out of range. @throws ClassCastException if a constant pool index references the wrong type.
[ "Reads", "a", "ClassFile", "from", "the", "given", "DataInput", ".", "A", "{", "@link", "ClassFileDataLoader", "}", "may", "be", "provided", "which", "allows", "inner", "class", "definitions", "to", "be", "loaded", ".", "Also", "an", "{", "@link", "Attribute...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L1052-L1058
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/MutableHashTable.java
MutableHashTable.buildBloomFilterForBucket
final void buildBloomFilterForBucket(int bucketInSegmentPos, MemorySegment bucket, HashPartition<BT, PT> p) { final int count = bucket.getShort(bucketInSegmentPos + HEADER_COUNT_OFFSET); if (count <= 0) { return; } int[] hashCodes = new int[count]; // As the hashcode and bloom filter occupy same bytes, so we read all hashcode out at first and then write back to bloom filter. for (int i = 0; i < count; i++) { hashCodes[i] = bucket.getInt(bucketInSegmentPos + BUCKET_HEADER_LENGTH + i * HASH_CODE_LEN); } this.bloomFilter.setBitsLocation(bucket, bucketInSegmentPos + BUCKET_HEADER_LENGTH); for (int hashCode : hashCodes) { this.bloomFilter.addHash(hashCode); } buildBloomFilterForExtraOverflowSegments(bucketInSegmentPos, bucket, p); }
java
final void buildBloomFilterForBucket(int bucketInSegmentPos, MemorySegment bucket, HashPartition<BT, PT> p) { final int count = bucket.getShort(bucketInSegmentPos + HEADER_COUNT_OFFSET); if (count <= 0) { return; } int[] hashCodes = new int[count]; // As the hashcode and bloom filter occupy same bytes, so we read all hashcode out at first and then write back to bloom filter. for (int i = 0; i < count; i++) { hashCodes[i] = bucket.getInt(bucketInSegmentPos + BUCKET_HEADER_LENGTH + i * HASH_CODE_LEN); } this.bloomFilter.setBitsLocation(bucket, bucketInSegmentPos + BUCKET_HEADER_LENGTH); for (int hashCode : hashCodes) { this.bloomFilter.addHash(hashCode); } buildBloomFilterForExtraOverflowSegments(bucketInSegmentPos, bucket, p); }
[ "final", "void", "buildBloomFilterForBucket", "(", "int", "bucketInSegmentPos", ",", "MemorySegment", "bucket", ",", "HashPartition", "<", "BT", ",", "PT", ">", "p", ")", "{", "final", "int", "count", "=", "bucket", ".", "getShort", "(", "bucketInSegmentPos", ...
Set all the bucket memory except bucket header as the bit set of bloom filter, and use hash code of build records to build bloom filter.
[ "Set", "all", "the", "bucket", "memory", "except", "bucket", "header", "as", "the", "bit", "set", "of", "bloom", "filter", "and", "use", "hash", "code", "of", "build", "records", "to", "build", "bloom", "filter", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/MutableHashTable.java#L1269-L1285
elki-project/elki
elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java
VectorUtil.dotSparseDense
public static double dotSparseDense(SparseNumberVector v1, NumberVector v2) { final int dim2 = v2.getDimensionality(); double dot = 0.; for(int i1 = v1.iter(); v1.iterValid(i1);) { final int d1 = v1.iterDim(i1); if(d1 >= dim2) { break; } dot += v1.iterDoubleValue(i1) * v2.doubleValue(d1); i1 = v1.iterAdvance(i1); } return dot; }
java
public static double dotSparseDense(SparseNumberVector v1, NumberVector v2) { final int dim2 = v2.getDimensionality(); double dot = 0.; for(int i1 = v1.iter(); v1.iterValid(i1);) { final int d1 = v1.iterDim(i1); if(d1 >= dim2) { break; } dot += v1.iterDoubleValue(i1) * v2.doubleValue(d1); i1 = v1.iterAdvance(i1); } return dot; }
[ "public", "static", "double", "dotSparseDense", "(", "SparseNumberVector", "v1", ",", "NumberVector", "v2", ")", "{", "final", "int", "dim2", "=", "v2", ".", "getDimensionality", "(", ")", ";", "double", "dot", "=", "0.", ";", "for", "(", "int", "i1", "=...
Compute the dot product for a sparse and a dense vector. @param v1 Sparse first vector @param v2 Dense second vector @return dot product
[ "Compute", "the", "dot", "product", "for", "a", "sparse", "and", "a", "dense", "vector", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java#L392-L404
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.asImmutable
public static <K, V> Map<K, V> asImmutable(Map<K, V> self) { return asUnmodifiable(new LinkedHashMap<K, V>(self)); }
java
public static <K, V> Map<K, V> asImmutable(Map<K, V> self) { return asUnmodifiable(new LinkedHashMap<K, V>(self)); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "asImmutable", "(", "Map", "<", "K", ",", "V", ">", "self", ")", "{", "return", "asUnmodifiable", "(", "new", "LinkedHashMap", "<", "K", ",", "V", ">", "(", "self", ")...
A convenience method for creating an immutable Map. @param self a Map @return an unmodifiable view of a copy of the original, i.e. an effectively immutable copy @see #asImmutable(java.util.List) @see #asUnmodifiable(java.util.Map) @since 1.0
[ "A", "convenience", "method", "for", "creating", "an", "immutable", "Map", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8252-L8254
StripesFramework/stripes-stuff
src/main/java/org/stripesstuff/plugin/session/SessionStoreInterceptor.java
SessionStoreInterceptor.setAttribute
protected Object setAttribute(HttpSession session, String key, Object object, boolean serializable, int maxTime) { if (object == null) { // If object is null, remove attribute. Object ret; synchronized (session) { ret = session.getAttribute(key); session.removeAttribute(key); } return ret; } else { // Set object in session. Object ret; synchronized (session) { ret = session.getAttribute(key); session.setAttribute(key, object); } SessionMapper mapper = (SessionMapper) session.getAttribute(MAPPER_ATTRIBUTE); if (mapper == null) { // Register mapper for session. mapper = new SessionMapper(); session.setAttribute(MAPPER_ATTRIBUTE, mapper); } synchronized (mapper) { // Update field mapper. SessionFieldMapper fieldMapper = mapper.get(key); if (fieldMapper == null) { fieldMapper = new SessionFieldMapper(serializable && object instanceof Serializable); mapper.put(key, fieldMapper); } if (maxTime > 0) { // Register runnable to remove attribute. if (fieldMapper.runnable != null) { // Cancel old runnable because a new one will be created. fieldMapper.runnable.cancel(); } // Register runnable. RemoveFieldRunnable runnable = new RemoveFieldRunnable(key, maxTime, session); fieldMapper.runnable = runnable; (new Thread(runnable)).start(); } } return ret; } }
java
protected Object setAttribute(HttpSession session, String key, Object object, boolean serializable, int maxTime) { if (object == null) { // If object is null, remove attribute. Object ret; synchronized (session) { ret = session.getAttribute(key); session.removeAttribute(key); } return ret; } else { // Set object in session. Object ret; synchronized (session) { ret = session.getAttribute(key); session.setAttribute(key, object); } SessionMapper mapper = (SessionMapper) session.getAttribute(MAPPER_ATTRIBUTE); if (mapper == null) { // Register mapper for session. mapper = new SessionMapper(); session.setAttribute(MAPPER_ATTRIBUTE, mapper); } synchronized (mapper) { // Update field mapper. SessionFieldMapper fieldMapper = mapper.get(key); if (fieldMapper == null) { fieldMapper = new SessionFieldMapper(serializable && object instanceof Serializable); mapper.put(key, fieldMapper); } if (maxTime > 0) { // Register runnable to remove attribute. if (fieldMapper.runnable != null) { // Cancel old runnable because a new one will be created. fieldMapper.runnable.cancel(); } // Register runnable. RemoveFieldRunnable runnable = new RemoveFieldRunnable(key, maxTime, session); fieldMapper.runnable = runnable; (new Thread(runnable)).start(); } } return ret; } }
[ "protected", "Object", "setAttribute", "(", "HttpSession", "session", ",", "String", "key", ",", "Object", "object", ",", "boolean", "serializable", ",", "int", "maxTime", ")", "{", "if", "(", "object", "==", "null", ")", "{", "// If object is null, remove attri...
Saves an object in session for latter use. @param session Session in which to store object. @param key Key under which object is saved. @param object Object to save. @param serializable True if object is serializable. @param maxTime Maximum time to keep object in session. @return Object previously saved under key.
[ "Saves", "an", "object", "in", "session", "for", "latter", "use", "." ]
train
https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/session/SessionStoreInterceptor.java#L192-L236
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/DatagramPacket.java
DatagramPacket.setData
public synchronized void setData(byte[] buf, int offset, int length) { /* this will check to see if buf is null */ if (length < 0 || offset < 0 || (length + offset) < 0 || ((length + offset) > buf.length)) { throw new IllegalArgumentException("illegal length or offset"); } this.buf = buf; this.length = length; this.bufLength = length; this.offset = offset; }
java
public synchronized void setData(byte[] buf, int offset, int length) { /* this will check to see if buf is null */ if (length < 0 || offset < 0 || (length + offset) < 0 || ((length + offset) > buf.length)) { throw new IllegalArgumentException("illegal length or offset"); } this.buf = buf; this.length = length; this.bufLength = length; this.offset = offset; }
[ "public", "synchronized", "void", "setData", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ")", "{", "/* this will check to see if buf is null */", "if", "(", "length", "<", "0", "||", "offset", "<", "0", "||", "(", "length", "+...
Set the data buffer for this packet. This sets the data, length and offset of the packet. @param buf the buffer to set for this packet @param offset the offset into the data @param length the length of the data and/or the length of the buffer used to receive data @exception NullPointerException if the argument is null @see #getData @see #getOffset @see #getLength @since 1.2
[ "Set", "the", "data", "buffer", "for", "this", "packet", ".", "This", "sets", "the", "data", "length", "and", "offset", "of", "the", "packet", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/DatagramPacket.java#L261-L272
jsonld-java/jsonld-java
core/src/main/java/com/github/jsonldjava/core/NormalizeUtils.java
NormalizeUtils.hashQuads
private static String hashQuads(String id, Map<String, Object> bnodes, UniqueNamer namer) { // return cached hash if (((Map<String, Object>) bnodes.get(id)).containsKey("hash")) { return (String) ((Map<String, Object>) bnodes.get(id)).get("hash"); } // serialize all of bnode's quads final List<Map<String, Object>> quads = (List<Map<String, Object>>) ((Map<String, Object>) bnodes .get(id)).get("quads"); final List<String> nquads = new ArrayList<String>(); for (int i = 0; i < quads.size(); ++i) { nquads.add(toNQuad((RDFDataset.Quad) quads.get(i), quads.get(i).get("name") != null ? (String) ((Map<String, Object>) quads.get(i).get("name")).get("value") : null, id)); } // sort serialized quads Collections.sort(nquads); // return hashed quads final String hash = sha1hash(nquads); ((Map<String, Object>) bnodes.get(id)).put("hash", hash); return hash; }
java
private static String hashQuads(String id, Map<String, Object> bnodes, UniqueNamer namer) { // return cached hash if (((Map<String, Object>) bnodes.get(id)).containsKey("hash")) { return (String) ((Map<String, Object>) bnodes.get(id)).get("hash"); } // serialize all of bnode's quads final List<Map<String, Object>> quads = (List<Map<String, Object>>) ((Map<String, Object>) bnodes .get(id)).get("quads"); final List<String> nquads = new ArrayList<String>(); for (int i = 0; i < quads.size(); ++i) { nquads.add(toNQuad((RDFDataset.Quad) quads.get(i), quads.get(i).get("name") != null ? (String) ((Map<String, Object>) quads.get(i).get("name")).get("value") : null, id)); } // sort serialized quads Collections.sort(nquads); // return hashed quads final String hash = sha1hash(nquads); ((Map<String, Object>) bnodes.get(id)).put("hash", hash); return hash; }
[ "private", "static", "String", "hashQuads", "(", "String", "id", ",", "Map", "<", "String", ",", "Object", ">", "bnodes", ",", "UniqueNamer", "namer", ")", "{", "// return cached hash", "if", "(", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", ...
Hashes all of the quads about a blank node. @param id the ID of the bnode to hash quads for. @param bnodes the mapping of bnodes to quads. @param namer the canonical bnode namer. @return the new hash.
[ "Hashes", "all", "of", "the", "quads", "about", "a", "blank", "node", "." ]
train
https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/NormalizeUtils.java#L427-L450
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpUtil.java
HttpUtil.downloadFile
public static long downloadFile(String url, File destFile, StreamProgress streamProgress) { return downloadFile(url, destFile, -1, streamProgress); }
java
public static long downloadFile(String url, File destFile, StreamProgress streamProgress) { return downloadFile(url, destFile, -1, streamProgress); }
[ "public", "static", "long", "downloadFile", "(", "String", "url", ",", "File", "destFile", ",", "StreamProgress", "streamProgress", ")", "{", "return", "downloadFile", "(", "url", ",", "destFile", ",", "-", "1", ",", "streamProgress", ")", ";", "}" ]
下载远程文件 @param url 请求的url @param destFile 目标文件或目录,当为目录时,取URL中的文件名,取不到使用编码后的URL做为文件名 @param streamProgress 进度条 @return 文件大小
[ "下载远程文件" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L290-L292
structurizr/java
structurizr-core/src/com/structurizr/documentation/Documentation.java
Documentation.addDecision
public Decision addDecision(String id, Date date, String title, DecisionStatus status, Format format, String content) { return addDecision(null, id, date, title, status, format, content); }
java
public Decision addDecision(String id, Date date, String title, DecisionStatus status, Format format, String content) { return addDecision(null, id, date, title, status, format, content); }
[ "public", "Decision", "addDecision", "(", "String", "id", ",", "Date", "date", ",", "String", "title", ",", "DecisionStatus", "status", ",", "Format", "format", ",", "String", "content", ")", "{", "return", "addDecision", "(", "null", ",", "id", ",", "date...
Adds a new decision to this workspace. @param id the ID of the decision @param date the date of the decision @param title the title of the decision @param status the status of the decision @param format the format of the decision content @param content the content of the decision @return a Decision object
[ "Adds", "a", "new", "decision", "to", "this", "workspace", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/Documentation.java#L131-L133
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByEmail
public Iterable<DContact> queryByEmail(Object parent, java.lang.String email) { return queryByField(parent, DContactMapper.Field.EMAIL.getFieldName(), email); }
java
public Iterable<DContact> queryByEmail(Object parent, java.lang.String email) { return queryByField(parent, DContactMapper.Field.EMAIL.getFieldName(), email); }
[ "public", "Iterable", "<", "DContact", ">", "queryByEmail", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "email", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "EMAIL", ".", "getFieldName", ...
query-by method for field email @param email the specified attribute @return an Iterable of DContacts for the specified email
[ "query", "-", "by", "method", "for", "field", "email" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L151-L153
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/AbstractOperatingSystemWrapper.java
AbstractOperatingSystemWrapper.runCommand
protected static String runCommand(String... command) { try { final Process p = Runtime.getRuntime().exec(command); if (p == null) { return null; } final StringBuilder bStr = new StringBuilder(); try (InputStream standardOutput = p.getInputStream()) { final byte[] buffer = new byte[BUFFER_SIZE]; int len; while ((len = standardOutput.read(buffer)) > 0) { bStr.append(new String(buffer, 0, len)); } p.waitFor(); return bStr.toString(); } } catch (Exception e) { return null; } }
java
protected static String runCommand(String... command) { try { final Process p = Runtime.getRuntime().exec(command); if (p == null) { return null; } final StringBuilder bStr = new StringBuilder(); try (InputStream standardOutput = p.getInputStream()) { final byte[] buffer = new byte[BUFFER_SIZE]; int len; while ((len = standardOutput.read(buffer)) > 0) { bStr.append(new String(buffer, 0, len)); } p.waitFor(); return bStr.toString(); } } catch (Exception e) { return null; } }
[ "protected", "static", "String", "runCommand", "(", "String", "...", "command", ")", "{", "try", "{", "final", "Process", "p", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "command", ")", ";", "if", "(", "p", "==", "null", ")", "{",...
Run a shell command. @param command is the shell command to run. @return the standard output
[ "Run", "a", "shell", "command", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/AbstractOperatingSystemWrapper.java#L54-L73
alkacon/opencms-core
src/org/opencms/importexport/CmsImportExportManager.java
CmsImportExportManager.importData
public void importData(CmsObject cms, I_CmsReport report, CmsImportParameters parameters) throws CmsImportExportException, CmsXmlException, CmsRoleViolationException, CmsException { // check the required role permissions OpenCms.getRoleManager().checkRole(cms, CmsRole.DATABASE_MANAGER); try { OpenCms.fireCmsEvent( new CmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, Collections.<String, Object> emptyMap())); I_CmsImportExportHandler handler = getImportExportHandler(parameters); synchronized (handler) { handler.setImportParameters(parameters); handler.importData(cms, report); } } finally { OpenCms.fireCmsEvent( new CmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, Collections.<String, Object> emptyMap())); } }
java
public void importData(CmsObject cms, I_CmsReport report, CmsImportParameters parameters) throws CmsImportExportException, CmsXmlException, CmsRoleViolationException, CmsException { // check the required role permissions OpenCms.getRoleManager().checkRole(cms, CmsRole.DATABASE_MANAGER); try { OpenCms.fireCmsEvent( new CmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, Collections.<String, Object> emptyMap())); I_CmsImportExportHandler handler = getImportExportHandler(parameters); synchronized (handler) { handler.setImportParameters(parameters); handler.importData(cms, report); } } finally { OpenCms.fireCmsEvent( new CmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, Collections.<String, Object> emptyMap())); } }
[ "public", "void", "importData", "(", "CmsObject", "cms", ",", "I_CmsReport", "report", ",", "CmsImportParameters", "parameters", ")", "throws", "CmsImportExportException", ",", "CmsXmlException", ",", "CmsRoleViolationException", ",", "CmsException", "{", "// check the re...
Checks if the current user has permissions to import data into the Cms, and if so, creates a new import handler instance that imports the data.<p> @param cms the current OpenCms context object @param report a Cms report to print log messages @param parameters the import parameters @throws CmsRoleViolationException if the current user is not allowed to import the OpenCms database @throws CmsImportExportException if operation was not successful @throws CmsXmlException if the manifest of the import could not be unmarshalled @throws CmsException in case of errors accessing the VFS @see I_CmsImportExportHandler @see #importData(CmsObject, String, String, I_CmsReport)
[ "Checks", "if", "the", "current", "user", "has", "permissions", "to", "import", "data", "into", "the", "Cms", "and", "if", "so", "creates", "a", "new", "import", "handler", "instance", "that", "imports", "the", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportExportManager.java#L891-L909
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.lte
public PropertyConstraint lte(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, lte(propertyValue)); }
java
public PropertyConstraint lte(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, lte(propertyValue)); }
[ "public", "PropertyConstraint", "lte", "(", "String", "propertyName", ",", "Comparable", "propertyValue", ")", "{", "return", "new", "ParameterizedPropertyConstraint", "(", "propertyName", ",", "lte", "(", "propertyValue", ")", ")", ";", "}" ]
Apply a "less than equal to" constraint to a bean property. @param propertyName The first property @param propertyValue The constraint value @return The constraint
[ "Apply", "a", "less", "than", "equal", "to", "constraint", "to", "a", "bean", "property", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L724-L726
arxanchain/java-common
src/main/java/com/arxanfintech/common/util/ByteUtil.java
ByteUtil.xorAlignRight
public static byte[] xorAlignRight(byte[] b1, byte[] b2) { if (b1.length > b2.length) { byte[] b2_ = new byte[b1.length]; System.arraycopy(b2, 0, b2_, b1.length - b2.length, b2.length); b2 = b2_; } else if (b2.length > b1.length) { byte[] b1_ = new byte[b2.length]; System.arraycopy(b1, 0, b1_, b2.length - b1.length, b1.length); b1 = b1_; } return xor(b1, b2); }
java
public static byte[] xorAlignRight(byte[] b1, byte[] b2) { if (b1.length > b2.length) { byte[] b2_ = new byte[b1.length]; System.arraycopy(b2, 0, b2_, b1.length - b2.length, b2.length); b2 = b2_; } else if (b2.length > b1.length) { byte[] b1_ = new byte[b2.length]; System.arraycopy(b1, 0, b1_, b2.length - b1.length, b1.length); b1 = b1_; } return xor(b1, b2); }
[ "public", "static", "byte", "[", "]", "xorAlignRight", "(", "byte", "[", "]", "b1", ",", "byte", "[", "]", "b2", ")", "{", "if", "(", "b1", ".", "length", ">", "b2", ".", "length", ")", "{", "byte", "[", "]", "b2_", "=", "new", "byte", "[", "...
XORs byte arrays of different lengths by aligning length of the shortest via adding zeros at beginning @param b1 b1 @param b2 b2 @return xorAlignRight
[ "XORs", "byte", "arrays", "of", "different", "lengths", "by", "aligning", "length", "of", "the", "shortest", "via", "adding", "zeros", "at", "beginning" ]
train
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L510-L522
adyliu/jafka
src/main/java/io/jafka/utils/Utils.java
Utils.newThread
public static Thread newThread(String name, Runnable runnable, boolean daemon) { Thread thread = new Thread(runnable, name); thread.setDaemon(daemon); return thread; }
java
public static Thread newThread(String name, Runnable runnable, boolean daemon) { Thread thread = new Thread(runnable, name); thread.setDaemon(daemon); return thread; }
[ "public", "static", "Thread", "newThread", "(", "String", "name", ",", "Runnable", "runnable", ",", "boolean", "daemon", ")", "{", "Thread", "thread", "=", "new", "Thread", "(", "runnable", ",", "name", ")", ";", "thread", ".", "setDaemon", "(", "daemon", ...
Create a new thread @param name The name of the thread @param runnable The work for the thread to do @param daemon Should the thread block JVM shutdown? @return The unstarted thread
[ "Create", "a", "new", "thread" ]
train
https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/utils/Utils.java#L322-L326
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosetsApi.java
PhotosetsApi.removePhotos
public Response removePhotos(String photosetId, List<String> photoIds) throws JinxException { JinxUtils.validateParams(photosetId, photoIds); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photosets.removePhotos"); params.put("photoset_id", photosetId); params.put("photo_ids", JinxUtils.buildCommaDelimitedList(photoIds)); return jinx.flickrPost(params, Response.class); }
java
public Response removePhotos(String photosetId, List<String> photoIds) throws JinxException { JinxUtils.validateParams(photosetId, photoIds); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photosets.removePhotos"); params.put("photoset_id", photosetId); params.put("photo_ids", JinxUtils.buildCommaDelimitedList(photoIds)); return jinx.flickrPost(params, Response.class); }
[ "public", "Response", "removePhotos", "(", "String", "photosetId", ",", "List", "<", "String", ">", "photoIds", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photosetId", ",", "photoIds", ")", ";", "Map", "<", "String", ",", ...
Remove multiple photos from a photoset. <br> This method requires authentication with 'write' permission. <br> Note: This method requires an HTTP POST request. @param photosetId id of the photoset to remove a photo from. @param photoIds list of photo id's to remove from the photoset. @return an empty success response if it completes without error. @throws JinxException if any parameter is null or empty, or if there are other errors. @see <a href="https://www.flickr.com/services/api/flickr.photosets.removePhotos.html">flickr.photosets.removePhotos</a>
[ "Remove", "multiple", "photos", "from", "a", "photoset", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "write", "permission", ".", "<br", ">", "Note", ":", "This", "method", "requires", "an", "HTTP", "POST", "request", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosetsApi.java#L356-L363
VoltDB/voltdb
examples/contentionmark/ContentionMark.java
ContentionMark.runBenchmark
public void runBenchmark() throws Exception { System.out.print(HORIZONTAL_RULE); System.out.println(" Setup & Initialization"); System.out.println(HORIZONTAL_RULE); // connect to one or more servers, loop until success connect(client, config.servers); for (long i = 0; i < config.tuples; i++) { ClientResponse response = client.callProcedure("Init", i, i); if (response.getStatus() != ClientResponse.SUCCESS) { System.exit(-1); } } System.out.print("\n\n" + HORIZONTAL_RULE); System.out.println(" Starting Benchmark"); System.out.println(HORIZONTAL_RULE); System.out.println("\nWarming up..."); final long warmupEndTime = System.currentTimeMillis() + (1000l * config.warmup); while (warmupEndTime > System.currentTimeMillis()) { increment(); } // reset counters before the real benchmark starts post-warmup incrementCount.set(0); lastPeriod.set(0); failureCount.set(0); lastStatsReportTS = System.currentTimeMillis(); // print periodic statistics to the console benchmarkStartTS = System.currentTimeMillis(); TimerTask statsPrinting = new TimerTask() { @Override public void run() { printStatistics(); } }; Timer timer = new Timer(); timer.scheduleAtFixedRate(statsPrinting, config.displayinterval * 1000, config.displayinterval * 1000); // Run the benchmark loop for the requested duration // The throughput may be throttled depending on client configuration System.out.println("\nRunning benchmark..."); final long benchmarkEndTime = System.currentTimeMillis() + (1000l * config.duration); while (benchmarkEndTime > System.currentTimeMillis()) { increment(); } // cancel periodic stats printing timer.cancel(); // block until all outstanding txns return client.drain(); // close down the client connections client.close(); }
java
public void runBenchmark() throws Exception { System.out.print(HORIZONTAL_RULE); System.out.println(" Setup & Initialization"); System.out.println(HORIZONTAL_RULE); // connect to one or more servers, loop until success connect(client, config.servers); for (long i = 0; i < config.tuples; i++) { ClientResponse response = client.callProcedure("Init", i, i); if (response.getStatus() != ClientResponse.SUCCESS) { System.exit(-1); } } System.out.print("\n\n" + HORIZONTAL_RULE); System.out.println(" Starting Benchmark"); System.out.println(HORIZONTAL_RULE); System.out.println("\nWarming up..."); final long warmupEndTime = System.currentTimeMillis() + (1000l * config.warmup); while (warmupEndTime > System.currentTimeMillis()) { increment(); } // reset counters before the real benchmark starts post-warmup incrementCount.set(0); lastPeriod.set(0); failureCount.set(0); lastStatsReportTS = System.currentTimeMillis(); // print periodic statistics to the console benchmarkStartTS = System.currentTimeMillis(); TimerTask statsPrinting = new TimerTask() { @Override public void run() { printStatistics(); } }; Timer timer = new Timer(); timer.scheduleAtFixedRate(statsPrinting, config.displayinterval * 1000, config.displayinterval * 1000); // Run the benchmark loop for the requested duration // The throughput may be throttled depending on client configuration System.out.println("\nRunning benchmark..."); final long benchmarkEndTime = System.currentTimeMillis() + (1000l * config.duration); while (benchmarkEndTime > System.currentTimeMillis()) { increment(); } // cancel periodic stats printing timer.cancel(); // block until all outstanding txns return client.drain(); // close down the client connections client.close(); }
[ "public", "void", "runBenchmark", "(", ")", "throws", "Exception", "{", "System", ".", "out", ".", "print", "(", "HORIZONTAL_RULE", ")", ";", "System", ".", "out", ".", "println", "(", "\" Setup & Initialization\"", ")", ";", "System", ".", "out", ".", "pr...
Core benchmark code. Connect. Initialize. Run the loop. Cleanup. Print Results. @throws Exception if anything unexpected happens.
[ "Core", "benchmark", "code", ".", "Connect", ".", "Initialize", ".", "Run", "the", "loop", ".", "Cleanup", ".", "Print", "Results", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/contentionmark/ContentionMark.java#L269-L325
dashorst/wicket-stuff-markup-validator
whattf/src/main/java/org/whattf/datatype/AbstractDatatype.java
AbstractDatatype.sameValue
public final boolean sameValue(Object value1, Object value2) { if (value1 == null) { return (value2 == null); } return value1.equals(value2); }
java
public final boolean sameValue(Object value1, Object value2) { if (value1 == null) { return (value2 == null); } return value1.equals(value2); }
[ "public", "final", "boolean", "sameValue", "(", "Object", "value1", ",", "Object", "value2", ")", "{", "if", "(", "value1", "==", "null", ")", "{", "return", "(", "value2", "==", "null", ")", ";", "}", "return", "value1", ".", "equals", "(", "value2", ...
Implements strict string equality semantics by performing a standard <code>equals</code> check on the arguments. @param value1 an object returned by <code>createValue</code> @param value2 another object returned by <code>createValue</code> @return <code>true</code> if the values are equal, <code>false</code> otherwise @see org.relaxng.datatype.Datatype#sameValue(java.lang.Object, java.lang.Object)
[ "Implements", "strict", "string", "equality", "semantics", "by", "performing", "a", "standard", "<code", ">", "equals<", "/", "code", ">", "check", "on", "the", "arguments", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/whattf/src/main/java/org/whattf/datatype/AbstractDatatype.java#L111-L116
ButterFaces/ButterFaces
components/src/main/java/org/butterfaces/model/table/json/JsonToModelConverter.java
JsonToModelConverter.convertTableColumnOrdering
public TableColumnOrdering convertTableColumnOrdering(final String tableIdentifier, final String json) { final String[] split = this.splitColumns(json); final List<Ordering> orderings = new ArrayList<>(); for (String column : split) { final String[] attribute = this.splitAttributes(column); final String identifier = attribute[0].split(":")[1]; final String position = attribute[1].split(":")[1]; orderings.add(new Ordering(identifier, Integer.valueOf(position))); } Collections.sort(orderings, new Comparator<Ordering>() { @Override public int compare(Ordering o1, Ordering o2) { return o1.getIndex().compareTo(o2.getIndex()); } }); final List<String> columnIdentifier = new ArrayList<>(); for (Ordering ordering : orderings) { columnIdentifier.add(ordering.getIdentifier()); } return new TableColumnOrdering(tableIdentifier, columnIdentifier); }
java
public TableColumnOrdering convertTableColumnOrdering(final String tableIdentifier, final String json) { final String[] split = this.splitColumns(json); final List<Ordering> orderings = new ArrayList<>(); for (String column : split) { final String[] attribute = this.splitAttributes(column); final String identifier = attribute[0].split(":")[1]; final String position = attribute[1].split(":")[1]; orderings.add(new Ordering(identifier, Integer.valueOf(position))); } Collections.sort(orderings, new Comparator<Ordering>() { @Override public int compare(Ordering o1, Ordering o2) { return o1.getIndex().compareTo(o2.getIndex()); } }); final List<String> columnIdentifier = new ArrayList<>(); for (Ordering ordering : orderings) { columnIdentifier.add(ordering.getIdentifier()); } return new TableColumnOrdering(tableIdentifier, columnIdentifier); }
[ "public", "TableColumnOrdering", "convertTableColumnOrdering", "(", "final", "String", "tableIdentifier", ",", "final", "String", "json", ")", "{", "final", "String", "[", "]", "split", "=", "this", ".", "splitColumns", "(", "json", ")", ";", "final", "List", ...
Converts given json string to {@link TableColumnOrdering} used by {@link TableColumnOrderingModel}. @param tableIdentifier an application unique table identifier. @param json string to convert to {@link TableColumnOrdering}. @return the converted {@link TableColumnOrdering}.
[ "Converts", "given", "json", "string", "to", "{", "@link", "TableColumnOrdering", "}", "used", "by", "{", "@link", "TableColumnOrderingModel", "}", "." ]
train
https://github.com/ButterFaces/ButterFaces/blob/e8c2bb340c89dcdbac409fcfc7a2a0e07f2462fc/components/src/main/java/org/butterfaces/model/table/json/JsonToModelConverter.java#L53-L80
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/ContentElement.java
ContentElement.writePostamble
public void writePostamble(final XMLUtil util, final ZipUTF8Writer writer) throws IOException { if (this.autofilters != null) this.appendAutofilters(writer, util); writer.write("</office:spreadsheet>"); writer.write("</office:body>"); writer.write("</office:document-content>"); writer.flush(); writer.closeEntry(); }
java
public void writePostamble(final XMLUtil util, final ZipUTF8Writer writer) throws IOException { if (this.autofilters != null) this.appendAutofilters(writer, util); writer.write("</office:spreadsheet>"); writer.write("</office:body>"); writer.write("</office:document-content>"); writer.flush(); writer.closeEntry(); }
[ "public", "void", "writePostamble", "(", "final", "XMLUtil", "util", ",", "final", "ZipUTF8Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "this", ".", "autofilters", "!=", "null", ")", "this", ".", "appendAutofilters", "(", "writer", ",", "...
Write the postamble into the given writer. Used by the FinalizeFlusher and by standard write method @param util an XML util @param writer the destination @throws IOException if the postamble could not be written
[ "Write", "the", "postamble", "into", "the", "given", "writer", ".", "Used", "by", "the", "FinalizeFlusher", "and", "by", "standard", "write", "method" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/ContentElement.java#L241-L248
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-displayer/src/main/java/org/xwiki/displayer/internal/DefaultHTMLDisplayerManager.java
DefaultHTMLDisplayerManager.getHTMLDisplayer
@Override public <T> HTMLDisplayer<T> getHTMLDisplayer(Type targetType, String roleHint) throws HTMLDisplayerException { try { HTMLDisplayer<T> component; ComponentManager componentManager = this.componentManagerProvider.get(); Type type = targetType; Type displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type); while (!componentManager.hasComponent(displayerType, roleHint) && type instanceof ParameterizedType) { type = ((ParameterizedType) type).getRawType(); displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type); } if (!componentManager.hasComponent(displayerType, roleHint)) { displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, Object.class); } if (componentManager.hasComponent(displayerType, roleHint)) { component = componentManager.getInstance(displayerType, roleHint); } else { component = componentManager.getInstance(displayerType); } return component; } catch (ComponentLookupException e) { throw new HTMLDisplayerException("Failed to initialized the HTML displayer for target type [" + targetType + "] and role [" + String.valueOf(roleHint) + "]", e); } }
java
@Override public <T> HTMLDisplayer<T> getHTMLDisplayer(Type targetType, String roleHint) throws HTMLDisplayerException { try { HTMLDisplayer<T> component; ComponentManager componentManager = this.componentManagerProvider.get(); Type type = targetType; Type displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type); while (!componentManager.hasComponent(displayerType, roleHint) && type instanceof ParameterizedType) { type = ((ParameterizedType) type).getRawType(); displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type); } if (!componentManager.hasComponent(displayerType, roleHint)) { displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, Object.class); } if (componentManager.hasComponent(displayerType, roleHint)) { component = componentManager.getInstance(displayerType, roleHint); } else { component = componentManager.getInstance(displayerType); } return component; } catch (ComponentLookupException e) { throw new HTMLDisplayerException("Failed to initialized the HTML displayer for target type [" + targetType + "] and role [" + String.valueOf(roleHint) + "]", e); } }
[ "@", "Override", "public", "<", "T", ">", "HTMLDisplayer", "<", "T", ">", "getHTMLDisplayer", "(", "Type", "targetType", ",", "String", "roleHint", ")", "throws", "HTMLDisplayerException", "{", "try", "{", "HTMLDisplayer", "<", "T", ">", "component", ";", "C...
{@inheritDoc} <p> Example: if the target type is <code>A&lt;B&lt;C&gt;&gt;</code> with {@code hint} hint, the following lookups will be made until a {@link HTMLDisplayer} component is found: <ul> <li>Component: <code>HTMLDisplayer&lt;A&lt;B&lt;C&gt;&gt;&gt;</code>; Role: {@code hint} <li>Component: <code>HTMLDisplayer&lt;A&lt;B&gt;&gt;</code>; Role: {@code hint} <li>Component: <code>HTMLDisplayer&lt;A&gt;</code>; Role: {@code hint} <li>Component: {@code HTMLDisplayer}; Role: {@code hint} <li>Component: {@code HTMLDisplayer}; Role: default </ul>
[ "{" ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-displayer/src/main/java/org/xwiki/displayer/internal/DefaultHTMLDisplayerManager.java#L75-L102
Stratio/deep-spark
deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java
Cells.getDate
public Date getDate(String nameSpace, String cellName) { return getValue(nameSpace, cellName, Date.class); }
java
public Date getDate(String nameSpace, String cellName) { return getValue(nameSpace, cellName, Date.class); }
[ "public", "Date", "getDate", "(", "String", "nameSpace", ",", "String", "cellName", ")", "{", "return", "getValue", "(", "nameSpace", ",", "cellName", ",", "Date", ".", "class", ")", ";", "}" ]
Returns the {@code Date} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or null if this Cells object contains no cell whose name is cellName. @param nameSpace the name of the owning table @param cellName the name of the Cell we want to retrieve from this Cells object. @return the {@code Date} value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null if this Cells object contains no cell whose name is cellName
[ "Returns", "the", "{", "@code", "Date", "}", "value", "of", "the", "{", "@link", "Cell", "}", "(", "associated", "to", "{", "@code", "table", "}", ")", "whose", "name", "iscellName", "or", "null", "if", "this", "Cells", "object", "contains", "no", "cel...
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L883-L885
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.createOrUpdate
public NetworkWatcherInner createOrUpdate(String resourceGroupName, String networkWatcherName, NetworkWatcherInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
java
public NetworkWatcherInner createOrUpdate(String resourceGroupName, String networkWatcherName, NetworkWatcherInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
[ "public", "NetworkWatcherInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "NetworkWatcherInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName...
Creates or updates a network watcher in the specified resource group. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param parameters Parameters that define the network watcher resource. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the NetworkWatcherInner object if successful.
[ "Creates", "or", "updates", "a", "network", "watcher", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L203-L205
m-m-m/util
xml/src/main/java/net/sf/mmm/util/xml/base/jaxb/XmlBeanMapper.java
XmlBeanMapper.loadXml
public T loadXml(InputStream inputStream, Object source) { try { Object unmarshalledObject = getOrCreateUnmarshaller().unmarshal(inputStream); T jaxbBean = this.xmlBeanClass.cast(unmarshalledObject); validate(jaxbBean); return jaxbBean; } catch (JAXBException e) { throw new XmlInvalidException(e, source); } }
java
public T loadXml(InputStream inputStream, Object source) { try { Object unmarshalledObject = getOrCreateUnmarshaller().unmarshal(inputStream); T jaxbBean = this.xmlBeanClass.cast(unmarshalledObject); validate(jaxbBean); return jaxbBean; } catch (JAXBException e) { throw new XmlInvalidException(e, source); } }
[ "public", "T", "loadXml", "(", "InputStream", "inputStream", ",", "Object", "source", ")", "{", "try", "{", "Object", "unmarshalledObject", "=", "getOrCreateUnmarshaller", "(", ")", ".", "unmarshal", "(", "inputStream", ")", ";", "T", "jaxbBean", "=", "this", ...
This method loads the JAXB-bean as XML from the given {@code inputStream}. @param inputStream is the {@link InputStream} with the XML to parse. @return the parsed XML converted to the according JAXB-bean. @param source describes the source of the invalid XML. Typically this will be the filename where the XML was read from. It is used in in the exception message. This will help to find the problem easier.
[ "This", "method", "loads", "the", "JAXB", "-", "bean", "as", "XML", "from", "the", "given", "{", "@code", "inputStream", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/xml/src/main/java/net/sf/mmm/util/xml/base/jaxb/XmlBeanMapper.java#L232-L242
nominanuda/zen-project
zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java
BaseTree.insertChild
public void insertChild(int i, Object t) { if (i < 0 || i > getChildCount()) { throw new IndexOutOfBoundsException(i+" out or range"); } if (children == null) { children = createChildrenList(); } children.add(i, t); // walk others to increment their child indexes // set index, parent of this one too this.freshenParentAndChildIndexes(i); }
java
public void insertChild(int i, Object t) { if (i < 0 || i > getChildCount()) { throw new IndexOutOfBoundsException(i+" out or range"); } if (children == null) { children = createChildrenList(); } children.add(i, t); // walk others to increment their child indexes // set index, parent of this one too this.freshenParentAndChildIndexes(i); }
[ "public", "void", "insertChild", "(", "int", "i", ",", "Object", "t", ")", "{", "if", "(", "i", "<", "0", "||", "i", ">", "getChildCount", "(", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "i", "+", "\" out or range\"", ")", ";", ...
Insert child t at child position i (0..n-1) by shifting children i+1..n-1 to the right one position. Set parent / indexes properly but does NOT collapse nil-rooted t's that come in here like addChild.
[ "Insert", "child", "t", "at", "child", "position", "i", "(", "0", "..", "n", "-", "1", ")", "by", "shifting", "children", "i", "+", "1", "..", "n", "-", "1", "to", "the", "right", "one", "position", ".", "Set", "parent", "/", "indexes", "properly",...
train
https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java#L162-L175
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java
OUTRES.relevantSubspace
protected boolean relevantSubspace(long[] subspace, DoubleDBIDList neigh, KernelDensityEstimator kernel) { final double crit = K_S_CRITICAL001 / FastMath.sqrt(neigh.size() - 2); double[] data = new double[neigh.size()]; Relation<? extends NumberVector> relation = kernel.relation; for(int dim = BitsUtil.nextSetBit(subspace, 0); dim >= 0; dim = BitsUtil.nextSetBit(subspace, dim + 1)) { // TODO: can/should we save this copy? int count = 0; for(DBIDIter neighbor = neigh.iter(); neighbor.valid(); neighbor.advance()) { data[count++] = relation.get(neighbor).doubleValue(dim); } assert (count == neigh.size()); Arrays.sort(data); final double min = data[0], norm = data[data.length - 1] - min; // Kolmogorow-Smirnow-Test against uniform distribution: boolean flag = false; for(int j = 1, end = data.length - 1; j < end; j++) { if(Math.abs(j / (data.length - 2.) - (data[j] - min) / norm) > crit) { flag = true; break; } } if(!flag) { return false; } } return true; }
java
protected boolean relevantSubspace(long[] subspace, DoubleDBIDList neigh, KernelDensityEstimator kernel) { final double crit = K_S_CRITICAL001 / FastMath.sqrt(neigh.size() - 2); double[] data = new double[neigh.size()]; Relation<? extends NumberVector> relation = kernel.relation; for(int dim = BitsUtil.nextSetBit(subspace, 0); dim >= 0; dim = BitsUtil.nextSetBit(subspace, dim + 1)) { // TODO: can/should we save this copy? int count = 0; for(DBIDIter neighbor = neigh.iter(); neighbor.valid(); neighbor.advance()) { data[count++] = relation.get(neighbor).doubleValue(dim); } assert (count == neigh.size()); Arrays.sort(data); final double min = data[0], norm = data[data.length - 1] - min; // Kolmogorow-Smirnow-Test against uniform distribution: boolean flag = false; for(int j = 1, end = data.length - 1; j < end; j++) { if(Math.abs(j / (data.length - 2.) - (data[j] - min) / norm) > crit) { flag = true; break; } } if(!flag) { return false; } } return true; }
[ "protected", "boolean", "relevantSubspace", "(", "long", "[", "]", "subspace", ",", "DoubleDBIDList", "neigh", ",", "KernelDensityEstimator", "kernel", ")", "{", "final", "double", "crit", "=", "K_S_CRITICAL001", "/", "FastMath", ".", "sqrt", "(", "neigh", ".", ...
Subspace relevance test. @param subspace Subspace to test @param neigh Neighbor list @param kernel Kernel density estimator @return relevance test result
[ "Subspace", "relevance", "test", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java#L249-L277
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java
GeoJsonToAssembler.fromTransferObject
public Point fromTransferObject(PointTo input, CrsId crsId) { if (input == null) { return null; } crsId = getCrsId(input, crsId); isValid(input); return createPoint(input.getCoordinates(), crsId); }
java
public Point fromTransferObject(PointTo input, CrsId crsId) { if (input == null) { return null; } crsId = getCrsId(input, crsId); isValid(input); return createPoint(input.getCoordinates(), crsId); }
[ "public", "Point", "fromTransferObject", "(", "PointTo", "input", ",", "CrsId", "crsId", ")", "{", "if", "(", "input", "==", "null", ")", "{", "return", "null", ";", "}", "crsId", "=", "getCrsId", "(", "input", ",", "crsId", ")", ";", "isValid", "(", ...
Creates a point object starting from a transfer object. @param input the point transfer object @param crsId the crs id to use (ignores the crs of the input). If null, uses the crs of the input. @return the corresponding geometry @throws IllegalArgumentException If the geometry could not be constructed due to an invalid transfer object
[ "Creates", "a", "point", "object", "starting", "from", "a", "transfer", "object", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java#L428-L435
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.writeUtf8Lines
public static <T> File writeUtf8Lines(Collection<T> list, File file) throws IORuntimeException { return writeLines(list, file, CharsetUtil.CHARSET_UTF_8); }
java
public static <T> File writeUtf8Lines(Collection<T> list, File file) throws IORuntimeException { return writeLines(list, file, CharsetUtil.CHARSET_UTF_8); }
[ "public", "static", "<", "T", ">", "File", "writeUtf8Lines", "(", "Collection", "<", "T", ">", "list", ",", "File", "file", ")", "throws", "IORuntimeException", "{", "return", "writeLines", "(", "list", ",", "file", ",", "CharsetUtil", ".", "CHARSET_UTF_8", ...
将列表写入文件,覆盖模式,编码为UTF-8 @param <T> 集合元素类型 @param list 列表 @param file 绝对路径 @return 目标文件 @throws IORuntimeException IO异常 @since 3.2.0
[ "将列表写入文件,覆盖模式,编码为UTF", "-", "8" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2867-L2869
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.updateShippingAddress
public ShippingAddress updateShippingAddress(final String accountCode, final long shippingAddressId, ShippingAddress shippingAddress) { return doPUT(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + ShippingAddresses.SHIPPING_ADDRESSES_RESOURCE + "/" + shippingAddressId, shippingAddress, ShippingAddress.class); }
java
public ShippingAddress updateShippingAddress(final String accountCode, final long shippingAddressId, ShippingAddress shippingAddress) { return doPUT(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + ShippingAddresses.SHIPPING_ADDRESSES_RESOURCE + "/" + shippingAddressId, shippingAddress, ShippingAddress.class); }
[ "public", "ShippingAddress", "updateShippingAddress", "(", "final", "String", "accountCode", ",", "final", "long", "shippingAddressId", ",", "ShippingAddress", "shippingAddress", ")", "{", "return", "doPUT", "(", "Accounts", ".", "ACCOUNTS_RESOURCE", "+", "\"/\"", "+"...
Update an existing shipping address <p> @param accountCode recurly account id @param shippingAddressId the shipping address id to update @param shippingAddress the shipping address request data @return the updated shipping address on success
[ "Update", "an", "existing", "shipping", "address", "<p", ">" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1219-L1222
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/MainActivity.java
MainActivity.createPreferenceButtonListener
private OnClickListener createPreferenceButtonListener() { return new OnClickListener() { @Override public void onClick(final View v) { Intent intent = new Intent(MainActivity.this, SettingsActivity.class); startActivity(intent); } }; }
java
private OnClickListener createPreferenceButtonListener() { return new OnClickListener() { @Override public void onClick(final View v) { Intent intent = new Intent(MainActivity.this, SettingsActivity.class); startActivity(intent); } }; }
[ "private", "OnClickListener", "createPreferenceButtonListener", "(", ")", "{", "return", "new", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "final", "View", "v", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", ...
Creates and returns a listener, which allows to show a default {@link PreferenceActivity}. @return The listener, which has been created as an instance of the type {@link OnClickListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "show", "a", "default", "{", "@link", "PreferenceActivity", "}", "." ]
train
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/MainActivity.java#L49-L59
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/NetUtils.java
NetUtils.getConnectAddress
public static InetSocketAddress getConnectAddress(Server server) { InetSocketAddress addr = server.getListenerAddress(); if (addr.getAddress().getHostAddress().equals("0.0.0.0")) { addr = new InetSocketAddress("127.0.0.1", addr.getPort()); } return addr; }
java
public static InetSocketAddress getConnectAddress(Server server) { InetSocketAddress addr = server.getListenerAddress(); if (addr.getAddress().getHostAddress().equals("0.0.0.0")) { addr = new InetSocketAddress("127.0.0.1", addr.getPort()); } return addr; }
[ "public", "static", "InetSocketAddress", "getConnectAddress", "(", "Server", "server", ")", "{", "InetSocketAddress", "addr", "=", "server", ".", "getListenerAddress", "(", ")", ";", "if", "(", "addr", ".", "getAddress", "(", ")", ".", "getHostAddress", "(", "...
Returns InetSocketAddress that a client can use to connect to the server. Server.getListenerAddress() is not correct when the server binds to "0.0.0.0". This returns "127.0.0.1:port" when the getListenerAddress() returns "0.0.0.0:port". @param server @return socket address that a client can use to connect to the server.
[ "Returns", "InetSocketAddress", "that", "a", "client", "can", "use", "to", "connect", "to", "the", "server", ".", "Server", ".", "getListenerAddress", "()", "is", "not", "correct", "when", "the", "server", "binds", "to", "0", ".", "0", ".", "0", ".", "0"...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetUtils.java#L287-L293
icode/ameba
src/main/java/ameba/core/Requests.java
Requests.evaluatePreconditions
public static Response.ResponseBuilder evaluatePreconditions(Date lastModified, EntityTag eTag) { return getRequest().evaluatePreconditions(lastModified, eTag); }
java
public static Response.ResponseBuilder evaluatePreconditions(Date lastModified, EntityTag eTag) { return getRequest().evaluatePreconditions(lastModified, eTag); }
[ "public", "static", "Response", ".", "ResponseBuilder", "evaluatePreconditions", "(", "Date", "lastModified", ",", "EntityTag", "eTag", ")", "{", "return", "getRequest", "(", ")", ".", "evaluatePreconditions", "(", "lastModified", ",", "eTag", ")", ";", "}" ]
<p>evaluatePreconditions.</p> @param lastModified a {@link java.util.Date} object. @param eTag a {@link javax.ws.rs.core.EntityTag} object. @return a {@link javax.ws.rs.core.Response.ResponseBuilder} object.
[ "<p", ">", "evaluatePreconditions", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/core/Requests.java#L740-L742
jboss/jboss-servlet-api_spec
src/main/java/javax/servlet/http/HttpServletResponseWrapper.java
HttpServletResponseWrapper.setHeader
@Override public void setHeader(String name, String value) { this._getHttpServletResponse().setHeader(name, value); }
java
@Override public void setHeader(String name, String value) { this._getHttpServletResponse().setHeader(name, value); }
[ "@", "Override", "public", "void", "setHeader", "(", "String", "name", ",", "String", "value", ")", "{", "this", ".", "_getHttpServletResponse", "(", ")", ".", "setHeader", "(", "name", ",", "value", ")", ";", "}" ]
The default behavior of this method is to return setHeader(String name, String value) on the wrapped response object.
[ "The", "default", "behavior", "of", "this", "method", "is", "to", "return", "setHeader", "(", "String", "name", "String", "value", ")", "on", "the", "wrapped", "response", "object", "." ]
train
https://github.com/jboss/jboss-servlet-api_spec/blob/5bc96f2b833c072baff6eb8ae49bc7b5e503e9b2/src/main/java/javax/servlet/http/HttpServletResponseWrapper.java#L207-L210
Azure/autorest-clientruntime-for-java
azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java
DAGraph.addDependencyGraph
public void addDependencyGraph(DAGraph<DataT, NodeT> dependencyGraph) { this.rootNode.addDependency(dependencyGraph.rootNode.key()); Map<String, NodeT> sourceNodeTable = dependencyGraph.nodeTable; Map<String, NodeT> targetNodeTable = this.nodeTable; this.merge(sourceNodeTable, targetNodeTable); dependencyGraph.parentDAGs.add(this); if (this.hasParents()) { this.bubbleUpNodeTable(this, new LinkedList<String>()); } }
java
public void addDependencyGraph(DAGraph<DataT, NodeT> dependencyGraph) { this.rootNode.addDependency(dependencyGraph.rootNode.key()); Map<String, NodeT> sourceNodeTable = dependencyGraph.nodeTable; Map<String, NodeT> targetNodeTable = this.nodeTable; this.merge(sourceNodeTable, targetNodeTable); dependencyGraph.parentDAGs.add(this); if (this.hasParents()) { this.bubbleUpNodeTable(this, new LinkedList<String>()); } }
[ "public", "void", "addDependencyGraph", "(", "DAGraph", "<", "DataT", ",", "NodeT", ">", "dependencyGraph", ")", "{", "this", ".", "rootNode", ".", "addDependency", "(", "dependencyGraph", ".", "rootNode", ".", "key", "(", ")", ")", ";", "Map", "<", "Strin...
Mark root of this DAG depends on given DAG's root. @param dependencyGraph the dependency DAG
[ "Mark", "root", "of", "this", "DAG", "depends", "on", "given", "DAG", "s", "root", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L101-L110
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/access/defaultdisseminator/DefaultDisseminatorImpl.java
DefaultDisseminatorImpl.viewItemIndex
public MIMETypedStream viewItemIndex() throws ServerException { // get the item index as xml Reader in = null; try { ReadableCharArrayWriter out = new ReadableCharArrayWriter(4096); ObjectInfoAsXML .getItemIndex(reposBaseURL, context .getEnvironmentValue(Constants.FEDORA_APP_CONTEXT_NAME), reader, asOfDateTime, out); out.close(); in = out.toReader(); } catch (Exception e) { throw new GeneralException("[DefaultDisseminatorImpl] An error has occurred. " + "The error was a \"" + e.getClass().getName() + "\" . The " + "Reason was \"" + e.getMessage() + "\" ."); } // convert the xml to an html view try { //InputStream in = getItemIndex().getStream(); ReadableByteArrayOutputStream bytes = new ReadableByteArrayOutputStream(2048); PrintWriter out = new PrintWriter( new OutputStreamWriter(bytes, Charset.forName("UTF-8"))); File xslFile = new File(reposHomeDir, "access/viewItemIndex.xslt"); Templates template = XmlTransformUtility.getTemplates(xslFile); Transformer transformer = template.newTransformer(); transformer.setParameter("fedora", context .getEnvironmentValue(Constants.FEDORA_APP_CONTEXT_NAME)); transformer.transform(new StreamSource(in), new StreamResult(out)); out.close(); return new MIMETypedStream("text/html", bytes.toInputStream(), null, bytes.length()); } catch (Exception e) { throw new DisseminationException("[DefaultDisseminatorImpl] had an error " + "in transforming xml for viewItemIndex. " + "Underlying exception was: " + e.getMessage()); } }
java
public MIMETypedStream viewItemIndex() throws ServerException { // get the item index as xml Reader in = null; try { ReadableCharArrayWriter out = new ReadableCharArrayWriter(4096); ObjectInfoAsXML .getItemIndex(reposBaseURL, context .getEnvironmentValue(Constants.FEDORA_APP_CONTEXT_NAME), reader, asOfDateTime, out); out.close(); in = out.toReader(); } catch (Exception e) { throw new GeneralException("[DefaultDisseminatorImpl] An error has occurred. " + "The error was a \"" + e.getClass().getName() + "\" . The " + "Reason was \"" + e.getMessage() + "\" ."); } // convert the xml to an html view try { //InputStream in = getItemIndex().getStream(); ReadableByteArrayOutputStream bytes = new ReadableByteArrayOutputStream(2048); PrintWriter out = new PrintWriter( new OutputStreamWriter(bytes, Charset.forName("UTF-8"))); File xslFile = new File(reposHomeDir, "access/viewItemIndex.xslt"); Templates template = XmlTransformUtility.getTemplates(xslFile); Transformer transformer = template.newTransformer(); transformer.setParameter("fedora", context .getEnvironmentValue(Constants.FEDORA_APP_CONTEXT_NAME)); transformer.transform(new StreamSource(in), new StreamResult(out)); out.close(); return new MIMETypedStream("text/html", bytes.toInputStream(), null, bytes.length()); } catch (Exception e) { throw new DisseminationException("[DefaultDisseminatorImpl] had an error " + "in transforming xml for viewItemIndex. " + "Underlying exception was: " + e.getMessage()); } }
[ "public", "MIMETypedStream", "viewItemIndex", "(", ")", "throws", "ServerException", "{", "// get the item index as xml", "Reader", "in", "=", "null", ";", "try", "{", "ReadableCharArrayWriter", "out", "=", "new", "ReadableCharArrayWriter", "(", "4096", ")", ";", "O...
Returns an HTML rendering of the Item Index for the object. The Item Index is a list of all datastreams in the object. The datastream items can be data or metadata. The Item Index is returned as HTML in a presentation-oriented format. This is accomplished by doing an XSLT transform on the XML that is obtained from listDatastreams in API-A. @return html packaged as a MIMETypedStream @throws ServerException
[ "Returns", "an", "HTML", "rendering", "of", "the", "Item", "Index", "for", "the", "object", ".", "The", "Item", "Index", "is", "a", "list", "of", "all", "datastreams", "in", "the", "object", ".", "The", "datastream", "items", "can", "be", "data", "or", ...
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/access/defaultdisseminator/DefaultDisseminatorImpl.java#L215-L258
alkacon/opencms-core
src/org/opencms/ui/apps/sessions/CmsSessionsTable.java
CmsSessionsTable.getCloseRunnable
protected static Runnable getCloseRunnable(final Window window, final CmsSessionsTable table) { return new Runnable() { public void run() { window.close(); try { table.ini(); } catch (CmsException e) { LOG.error("Error on reading session information", e); } } }; }
java
protected static Runnable getCloseRunnable(final Window window, final CmsSessionsTable table) { return new Runnable() { public void run() { window.close(); try { table.ini(); } catch (CmsException e) { LOG.error("Error on reading session information", e); } } }; }
[ "protected", "static", "Runnable", "getCloseRunnable", "(", "final", "Window", "window", ",", "final", "CmsSessionsTable", "table", ")", "{", "return", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "window", ".", "close", "(", "...
Runnable called when a window should be closed.<p> Reinitializes the table.<p> @param window to be closed @param table to be updated @return a runnable
[ "Runnable", "called", "when", "a", "window", "should", "be", "closed", ".", "<p", ">", "Reinitializes", "the", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsSessionsTable.java#L457-L473
sebastiangraf/jSCSI
bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java
Configuration.getSettings
public final SettingsMap getSettings (final String targetName, final int connectionID) { final SettingsMap sm = new SettingsMap(); // set all default settings synchronized (globalConfig) { for (Map.Entry<OperationalTextKey , SettingEntry> e : globalConfig.entrySet()) { sm.add(e.getKey(), e.getValue().getValue()); } } // set all further settings final SessionConfiguration sc; synchronized (sessionConfigs) { sc = sessionConfigs.get(targetName); synchronized (sc) { if (sc != null) { final SettingsMap furtherSettings = sc.getSettings(connectionID); for (Map.Entry<OperationalTextKey , String> e : furtherSettings.entrySet()) { sm.add(e.getKey(), e.getValue()); } } } } return sm; }
java
public final SettingsMap getSettings (final String targetName, final int connectionID) { final SettingsMap sm = new SettingsMap(); // set all default settings synchronized (globalConfig) { for (Map.Entry<OperationalTextKey , SettingEntry> e : globalConfig.entrySet()) { sm.add(e.getKey(), e.getValue().getValue()); } } // set all further settings final SessionConfiguration sc; synchronized (sessionConfigs) { sc = sessionConfigs.get(targetName); synchronized (sc) { if (sc != null) { final SettingsMap furtherSettings = sc.getSettings(connectionID); for (Map.Entry<OperationalTextKey , String> e : furtherSettings.entrySet()) { sm.add(e.getKey(), e.getValue()); } } } } return sm; }
[ "public", "final", "SettingsMap", "getSettings", "(", "final", "String", "targetName", ",", "final", "int", "connectionID", ")", "{", "final", "SettingsMap", "sm", "=", "new", "SettingsMap", "(", ")", ";", "// set all default settings", "synchronized", "(", "globa...
Unifies all parameters (in the right precedence) and returns one <code>SettingsMap</code>. Right order means: default, then the session-wide, and finally the connection-wide valid parameters. @param targetName Name of the iSCSI Target to connect. @param connectionID The ID of the connection to retrieve. @return All unified parameters in one single <code>SettingsMap</code>.
[ "Unifies", "all", "parameters", "(", "in", "the", "right", "precedence", ")", "and", "returns", "one", "<code", ">", "SettingsMap<", "/", "code", ">", ".", "Right", "order", "means", ":", "default", "then", "the", "session", "-", "wide", "and", "finally", ...
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java#L245-L272
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.unescapeUriPath
public static String unescapeUriPath(final String text, final String encoding) { if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } return UriEscapeUtil.unescape(text, UriEscapeUtil.UriEscapeType.PATH, encoding); }
java
public static String unescapeUriPath(final String text, final String encoding) { if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } return UriEscapeUtil.unescape(text, UriEscapeUtil.UriEscapeType.PATH, encoding); }
[ "public", "static", "String", "unescapeUriPath", "(", "final", "String", "text", ",", "final", "String", "encoding", ")", "{", "if", "(", "encoding", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'encoding' cannot be null\"", ...
<p> Perform am URI path <strong>unescape</strong> operation on a <tt>String</tt> input. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use the specified <tt>encoding</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be unescaped. @param encoding the encoding to be used for unescaping. @return The unescaped result <tt>String</tt>. As a memory-performance improvement, will return the exact same object as the <tt>text</tt> input argument if no unescaping modifications were required (and no additional <tt>String</tt> objects will be created during processing). Will return <tt>null</tt> if input is <tt>null</tt>.
[ "<p", ">", "Perform", "am", "URI", "path", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "unescape", "every", "...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1568-L1573
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateTime.java
DateTime.toCalendar
public Calendar toCalendar(TimeZone zone, Locale locale) { if (null == locale) { locale = Locale.getDefault(Locale.Category.FORMAT); } final Calendar cal = (null != zone) ? Calendar.getInstance(zone, locale) : Calendar.getInstance(locale); cal.setFirstDayOfWeek(firstDayOfWeek.getValue()); cal.setTime(this); return cal; }
java
public Calendar toCalendar(TimeZone zone, Locale locale) { if (null == locale) { locale = Locale.getDefault(Locale.Category.FORMAT); } final Calendar cal = (null != zone) ? Calendar.getInstance(zone, locale) : Calendar.getInstance(locale); cal.setFirstDayOfWeek(firstDayOfWeek.getValue()); cal.setTime(this); return cal; }
[ "public", "Calendar", "toCalendar", "(", "TimeZone", "zone", ",", "Locale", "locale", ")", "{", "if", "(", "null", "==", "locale", ")", "{", "locale", "=", "Locale", ".", "getDefault", "(", "Locale", ".", "Category", ".", "FORMAT", ")", ";", "}", "fina...
转换为Calendar @param zone 时区 {@link TimeZone} @param locale 地域 {@link Locale} @return {@link Calendar}
[ "转换为Calendar" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L541-L549
LearnLib/automatalib
util/src/main/java/net/automatalib/util/minimizer/Minimizer.java
Minimizer.removeFromSplitterQueue
private boolean removeFromSplitterQueue(Block<S, L> block) { ElementReference ref = block.getSplitterQueueReference(); if (ref == null) { return false; } splitters.remove(ref); block.setSplitterQueueReference(null); return true; }
java
private boolean removeFromSplitterQueue(Block<S, L> block) { ElementReference ref = block.getSplitterQueueReference(); if (ref == null) { return false; } splitters.remove(ref); block.setSplitterQueueReference(null); return true; }
[ "private", "boolean", "removeFromSplitterQueue", "(", "Block", "<", "S", ",", "L", ">", "block", ")", "{", "ElementReference", "ref", "=", "block", ".", "getSplitterQueueReference", "(", ")", ";", "if", "(", "ref", "==", "null", ")", "{", "return", "false"...
Removes a block from the splitter queue. This is done when it is split completely and thus no longer existant.
[ "Removes", "a", "block", "from", "the", "splitter", "queue", ".", "This", "is", "done", "when", "it", "is", "split", "completely", "and", "thus", "no", "longer", "existant", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/minimizer/Minimizer.java#L237-L247
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertFromFarenheit
public static double convertFromFarenheit (TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return temperature; case CELSIUS: return convertFarenheitToCelsius(temperature); case KELVIN: return convertFarenheitToKelvin(temperature); case RANKINE: return convertFarenheitToRankine(temperature); default: throw(new RuntimeException("Invalid termpature conversion")); } }
java
public static double convertFromFarenheit (TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return temperature; case CELSIUS: return convertFarenheitToCelsius(temperature); case KELVIN: return convertFarenheitToKelvin(temperature); case RANKINE: return convertFarenheitToRankine(temperature); default: throw(new RuntimeException("Invalid termpature conversion")); } }
[ "public", "static", "double", "convertFromFarenheit", "(", "TemperatureScale", "to", ",", "double", "temperature", ")", "{", "switch", "(", "to", ")", "{", "case", "FARENHEIT", ":", "return", "temperature", ";", "case", "CELSIUS", ":", "return", "convertFarenhei...
Convert a temperature value from the Farenheit temperature scale to another. @param to TemperatureScale @param temperature value in degrees Farenheit @return converted temperature value in the requested to scale
[ "Convert", "a", "temperature", "value", "from", "the", "Farenheit", "temperature", "scale", "to", "another", "." ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L73-L88
h2oai/h2o-3
h2o-parsers/h2o-orc-parser/src/main/java/water/parser/orc/OrcParser.java
OrcParser.write1column
private void write1column(ColumnVector oneColumn, String columnType, int cIdx, int rowNumber,ParseWriter dout) { if(oneColumn.isRepeating && !oneColumn.noNulls) { // ALL NAs for(int i = 0; i < rowNumber; ++i) dout.addInvalidCol(cIdx); } else switch (columnType.toLowerCase()) { case "bigint": case "boolean": case "int": case "smallint": case "tinyint": writeLongcolumn((LongColumnVector)oneColumn, cIdx, rowNumber, dout); break; case "float": case "double": writeDoublecolumn((DoubleColumnVector)oneColumn, cIdx, rowNumber, dout); break; case "numeric": case "real": if (oneColumn instanceof LongColumnVector) writeLongcolumn((LongColumnVector)oneColumn, cIdx, rowNumber, dout); else writeDoublecolumn((DoubleColumnVector)oneColumn, cIdx, rowNumber, dout); break; case "string": case "varchar": case "char": // case "binary": //FIXME: only reading it as string right now. writeStringcolumn((BytesColumnVector)oneColumn, cIdx, rowNumber, dout); break; case "date": case "timestamp": writeTimecolumn((LongColumnVector)oneColumn, columnType, cIdx, rowNumber, dout); break; case "decimal": writeDecimalcolumn((DecimalColumnVector)oneColumn, cIdx, rowNumber, dout); break; default: throw new IllegalArgumentException("Unsupported Orc schema type: " + columnType); } }
java
private void write1column(ColumnVector oneColumn, String columnType, int cIdx, int rowNumber,ParseWriter dout) { if(oneColumn.isRepeating && !oneColumn.noNulls) { // ALL NAs for(int i = 0; i < rowNumber; ++i) dout.addInvalidCol(cIdx); } else switch (columnType.toLowerCase()) { case "bigint": case "boolean": case "int": case "smallint": case "tinyint": writeLongcolumn((LongColumnVector)oneColumn, cIdx, rowNumber, dout); break; case "float": case "double": writeDoublecolumn((DoubleColumnVector)oneColumn, cIdx, rowNumber, dout); break; case "numeric": case "real": if (oneColumn instanceof LongColumnVector) writeLongcolumn((LongColumnVector)oneColumn, cIdx, rowNumber, dout); else writeDoublecolumn((DoubleColumnVector)oneColumn, cIdx, rowNumber, dout); break; case "string": case "varchar": case "char": // case "binary": //FIXME: only reading it as string right now. writeStringcolumn((BytesColumnVector)oneColumn, cIdx, rowNumber, dout); break; case "date": case "timestamp": writeTimecolumn((LongColumnVector)oneColumn, columnType, cIdx, rowNumber, dout); break; case "decimal": writeDecimalcolumn((DecimalColumnVector)oneColumn, cIdx, rowNumber, dout); break; default: throw new IllegalArgumentException("Unsupported Orc schema type: " + columnType); } }
[ "private", "void", "write1column", "(", "ColumnVector", "oneColumn", ",", "String", "columnType", ",", "int", "cIdx", ",", "int", "rowNumber", ",", "ParseWriter", "dout", ")", "{", "if", "(", "oneColumn", ".", "isRepeating", "&&", "!", "oneColumn", ".", "noN...
This method writes one column of H2O data frame at a time. @param oneColumn @param columnType @param cIdx @param rowNumber @param dout
[ "This", "method", "writes", "one", "column", "of", "H2O", "data", "frame", "at", "a", "time", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-parsers/h2o-orc-parser/src/main/java/water/parser/orc/OrcParser.java#L165-L204
jamel/dbf
dbf-reader/src/main/java/org/jamel/dbf/utils/DbfUtils.java
DbfUtils.parseLong
public static long parseLong(byte[] bytes, int from, int to) { long result = 0; for (int i = from; i < to && i < bytes.length; i++) { result *= 10; result += (bytes[i] - (byte) '0'); } return result; }
java
public static long parseLong(byte[] bytes, int from, int to) { long result = 0; for (int i = from; i < to && i < bytes.length; i++) { result *= 10; result += (bytes[i] - (byte) '0'); } return result; }
[ "public", "static", "long", "parseLong", "(", "byte", "[", "]", "bytes", ",", "int", "from", ",", "int", "to", ")", "{", "long", "result", "=", "0", ";", "for", "(", "int", "i", "=", "from", ";", "i", "<", "to", "&&", "i", "<", "bytes", ".", ...
parses only positive numbers @param bytes bytes of string value @param from index to start from @param to index to end at @return integer value
[ "parses", "only", "positive", "numbers" ]
train
https://github.com/jamel/dbf/blob/5f065f8a13d9a4ffe27c617e7ec321771c95da7f/dbf-reader/src/main/java/org/jamel/dbf/utils/DbfUtils.java#L105-L112
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.constraintHomography
public static Point2D_F64 constraintHomography( DMatrixRMaj H , Point2D_F64 p1 , Point2D_F64 outputP2 ) { if( outputP2 == null ) outputP2 = new Point2D_F64(); GeometryMath_F64.mult(H,p1,outputP2); return outputP2; }
java
public static Point2D_F64 constraintHomography( DMatrixRMaj H , Point2D_F64 p1 , Point2D_F64 outputP2 ) { if( outputP2 == null ) outputP2 = new Point2D_F64(); GeometryMath_F64.mult(H,p1,outputP2); return outputP2; }
[ "public", "static", "Point2D_F64", "constraintHomography", "(", "DMatrixRMaj", "H", ",", "Point2D_F64", "p1", ",", "Point2D_F64", "outputP2", ")", "{", "if", "(", "outputP2", "==", "null", ")", "outputP2", "=", "new", "Point2D_F64", "(", ")", ";", "GeometryMat...
<p> Applies the homography constraints to two points:<br> z*p2 = H*p1<br> where z is a scale factor and (p1,p2) are point observations. Note that since 2D points are inputted translation and normalization to homogeneous coordinates with z=1 is automatically handled. </p> @param H Input: 3x3 Homography matrix. @param p1 Input: Point in view 1. @param outputP2 Output: storage for point in view 2. @return Predicted point in view 2
[ "<p", ">", "Applies", "the", "homography", "constraints", "to", "two", "points", ":", "<br", ">", "z", "*", "p2", "=", "H", "*", "p1<br", ">", "where", "z", "is", "a", "scale", "factor", "and", "(", "p1", "p2", ")", "are", "point", "observations", ...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L417-L424
square/wire
wire-schema/src/main/java/com/squareup/wire/schema/Schema.java
Schema.protoAdapter
public ProtoAdapter<Object> protoAdapter(String typeName, boolean includeUnknown) { Type type = getType(typeName); if (type == null) throw new IllegalArgumentException("unexpected type " + typeName); return new SchemaProtoAdapterFactory(this, includeUnknown).get(type.type()); }
java
public ProtoAdapter<Object> protoAdapter(String typeName, boolean includeUnknown) { Type type = getType(typeName); if (type == null) throw new IllegalArgumentException("unexpected type " + typeName); return new SchemaProtoAdapterFactory(this, includeUnknown).get(type.type()); }
[ "public", "ProtoAdapter", "<", "Object", ">", "protoAdapter", "(", "String", "typeName", ",", "boolean", "includeUnknown", ")", "{", "Type", "type", "=", "getType", "(", "typeName", ")", ";", "if", "(", "type", "==", "null", ")", "throw", "new", "IllegalAr...
Returns a wire adapter for the message or enum type named {@code typeName}. The returned type adapter doesn't have model classes to encode and decode from, so instead it uses scalar types ({@linkplain String}, {@linkplain okio.ByteString ByteString}, {@linkplain Integer}, etc.), {@linkplain Map maps}, and {@linkplain java.util.List lists}. It can both encode and decode these objects. Map keys are field names. @param includeUnknown true to include values for unknown tags in the returned model. Map keys for such values is the unknown value's tag name as a string. Unknown values are decoded to {@linkplain Long}, {@linkplain Long}, {@linkplain Integer}, or {@linkplain okio.ByteString ByteString} for {@linkplain com.squareup.wire.FieldEncoding#VARINT VARINT}, {@linkplain com.squareup.wire.FieldEncoding#FIXED64 FIXED64}, {@linkplain com.squareup.wire.FieldEncoding#FIXED32 FIXED32}, or {@linkplain com.squareup.wire.FieldEncoding#LENGTH_DELIMITED LENGTH_DELIMITED} respectively.
[ "Returns", "a", "wire", "adapter", "for", "the", "message", "or", "enum", "type", "named", "{", "@code", "typeName", "}", ".", "The", "returned", "type", "adapter", "doesn", "t", "have", "model", "classes", "to", "encode", "and", "decode", "from", "so", ...
train
https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/Schema.java#L154-L158
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsListItem.java
CmsListItem.removeDecorationWidget
protected void removeDecorationWidget(Widget widget, int width) { if ((widget != null) && m_decorationWidgets.remove(widget)) { m_decorationWidth -= width; initContent(); } }
java
protected void removeDecorationWidget(Widget widget, int width) { if ((widget != null) && m_decorationWidgets.remove(widget)) { m_decorationWidth -= width; initContent(); } }
[ "protected", "void", "removeDecorationWidget", "(", "Widget", "widget", ",", "int", "width", ")", "{", "if", "(", "(", "widget", "!=", "null", ")", "&&", "m_decorationWidgets", ".", "remove", "(", "widget", ")", ")", "{", "m_decorationWidth", "-=", "width", ...
Removes a decoration widget.<p> @param widget the widget to remove @param width the widget width
[ "Removes", "a", "decoration", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItem.java#L688-L694
tomgibara/streams
src/main/java/com/tomgibara/streams/Streams.java
Streams.concatWriteStreams
public static WriteStream concatWriteStreams(StreamCloser closer, WriteStream... streams) { if (closer == null) throw new IllegalArgumentException("null closer"); if (streams == null) throw new IllegalArgumentException("null streams"); for (WriteStream stream : streams) { if (stream == null) throw new IllegalArgumentException("null stream"); } return new SeqWriteStream(closer, streams); }
java
public static WriteStream concatWriteStreams(StreamCloser closer, WriteStream... streams) { if (closer == null) throw new IllegalArgumentException("null closer"); if (streams == null) throw new IllegalArgumentException("null streams"); for (WriteStream stream : streams) { if (stream == null) throw new IllegalArgumentException("null stream"); } return new SeqWriteStream(closer, streams); }
[ "public", "static", "WriteStream", "concatWriteStreams", "(", "StreamCloser", "closer", ",", "WriteStream", "...", "streams", ")", "{", "if", "(", "closer", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null closer\"", ")", ";", "if", "(...
<p> A stream that writes byte data to a fixed sequence of underlying streams. <p> This is a multi-stream analogue of {@link WriteStream#andThen(StreamCloser, WriteStream)} or {@link WriteStream#butFirst(StreamCloser, WriteStream)} methods. Each stream is closed after it has been filled, with the last stream being closed on an end of stream condition. <p> All unclosed streams are operated on by the {@link StreamCloser} when {@link CloseableStream#close()} is called. @param streams streams to which byte data is to be written @param closer logic to be performed on each stream before writing data to the next stream @return a stream that splits its writing across multiple streams
[ "<p", ">", "A", "stream", "that", "writes", "byte", "data", "to", "a", "fixed", "sequence", "of", "underlying", "streams", "." ]
train
https://github.com/tomgibara/streams/blob/553dc97293a1f1fd2d88e08d26e19369e9ffa6d3/src/main/java/com/tomgibara/streams/Streams.java#L528-L535
liyiorg/weixin-popular
src/main/java/weixin/popular/api/WxopenAPI.java
WxopenAPI.templateLibraryList
public static TemplateLibraryListResult templateLibraryList(String access_token,int offset,int count){ String json = String.format("{\"offset\":%d,\"count\":%d}", offset, count); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI+"/cgi-bin/wxopen/template/library/list") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,TemplateLibraryListResult.class); }
java
public static TemplateLibraryListResult templateLibraryList(String access_token,int offset,int count){ String json = String.format("{\"offset\":%d,\"count\":%d}", offset, count); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI+"/cgi-bin/wxopen/template/library/list") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,TemplateLibraryListResult.class); }
[ "public", "static", "TemplateLibraryListResult", "templateLibraryList", "(", "String", "access_token", ",", "int", "offset", ",", "int", "count", ")", "{", "String", "json", "=", "String", ".", "format", "(", "\"{\\\"offset\\\":%d,\\\"count\\\":%d}\"", ",", "offset", ...
获取小程序模板库标题列表 @since 2.8.18 @param access_token access_token @param offset offset和count用于分页,表示从offset开始,拉取count条记录,offset从0开始,count最大为20。 @param count offset和count用于分页,表示从offset开始,拉取count条记录,offset从0开始,count最大为20。 @return result
[ "获取小程序模板库标题列表" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/WxopenAPI.java#L86-L95
zackpollard/JavaTelegramBot-API
core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java
TelegramBot.login
public static TelegramBot login(String authToken) { try { HttpRequestWithBody request = Unirest.post(API_URL + "bot" + authToken + "/getMe"); HttpResponse<String> response = request.asString(); JSONObject jsonResponse = Utils.processResponse(response); if (jsonResponse != null && Utils.checkResponseStatus(jsonResponse)) { JSONObject result = jsonResponse.getJSONObject("result"); return new TelegramBot(authToken, result.getInt("id"), result.getString("first_name"), result.getString("username")); } } catch (UnirestException e) { e.printStackTrace(); } return null; }
java
public static TelegramBot login(String authToken) { try { HttpRequestWithBody request = Unirest.post(API_URL + "bot" + authToken + "/getMe"); HttpResponse<String> response = request.asString(); JSONObject jsonResponse = Utils.processResponse(response); if (jsonResponse != null && Utils.checkResponseStatus(jsonResponse)) { JSONObject result = jsonResponse.getJSONObject("result"); return new TelegramBot(authToken, result.getInt("id"), result.getString("first_name"), result.getString("username")); } } catch (UnirestException e) { e.printStackTrace(); } return null; }
[ "public", "static", "TelegramBot", "login", "(", "String", "authToken", ")", "{", "try", "{", "HttpRequestWithBody", "request", "=", "Unirest", ".", "post", "(", "API_URL", "+", "\"bot\"", "+", "authToken", "+", "\"/getMe\"", ")", ";", "HttpResponse", "<", "...
Use this method to get a new TelegramBot instance with the selected auth token @param authToken The bots auth token @return A new TelegramBot instance or null if something failed
[ "Use", "this", "method", "to", "get", "a", "new", "TelegramBot", "instance", "with", "the", "selected", "auth", "token" ]
train
https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L90-L109
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/SpringLoaded.java
SpringLoaded.loadNewVersionOfType
public static int loadNewVersionOfType(Class<?> clazz, byte[] newbytes) { return loadNewVersionOfType(clazz.getClassLoader(), clazz.getName(), newbytes); }
java
public static int loadNewVersionOfType(Class<?> clazz, byte[] newbytes) { return loadNewVersionOfType(clazz.getClassLoader(), clazz.getName(), newbytes); }
[ "public", "static", "int", "loadNewVersionOfType", "(", "Class", "<", "?", ">", "clazz", ",", "byte", "[", "]", "newbytes", ")", "{", "return", "loadNewVersionOfType", "(", "clazz", ".", "getClassLoader", "(", ")", ",", "clazz", ".", "getName", "(", ")", ...
Force a reload of an existing type. @param clazz the class to be reloaded @param newbytes the data bytecode data to reload as the new version @return int return code: 0 is success. 1 is unknown classloader, 2 is unknown type (possibly not yet loaded). 3 is reload event failed. 4 is exception occurred.
[ "Force", "a", "reload", "of", "an", "existing", "type", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/SpringLoaded.java#L35-L37
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/Iterators.java
Iterators.getOnlyElement
@CanIgnoreReturnValue // TODO(kak): Consider removing this? @Nullable public static <T> T getOnlyElement(Iterator<? extends T> iterator, @Nullable T defaultValue) { return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue; }
java
@CanIgnoreReturnValue // TODO(kak): Consider removing this? @Nullable public static <T> T getOnlyElement(Iterator<? extends T> iterator, @Nullable T defaultValue) { return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue; }
[ "@", "CanIgnoreReturnValue", "// TODO(kak): Consider removing this?", "@", "Nullable", "public", "static", "<", "T", ">", "T", "getOnlyElement", "(", "Iterator", "<", "?", "extends", "T", ">", "iterator", ",", "@", "Nullable", "T", "defaultValue", ")", "{", "ret...
Returns the single element contained in {@code iterator}, or {@code defaultValue} if the iterator is empty. @throws IllegalArgumentException if the iterator contains multiple elements. The state of the iterator is unspecified.
[ "Returns", "the", "single", "element", "contained", "in", "{", "@code", "iterator", "}", "or", "{", "@code", "defaultValue", "}", "if", "the", "iterator", "is", "empty", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Iterators.java#L332-L336
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.removeBeforeLast
@Override public boolean removeBeforeLast(ST obj, PT pt) { return removeUntil(lastIndexOf(obj, pt), false); }
java
@Override public boolean removeBeforeLast(ST obj, PT pt) { return removeUntil(lastIndexOf(obj, pt), false); }
[ "@", "Override", "public", "boolean", "removeBeforeLast", "(", "ST", "obj", ",", "PT", "pt", ")", "{", "return", "removeUntil", "(", "lastIndexOf", "(", "obj", ",", "pt", ")", ",", "false", ")", ";", "}" ]
Remove the path's elements before the specified one which is starting at the specified point. The specified element will not be removed. <p>This function removes until the <i>last occurence</i> of the given object. @param obj is the segment to remove @param pt is the point on which the segment was connected as its first point. @return <code>true</code> on success, otherwise <code>false</code>
[ "Remove", "the", "path", "s", "elements", "before", "the", "specified", "one", "which", "is", "starting", "at", "the", "specified", "point", ".", "The", "specified", "element", "will", "not", "be", "removed", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L691-L694
windup/windup
config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java
Iteration.getCurrentPayload
@SuppressWarnings("unchecked") public static <FRAMETYPE extends WindupVertexFrame> FRAMETYPE getCurrentPayload(Variables stack, String name) throws IllegalStateException, IllegalArgumentException { Map<String, Iterable<? extends WindupVertexFrame>> vars = stack.peek(); Iterable<? extends WindupVertexFrame> existingValue = vars.get(name); if (!(existingValue == null || existingValue instanceof IterationPayload)) { throw new IllegalArgumentException("Variable \"" + name + "\" is not an " + Iteration.class.getSimpleName() + " variable."); } Object object = stack.findSingletonVariable(name); return (FRAMETYPE) object; }
java
@SuppressWarnings("unchecked") public static <FRAMETYPE extends WindupVertexFrame> FRAMETYPE getCurrentPayload(Variables stack, String name) throws IllegalStateException, IllegalArgumentException { Map<String, Iterable<? extends WindupVertexFrame>> vars = stack.peek(); Iterable<? extends WindupVertexFrame> existingValue = vars.get(name); if (!(existingValue == null || existingValue instanceof IterationPayload)) { throw new IllegalArgumentException("Variable \"" + name + "\" is not an " + Iteration.class.getSimpleName() + " variable."); } Object object = stack.findSingletonVariable(name); return (FRAMETYPE) object; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "FRAMETYPE", "extends", "WindupVertexFrame", ">", "FRAMETYPE", "getCurrentPayload", "(", "Variables", "stack", ",", "String", "name", ")", "throws", "IllegalStateException", ",", "IllegalArgu...
Get the {@link Iteration} payload with the given name. @throws IllegalArgumentException if the given variable refers to a non-payload.
[ "Get", "the", "{", "@link", "Iteration", "}", "payload", "with", "the", "given", "name", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java#L416-L431
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java
MeshGenerator.generateCone
public static void generateCone(TFloatList positions, TFloatList normals, TIntList indices, float radius, float height) { // 0,0,0 will be halfway up the cone in the middle final float halfHeight = height / 2; // The positions at the bottom rim of the cone final List<Vector3f> rim = new ArrayList<>(); for (int angle = 0; angle < 360; angle += 15) { final double angleRads = Math.toRadians(angle); rim.add(new Vector3f( radius * TrigMath.cos(angleRads), -halfHeight, radius * -TrigMath.sin(angleRads))); } // Apex of the cone final Vector3f top = new Vector3f(0, halfHeight, 0); // The normal for the triangle of the bottom face final Vector3f bottomNormal = new Vector3f(0, -1, 0); // Add the bottom face center vertex addVector(positions, new Vector3f(0, -halfHeight, 0));// 0 addVector(normals, bottomNormal); // The square of the radius of the cone on the xy plane final float radiusSquared = radius * radius / 4; // Add all the faces section by section, turning around the y axis final int rimSize = rim.size(); for (int i = 0; i < rimSize; i++) { // Get the bottom vertex position and the side normal final Vector3f b = rim.get(i); final Vector3f bn = new Vector3f(b.getX() / radiusSquared, halfHeight - b.getY(), b.getZ() / radiusSquared).normalize(); // Average the current and next normal to get the top normal final int nextI = i == rimSize - 1 ? 0 : i + 1; final Vector3f nextB = rim.get(nextI); final Vector3f nextBN = new Vector3f(nextB.getX() / radiusSquared, halfHeight - nextB.getY(), nextB.getZ() / radiusSquared).normalize(); final Vector3f tn = bn.add(nextBN).normalize(); // Top side vertex addVector(positions, top);// index addVector(normals, tn); // Bottom side vertex addVector(positions, b);// index + 1 addVector(normals, bn); // Bottom face vertex addVector(positions, b);// index + 2 addVector(normals, bottomNormal); // Get the current index for our vertices final int currentIndex = i * 3 + 1; // Get the index for the next iteration, wrapping around at the end final int nextIndex = nextI * 3 + 1; // Add the 2 triangles (1 side, 1 bottom) addAll(indices, currentIndex, currentIndex + 1, nextIndex + 1); addAll(indices, currentIndex + 2, 0, nextIndex + 2); } }
java
public static void generateCone(TFloatList positions, TFloatList normals, TIntList indices, float radius, float height) { // 0,0,0 will be halfway up the cone in the middle final float halfHeight = height / 2; // The positions at the bottom rim of the cone final List<Vector3f> rim = new ArrayList<>(); for (int angle = 0; angle < 360; angle += 15) { final double angleRads = Math.toRadians(angle); rim.add(new Vector3f( radius * TrigMath.cos(angleRads), -halfHeight, radius * -TrigMath.sin(angleRads))); } // Apex of the cone final Vector3f top = new Vector3f(0, halfHeight, 0); // The normal for the triangle of the bottom face final Vector3f bottomNormal = new Vector3f(0, -1, 0); // Add the bottom face center vertex addVector(positions, new Vector3f(0, -halfHeight, 0));// 0 addVector(normals, bottomNormal); // The square of the radius of the cone on the xy plane final float radiusSquared = radius * radius / 4; // Add all the faces section by section, turning around the y axis final int rimSize = rim.size(); for (int i = 0; i < rimSize; i++) { // Get the bottom vertex position and the side normal final Vector3f b = rim.get(i); final Vector3f bn = new Vector3f(b.getX() / radiusSquared, halfHeight - b.getY(), b.getZ() / radiusSquared).normalize(); // Average the current and next normal to get the top normal final int nextI = i == rimSize - 1 ? 0 : i + 1; final Vector3f nextB = rim.get(nextI); final Vector3f nextBN = new Vector3f(nextB.getX() / radiusSquared, halfHeight - nextB.getY(), nextB.getZ() / radiusSquared).normalize(); final Vector3f tn = bn.add(nextBN).normalize(); // Top side vertex addVector(positions, top);// index addVector(normals, tn); // Bottom side vertex addVector(positions, b);// index + 1 addVector(normals, bn); // Bottom face vertex addVector(positions, b);// index + 2 addVector(normals, bottomNormal); // Get the current index for our vertices final int currentIndex = i * 3 + 1; // Get the index for the next iteration, wrapping around at the end final int nextIndex = nextI * 3 + 1; // Add the 2 triangles (1 side, 1 bottom) addAll(indices, currentIndex, currentIndex + 1, nextIndex + 1); addAll(indices, currentIndex + 2, 0, nextIndex + 2); } }
[ "public", "static", "void", "generateCone", "(", "TFloatList", "positions", ",", "TFloatList", "normals", ",", "TIntList", "indices", ",", "float", "radius", ",", "float", "height", ")", "{", "// 0,0,0 will be halfway up the cone in the middle", "final", "float", "hal...
Generates a conical solid mesh. The center is at the middle of the cone. @param positions Where to save the position information @param normals Where to save the normal information, can be null to ignore the attribute @param indices Where to save the indices @param radius The radius of the base @param height The height (distance from the base to the apex)
[ "Generates", "a", "conical", "solid", "mesh", ".", "The", "center", "is", "at", "the", "middle", "of", "the", "cone", "." ]
train
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L1025-L1074
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/media/MediaClient.java
MediaClient.createPreset
public CreatePresetResponse createPreset(CreatePresetRequest request) { checkNotNull(request, "The parameter request should NOT be null."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PRESET); return invokeHttpClient(internalRequest, CreatePresetResponse.class); }
java
public CreatePresetResponse createPreset(CreatePresetRequest request) { checkNotNull(request, "The parameter request should NOT be null."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PRESET); return invokeHttpClient(internalRequest, CreatePresetResponse.class); }
[ "public", "CreatePresetResponse", "createPreset", "(", "CreatePresetRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName"...
Create a preset which help to convert media files on be played in a wide range of devices. @param request The request object containing all options for deleting presets.
[ "Create", "a", "preset", "which", "help", "to", "convert", "media", "files", "on", "be", "played", "in", "a", "wide", "range", "of", "devices", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L907-L913
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/gremlin/GremlinExpressionFactory.java
GremlinExpressionFactory.generateLoopEmitExpression
protected GroovyExpression generateLoopEmitExpression(GraphPersistenceStrategies s, IDataType dataType) { return typeTestExpression(s, dataType.getName(), getCurrentObjectExpression()); }
java
protected GroovyExpression generateLoopEmitExpression(GraphPersistenceStrategies s, IDataType dataType) { return typeTestExpression(s, dataType.getName(), getCurrentObjectExpression()); }
[ "protected", "GroovyExpression", "generateLoopEmitExpression", "(", "GraphPersistenceStrategies", "s", ",", "IDataType", "dataType", ")", "{", "return", "typeTestExpression", "(", "s", ",", "dataType", ".", "getName", "(", ")", ",", "getCurrentObjectExpression", "(", ...
Generates the emit expression used in loop expressions. @param s @param dataType @return
[ "Generates", "the", "emit", "expression", "used", "in", "loop", "expressions", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/gremlin/GremlinExpressionFactory.java#L441-L443
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/internal/config/InternalConfig.java
InternalConfig.getSignerConfig
public SignerConfig getSignerConfig(String serviceName, String regionName) { if (serviceName == null) throw new IllegalArgumentException(); SignerConfig signerConfig = null; if (regionName != null) { // Service+Region signer config has the highest precedence String key = serviceName + SERVICE_REGION_DELIMITOR + regionName; signerConfig = serviceRegionSigners.get(key); if (signerConfig != null) { return signerConfig; } // Region signer config has the 2nd highest precedence signerConfig = regionSigners.get(regionName); if (signerConfig != null) { return signerConfig; } } // Service signer config has the 3rd highest precedence signerConfig = serviceSigners.get(serviceName); // Fall back to the default return signerConfig == null ? defaultSignerConfig : signerConfig; }
java
public SignerConfig getSignerConfig(String serviceName, String regionName) { if (serviceName == null) throw new IllegalArgumentException(); SignerConfig signerConfig = null; if (regionName != null) { // Service+Region signer config has the highest precedence String key = serviceName + SERVICE_REGION_DELIMITOR + regionName; signerConfig = serviceRegionSigners.get(key); if (signerConfig != null) { return signerConfig; } // Region signer config has the 2nd highest precedence signerConfig = regionSigners.get(regionName); if (signerConfig != null) { return signerConfig; } } // Service signer config has the 3rd highest precedence signerConfig = serviceSigners.get(serviceName); // Fall back to the default return signerConfig == null ? defaultSignerConfig : signerConfig; }
[ "public", "SignerConfig", "getSignerConfig", "(", "String", "serviceName", ",", "String", "regionName", ")", "{", "if", "(", "serviceName", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "SignerConfig", "signerConfig", "=", "null", ...
Returns the signer configuration for the specified service name and an optional region name. @param serviceName must not be null @param regionName similar to the region name in <code>Regions</code>; can be null. @return the signer
[ "Returns", "the", "signer", "configuration", "for", "the", "specified", "service", "name", "and", "an", "optional", "region", "name", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/internal/config/InternalConfig.java#L206-L227
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/object/StubObject.java
StubObject.createForCurrentUserAndID
@Nonnull public static StubObject createForCurrentUserAndID (@Nonnull @Nonempty final String sID, @Nullable final Map <String, String> aCustomAttrs) { return new StubObject (sID, LoggedInUserManager.getInstance ().getCurrentUserID (), aCustomAttrs); }
java
@Nonnull public static StubObject createForCurrentUserAndID (@Nonnull @Nonempty final String sID, @Nullable final Map <String, String> aCustomAttrs) { return new StubObject (sID, LoggedInUserManager.getInstance ().getCurrentUserID (), aCustomAttrs); }
[ "@", "Nonnull", "public", "static", "StubObject", "createForCurrentUserAndID", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sID", ",", "@", "Nullable", "final", "Map", "<", "String", ",", "String", ">", "aCustomAttrs", ")", "{", "return", "new", ...
Create a {@link StubObject} using the current user ID and the provided object ID @param sID Object ID @param aCustomAttrs Custom attributes. May be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "{", "@link", "StubObject", "}", "using", "the", "current", "user", "ID", "and", "the", "provided", "object", "ID" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/object/StubObject.java#L159-L164
jirkapinkas/jsitemapgenerator
src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractGenerator.java
AbstractGenerator.addPageNames
public <T> I addPageNames(Supplier<Collection<T>> webPagesSupplier, Function<T, String> mapper) { for (T element : webPagesSupplier.get()) { addPage(WebPage.of(mapper.apply(element))); } return getThis(); }
java
public <T> I addPageNames(Supplier<Collection<T>> webPagesSupplier, Function<T, String> mapper) { for (T element : webPagesSupplier.get()) { addPage(WebPage.of(mapper.apply(element))); } return getThis(); }
[ "public", "<", "T", ">", "I", "addPageNames", "(", "Supplier", "<", "Collection", "<", "T", ">", ">", "webPagesSupplier", ",", "Function", "<", "T", ",", "String", ">", "mapper", ")", "{", "for", "(", "T", "element", ":", "webPagesSupplier", ".", "get"...
Add collection of pages to sitemap @param <T> This is the type parameter @param webPagesSupplier Collection of pages supplier @param mapper Mapper function which transforms some object to String. This will be passed to WebPage.of(name) @return this
[ "Add", "collection", "of", "pages", "to", "sitemap" ]
train
https://github.com/jirkapinkas/jsitemapgenerator/blob/42e1f57bd936e21fe9df642e722726e71f667442/src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractGenerator.java#L181-L186
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwfieldtype.java
appfwfieldtype.get
public static appfwfieldtype get(nitro_service service, String name) throws Exception{ appfwfieldtype obj = new appfwfieldtype(); obj.set_name(name); appfwfieldtype response = (appfwfieldtype) obj.get_resource(service); return response; }
java
public static appfwfieldtype get(nitro_service service, String name) throws Exception{ appfwfieldtype obj = new appfwfieldtype(); obj.set_name(name); appfwfieldtype response = (appfwfieldtype) obj.get_resource(service); return response; }
[ "public", "static", "appfwfieldtype", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "appfwfieldtype", "obj", "=", "new", "appfwfieldtype", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "appfwf...
Use this API to fetch appfwfieldtype resource of given name .
[ "Use", "this", "API", "to", "fetch", "appfwfieldtype", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwfieldtype.java#L308-L313
Azure/azure-sdk-for-java
redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/LinkedServersInner.java
LinkedServersInner.beginCreate
public RedisLinkedServerWithPropertiesInner beginCreate(String resourceGroupName, String name, String linkedServerName, RedisLinkedServerCreateParameters parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, name, linkedServerName, parameters).toBlocking().single().body(); }
java
public RedisLinkedServerWithPropertiesInner beginCreate(String resourceGroupName, String name, String linkedServerName, RedisLinkedServerCreateParameters parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, name, linkedServerName, parameters).toBlocking().single().body(); }
[ "public", "RedisLinkedServerWithPropertiesInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "linkedServerName", ",", "RedisLinkedServerCreateParameters", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(",...
Adds a linked server to the Redis cache (requires Premium SKU). @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param linkedServerName The name of the linked server that is being added to the Redis cache. @param parameters Parameters supplied to the Create Linked server operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RedisLinkedServerWithPropertiesInner object if successful.
[ "Adds", "a", "linked", "server", "to", "the", "Redis", "cache", "(", "requires", "Premium", "SKU", ")", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/LinkedServersInner.java#L187-L189
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineItineraryTemplateBuilder.java
AirlineItineraryTemplateBuilder.addQuickReply
public AirlineItineraryTemplateBuilder addQuickReply(String title, String payload) { this.messageBuilder.addQuickReply(title, payload); return this; }
java
public AirlineItineraryTemplateBuilder addQuickReply(String title, String payload) { this.messageBuilder.addQuickReply(title, payload); return this; }
[ "public", "AirlineItineraryTemplateBuilder", "addQuickReply", "(", "String", "title", ",", "String", "payload", ")", "{", "this", ".", "messageBuilder", ".", "addQuickReply", "(", "title", ",", "payload", ")", ";", "return", "this", ";", "}" ]
Adds a {@link QuickReply} to the current object. @param title the quick reply button label. It can't be empty. @param payload the payload sent back when the button is pressed. It can't be empty. @return this builder. @see <a href= "https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies" >Facebook's Messenger Platform Quick Replies Documentation</a>
[ "Adds", "a", "{", "@link", "QuickReply", "}", "to", "the", "current", "object", "." ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineItineraryTemplateBuilder.java#L338-L342
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setBaselineWork
public void setBaselineWork(int baselineNumber, Duration value) { set(selectField(AssignmentFieldLists.BASELINE_WORKS, baselineNumber), value); }
java
public void setBaselineWork(int baselineNumber, Duration value) { set(selectField(AssignmentFieldLists.BASELINE_WORKS, baselineNumber), value); }
[ "public", "void", "setBaselineWork", "(", "int", "baselineNumber", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "BASELINE_WORKS", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value
[ "Set", "a", "baseline", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1397-L1400
i-net-software/jlessc
src/com/inet/lib/less/Operation.java
Operation.doubleValueRightColor
private double doubleValueRightColor( double left, double color ) { return rgba( doubleValue( left, red( color ) ), // doubleValue( left, green( color ) ), // doubleValue( left, blue( color ) ), 1 ); }
java
private double doubleValueRightColor( double left, double color ) { return rgba( doubleValue( left, red( color ) ), // doubleValue( left, green( color ) ), // doubleValue( left, blue( color ) ), 1 ); }
[ "private", "double", "doubleValueRightColor", "(", "double", "left", ",", "double", "color", ")", "{", "return", "rgba", "(", "doubleValue", "(", "left", ",", "red", "(", "color", ")", ")", ",", "//", "doubleValue", "(", "left", ",", "green", "(", "color...
Calculate a number on left with a color on the right side. The calculation occur for every color channel. @param left the left @param color the color @return color value as long
[ "Calculate", "a", "number", "on", "left", "with", "a", "color", "on", "the", "right", "side", ".", "The", "calculation", "occur", "for", "every", "color", "channel", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L393-L397
facebookarchive/hadoop-20
src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java
PipeMapRed.splitKeyVal
void splitKeyVal(byte[] line, int length, Text key, Text val) throws IOException { int numKeyFields = getNumOfKeyFields(); byte[] separator = getFieldSeparator(); // Need to find numKeyFields separators int pos = UTF8ByteArrayUtils.findBytes(line, 0, length, separator); for(int k=1; k<numKeyFields && pos!=-1; k++) { pos = UTF8ByteArrayUtils.findBytes(line, pos + separator.length, length, separator); } try { if (pos == -1) { key.set(line, 0, length); val.set(""); } else { StreamKeyValUtil.splitKeyVal(line, 0, length, key, val, pos, separator.length); } } catch (CharacterCodingException e) { LOG.warn(StringUtils.stringifyException(e)); } }
java
void splitKeyVal(byte[] line, int length, Text key, Text val) throws IOException { int numKeyFields = getNumOfKeyFields(); byte[] separator = getFieldSeparator(); // Need to find numKeyFields separators int pos = UTF8ByteArrayUtils.findBytes(line, 0, length, separator); for(int k=1; k<numKeyFields && pos!=-1; k++) { pos = UTF8ByteArrayUtils.findBytes(line, pos + separator.length, length, separator); } try { if (pos == -1) { key.set(line, 0, length); val.set(""); } else { StreamKeyValUtil.splitKeyVal(line, 0, length, key, val, pos, separator.length); } } catch (CharacterCodingException e) { LOG.warn(StringUtils.stringifyException(e)); } }
[ "void", "splitKeyVal", "(", "byte", "[", "]", "line", ",", "int", "length", ",", "Text", "key", ",", "Text", "val", ")", "throws", "IOException", "{", "int", "numKeyFields", "=", "getNumOfKeyFields", "(", ")", ";", "byte", "[", "]", "separator", "=", "...
Split a line into key and value. @param line: a byte array of line containing UTF-8 bytes @param key: key of a record @param val: value of a record @throws IOException
[ "Split", "a", "line", "into", "key", "and", "value", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java#L375-L396
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/element/link/Link.java
Link.connectDevices
public void connectDevices(Device device1, Device device2) throws ShanksException { this.connectDevice(device1); try { this.connectDevice(device2); } catch (ShanksException e) { this.disconnectDevice(device1); throw e; } }
java
public void connectDevices(Device device1, Device device2) throws ShanksException { this.connectDevice(device1); try { this.connectDevice(device2); } catch (ShanksException e) { this.disconnectDevice(device1); throw e; } }
[ "public", "void", "connectDevices", "(", "Device", "device1", ",", "Device", "device2", ")", "throws", "ShanksException", "{", "this", ".", "connectDevice", "(", "device1", ")", ";", "try", "{", "this", ".", "connectDevice", "(", "device2", ")", ";", "}", ...
Connect both devices to the link @param device1 @param device2 @throws TooManyConnectionException
[ "Connect", "both", "devices", "to", "the", "link" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/element/link/Link.java#L123-L132
joestelmach/natty
src/main/java/com/joestelmach/natty/Parser.java
Parser.singleParse
private DateGroup singleParse(TokenStream stream, String fullText, Date referenceDate) { DateGroup group = null; List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens(); if(tokens.isEmpty()) return group; StringBuilder tokenString = new StringBuilder(); for(Token token:tokens) { tokenString.append(DateParser.tokenNames[token.getType()]); tokenString.append(" "); } try { // parse ParseListener listener = new ParseListener(); DateParser parser = new DateParser(stream, listener); DateParser.parse_return parseReturn = parser.parse(); Tree tree = (Tree) parseReturn.getTree(); // we only continue if a meaningful syntax tree has been built if(tree.getChildCount() > 0) { _logger.info("PARSE: " + tokenString.toString()); // rewrite the tree (temporary fix for http://www.antlr.org/jira/browse/ANTLR-427) CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree); TreeRewrite s = new TreeRewrite(nodes); tree = (CommonTree)s.downup(tree); // and walk it nodes = new CommonTreeNodeStream(tree); nodes.setTokenStream(stream); DateWalker walker = new DateWalker(nodes); walker.setReferenceDate(referenceDate); walker.getState().setDefaultTimeZone(_defaultTimeZone); walker.parse(); _logger.info("AST: " + tree.toStringTree()); // run through the results and append the parse information group = walker.getState().getDateGroup(); ParseLocation location = listener.getDateGroupLocation(); group.setLine(location.getLine()); group.setText(location.getText()); group.setPosition(location.getStart()); group.setSyntaxTree(tree); group.setParseLocations(listener.getLocations()); group.setFullText(fullText); // if the group's matching text has an immediate alphabetic prefix or suffix, // we ignore this result String prefix = group.getPrefix(1); String suffix = group.getSuffix(1); if((!prefix.isEmpty() && Character.isLetter(prefix.charAt(0))) || (!suffix.isEmpty() && Character.isLetter(suffix.charAt(0)))) { group = null; } } } catch(RecognitionException e) { _logger.debug("Could not parse input", e); } return group; }
java
private DateGroup singleParse(TokenStream stream, String fullText, Date referenceDate) { DateGroup group = null; List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens(); if(tokens.isEmpty()) return group; StringBuilder tokenString = new StringBuilder(); for(Token token:tokens) { tokenString.append(DateParser.tokenNames[token.getType()]); tokenString.append(" "); } try { // parse ParseListener listener = new ParseListener(); DateParser parser = new DateParser(stream, listener); DateParser.parse_return parseReturn = parser.parse(); Tree tree = (Tree) parseReturn.getTree(); // we only continue if a meaningful syntax tree has been built if(tree.getChildCount() > 0) { _logger.info("PARSE: " + tokenString.toString()); // rewrite the tree (temporary fix for http://www.antlr.org/jira/browse/ANTLR-427) CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree); TreeRewrite s = new TreeRewrite(nodes); tree = (CommonTree)s.downup(tree); // and walk it nodes = new CommonTreeNodeStream(tree); nodes.setTokenStream(stream); DateWalker walker = new DateWalker(nodes); walker.setReferenceDate(referenceDate); walker.getState().setDefaultTimeZone(_defaultTimeZone); walker.parse(); _logger.info("AST: " + tree.toStringTree()); // run through the results and append the parse information group = walker.getState().getDateGroup(); ParseLocation location = listener.getDateGroupLocation(); group.setLine(location.getLine()); group.setText(location.getText()); group.setPosition(location.getStart()); group.setSyntaxTree(tree); group.setParseLocations(listener.getLocations()); group.setFullText(fullText); // if the group's matching text has an immediate alphabetic prefix or suffix, // we ignore this result String prefix = group.getPrefix(1); String suffix = group.getSuffix(1); if((!prefix.isEmpty() && Character.isLetter(prefix.charAt(0))) || (!suffix.isEmpty() && Character.isLetter(suffix.charAt(0)))) { group = null; } } } catch(RecognitionException e) { _logger.debug("Could not parse input", e); } return group; }
[ "private", "DateGroup", "singleParse", "(", "TokenStream", "stream", ",", "String", "fullText", ",", "Date", "referenceDate", ")", "{", "DateGroup", "group", "=", "null", ";", "List", "<", "Token", ">", "tokens", "=", "(", "(", "NattyTokenSource", ")", "stre...
Parses the token stream for a SINGLE date time alternative. This method assumes that the entire token stream represents date and or time information (no extraneous tokens) @param stream @return
[ "Parses", "the", "token", "stream", "for", "a", "SINGLE", "date", "time", "alternative", ".", "This", "method", "assumes", "that", "the", "entire", "token", "stream", "represents", "date", "and", "or", "time", "information", "(", "no", "extraneous", "tokens", ...
train
https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/Parser.java#L186-L250
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/selector/SelectorRefresher.java
SelectorRefresher.createStart
private StateUpdater createStart(Cursor cursor, SelectorModel model, StateUpdater check, StateUpdater select) { return (extrp, current) -> { StateUpdater next = current; if (!model.isEnabled()) { next = check; } else if (model.getSelectionClick() == cursor.getClick()) { checkBeginSelection(cursor, model); if (model.isSelecting()) { next = select; } } return next; }; }
java
private StateUpdater createStart(Cursor cursor, SelectorModel model, StateUpdater check, StateUpdater select) { return (extrp, current) -> { StateUpdater next = current; if (!model.isEnabled()) { next = check; } else if (model.getSelectionClick() == cursor.getClick()) { checkBeginSelection(cursor, model); if (model.isSelecting()) { next = select; } } return next; }; }
[ "private", "StateUpdater", "createStart", "(", "Cursor", "cursor", ",", "SelectorModel", "model", ",", "StateUpdater", "check", ",", "StateUpdater", "select", ")", "{", "return", "(", "extrp", ",", "current", ")", "->", "{", "StateUpdater", "next", "=", "curre...
Create start action. @param cursor The cursor reference. @param model The selector model. @param check The check action. @param select The selection action. @return The start action.
[ "Create", "start", "action", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/selector/SelectorRefresher.java#L130-L149
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ObjectDataTypesInner.java
ObjectDataTypesInner.listFieldsByModuleAndTypeAsync
public Observable<List<TypeFieldInner>> listFieldsByModuleAndTypeAsync(String resourceGroupName, String automationAccountName, String moduleName, String typeName) { return listFieldsByModuleAndTypeWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName, typeName).map(new Func1<ServiceResponse<List<TypeFieldInner>>, List<TypeFieldInner>>() { @Override public List<TypeFieldInner> call(ServiceResponse<List<TypeFieldInner>> response) { return response.body(); } }); }
java
public Observable<List<TypeFieldInner>> listFieldsByModuleAndTypeAsync(String resourceGroupName, String automationAccountName, String moduleName, String typeName) { return listFieldsByModuleAndTypeWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName, typeName).map(new Func1<ServiceResponse<List<TypeFieldInner>>, List<TypeFieldInner>>() { @Override public List<TypeFieldInner> call(ServiceResponse<List<TypeFieldInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "TypeFieldInner", ">", ">", "listFieldsByModuleAndTypeAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "moduleName", ",", "String", "typeName", ")", "{", "return", "listFieldsB...
Retrieve a list of fields of a given type identified by module name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param moduleName The name of module. @param typeName The name of type. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;TypeFieldInner&gt; object
[ "Retrieve", "a", "list", "of", "fields", "of", "a", "given", "type", "identified", "by", "module", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ObjectDataTypesInner.java#L106-L113
watchrabbit/rabbit-commons
src/main/java/com/watchrabbit/commons/sleep/Sleep.java
Sleep.untilTrue
public static Boolean untilTrue(Callable<Boolean> callable, long timeout, TimeUnit unit) throws SystemException { return SleepBuilder.<Boolean>sleep() .withComparer(argument -> argument) .withTimeout(timeout, unit) .withStatement(callable) .build(); }
java
public static Boolean untilTrue(Callable<Boolean> callable, long timeout, TimeUnit unit) throws SystemException { return SleepBuilder.<Boolean>sleep() .withComparer(argument -> argument) .withTimeout(timeout, unit) .withStatement(callable) .build(); }
[ "public", "static", "Boolean", "untilTrue", "(", "Callable", "<", "Boolean", ">", "callable", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "SystemException", "{", "return", "SleepBuilder", ".", "<", "Boolean", ">", "sleep", "(", ")", ".", ...
Causes the current thread to wait until the callable is returning {@code true}, or the specified waiting time elapses. <p> If the callable returns {@code false} then this method returns immediately with the value returned by callable. <p> Any {@code InterruptedException}'s are suppress and logged. Any {@code Exception}'s thrown by callable are propagate as SystemException @param callable callable checked by this method @param timeout the maximum time to wait @param unit the time unit of the {@code timeout} argument @return {@code Boolean} returned by callable method @throws SystemException if callable throws exception
[ "Causes", "the", "current", "thread", "to", "wait", "until", "the", "callable", "is", "returning", "{", "@code", "true", "}", "or", "the", "specified", "waiting", "time", "elapses", "." ]
train
https://github.com/watchrabbit/rabbit-commons/blob/b11c9f804b5ab70b9264635c34a02f5029bd2a5d/src/main/java/com/watchrabbit/commons/sleep/Sleep.java#L65-L71
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java
VirtualNetworksInner.createOrUpdateAsync
public Observable<VirtualNetworkInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).map(new Func1<ServiceResponse<VirtualNetworkInner>, VirtualNetworkInner>() { @Override public VirtualNetworkInner call(ServiceResponse<VirtualNetworkInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).map(new Func1<ServiceResponse<VirtualNetworkInner>, VirtualNetworkInner>() { @Override public VirtualNetworkInner call(ServiceResponse<VirtualNetworkInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkName", ",", "VirtualNetworkInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroup...
Creates or updates a virtual network in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param parameters Parameters supplied to the create or update virtual network operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "virtual", "network", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L483-L490
thinkaurelius/faunus
src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java
FaunusPipeline.groupCount
public FaunusPipeline groupCount(final String keyClosure, final String valueClosure) { this.state.assertNotLocked(); this.compiler.addMapReduce(GroupCountMapReduce.Map.class, GroupCountMapReduce.Combiner.class, GroupCountMapReduce.Reduce.class, Text.class, LongWritable.class, Text.class, LongWritable.class, GroupCountMapReduce.createConfiguration(this.state.getElementType(), this.validateClosure(keyClosure), this.validateClosure(valueClosure))); makeMapReduceString(GroupCountMapReduce.class); return this; }
java
public FaunusPipeline groupCount(final String keyClosure, final String valueClosure) { this.state.assertNotLocked(); this.compiler.addMapReduce(GroupCountMapReduce.Map.class, GroupCountMapReduce.Combiner.class, GroupCountMapReduce.Reduce.class, Text.class, LongWritable.class, Text.class, LongWritable.class, GroupCountMapReduce.createConfiguration(this.state.getElementType(), this.validateClosure(keyClosure), this.validateClosure(valueClosure))); makeMapReduceString(GroupCountMapReduce.class); return this; }
[ "public", "FaunusPipeline", "groupCount", "(", "final", "String", "keyClosure", ",", "final", "String", "valueClosure", ")", "{", "this", ".", "state", ".", "assertNotLocked", "(", ")", ";", "this", ".", "compiler", ".", "addMapReduce", "(", "GroupCountMapReduce...
Apply the provided closure to the incoming element to determine the grouping key. Then apply the value closure to the current element to determine the count increment. The results are stored in the jobs sideeffect file in HDFS. @return the extended FaunusPipeline.
[ "Apply", "the", "provided", "closure", "to", "the", "incoming", "element", "to", "determine", "the", "grouping", "key", ".", "Then", "apply", "the", "value", "closure", "to", "the", "current", "element", "to", "determine", "the", "count", "increment", ".", "...
train
https://github.com/thinkaurelius/faunus/blob/1eb8494eeb3fe3b84a98d810d304ba01d55b0d6e/src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java#L935-L951
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhDbaastimeseries.java
ApiOvhDbaastimeseries.serviceName_token_opentsdb_POST
public OvhOpenTSDBToken serviceName_token_opentsdb_POST(String serviceName, String description, String permission, OvhTag[] tags) throws IOException { String qPath = "/dbaas/timeseries/{serviceName}/token/opentsdb"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "permission", permission); addBody(o, "tags", tags); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOpenTSDBToken.class); }
java
public OvhOpenTSDBToken serviceName_token_opentsdb_POST(String serviceName, String description, String permission, OvhTag[] tags) throws IOException { String qPath = "/dbaas/timeseries/{serviceName}/token/opentsdb"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "permission", permission); addBody(o, "tags", tags); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOpenTSDBToken.class); }
[ "public", "OvhOpenTSDBToken", "serviceName_token_opentsdb_POST", "(", "String", "serviceName", ",", "String", "description", ",", "String", "permission", ",", "OvhTag", "[", "]", "tags", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/timeseries/{...
Create a OpenTSDB token REST: POST /dbaas/timeseries/{serviceName}/token/opentsdb @param serviceName [required] Service Name @param description [required] Token description @param permission [required] Permission @param tags [required] Tags to apply API beta
[ "Create", "a", "OpenTSDB", "token" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhDbaastimeseries.java#L151-L160
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockWithChecksumFileReader.java
BlockWithChecksumFileReader.getGenerationStampFromSeperateChecksumFile
static long getGenerationStampFromSeperateChecksumFile(String[] listdir, String blockName) { for (int j = 0; j < listdir.length; j++) { String path = listdir[j]; if (!path.startsWith(blockName)) { continue; } String[] vals = StringUtils.split(path, '_'); if (vals.length != 3) { // blk, blkid, genstamp.meta continue; } String[] str = StringUtils.split(vals[2], '.'); if (str.length != 2) { continue; } return Long.parseLong(str[0]); } DataNode.LOG.warn("Block " + blockName + " does not have a metafile!"); return Block.GRANDFATHER_GENERATION_STAMP; }
java
static long getGenerationStampFromSeperateChecksumFile(String[] listdir, String blockName) { for (int j = 0; j < listdir.length; j++) { String path = listdir[j]; if (!path.startsWith(blockName)) { continue; } String[] vals = StringUtils.split(path, '_'); if (vals.length != 3) { // blk, blkid, genstamp.meta continue; } String[] str = StringUtils.split(vals[2], '.'); if (str.length != 2) { continue; } return Long.parseLong(str[0]); } DataNode.LOG.warn("Block " + blockName + " does not have a metafile!"); return Block.GRANDFATHER_GENERATION_STAMP; }
[ "static", "long", "getGenerationStampFromSeperateChecksumFile", "(", "String", "[", "]", "listdir", ",", "String", "blockName", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "listdir", ".", "length", ";", "j", "++", ")", "{", "String", "path...
Find the metadata file for the specified block file. Return the generation stamp from the name of the metafile.
[ "Find", "the", "metadata", "file", "for", "the", "specified", "block", "file", ".", "Return", "the", "generation", "stamp", "from", "the", "name", "of", "the", "metafile", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockWithChecksumFileReader.java#L397-L416
btrplace/scheduler
btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java
SymbolsTable.popTable
public boolean popTable() { if (currentLevel > 0) { //Remove all the variable having a level equals to currentLevel for (Iterator<Map.Entry<String, Integer>> ite = level.entrySet().iterator(); ite.hasNext(); ) { Map.Entry<String, Integer> e = ite.next(); if (e.getValue() == currentLevel) { ite.remove(); type.remove(e.getKey()); } } currentLevel--; return true; } return false; }
java
public boolean popTable() { if (currentLevel > 0) { //Remove all the variable having a level equals to currentLevel for (Iterator<Map.Entry<String, Integer>> ite = level.entrySet().iterator(); ite.hasNext(); ) { Map.Entry<String, Integer> e = ite.next(); if (e.getValue() == currentLevel) { ite.remove(); type.remove(e.getKey()); } } currentLevel--; return true; } return false; }
[ "public", "boolean", "popTable", "(", ")", "{", "if", "(", "currentLevel", ">", "0", ")", "{", "//Remove all the variable having a level equals to currentLevel", "for", "(", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "Integer", ">", ">", "ite", ...
Pop the table. Every variable created after the last pushTable() are removed from the table. The table can not be poped if it was not at least pushed once earlier. @return {@code true} if the table has been popped successfully. {@code false} otherwise
[ "Pop", "the", "table", ".", "Every", "variable", "created", "after", "the", "last", "pushTable", "()", "are", "removed", "from", "the", "table", ".", "The", "table", "can", "not", "be", "poped", "if", "it", "was", "not", "at", "least", "pushed", "once", ...
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java#L181-L195
dbracewell/mango
src/main/java/com/davidbracewell/config/Config.java
Config.setProperty
@SneakyThrows public static void setProperty(String name, String value) { getInstance().properties.put(name, value); if (name.toLowerCase().endsWith(".level")) { String className = name.substring(0, name.length() - ".level".length()); LogManager.getLogManager().setLevel(className, Level.parse(value.trim().toUpperCase())); } if (name.equals("com.davidbracewell.logging.logfile")) { LogManager.addFileHandler(value); } if (name.toLowerCase().startsWith(SYSTEM_PROPERTY)) { String systemSetting = name.substring(SYSTEM_PROPERTY.length()); System.setProperty(systemSetting, value); } log.finest("Setting property {0} to value of {1}", name, value); }
java
@SneakyThrows public static void setProperty(String name, String value) { getInstance().properties.put(name, value); if (name.toLowerCase().endsWith(".level")) { String className = name.substring(0, name.length() - ".level".length()); LogManager.getLogManager().setLevel(className, Level.parse(value.trim().toUpperCase())); } if (name.equals("com.davidbracewell.logging.logfile")) { LogManager.addFileHandler(value); } if (name.toLowerCase().startsWith(SYSTEM_PROPERTY)) { String systemSetting = name.substring(SYSTEM_PROPERTY.length()); System.setProperty(systemSetting, value); } log.finest("Setting property {0} to value of {1}", name, value); }
[ "@", "SneakyThrows", "public", "static", "void", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "getInstance", "(", ")", ".", "properties", ".", "put", "(", "name", ",", "value", ")", ";", "if", "(", "name", ".", "toLowerCase", ...
Sets the value of a property. @param name the name of the property @param value the value of the property
[ "Sets", "the", "value", "of", "a", "property", "." ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/config/Config.java#L718-L733
E7du/jfinal-ext3
src/main/java/com/jfinal/ext/kit/PageViewKit.java
PageViewKit.getHTMLPageView
public static String getHTMLPageView(String dir, String viewPath, String pageName){ return getPageView(dir, viewPath, pageName, HTML); }
java
public static String getHTMLPageView(String dir, String viewPath, String pageName){ return getPageView(dir, viewPath, pageName, HTML); }
[ "public", "static", "String", "getHTMLPageView", "(", "String", "dir", ",", "String", "viewPath", ",", "String", "pageName", ")", "{", "return", "getPageView", "(", "dir", ",", "viewPath", ",", "pageName", ",", "HTML", ")", ";", "}" ]
获取静态页面 @param dir 所在目录 @param viewPath view路径 @param pageName view名字 @return
[ "获取静态页面" ]
train
https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/kit/PageViewKit.java#L192-L194
milaboratory/milib
src/main/java/com/milaboratory/core/mutations/MutationsUtil.java
MutationsUtil.shiftIndelsAtHomopolymers
public static <S extends Sequence<S>> Mutations<S> shiftIndelsAtHomopolymers(S seq1, Mutations<S> mutations) { return shiftIndelsAtHomopolymers(seq1, 0, mutations); }
java
public static <S extends Sequence<S>> Mutations<S> shiftIndelsAtHomopolymers(S seq1, Mutations<S> mutations) { return shiftIndelsAtHomopolymers(seq1, 0, mutations); }
[ "public", "static", "<", "S", "extends", "Sequence", "<", "S", ">", ">", "Mutations", "<", "S", ">", "shiftIndelsAtHomopolymers", "(", "S", "seq1", ",", "Mutations", "<", "S", ">", "mutations", ")", "{", "return", "shiftIndelsAtHomopolymers", "(", "seq1", ...
This one shifts indels to the left at homopolymer regions Applicable to KAligner data, which normally put indels randomly along such regions Required for filterMutations algorithm to work correctly Works inplace @param seq1 reference sequence for the mutations @param mutations array of mutations
[ "This", "one", "shifts", "indels", "to", "the", "left", "at", "homopolymer", "regions", "Applicable", "to", "KAligner", "data", "which", "normally", "put", "indels", "randomly", "along", "such", "regions", "Required", "for", "filterMutations", "algorithm", "to", ...
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/mutations/MutationsUtil.java#L99-L101
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.processTaskFilter
private static void processTaskFilter(ProjectFile project, Filter filter) { for (Task task : project.getTasks()) { if (filter.evaluate(task, null)) { System.out.println(task.getID() + "," + task.getUniqueID() + "," + task.getName()); } } }
java
private static void processTaskFilter(ProjectFile project, Filter filter) { for (Task task : project.getTasks()) { if (filter.evaluate(task, null)) { System.out.println(task.getID() + "," + task.getUniqueID() + "," + task.getName()); } } }
[ "private", "static", "void", "processTaskFilter", "(", "ProjectFile", "project", ",", "Filter", "filter", ")", "{", "for", "(", "Task", "task", ":", "project", ".", "getTasks", "(", ")", ")", "{", "if", "(", "filter", ".", "evaluate", "(", "task", ",", ...
Apply a filter to the list of all tasks, and show the results. @param project project file @param filter filter
[ "Apply", "a", "filter", "to", "the", "list", "of", "all", "tasks", "and", "show", "the", "results", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L128-L137
bazaarvoice/jolt
complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java
ChainrFactory.fromFileSystem
public static Chainr fromFileSystem( String chainrSpecFilePath, ChainrInstantiator chainrInstantiator ) { Object chainrSpec = JsonUtils.filepathToObject( chainrSpecFilePath ); return getChainr( chainrInstantiator, chainrSpec ); }
java
public static Chainr fromFileSystem( String chainrSpecFilePath, ChainrInstantiator chainrInstantiator ) { Object chainrSpec = JsonUtils.filepathToObject( chainrSpecFilePath ); return getChainr( chainrInstantiator, chainrSpec ); }
[ "public", "static", "Chainr", "fromFileSystem", "(", "String", "chainrSpecFilePath", ",", "ChainrInstantiator", "chainrInstantiator", ")", "{", "Object", "chainrSpec", "=", "JsonUtils", ".", "filepathToObject", "(", "chainrSpecFilePath", ")", ";", "return", "getChainr",...
Builds a Chainr instance using the spec described in the data via the file path that is passed in. @param chainrSpecFilePath The file path that points to the chainr spec. @param chainrInstantiator the ChainrInstantiator to use to initialze the Chainr instance @return a Chainr instance
[ "Builds", "a", "Chainr", "instance", "using", "the", "spec", "described", "in", "the", "data", "via", "the", "file", "path", "that", "is", "passed", "in", "." ]
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java#L67-L70
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.markVisited
public void markVisited(int from, int upTo) { if (checkBounds(from) && checkBounds(upTo - 1)) { for (int i = from; i < upTo; i++) { this.markVisited(i); } } else { throw new RuntimeException("The location " + from + "," + upTo + " out of bounds [0," + (this.registry.length - 1) + "]"); } }
java
public void markVisited(int from, int upTo) { if (checkBounds(from) && checkBounds(upTo - 1)) { for (int i = from; i < upTo; i++) { this.markVisited(i); } } else { throw new RuntimeException("The location " + from + "," + upTo + " out of bounds [0," + (this.registry.length - 1) + "]"); } }
[ "public", "void", "markVisited", "(", "int", "from", ",", "int", "upTo", ")", "{", "if", "(", "checkBounds", "(", "from", ")", "&&", "checkBounds", "(", "upTo", "-", "1", ")", ")", "{", "for", "(", "int", "i", "=", "from", ";", "i", "<", "upTo", ...
Marks as visited a range of locations. @param from the start of labeling (inclusive). @param upTo the end of labeling (exclusive).
[ "Marks", "as", "visited", "a", "range", "of", "locations", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L67-L77
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DecimalFormatSymbols.java
DecimalFormatSymbols.maybeStripMarkers
private static char maybeStripMarkers(String symbol, char fallback) { final int length = symbol.length(); if (length == 1) { return symbol.charAt(0); } if (length > 1) { char first = symbol.charAt(0); if (first =='\u200E' || first =='\u200F' || first =='\u061C') { return symbol.charAt(1); } } return fallback; }
java
private static char maybeStripMarkers(String symbol, char fallback) { final int length = symbol.length(); if (length == 1) { return symbol.charAt(0); } if (length > 1) { char first = symbol.charAt(0); if (first =='\u200E' || first =='\u200F' || first =='\u061C') { return symbol.charAt(1); } } return fallback; }
[ "private", "static", "char", "maybeStripMarkers", "(", "String", "symbol", ",", "char", "fallback", ")", "{", "final", "int", "length", "=", "symbol", ".", "length", "(", ")", ";", "if", "(", "length", "==", "1", ")", "{", "return", "symbol", ".", "cha...
Attempts to strip RTL, LTR and Arabic letter markers from {@code symbol}. If the symbol's length is 1, then the first char of the symbol is returned. If the symbol's length is more than 1 and the first char is a marker, then this marker is ignored. In all other cases, {@code fallback} is returned.
[ "Attempts", "to", "strip", "RTL", "LTR", "and", "Arabic", "letter", "markers", "from", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DecimalFormatSymbols.java#L720-L734
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ServletChain.java
ServletChain.chainRequestDispatchers
public static void chainRequestDispatchers(RequestDispatcher[] dispatchers, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ for(int i=0; i<dispatchers.length-1; i++) { ChainedResponse chainedResp = new ChainedResponse(request, response); dispatchers[i].forward(request, chainedResp); request = chainedResp.getChainedRequest(); } dispatchers[dispatchers.length-1].forward(request, response); }
java
public static void chainRequestDispatchers(RequestDispatcher[] dispatchers, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ for(int i=0; i<dispatchers.length-1; i++) { ChainedResponse chainedResp = new ChainedResponse(request, response); dispatchers[i].forward(request, chainedResp); request = chainedResp.getChainedRequest(); } dispatchers[dispatchers.length-1].forward(request, response); }
[ "public", "static", "void", "chainRequestDispatchers", "(", "RequestDispatcher", "[", "]", "dispatchers", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", ",", "ServletException", "{", "for", "(", "int", "i", ...
Chain the responses of a set of request dispatchers together.
[ "Chain", "the", "responses", "of", "a", "set", "of", "request", "dispatchers", "together", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ServletChain.java#L192-L200
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.getWriter
public static BufferedWriter getWriter(String path, String charsetName, boolean isAppend) throws IORuntimeException { return getWriter(touch(path), Charset.forName(charsetName), isAppend); }
java
public static BufferedWriter getWriter(String path, String charsetName, boolean isAppend) throws IORuntimeException { return getWriter(touch(path), Charset.forName(charsetName), isAppend); }
[ "public", "static", "BufferedWriter", "getWriter", "(", "String", "path", ",", "String", "charsetName", ",", "boolean", "isAppend", ")", "throws", "IORuntimeException", "{", "return", "getWriter", "(", "touch", "(", "path", ")", ",", "Charset", ".", "forName", ...
获得一个带缓存的写入对象 @param path 输出路径,绝对路径 @param charsetName 字符集 @param isAppend 是否追加 @return BufferedReader对象 @throws IORuntimeException IO异常
[ "获得一个带缓存的写入对象" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2585-L2587
Syncleus/aparapi
src/main/java/com/aparapi/internal/kernel/KernelManager.java
KernelManager.selectLhsIfCUDA
protected static boolean selectLhsIfCUDA(OpenCLDevice _deviceLhs, OpenCLDevice _deviceRhs) { if (_deviceLhs.getType() != _deviceRhs.getType()) { return selectLhsByType(_deviceLhs.getType(), _deviceRhs.getType()); } return _deviceLhs.getMaxWorkGroupSize() == _deviceRhs.getMaxWorkGroupSize() ? _deviceLhs.getGlobalMemSize() > _deviceRhs.getGlobalMemSize() : _deviceLhs.getMaxWorkGroupSize() > _deviceRhs.getMaxWorkGroupSize(); }
java
protected static boolean selectLhsIfCUDA(OpenCLDevice _deviceLhs, OpenCLDevice _deviceRhs) { if (_deviceLhs.getType() != _deviceRhs.getType()) { return selectLhsByType(_deviceLhs.getType(), _deviceRhs.getType()); } return _deviceLhs.getMaxWorkGroupSize() == _deviceRhs.getMaxWorkGroupSize() ? _deviceLhs.getGlobalMemSize() > _deviceRhs.getGlobalMemSize() : _deviceLhs.getMaxWorkGroupSize() > _deviceRhs.getMaxWorkGroupSize(); }
[ "protected", "static", "boolean", "selectLhsIfCUDA", "(", "OpenCLDevice", "_deviceLhs", ",", "OpenCLDevice", "_deviceRhs", ")", "{", "if", "(", "_deviceLhs", ".", "getType", "(", ")", "!=", "_deviceRhs", ".", "getType", "(", ")", ")", "{", "return", "selectLhs...
NVidia/CUDA architecture reports maxComputeUnits in a completely different context, i.e. maxComputeUnits is not same as (is much less than) the number of OpenCL cores available. <p>Therefore when comparing an NVidia device we use different criteria.</p>
[ "NVidia", "/", "CUDA", "architecture", "reports", "maxComputeUnits", "in", "a", "completely", "different", "context", "i", ".", "e", ".", "maxComputeUnits", "is", "not", "same", "as", "(", "is", "much", "less", "than", ")", "the", "number", "of", "OpenCL", ...
train
https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelManager.java#L291-L298
cycorp/api-suite
core-api/src/main/java/com/cyc/kb/exception/KbTypeConflictException.java
KbTypeConflictException.fromThrowable
public static KbTypeConflictException fromThrowable(String message, Throwable cause) { return (cause instanceof KbTypeConflictException && Objects.equals(message, cause.getMessage())) ? (KbTypeConflictException) cause : new KbTypeConflictException(message, cause); }
java
public static KbTypeConflictException fromThrowable(String message, Throwable cause) { return (cause instanceof KbTypeConflictException && Objects.equals(message, cause.getMessage())) ? (KbTypeConflictException) cause : new KbTypeConflictException(message, cause); }
[ "public", "static", "KbTypeConflictException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "KbTypeConflictException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getM...
Converts a Throwable to a KbTypeConflictException with the specified detail message. If the Throwable is a KbTypeConflictException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new KbTypeConflictException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a KbTypeConflictException
[ "Converts", "a", "Throwable", "to", "a", "KbTypeConflictException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "KbTypeConflictException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "t...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbTypeConflictException.java#L68-L72
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java
StreamingLocatorsInner.listAsync
public Observable<Page<StreamingLocatorInner>> listAsync(final String resourceGroupName, final String accountName) { return listWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<StreamingLocatorInner>>, Page<StreamingLocatorInner>>() { @Override public Page<StreamingLocatorInner> call(ServiceResponse<Page<StreamingLocatorInner>> response) { return response.body(); } }); }
java
public Observable<Page<StreamingLocatorInner>> listAsync(final String resourceGroupName, final String accountName) { return listWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<StreamingLocatorInner>>, Page<StreamingLocatorInner>>() { @Override public Page<StreamingLocatorInner> call(ServiceResponse<Page<StreamingLocatorInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "StreamingLocatorInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountNam...
List Streaming Locators. Lists the Streaming Locators in the account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StreamingLocatorInner&gt; object
[ "List", "Streaming", "Locators", ".", "Lists", "the", "Streaming", "Locators", "in", "the", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L147-L155
rhiot/rhiot
gateway/components/camel-webcam/src/main/java/io/rhiot/gateway/camel/webcam/WebcamHelper.java
WebcamHelper.consumeBufferedImage
public static void consumeBufferedImage(BufferedImage image, Processor processor, WebcamEndpoint endpoint, ExceptionHandler exceptionHandler) { Validate.notNull(image); Validate.notNull(processor); Validate.notNull(endpoint); try { Exchange exchange = createOutOnlyExchangeWithBodyAndHeaders(endpoint, image); processor.process(exchange); } catch (Exception e) { exceptionHandler.handleException(e); } }
java
public static void consumeBufferedImage(BufferedImage image, Processor processor, WebcamEndpoint endpoint, ExceptionHandler exceptionHandler) { Validate.notNull(image); Validate.notNull(processor); Validate.notNull(endpoint); try { Exchange exchange = createOutOnlyExchangeWithBodyAndHeaders(endpoint, image); processor.process(exchange); } catch (Exception e) { exceptionHandler.handleException(e); } }
[ "public", "static", "void", "consumeBufferedImage", "(", "BufferedImage", "image", ",", "Processor", "processor", ",", "WebcamEndpoint", "endpoint", ",", "ExceptionHandler", "exceptionHandler", ")", "{", "Validate", ".", "notNull", "(", "image", ")", ";", "Validate"...
Consume the java.awt.BufferedImage from the webcam, all params required. @param image The image to process. @param processor Processor that handles the exchange. @param endpoint WebcamEndpoint receiving the exchange.
[ "Consume", "the", "java", ".", "awt", ".", "BufferedImage", "from", "the", "webcam", "all", "params", "required", "." ]
train
https://github.com/rhiot/rhiot/blob/82eac10e365f72bab9248b8c3bd0ec9a2fc0a721/gateway/components/camel-webcam/src/main/java/io/rhiot/gateway/camel/webcam/WebcamHelper.java#L66-L77
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java
ServerImpl.setSelfDeafened
public void setSelfDeafened(long userId, boolean deafened) { if (deafened) { selfDeafened.add(userId); } else { selfDeafened.remove(userId); } }
java
public void setSelfDeafened(long userId, boolean deafened) { if (deafened) { selfDeafened.add(userId); } else { selfDeafened.remove(userId); } }
[ "public", "void", "setSelfDeafened", "(", "long", "userId", ",", "boolean", "deafened", ")", "{", "if", "(", "deafened", ")", "{", "selfDeafened", ".", "add", "(", "userId", ")", ";", "}", "else", "{", "selfDeafened", ".", "remove", "(", "userId", ")", ...
Sets the self-deafened state of the user with the given id. @param userId The id of the user. @param deafened Whether the user with the given id is self-deafened or not.
[ "Sets", "the", "self", "-", "deafened", "state", "of", "the", "user", "with", "the", "given", "id", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L744-L750
algolia/instantsearch-android
ui/src/main/java/com/algolia/instantsearch/ui/helpers/InstantSearch.java
InstantSearch.getEmptyView
@Nullable private static View getEmptyView(@Nullable View rootView) { if (rootView == null) { throw new RuntimeException("A null rootView was passed to getEmptyView, but Hits/RefinementList require one."); } return rootView.findViewById(android.R.id.empty); }
java
@Nullable private static View getEmptyView(@Nullable View rootView) { if (rootView == null) { throw new RuntimeException("A null rootView was passed to getEmptyView, but Hits/RefinementList require one."); } return rootView.findViewById(android.R.id.empty); }
[ "@", "Nullable", "private", "static", "View", "getEmptyView", "(", "@", "Nullable", "View", "rootView", ")", "{", "if", "(", "rootView", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"A null rootView was passed to getEmptyView, but Hits/Refinement...
Finds the empty view in the given rootView. @param rootView the topmost view in the view hierarchy of the Activity. @return the empty view if it was in the rootView. @throws RuntimeException if the rootView is null.
[ "Finds", "the", "empty", "view", "in", "the", "given", "rootView", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/helpers/InstantSearch.java#L573-L579
line/centraldogma
common/src/main/java/com/linecorp/centraldogma/internal/api/v1/WatchTimeout.java
WatchTimeout.makeReasonable
public static long makeReasonable(long expectedTimeoutMillis, long bufferMillis) { checkArgument(expectedTimeoutMillis > 0, "expectedTimeoutMillis: %s (expected: > 0)", expectedTimeoutMillis); checkArgument(bufferMillis >= 0, "bufferMillis: %s (expected: > 0)", bufferMillis); final long timeout = Math.min(expectedTimeoutMillis, MAX_MILLIS); if (bufferMillis == 0) { return timeout; } if (timeout > MAX_MILLIS - bufferMillis) { return MAX_MILLIS; } else { return bufferMillis + timeout; } }
java
public static long makeReasonable(long expectedTimeoutMillis, long bufferMillis) { checkArgument(expectedTimeoutMillis > 0, "expectedTimeoutMillis: %s (expected: > 0)", expectedTimeoutMillis); checkArgument(bufferMillis >= 0, "bufferMillis: %s (expected: > 0)", bufferMillis); final long timeout = Math.min(expectedTimeoutMillis, MAX_MILLIS); if (bufferMillis == 0) { return timeout; } if (timeout > MAX_MILLIS - bufferMillis) { return MAX_MILLIS; } else { return bufferMillis + timeout; } }
[ "public", "static", "long", "makeReasonable", "(", "long", "expectedTimeoutMillis", ",", "long", "bufferMillis", ")", "{", "checkArgument", "(", "expectedTimeoutMillis", ">", "0", ",", "\"expectedTimeoutMillis: %s (expected: > 0)\"", ",", "expectedTimeoutMillis", ")", ";"...
Returns a reasonable timeout duration for a watch request. @param expectedTimeoutMillis timeout duration that a user wants to use, in milliseconds @param bufferMillis buffer duration which needs to be added, in milliseconds @return timeout duration in milliseconds, between the specified {@code bufferMillis} and the {@link #MAX_MILLIS}.
[ "Returns", "a", "reasonable", "timeout", "duration", "for", "a", "watch", "request", "." ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/common/src/main/java/com/linecorp/centraldogma/internal/api/v1/WatchTimeout.java#L49-L65
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreException.java
FirestoreException.serverRejected
static FirestoreException serverRejected(Status status, String message, Object... params) { return new FirestoreException(String.format(message, params), status); }
java
static FirestoreException serverRejected(Status status, String message, Object... params) { return new FirestoreException(String.format(message, params), status); }
[ "static", "FirestoreException", "serverRejected", "(", "Status", "status", ",", "String", "message", ",", "Object", "...", "params", ")", "{", "return", "new", "FirestoreException", "(", "String", ".", "format", "(", "message", ",", "params", ")", ",", "status...
Creates a FirestoreException with the provided GRPC Status code and message in a nested exception. @return The FirestoreException
[ "Creates", "a", "FirestoreException", "with", "the", "provided", "GRPC", "Status", "code", "and", "message", "in", "a", "nested", "exception", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreException.java#L60-L62
spockframework/spock
spock-core/src/main/java/spock/util/concurrent/PollingConditions.java
PollingConditions.within
@ConditionBlock public void within(double seconds, Closure<?> conditions) throws InterruptedException { long timeoutMillis = toMillis(seconds); long start = System.currentTimeMillis(); long lastAttempt = 0; Thread.sleep(toMillis(initialDelay)); long currDelay = toMillis(delay); int attempts = 0; while(true) { try { attempts++; lastAttempt = System.currentTimeMillis(); GroovyRuntimeUtil.invokeClosure(conditions); return; } catch (Throwable e) { long elapsedTime = lastAttempt - start; if (elapsedTime >= timeoutMillis) { String msg = String.format("Condition not satisfied after %1.2f seconds and %d attempts", elapsedTime / 1000d, attempts); throw new SpockTimeoutError(seconds, msg, e); } final long timeout = Math.min(currDelay, start + timeoutMillis - System.currentTimeMillis()); if (timeout > 0) { Thread.sleep(timeout); } currDelay *= factor; } } }
java
@ConditionBlock public void within(double seconds, Closure<?> conditions) throws InterruptedException { long timeoutMillis = toMillis(seconds); long start = System.currentTimeMillis(); long lastAttempt = 0; Thread.sleep(toMillis(initialDelay)); long currDelay = toMillis(delay); int attempts = 0; while(true) { try { attempts++; lastAttempt = System.currentTimeMillis(); GroovyRuntimeUtil.invokeClosure(conditions); return; } catch (Throwable e) { long elapsedTime = lastAttempt - start; if (elapsedTime >= timeoutMillis) { String msg = String.format("Condition not satisfied after %1.2f seconds and %d attempts", elapsedTime / 1000d, attempts); throw new SpockTimeoutError(seconds, msg, e); } final long timeout = Math.min(currDelay, start + timeoutMillis - System.currentTimeMillis()); if (timeout > 0) { Thread.sleep(timeout); } currDelay *= factor; } } }
[ "@", "ConditionBlock", "public", "void", "within", "(", "double", "seconds", ",", "Closure", "<", "?", ">", "conditions", ")", "throws", "InterruptedException", "{", "long", "timeoutMillis", "=", "toMillis", "(", "seconds", ")", ";", "long", "start", "=", "S...
Repeatedly evaluates the specified conditions until they are satisfied or the specified timeout (in seconds) has elapsed. @param conditions the conditions to evaluate @throws InterruptedException if evaluation is interrupted
[ "Repeatedly", "evaluates", "the", "specified", "conditions", "until", "they", "are", "satisfied", "or", "the", "specified", "timeout", "(", "in", "seconds", ")", "has", "elapsed", "." ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/util/concurrent/PollingConditions.java#L144-L173
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.importKey
public KeyBundle importKey(String vaultBaseUrl, String keyName, JsonWebKey key) { return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key).toBlocking().single().body(); }
java
public KeyBundle importKey(String vaultBaseUrl, String keyName, JsonWebKey key) { return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key).toBlocking().single().body(); }
[ "public", "KeyBundle", "importKey", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "JsonWebKey", "key", ")", "{", "return", "importKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "key", ")", ".", "toBlocking", "(", ")", "."...
Imports an externally created key, stores it, and returns key parameters and attributes to the client. The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName Name for the imported key. @param key The Json web key @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyBundle object if successful.
[ "Imports", "an", "externally", "created", "key", "stores", "it", "and", "returns", "key", "parameters", "and", "attributes", "to", "the", "client", ".", "The", "import", "key", "operation", "may", "be", "used", "to", "import", "any", "key", "type", "into", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L876-L878
mfornos/humanize
humanize-icu/src/main/java/humanize/ICUHumanize.java
ICUHumanize.formatPluralCurrency
public static String formatPluralCurrency(final Number value, final Locale locale) { return withinLocale(new Callable<String>() { public String call() throws Exception { return formatPluralCurrency(value); } }, locale); }
java
public static String formatPluralCurrency(final Number value, final Locale locale) { return withinLocale(new Callable<String>() { public String call() throws Exception { return formatPluralCurrency(value); } }, locale); }
[ "public", "static", "String", "formatPluralCurrency", "(", "final", "Number", "value", ",", "final", "Locale", "locale", ")", "{", "return", "withinLocale", "(", "new", "Callable", "<", "String", ">", "(", ")", "{", "public", "String", "call", "(", ")", "t...
<p> Same as {@link #formatPluralCurrency(Number) formatPluralCurrency} for the specified locale. </p> @param value Number to be formatted @param locale Target locale @return String representing the monetary amount
[ "<p", ">", "Same", "as", "{", "@link", "#formatPluralCurrency", "(", "Number", ")", "formatPluralCurrency", "}", "for", "the", "specified", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L983-L992
aws/aws-sdk-java
aws-java-sdk-elasticloadbalancingv2/src/main/java/com/amazonaws/services/elasticloadbalancingv2/model/AuthenticateOidcActionConfig.java
AuthenticateOidcActionConfig.withAuthenticationRequestExtraParams
public AuthenticateOidcActionConfig withAuthenticationRequestExtraParams(java.util.Map<String, String> authenticationRequestExtraParams) { setAuthenticationRequestExtraParams(authenticationRequestExtraParams); return this; }
java
public AuthenticateOidcActionConfig withAuthenticationRequestExtraParams(java.util.Map<String, String> authenticationRequestExtraParams) { setAuthenticationRequestExtraParams(authenticationRequestExtraParams); return this; }
[ "public", "AuthenticateOidcActionConfig", "withAuthenticationRequestExtraParams", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "authenticationRequestExtraParams", ")", "{", "setAuthenticationRequestExtraParams", "(", "authenticationRequestExtraParams...
<p> The query parameters (up to 10) to include in the redirect request to the authorization endpoint. </p> @param authenticationRequestExtraParams The query parameters (up to 10) to include in the redirect request to the authorization endpoint. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "query", "parameters", "(", "up", "to", "10", ")", "to", "include", "in", "the", "redirect", "request", "to", "the", "authorization", "endpoint", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-elasticloadbalancingv2/src/main/java/com/amazonaws/services/elasticloadbalancingv2/model/AuthenticateOidcActionConfig.java#L572-L575
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/MigrateRowsBase.java
MigrateRowsBase.executePrecompiledSQL
VoltTable executePrecompiledSQL(Statement catStmt, Object[] params, boolean replicated) throws VoltAbortException { // Create a SQLStmt instance on the fly // This is unusual to do, as they are typically required to be final instance variables. // This only works because the SQL text and plan is identical from the borrowed procedure. SQLStmt stmt = new SQLStmt(catStmt.getSqltext()); if (replicated) { stmt.setInCatalog(false); } m_runner.initSQLStmt(stmt, catStmt); voltQueueSQL(stmt, params); return voltExecuteSQL()[0]; }
java
VoltTable executePrecompiledSQL(Statement catStmt, Object[] params, boolean replicated) throws VoltAbortException { // Create a SQLStmt instance on the fly // This is unusual to do, as they are typically required to be final instance variables. // This only works because the SQL text and plan is identical from the borrowed procedure. SQLStmt stmt = new SQLStmt(catStmt.getSqltext()); if (replicated) { stmt.setInCatalog(false); } m_runner.initSQLStmt(stmt, catStmt); voltQueueSQL(stmt, params); return voltExecuteSQL()[0]; }
[ "VoltTable", "executePrecompiledSQL", "(", "Statement", "catStmt", ",", "Object", "[", "]", "params", ",", "boolean", "replicated", ")", "throws", "VoltAbortException", "{", "// Create a SQLStmt instance on the fly", "// This is unusual to do, as they are typically required to be...
Execute a pre-compiled adHoc SQL statement, throw exception if not. @return Count of rows inserted or upserted. @throws VoltAbortException if any failure at all.
[ "Execute", "a", "pre", "-", "compiled", "adHoc", "SQL", "statement", "throw", "exception", "if", "not", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/MigrateRowsBase.java#L65-L78