repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/mediasource/inline/InlineMediaSource.java
InlineMediaSource.cleanupFileName
private String cleanupFileName(String fileName) { String processedFileName = fileName; // strip off path parts if (StringUtils.contains(processedFileName, "/")) { processedFileName = StringUtils.substringAfterLast(processedFileName, "/"); } if (StringUtils.contains(processedFileName, "\\")) { processedFileName = StringUtils.substringAfterLast(processedFileName, "\\"); } // make sure filename does not contain any invalid characters processedFileName = Escape.validFilename(processedFileName); return processedFileName; }
java
private String cleanupFileName(String fileName) { String processedFileName = fileName; // strip off path parts if (StringUtils.contains(processedFileName, "/")) { processedFileName = StringUtils.substringAfterLast(processedFileName, "/"); } if (StringUtils.contains(processedFileName, "\\")) { processedFileName = StringUtils.substringAfterLast(processedFileName, "\\"); } // make sure filename does not contain any invalid characters processedFileName = Escape.validFilename(processedFileName); return processedFileName; }
[ "private", "String", "cleanupFileName", "(", "String", "fileName", ")", "{", "String", "processedFileName", "=", "fileName", ";", "// strip off path parts", "if", "(", "StringUtils", ".", "contains", "(", "processedFileName", ",", "\"/\"", ")", ")", "{", "processe...
Make sure filename contains no invalid characters or path parts @param fileName File name @return Cleaned up file name
[ "Make", "sure", "filename", "contains", "no", "invalid", "characters", "or", "path", "parts" ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineMediaSource.java#L225-L240
baneizalfe/PullToDismissPager
PullToDismissPager/src/main/java/com/mrbug/pulltodismisspager/PullToDismissPager.java
PullToDismissPager.collapsePanel
public boolean collapsePanel() { if (mFirstLayout) { mSlideState = SlideState.COLLAPSED; return true; } else { if (mSlideState == SlideState.HIDDEN || mSlideState == SlideState.COLLAPSED) return false; return collapsePanel(mSlideableView, 0); } }
java
public boolean collapsePanel() { if (mFirstLayout) { mSlideState = SlideState.COLLAPSED; return true; } else { if (mSlideState == SlideState.HIDDEN || mSlideState == SlideState.COLLAPSED) return false; return collapsePanel(mSlideableView, 0); } }
[ "public", "boolean", "collapsePanel", "(", ")", "{", "if", "(", "mFirstLayout", ")", "{", "mSlideState", "=", "SlideState", ".", "COLLAPSED", ";", "return", "true", ";", "}", "else", "{", "if", "(", "mSlideState", "==", "SlideState", ".", "HIDDEN", "||", ...
Collapse the sliding pane if it is currently slideable. If first layout has already completed this will animate. @return true if the pane was slideable and is now collapsed/in the process of collapsing
[ "Collapse", "the", "sliding", "pane", "if", "it", "is", "currently", "slideable", ".", "If", "first", "layout", "has", "already", "completed", "this", "will", "animate", "." ]
train
https://github.com/baneizalfe/PullToDismissPager/blob/14b12725f8ab9274b2499432d85e1b8b2b1850a5/PullToDismissPager/src/main/java/com/mrbug/pulltodismisspager/PullToDismissPager.java#L705-L714
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/BosClient.java
BosClient.appendObject
public AppendObjectResponse appendObject( String bucketName, String key, byte[] value, ObjectMetadata metadata) { checkNotNull(metadata, "metadata should not be null."); if (metadata.getContentLength() == -1) { metadata.setContentLength(value.length); } return this.appendObject( new AppendObjectRequest(bucketName, key, RestartableInputStream.wrap(value), metadata)); }
java
public AppendObjectResponse appendObject( String bucketName, String key, byte[] value, ObjectMetadata metadata) { checkNotNull(metadata, "metadata should not be null."); if (metadata.getContentLength() == -1) { metadata.setContentLength(value.length); } return this.appendObject( new AppendObjectRequest(bucketName, key, RestartableInputStream.wrap(value), metadata)); }
[ "public", "AppendObjectResponse", "appendObject", "(", "String", "bucketName", ",", "String", "key", ",", "byte", "[", "]", "value", ",", "ObjectMetadata", "metadata", ")", "{", "checkNotNull", "(", "metadata", ",", "\"metadata should not be null.\"", ")", ";", "i...
Uploads the appendable bytes and object metadata to Bos under the specified bucket and key name. @param bucketName The name of an existing bucket, to which you have Write permission. @param key The key under which to store the specified file. @param value The bytes containing the value to be uploaded to Bos. @param metadata Additional metadata instructing Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.). @return An AppendObjectResponse object containing the information returned by Bos for the newly created object.
[ "Uploads", "the", "appendable", "bytes", "and", "object", "metadata", "to", "Bos", "under", "the", "specified", "bucket", "and", "key", "name", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1747-L1755
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Period.java
Period.plusMonths
public Period plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; } return create(years, Math.toIntExact(Math.addExact(months, monthsToAdd)), days); }
java
public Period plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; } return create(years, Math.toIntExact(Math.addExact(months, monthsToAdd)), days); }
[ "public", "Period", "plusMonths", "(", "long", "monthsToAdd", ")", "{", "if", "(", "monthsToAdd", "==", "0", ")", "{", "return", "this", ";", "}", "return", "create", "(", "years", ",", "Math", ".", "toIntExact", "(", "Math", ".", "addExact", "(", "mon...
Returns a copy of this period with the specified months added. <p> This adds the amount to the months unit in a copy of this period. The years and days units are unaffected. For example, "1 year, 6 months and 3 days" plus 2 months returns "1 year, 8 months and 3 days". <p> This instance is immutable and unaffected by this method call. @param monthsToAdd the months to add, positive or negative @return a {@code Period} based on this period with the specified months added, not null @throws ArithmeticException if numeric overflow occurs
[ "Returns", "a", "copy", "of", "this", "period", "with", "the", "specified", "months", "added", ".", "<p", ">", "This", "adds", "the", "amount", "to", "the", "months", "unit", "in", "a", "copy", "of", "this", "period", ".", "The", "years", "and", "days"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Period.java#L660-L665
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.checkForHashCodeChange
private void checkForHashCodeChange(Entry<K, V> e) { K key = extractKeyObj(e); if (extractIntKeyValue(key, modifiedHash(key.hashCode())) != e.hashCode) { if (keyMutationCnt == 0) { getLog().warn("Key mismatch! Key hashcode changed! keyClass=" + e.getKey().getClass().getName()); String s; try { s = e.getKey().toString(); if (s != null) { getLog().warn("Key mismatch! key.toString(): " + s); } } catch (Throwable t) { getLog().warn("Key mismatch! key.toString() threw exception", t); } } keyMutationCnt++; } }
java
private void checkForHashCodeChange(Entry<K, V> e) { K key = extractKeyObj(e); if (extractIntKeyValue(key, modifiedHash(key.hashCode())) != e.hashCode) { if (keyMutationCnt == 0) { getLog().warn("Key mismatch! Key hashcode changed! keyClass=" + e.getKey().getClass().getName()); String s; try { s = e.getKey().toString(); if (s != null) { getLog().warn("Key mismatch! key.toString(): " + s); } } catch (Throwable t) { getLog().warn("Key mismatch! key.toString() threw exception", t); } } keyMutationCnt++; } }
[ "private", "void", "checkForHashCodeChange", "(", "Entry", "<", "K", ",", "V", ">", "e", ")", "{", "K", "key", "=", "extractKeyObj", "(", "e", ")", ";", "if", "(", "extractIntKeyValue", "(", "key", ",", "modifiedHash", "(", "key", ".", "hashCode", "(",...
Check whether the key was modified during the stay of the entry in the cache. We only need to check this when the entry is removed, since we expect that if the key has changed, the stored hash code in the cache will not match any more and the item is evicted very fast.
[ "Check", "whether", "the", "key", "was", "modified", "during", "the", "stay", "of", "the", "entry", "in", "the", "cache", ".", "We", "only", "need", "to", "check", "this", "when", "the", "entry", "is", "removed", "since", "we", "expect", "that", "if", ...
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1335-L1352
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/builder/AbstractProcessorBuilder.java
AbstractProcessorBuilder.getFormatter
@SuppressWarnings("unchecked") public TextFormatter<T> getFormatter(final FieldAccessor field, final Configuration config) { if(field.hasAnnotation(CsvFormat.class)) { CsvFormat formatAnno = field.getAnnotation(CsvFormat.class).get(); final TextFormatter<T> formatter = (TextFormatter<T>) config.getBeanFactory().create(formatAnno.formatter()); if(!formatAnno.message().isEmpty()) { formatter.setValidationMessage(formatAnno.message()); } return formatter; } else { return getDefaultFormatter(field, config); } }
java
@SuppressWarnings("unchecked") public TextFormatter<T> getFormatter(final FieldAccessor field, final Configuration config) { if(field.hasAnnotation(CsvFormat.class)) { CsvFormat formatAnno = field.getAnnotation(CsvFormat.class).get(); final TextFormatter<T> formatter = (TextFormatter<T>) config.getBeanFactory().create(formatAnno.formatter()); if(!formatAnno.message().isEmpty()) { formatter.setValidationMessage(formatAnno.message()); } return formatter; } else { return getDefaultFormatter(field, config); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "TextFormatter", "<", "T", ">", "getFormatter", "(", "final", "FieldAccessor", "field", ",", "final", "Configuration", "config", ")", "{", "if", "(", "field", ".", "hasAnnotation", "(", "CsvFormat", ...
文字列とオブジェクトを相互変換するフォーマッタを取得します。 <p>アノテーション{@link CsvFormat}が指定されている場合は、そちらを優先します。</p> @param field フィールド情報 @param config システム設定 @return フォーマッタを取得します。
[ "文字列とオブジェクトを相互変換するフォーマッタを取得します。", "<p", ">", "アノテーション", "{" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/AbstractProcessorBuilder.java#L226-L242
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java
BinaryString.fromAddress
public static BinaryString fromAddress( MemorySegment[] segments, int offset, int numBytes) { return new BinaryString(segments, offset, numBytes); }
java
public static BinaryString fromAddress( MemorySegment[] segments, int offset, int numBytes) { return new BinaryString(segments, offset, numBytes); }
[ "public", "static", "BinaryString", "fromAddress", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ",", "int", "numBytes", ")", "{", "return", "new", "BinaryString", "(", "segments", ",", "offset", ",", "numBytes", ")", ";", "}" ]
Creates an BinaryString from given address (base and offset) and length.
[ "Creates", "an", "BinaryString", "from", "given", "address", "(", "base", "and", "offset", ")", "and", "length", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L69-L72
VoltDB/voltdb
src/frontend/org/voltdb/ElasticHashinator.java
ElasticHashinator.containingBucket
private static int containingBucket(int token, long interval) { return (int) ((((long) token - Integer.MIN_VALUE) / interval) * interval + Integer.MIN_VALUE); }
java
private static int containingBucket(int token, long interval) { return (int) ((((long) token - Integer.MIN_VALUE) / interval) * interval + Integer.MIN_VALUE); }
[ "private", "static", "int", "containingBucket", "(", "int", "token", ",", "long", "interval", ")", "{", "return", "(", "int", ")", "(", "(", "(", "(", "long", ")", "token", "-", "Integer", ".", "MIN_VALUE", ")", "/", "interval", ")", "*", "interval", ...
Calculate the boundary of the bucket that countain the given token given the token interval. @return The token of the bucket boundary.
[ "Calculate", "the", "boundary", "of", "the", "bucket", "that", "countain", "the", "given", "token", "given", "the", "token", "interval", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ElasticHashinator.java#L767-L770
datastax/java-driver
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java
SchemaBuilder.dropType
@NonNull public static Drop dropType(@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier typeName) { return new DefaultDrop(keyspace, typeName, "TYPE"); }
java
@NonNull public static Drop dropType(@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier typeName) { return new DefaultDrop(keyspace, typeName, "TYPE"); }
[ "@", "NonNull", "public", "static", "Drop", "dropType", "(", "@", "Nullable", "CqlIdentifier", "keyspace", ",", "@", "NonNull", "CqlIdentifier", "typeName", ")", "{", "return", "new", "DefaultDrop", "(", "keyspace", ",", "typeName", ",", "\"TYPE\"", ")", ";", ...
Starts a DROP TYPE query for the given view name for the given type name.
[ "Starts", "a", "DROP", "TYPE", "query", "for", "the", "given", "view", "name", "for", "the", "given", "type", "name", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java#L400-L403
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMBuilder.java
DOMBuilder.startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { if(null == prefix || prefix.equals("")) prefix = "xmlns"; else prefix = "xmlns:"+prefix; m_prefixMappings.addElement(prefix); m_prefixMappings.addElement(uri); }
java
public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { if(null == prefix || prefix.equals("")) prefix = "xmlns"; else prefix = "xmlns:"+prefix; m_prefixMappings.addElement(prefix); m_prefixMappings.addElement(uri); }
[ "public", "void", "startPrefixMapping", "(", "String", "prefix", ",", "String", "uri", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "if", "(", "null", "==", "prefix", "||", "prefix", ".", "equals", "(", "\"\"", ")", ")", "pre...
Begin the scope of a prefix-URI Namespace mapping. <p>The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default).</p> <p>There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary.</p> <p>Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.</p> @param prefix The Namespace prefix being declared. @param uri The Namespace URI the prefix is mapped to. @see #endPrefixMapping @see #startElement
[ "Begin", "the", "scope", "of", "a", "prefix", "-", "URI", "Namespace", "mapping", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMBuilder.java#L755-L763
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java
ServletUtil.getHeader
public final static String getHeader(HttpServletRequest request, String name, String charset) { final String header = request.getHeader(name); if (null != header) { try { return new String(header.getBytes(CharsetUtil.ISO_8859_1), charset); } catch (UnsupportedEncodingException e) { throw new UtilException(StrUtil.format("Error charset {} for http request header.", charset)); } } return null; }
java
public final static String getHeader(HttpServletRequest request, String name, String charset) { final String header = request.getHeader(name); if (null != header) { try { return new String(header.getBytes(CharsetUtil.ISO_8859_1), charset); } catch (UnsupportedEncodingException e) { throw new UtilException(StrUtil.format("Error charset {} for http request header.", charset)); } } return null; }
[ "public", "final", "static", "String", "getHeader", "(", "HttpServletRequest", "request", ",", "String", "name", ",", "String", "charset", ")", "{", "final", "String", "header", "=", "request", ".", "getHeader", "(", "name", ")", ";", "if", "(", "null", "!...
获得请求header中的信息 @param request 请求对象{@link HttpServletRequest} @param name 头信息的KEY @param charset 字符集 @return header值
[ "获得请求header中的信息" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L298-L308
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.handleRequest
protected <T, A> void handleRequest(final Channel channel, final DataInput message, final ManagementProtocolHeader header, ActiveRequest<T, A> activeRequest) { handleMessage(channel, message, header, activeRequest.context, activeRequest.handler); }
java
protected <T, A> void handleRequest(final Channel channel, final DataInput message, final ManagementProtocolHeader header, ActiveRequest<T, A> activeRequest) { handleMessage(channel, message, header, activeRequest.context, activeRequest.handler); }
[ "protected", "<", "T", ",", "A", ">", "void", "handleRequest", "(", "final", "Channel", "channel", ",", "final", "DataInput", "message", ",", "final", "ManagementProtocolHeader", "header", ",", "ActiveRequest", "<", "T", ",", "A", ">", "activeRequest", ")", ...
Handle a message. @param channel the channel @param message the message @param header the protocol header @param activeRequest the active request
[ "Handle", "a", "message", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L285-L287
bazaarvoice/jolt
jolt-core/src/main/java/com/bazaarvoice/jolt/traversr/Traversr.java
Traversr.get
public Optional<DataType> get( Object tree, List<String> keys ) { if ( keys.size() != traversalLength ) { throw new TraversrException( "Traversal Path and number of keys mismatch, traversalLength:" + traversalLength + " numKeys:" + keys.size() ); } return root.traverse( tree, TraversalStep.Operation.GET, keys.iterator(), null ); }
java
public Optional<DataType> get( Object tree, List<String> keys ) { if ( keys.size() != traversalLength ) { throw new TraversrException( "Traversal Path and number of keys mismatch, traversalLength:" + traversalLength + " numKeys:" + keys.size() ); } return root.traverse( tree, TraversalStep.Operation.GET, keys.iterator(), null ); }
[ "public", "Optional", "<", "DataType", ">", "get", "(", "Object", "tree", ",", "List", "<", "String", ">", "keys", ")", "{", "if", "(", "keys", ".", "size", "(", ")", "!=", "traversalLength", ")", "{", "throw", "new", "TraversrException", "(", "\"Trave...
Note : Calling this method MAY modify the tree object by adding new Maps and Lists as needed for the traversal. This is determined by the behavior of the implementations of the abstract methods of this class.
[ "Note", ":", "Calling", "this", "method", "MAY", "modify", "the", "tree", "object", "by", "adding", "new", "Maps", "and", "Lists", "as", "needed", "for", "the", "traversal", ".", "This", "is", "determined", "by", "the", "behavior", "of", "the", "implementa...
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/traversr/Traversr.java#L117-L124
spring-projects/spring-mobile
spring-mobile-device/src/main/java/org/springframework/mobile/device/switcher/SiteSwitcherHandlerInterceptor.java
SiteSwitcherHandlerInterceptor.dotMobi
public static SiteSwitcherHandlerInterceptor dotMobi(String serverName, Boolean tabletIsMobile) { return new SiteSwitcherHandlerInterceptor(StandardSiteSwitcherHandlerFactory.dotMobi(serverName, tabletIsMobile)); }
java
public static SiteSwitcherHandlerInterceptor dotMobi(String serverName, Boolean tabletIsMobile) { return new SiteSwitcherHandlerInterceptor(StandardSiteSwitcherHandlerFactory.dotMobi(serverName, tabletIsMobile)); }
[ "public", "static", "SiteSwitcherHandlerInterceptor", "dotMobi", "(", "String", "serverName", ",", "Boolean", "tabletIsMobile", ")", "{", "return", "new", "SiteSwitcherHandlerInterceptor", "(", "StandardSiteSwitcherHandlerFactory", ".", "dotMobi", "(", "serverName", ",", ...
Creates a site switcher that redirects to a <code>.mobi</code> domain for normal site requests that either originate from a mobile device or indicate a mobile site preference. Will strip off the trailing domain name when building the mobile domain e.g. "app.com" will become "app.mobi" (the .com will be stripped). Uses a {@link CookieSitePreferenceRepository} that saves a cookie that is shared between the two domains.
[ "Creates", "a", "site", "switcher", "that", "redirects", "to", "a", "<code", ">", ".", "mobi<", "/", "code", ">", "domain", "for", "normal", "site", "requests", "that", "either", "originate", "from", "a", "mobile", "device", "or", "indicate", "a", "mobile"...
train
https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/switcher/SiteSwitcherHandlerInterceptor.java#L152-L154
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java
VisOdomMonoPlaneInfinity.computeAngleOfRotation
private void computeAngleOfRotation(PointTrack t, Vector3D_F64 pointingPlane) { VoTrack p = t.getCookie(); // Compute ground pointing vector groundCurr.x = pointingPlane.z; groundCurr.y = -pointingPlane.x; double norm = groundCurr.norm(); groundCurr.x /= norm; groundCurr.y /= norm; // dot product. vectors are normalized to 1 already double dot = groundCurr.x * p.ground.x + groundCurr.y * p.ground.y; // floating point round off error some times knocks it above 1.0 if (dot > 1.0) dot = 1.0; double angle = Math.acos(dot); // cross product to figure out direction if (groundCurr.x * p.ground.y - groundCurr.y * p.ground.x > 0) angle = -angle; farAngles.add(angle); }
java
private void computeAngleOfRotation(PointTrack t, Vector3D_F64 pointingPlane) { VoTrack p = t.getCookie(); // Compute ground pointing vector groundCurr.x = pointingPlane.z; groundCurr.y = -pointingPlane.x; double norm = groundCurr.norm(); groundCurr.x /= norm; groundCurr.y /= norm; // dot product. vectors are normalized to 1 already double dot = groundCurr.x * p.ground.x + groundCurr.y * p.ground.y; // floating point round off error some times knocks it above 1.0 if (dot > 1.0) dot = 1.0; double angle = Math.acos(dot); // cross product to figure out direction if (groundCurr.x * p.ground.y - groundCurr.y * p.ground.x > 0) angle = -angle; farAngles.add(angle); }
[ "private", "void", "computeAngleOfRotation", "(", "PointTrack", "t", ",", "Vector3D_F64", "pointingPlane", ")", "{", "VoTrack", "p", "=", "t", ".", "getCookie", "(", ")", ";", "// Compute ground pointing vector", "groundCurr", ".", "x", "=", "pointingPlane", ".", ...
Computes the angle of rotation between two pointing vectors on the ground plane and adds it to a list. @param pointingPlane Pointing vector of observation in plane reference frame
[ "Computes", "the", "angle", "of", "rotation", "between", "two", "pointing", "vectors", "on", "the", "ground", "plane", "and", "adds", "it", "to", "a", "list", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L418-L440
selenide/selenide
src/main/java/com/codeborne/selenide/Condition.java
Condition.exactText
public static Condition exactText(final String text) { return new Condition("exact text") { @Override public boolean apply(Driver driver, WebElement element) { return Html.text.equals(element.getText(), text); } @Override public String toString() { return name + " '" + text + '\''; } }; }
java
public static Condition exactText(final String text) { return new Condition("exact text") { @Override public boolean apply(Driver driver, WebElement element) { return Html.text.equals(element.getText(), text); } @Override public String toString() { return name + " '" + text + '\''; } }; }
[ "public", "static", "Condition", "exactText", "(", "final", "String", "text", ")", "{", "return", "new", "Condition", "(", "\"exact text\"", ")", "{", "@", "Override", "public", "boolean", "apply", "(", "Driver", "driver", ",", "WebElement", "element", ")", ...
<p>Sample: <code>$("h1").shouldHave(exactText("Hello"))</code></p> <p>Case insensitive</p> <p>NB! Ignores multiple whitespaces between words</p> @param text expected text of HTML element
[ "<p", ">", "Sample", ":", "<code", ">", "$", "(", "h1", ")", ".", "shouldHave", "(", "exactText", "(", "Hello", "))", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/Condition.java#L320-L332
amzn/ion-java
src/com/amazon/ion/Timestamp.java
Timestamp.addYear
public final Timestamp addYear(int amount) { if (amount == 0) return this; Calendar cal = calendarValue(); cal.add(Calendar.YEAR, amount); return new Timestamp(cal, _precision, _fraction, _offset); }
java
public final Timestamp addYear(int amount) { if (amount == 0) return this; Calendar cal = calendarValue(); cal.add(Calendar.YEAR, amount); return new Timestamp(cal, _precision, _fraction, _offset); }
[ "public", "final", "Timestamp", "addYear", "(", "int", "amount", ")", "{", "if", "(", "amount", "==", "0", ")", "return", "this", ";", "Calendar", "cal", "=", "calendarValue", "(", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "YEAR", ",", "amou...
Returns a timestamp relative to this one by the given number of years. The day field may be adjusted to account for leap days. For example, adding one year to {@code 2012-02-29} results in {@code 2013-02-28}. @param amount a number of years.
[ "Returns", "a", "timestamp", "relative", "to", "this", "one", "by", "the", "given", "number", "of", "years", ".", "The", "day", "field", "may", "be", "adjusted", "to", "account", "for", "leap", "days", ".", "For", "example", "adding", "one", "year", "to"...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L2522-L2529
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageInfoDisplay.java
CmsImageInfoDisplay.fillContent
public void fillContent(CmsResourceInfoBean infoBean, String crop, String point) { m_displayPath.setText(infoBean.getResourcePath()); if (infoBean instanceof CmsImageInfoBean) { CmsImageInfoBean imageInfo = (CmsImageInfoBean)infoBean; m_displayFormat.setText(imageInfo.getWidth() + " x " + imageInfo.getHeight()); } String path = infoBean.getResourcePath(); String typePrefix = "???"; int slashPos = path.lastIndexOf("/"); String name; if (slashPos >= 0) { name = path.substring(slashPos + 1); } else { name = path; } int dotPos = name.lastIndexOf("."); if (dotPos >= 0) { String extension = name.substring(dotPos + 1).toLowerCase(); if ("jpg".equals(extension) || "jpeg".equals(extension)) { typePrefix = "JPEG"; } else { typePrefix = extension.toUpperCase(); } } m_removePoint.setEnabled(CmsStringUtil.isEmptyOrWhitespaceOnly(infoBean.getNoEditReason())); m_displayType.setText(Messages.get().key(Messages.GUI_PREVIEW_VALUE_TYPE_1, typePrefix)); setCropFormat(crop); setFocalPoint(point); }
java
public void fillContent(CmsResourceInfoBean infoBean, String crop, String point) { m_displayPath.setText(infoBean.getResourcePath()); if (infoBean instanceof CmsImageInfoBean) { CmsImageInfoBean imageInfo = (CmsImageInfoBean)infoBean; m_displayFormat.setText(imageInfo.getWidth() + " x " + imageInfo.getHeight()); } String path = infoBean.getResourcePath(); String typePrefix = "???"; int slashPos = path.lastIndexOf("/"); String name; if (slashPos >= 0) { name = path.substring(slashPos + 1); } else { name = path; } int dotPos = name.lastIndexOf("."); if (dotPos >= 0) { String extension = name.substring(dotPos + 1).toLowerCase(); if ("jpg".equals(extension) || "jpeg".equals(extension)) { typePrefix = "JPEG"; } else { typePrefix = extension.toUpperCase(); } } m_removePoint.setEnabled(CmsStringUtil.isEmptyOrWhitespaceOnly(infoBean.getNoEditReason())); m_displayType.setText(Messages.get().key(Messages.GUI_PREVIEW_VALUE_TYPE_1, typePrefix)); setCropFormat(crop); setFocalPoint(point); }
[ "public", "void", "fillContent", "(", "CmsResourceInfoBean", "infoBean", ",", "String", "crop", ",", "String", "point", ")", "{", "m_displayPath", ".", "setText", "(", "infoBean", ".", "getResourcePath", "(", ")", ")", ";", "if", "(", "infoBean", "instanceof",...
Fills the contend data.<p> @param infoBean the image info bean @param crop the cropping text @param point the focal point text
[ "Fills", "the", "contend", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageInfoDisplay.java#L148-L177
diirt/util
src/main/java/org/epics/util/time/TimeDuration.java
TimeDuration.dividedBy
public TimeDuration dividedBy(int factor) { return createWithCarry(sec / factor, ((sec % factor) * NANOSEC_IN_SEC + (long) nanoSec) / factor); }
java
public TimeDuration dividedBy(int factor) { return createWithCarry(sec / factor, ((sec % factor) * NANOSEC_IN_SEC + (long) nanoSec) / factor); }
[ "public", "TimeDuration", "dividedBy", "(", "int", "factor", ")", "{", "return", "createWithCarry", "(", "sec", "/", "factor", ",", "(", "(", "sec", "%", "factor", ")", "*", "NANOSEC_IN_SEC", "+", "(", "long", ")", "nanoSec", ")", "/", "factor", ")", "...
Returns a new duration which is smaller by the given factor. @param factor constant to divide @return a new duration
[ "Returns", "a", "new", "duration", "which", "is", "smaller", "by", "the", "given", "factor", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/time/TimeDuration.java#L155-L157
powermock/powermock
powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java
PowerMockito.mockStatic
public static void mockStatic(Class<?> classMock, @SuppressWarnings("rawtypes") Answer defaultAnswer) { mockStatic(classMock, withSettings().defaultAnswer(defaultAnswer)); }
java
public static void mockStatic(Class<?> classMock, @SuppressWarnings("rawtypes") Answer defaultAnswer) { mockStatic(classMock, withSettings().defaultAnswer(defaultAnswer)); }
[ "public", "static", "void", "mockStatic", "(", "Class", "<", "?", ">", "classMock", ",", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Answer", "defaultAnswer", ")", "{", "mockStatic", "(", "classMock", ",", "withSettings", "(", ")", ".", "defaultAnswer"...
Creates class mock with a specified strategy for its answers to interactions. It's quite advanced feature and typically you don't need it to write decent tests. However it can be helpful when working with legacy systems. <p> It is the default answer so it will be used <b>only when you don't</b> stub the method call. <p> <pre> mockStatic(Foo.class, RETURNS_SMART_NULLS); mockStatic(Foo.class, new YourOwnAnswer()); </pre> @param classMock class to mock @param defaultAnswer default answer for unstubbed methods
[ "Creates", "class", "mock", "with", "a", "specified", "strategy", "for", "its", "answers", "to", "interactions", ".", "It", "s", "quite", "advanced", "feature", "and", "typically", "you", "don", "t", "need", "it", "to", "write", "decent", "tests", ".", "Ho...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java#L87-L89
jenkinsci/jenkins
core/src/main/java/jenkins/model/Jenkins.java
Jenkins.doRestart
@CLIMethod(name="restart") public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, RestartNotSupportedException { checkPermission(ADMINISTER); if (req != null && req.getMethod().equals("GET")) { req.getView(this,"_restart.jelly").forward(req,rsp); return; } if (req == null || req.getMethod().equals("POST")) { restart(); } if (rsp != null) { rsp.sendRedirect2("."); } }
java
@CLIMethod(name="restart") public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, RestartNotSupportedException { checkPermission(ADMINISTER); if (req != null && req.getMethod().equals("GET")) { req.getView(this,"_restart.jelly").forward(req,rsp); return; } if (req == null || req.getMethod().equals("POST")) { restart(); } if (rsp != null) { rsp.sendRedirect2("."); } }
[ "@", "CLIMethod", "(", "name", "=", "\"restart\"", ")", "public", "void", "doRestart", "(", "StaplerRequest", "req", ",", "StaplerResponse", "rsp", ")", "throws", "IOException", ",", "ServletException", ",", "RestartNotSupportedException", "{", "checkPermission", "(...
Perform a restart of Jenkins, if we can. This first replaces "app" to {@link HudsonIsRestarting}
[ "Perform", "a", "restart", "of", "Jenkins", "if", "we", "can", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L4185-L4200
ReactiveX/RxNetty
rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServer.java
HttpServer.newServer
public static HttpServer<ByteBuf, ByteBuf> newServer(SocketAddress socketAddress, EventLoopGroup eventLoopGroup, Class<? extends ServerChannel> channelClass) { return _newServer(TcpServer.newServer(socketAddress, eventLoopGroup, eventLoopGroup, channelClass)); }
java
public static HttpServer<ByteBuf, ByteBuf> newServer(SocketAddress socketAddress, EventLoopGroup eventLoopGroup, Class<? extends ServerChannel> channelClass) { return _newServer(TcpServer.newServer(socketAddress, eventLoopGroup, eventLoopGroup, channelClass)); }
[ "public", "static", "HttpServer", "<", "ByteBuf", ",", "ByteBuf", ">", "newServer", "(", "SocketAddress", "socketAddress", ",", "EventLoopGroup", "eventLoopGroup", ",", "Class", "<", "?", "extends", "ServerChannel", ">", "channelClass", ")", "{", "return", "_newSe...
Creates a new server using the passed port. @param socketAddress Socket address for the server. @param eventLoopGroup Eventloop group to be used for server as well as client sockets. @param channelClass The class to be used for server channel. @return A new {@link HttpServer}
[ "Creates", "a", "new", "server", "using", "the", "passed", "port", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServer.java#L421-L424
gresrun/jesque
src/main/java/net/greghaines/jesque/admin/AdminImpl.java
AdminImpl.recoverFromException
protected void recoverFromException(final String channel, final Exception e) { final RecoveryStrategy recoveryStrategy = this.exceptionHandlerRef.get().onException(this, e, channel); switch (recoveryStrategy) { case RECONNECT: LOG.info("Reconnecting to Redis in response to exception", e); final int reconAttempts = getReconnectAttempts(); if (!JedisUtils.reconnect(this.jedis, reconAttempts, RECONNECT_SLEEP_TIME)) { LOG.warn("Terminating in response to exception after " + reconAttempts + " to reconnect", e); end(false); } else { LOG.info("Reconnected to Redis"); } break; case TERMINATE: LOG.warn("Terminating in response to exception", e); end(false); break; case PROCEED: break; default: LOG.error("Unknown RecoveryStrategy: " + recoveryStrategy + " while attempting to recover from the following exception; Admin proceeding...", e); break; } }
java
protected void recoverFromException(final String channel, final Exception e) { final RecoveryStrategy recoveryStrategy = this.exceptionHandlerRef.get().onException(this, e, channel); switch (recoveryStrategy) { case RECONNECT: LOG.info("Reconnecting to Redis in response to exception", e); final int reconAttempts = getReconnectAttempts(); if (!JedisUtils.reconnect(this.jedis, reconAttempts, RECONNECT_SLEEP_TIME)) { LOG.warn("Terminating in response to exception after " + reconAttempts + " to reconnect", e); end(false); } else { LOG.info("Reconnected to Redis"); } break; case TERMINATE: LOG.warn("Terminating in response to exception", e); end(false); break; case PROCEED: break; default: LOG.error("Unknown RecoveryStrategy: " + recoveryStrategy + " while attempting to recover from the following exception; Admin proceeding...", e); break; } }
[ "protected", "void", "recoverFromException", "(", "final", "String", "channel", ",", "final", "Exception", "e", ")", "{", "final", "RecoveryStrategy", "recoveryStrategy", "=", "this", ".", "exceptionHandlerRef", ".", "get", "(", ")", ".", "onException", "(", "th...
Handle an exception that was thrown from inside {@link PubSubListener#onMessage(String,String)}. @param channel the name of the channel that was being processed when the exception was thrown @param e the exception that was thrown
[ "Handle", "an", "exception", "that", "was", "thrown", "from", "inside", "{", "@link", "PubSubListener#onMessage", "(", "String", "String", ")", "}", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/admin/AdminImpl.java#L363-L387
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java
DateFunctions.dateTruncStr
public static Expression dateTruncStr(Expression expression, DatePart part) { return x("DATE_TRUNC_STR(" + expression.toString() + ", \"" + part.toString() + "\")"); }
java
public static Expression dateTruncStr(Expression expression, DatePart part) { return x("DATE_TRUNC_STR(" + expression.toString() + ", \"" + part.toString() + "\")"); }
[ "public", "static", "Expression", "dateTruncStr", "(", "Expression", "expression", ",", "DatePart", "part", ")", "{", "return", "x", "(", "\"DATE_TRUNC_STR(\"", "+", "expression", ".", "toString", "(", ")", "+", "\", \\\"\"", "+", "part", ".", "toString", "(",...
Returned expression results in ISO 8601 timestamp that has been truncated so that the given date part is the least significant.
[ "Returned", "expression", "results", "in", "ISO", "8601", "timestamp", "that", "has", "been", "truncated", "so", "that", "the", "given", "date", "part", "is", "the", "least", "significant", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L188-L190
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java
CacheUnitImpl.addAlias
public void addAlias(String cacheName, Object id, Object[] aliasArray) { if (id != null && aliasArray != null) { DCache cache = ServerCache.getCache(cacheName); if (cache != null) { try { cache.addAlias(id, aliasArray, false, false); } catch (IllegalArgumentException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Adding alias for cache id " + id + " failure: " + e.getMessage()); } } } } }
java
public void addAlias(String cacheName, Object id, Object[] aliasArray) { if (id != null && aliasArray != null) { DCache cache = ServerCache.getCache(cacheName); if (cache != null) { try { cache.addAlias(id, aliasArray, false, false); } catch (IllegalArgumentException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Adding alias for cache id " + id + " failure: " + e.getMessage()); } } } } }
[ "public", "void", "addAlias", "(", "String", "cacheName", ",", "Object", "id", ",", "Object", "[", "]", "aliasArray", ")", "{", "if", "(", "id", "!=", "null", "&&", "aliasArray", "!=", "null", ")", "{", "DCache", "cache", "=", "ServerCache", ".", "getC...
This implements the method in the CacheUnit interface. This is called to add alias ids for cache id. @param cacheName The cache name @param id The cache id @param aliasArray The array of alias ids
[ "This", "implements", "the", "method", "in", "the", "CacheUnit", "interface", ".", "This", "is", "called", "to", "add", "alias", "ids", "for", "cache", "id", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java#L334-L347
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java
MapExtensions.operator_remove
@Inline(value = "$1.remove($2)", statementExpression = true) public static <K, V> V operator_remove(Map<K, V> map, K key) { return map.remove(key); }
java
@Inline(value = "$1.remove($2)", statementExpression = true) public static <K, V> V operator_remove(Map<K, V> map, K key) { return map.remove(key); }
[ "@", "Inline", "(", "value", "=", "\"$1.remove($2)\"", ",", "statementExpression", "=", "true", ")", "public", "static", "<", "K", ",", "V", ">", "V", "operator_remove", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "K", "key", ")", "{", "return",...
Remove a key from the given map. @param <K> type of the map keys. @param <V> type of the map values. @param map the map to update. @param key the key to remove. @return the removed value, or <code>null</code> if the key was not present in the map. @since 2.15
[ "Remove", "a", "key", "from", "the", "given", "map", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java#L206-L209
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/OrientModule.java
OrientModule.bindPool
protected final <T, P extends PoolManager<T>> void bindPool(final Class<T> type, final Class<P> pool) { bind(pool).in(Singleton.class); poolsMultibinder.addBinding().to(pool); bind(type).toProvider(pool); }
java
protected final <T, P extends PoolManager<T>> void bindPool(final Class<T> type, final Class<P> pool) { bind(pool).in(Singleton.class); poolsMultibinder.addBinding().to(pool); bind(type).toProvider(pool); }
[ "protected", "final", "<", "T", ",", "P", "extends", "PoolManager", "<", "T", ">", ">", "void", "bindPool", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "Class", "<", "P", ">", "pool", ")", "{", "bind", "(", "pool", ")", ".", "in",...
Register pool within pools set and register provider for specified type. Use to register custom pools in {@link #configurePools()}. @param type connection object type @param pool pool type @param <T> connection object type @param <P> pool type
[ "Register", "pool", "within", "pools", "set", "and", "register", "provider", "for", "specified", "type", ".", "Use", "to", "register", "custom", "pools", "in", "{", "@link", "#configurePools", "()", "}", "." ]
train
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/OrientModule.java#L344-L348
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
AbstractQueuedSynchronizer.unparkSuccessor
private void unparkSuccessor(Node node) { /* * If status is negative (i.e., possibly needing signal) try * to clear in anticipation of signalling. It is OK if this * fails or if status is changed by waiting thread. */ int ws = node.waitStatus; if (ws < 0) node.compareAndSetWaitStatus(ws, 0); /* * Thread to unpark is held in successor, which is normally * just the next node. But if cancelled or apparently null, * traverse backwards from tail to find the actual * non-cancelled successor. */ Node s = node.next; if (s == null || s.waitStatus > 0) { s = null; for (Node p = tail; p != node && p != null; p = p.prev) if (p.waitStatus <= 0) s = p; } if (s != null) LockSupport.unpark(s.thread); }
java
private void unparkSuccessor(Node node) { /* * If status is negative (i.e., possibly needing signal) try * to clear in anticipation of signalling. It is OK if this * fails or if status is changed by waiting thread. */ int ws = node.waitStatus; if (ws < 0) node.compareAndSetWaitStatus(ws, 0); /* * Thread to unpark is held in successor, which is normally * just the next node. But if cancelled or apparently null, * traverse backwards from tail to find the actual * non-cancelled successor. */ Node s = node.next; if (s == null || s.waitStatus > 0) { s = null; for (Node p = tail; p != node && p != null; p = p.prev) if (p.waitStatus <= 0) s = p; } if (s != null) LockSupport.unpark(s.thread); }
[ "private", "void", "unparkSuccessor", "(", "Node", "node", ")", "{", "/*\n * If status is negative (i.e., possibly needing signal) try\n * to clear in anticipation of signalling. It is OK if this\n * fails or if status is changed by waiting thread.\n */", "int", ...
Wakes up node's successor, if one exists. @param node the node
[ "Wakes", "up", "node", "s", "successor", "if", "one", "exists", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java#L674-L699
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_volume_volumeId_attach_POST
public OvhVolume project_serviceName_volume_volumeId_attach_POST(String serviceName, String volumeId, String instanceId) throws IOException { String qPath = "/cloud/project/{serviceName}/volume/{volumeId}/attach"; StringBuilder sb = path(qPath, serviceName, volumeId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "instanceId", instanceId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVolume.class); }
java
public OvhVolume project_serviceName_volume_volumeId_attach_POST(String serviceName, String volumeId, String instanceId) throws IOException { String qPath = "/cloud/project/{serviceName}/volume/{volumeId}/attach"; StringBuilder sb = path(qPath, serviceName, volumeId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "instanceId", instanceId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVolume.class); }
[ "public", "OvhVolume", "project_serviceName_volume_volumeId_attach_POST", "(", "String", "serviceName", ",", "String", "volumeId", ",", "String", "instanceId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/volume/{volumeId}/attach\""...
Attach a volume on an instance REST: POST /cloud/project/{serviceName}/volume/{volumeId}/attach @param instanceId [required] Instance id @param serviceName [required] Service name @param volumeId [required] Volume id
[ "Attach", "a", "volume", "on", "an", "instance" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1172-L1179
j-a-w-r/jawr
jawr-core/src/main/java/net/jawr/web/taglib/jsf/ImagePathTag.java
ImagePathTag.getImageUrl
protected String getImageUrl(FacesContext context, String src, boolean base64) { BinaryResourcesHandler imgRsHandler = getBinaryResourcesHandler(context); HttpServletResponse response = ((HttpServletResponse) context.getExternalContext().getResponse()); HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); return ImageTagUtils.getImageUrl(src, base64, imgRsHandler, request, response); }
java
protected String getImageUrl(FacesContext context, String src, boolean base64) { BinaryResourcesHandler imgRsHandler = getBinaryResourcesHandler(context); HttpServletResponse response = ((HttpServletResponse) context.getExternalContext().getResponse()); HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); return ImageTagUtils.getImageUrl(src, base64, imgRsHandler, request, response); }
[ "protected", "String", "getImageUrl", "(", "FacesContext", "context", ",", "String", "src", ",", "boolean", "base64", ")", "{", "BinaryResourcesHandler", "imgRsHandler", "=", "getBinaryResourcesHandler", "(", "context", ")", ";", "HttpServletResponse", "response", "="...
Returns the image URL generated by Jawr from a source image path @param context the faces context @param src the image source @param base64 the flag indicating if the image should be encoded in base64 @return the image URL generated by Jawr from a source image path
[ "Returns", "the", "image", "URL", "generated", "by", "Jawr", "from", "a", "source", "image", "path" ]
train
https://github.com/j-a-w-r/jawr/blob/1fa7cd46ebcd36908bd90b298ca316fa5b0c1b0d/jawr-core/src/main/java/net/jawr/web/taglib/jsf/ImagePathTag.java#L95-L103
h2oai/h2o-3
h2o-core/src/main/java/hex/grid/Grid.java
Grid.appendFailedModelParameters
void appendFailedModelParameters(MP params, Exception e) { assert params != null : "Model parameters should be always != null !"; String[] rawParams = ArrayUtils.toString(getHyperValues(params)); appendFailedModelParameters(params, rawParams, e.getMessage(), StringUtils.toString(e)); }
java
void appendFailedModelParameters(MP params, Exception e) { assert params != null : "Model parameters should be always != null !"; String[] rawParams = ArrayUtils.toString(getHyperValues(params)); appendFailedModelParameters(params, rawParams, e.getMessage(), StringUtils.toString(e)); }
[ "void", "appendFailedModelParameters", "(", "MP", "params", ",", "Exception", "e", ")", "{", "assert", "params", "!=", "null", ":", "\"Model parameters should be always != null !\"", ";", "String", "[", "]", "rawParams", "=", "ArrayUtils", ".", "toString", "(", "g...
This method appends a new item to the list of failed model parameters. <p/> <p> The failed parameters object represents a point in hyper space which cannot be used for model building.</p> <p/> <p> Should be used only from <code>GridSearch</code> job.</p> @param params model parameters which caused model builder failure @params e exception causing a failure
[ "This", "method", "appends", "a", "new", "item", "to", "the", "list", "of", "failed", "model", "parameters", ".", "<p", "/", ">", "<p", ">", "The", "failed", "parameters", "object", "represents", "a", "point", "in", "hyper", "space", "which", "cannot", "...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/grid/Grid.java#L197-L201
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_hunting_agent_agentId_liveStatus_GET
public OvhOvhPabxHuntingAgentLiveStatus billingAccount_easyHunting_serviceName_hunting_agent_agentId_liveStatus_GET(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/liveStatus"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxHuntingAgentLiveStatus.class); }
java
public OvhOvhPabxHuntingAgentLiveStatus billingAccount_easyHunting_serviceName_hunting_agent_agentId_liveStatus_GET(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/liveStatus"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxHuntingAgentLiveStatus.class); }
[ "public", "OvhOvhPabxHuntingAgentLiveStatus", "billingAccount_easyHunting_serviceName_hunting_agent_agentId_liveStatus_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "agentId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/tel...
Get this object properties REST: GET /telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/liveStatus @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param agentId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2343-L2348
NoraUi/NoraUi
src/main/java/com/github/noraui/data/excel/ExcelDataProvider.java
ExcelDataProvider.readCellByType
private String readCellByType(Cell cell, CellType type) { String txt = ""; if (cell != null) { switch (type) { case NUMERIC: txt = dateOrNumberProcessing(cell); break; case STRING: txt = String.valueOf(cell.getRichStringCellValue()); logger.debug("CELL_TYPE_STRING: {}", txt); break; case FORMULA: txt = readCellByType(cell, cell.getCachedFormulaResultTypeEnum()); logger.debug("CELL_TYPE_FORMULA: {}", txt); break; case BLANK: logger.debug("CELL_TYPE_BLANK (we do nothing)"); break; default: logger.error(Messages.getMessage(EXCEL_DATA_PROVIDER_WRONG_CELL_TYPE_ERROR_MESSAGE), type); break; } } return txt; }
java
private String readCellByType(Cell cell, CellType type) { String txt = ""; if (cell != null) { switch (type) { case NUMERIC: txt = dateOrNumberProcessing(cell); break; case STRING: txt = String.valueOf(cell.getRichStringCellValue()); logger.debug("CELL_TYPE_STRING: {}", txt); break; case FORMULA: txt = readCellByType(cell, cell.getCachedFormulaResultTypeEnum()); logger.debug("CELL_TYPE_FORMULA: {}", txt); break; case BLANK: logger.debug("CELL_TYPE_BLANK (we do nothing)"); break; default: logger.error(Messages.getMessage(EXCEL_DATA_PROVIDER_WRONG_CELL_TYPE_ERROR_MESSAGE), type); break; } } return txt; }
[ "private", "String", "readCellByType", "(", "Cell", "cell", ",", "CellType", "type", ")", "{", "String", "txt", "=", "\"\"", ";", "if", "(", "cell", "!=", "null", ")", "{", "switch", "(", "type", ")", "{", "case", "NUMERIC", ":", "txt", "=", "dateOrN...
readCellByType is used because CELL_TYPE_FORMULA can be CELL_TYPE_NUMERIC, CELL_TYPE_NUMERIC(date) or CELL_TYPE_STRING. @param cellcell read (line and column) @param type CELL_TYPE_FORMULA can be CELL_TYPE_NUMERIC, CELL_TYPE_NUMERIC(date) or CELL_TYPE_STRING @return a string with the data (evalued if CELL_TYPE_FORMULA)
[ "readCellByType", "is", "used", "because", "CELL_TYPE_FORMULA", "can", "be", "CELL_TYPE_NUMERIC", "CELL_TYPE_NUMERIC", "(", "date", ")", "or", "CELL_TYPE_STRING", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/data/excel/ExcelDataProvider.java#L294-L318
JM-Lab/utils-java8
src/main/java/kr/jm/utils/datastructure/JMMap.java
JMMap.newFilteredChangedKeyWithEntryMap
public static <K, V, NK> Map<NK, V> newFilteredChangedKeyWithEntryMap( Map<K, V> map, Predicate<? super Entry<K, V>> filter, Function<Entry<K, V>, NK> changingKeyFunction) { return getEntryStreamWithFilter(map, filter).collect( toMap(changingKeyFunction, Entry::getValue)); }
java
public static <K, V, NK> Map<NK, V> newFilteredChangedKeyWithEntryMap( Map<K, V> map, Predicate<? super Entry<K, V>> filter, Function<Entry<K, V>, NK> changingKeyFunction) { return getEntryStreamWithFilter(map, filter).collect( toMap(changingKeyFunction, Entry::getValue)); }
[ "public", "static", "<", "K", ",", "V", ",", "NK", ">", "Map", "<", "NK", ",", "V", ">", "newFilteredChangedKeyWithEntryMap", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Predicate", "<", "?", "super", "Entry", "<", "K", ",", "V", ">", ">", ...
New filtered changed key with entry map map. @param <K> the type parameter @param <V> the type parameter @param <NK> the type parameter @param map the map @param filter the filter @param changingKeyFunction the changing key function @return the map
[ "New", "filtered", "changed", "key", "with", "entry", "map", "map", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/datastructure/JMMap.java#L214-L219
apache/incubator-zipkin
zipkin/src/main/java/zipkin2/Span.java
Builder.traceId
public Builder traceId(long high, long low) { if (high == 0L && low == 0L) throw new IllegalArgumentException("empty trace ID"); char[] result = new char[high != 0L ? 32 : 16]; int pos = 0; if (high != 0L) { writeHexLong(result, pos, high); pos += 16; } writeHexLong(result, pos, low); this.traceId = new String(result); return this; }
java
public Builder traceId(long high, long low) { if (high == 0L && low == 0L) throw new IllegalArgumentException("empty trace ID"); char[] result = new char[high != 0L ? 32 : 16]; int pos = 0; if (high != 0L) { writeHexLong(result, pos, high); pos += 16; } writeHexLong(result, pos, low); this.traceId = new String(result); return this; }
[ "public", "Builder", "traceId", "(", "long", "high", ",", "long", "low", ")", "{", "if", "(", "high", "==", "0L", "&&", "low", "==", "0L", ")", "throw", "new", "IllegalArgumentException", "(", "\"empty trace ID\"", ")", ";", "char", "[", "]", "result", ...
Encodes 64 or 128 bits from the input into a hex trace ID. @param high Upper 64bits of the trace ID. Zero means the trace ID is 64-bit. @param low Lower 64bits of the trace ID. @throws IllegalArgumentException if both values are zero
[ "Encodes", "64", "or", "128", "bits", "from", "the", "input", "into", "a", "hex", "trace", "ID", "." ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/Span.java#L416-L427
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_availableWLANChannel_GET
public ArrayList<Long> serviceName_modem_availableWLANChannel_GET(String serviceName, OvhWLANFrequencyEnum frequency) throws IOException { String qPath = "/xdsl/{serviceName}/modem/availableWLANChannel"; StringBuilder sb = path(qPath, serviceName); query(sb, "frequency", frequency); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
java
public ArrayList<Long> serviceName_modem_availableWLANChannel_GET(String serviceName, OvhWLANFrequencyEnum frequency) throws IOException { String qPath = "/xdsl/{serviceName}/modem/availableWLANChannel"; StringBuilder sb = path(qPath, serviceName); query(sb, "frequency", frequency); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_modem_availableWLANChannel_GET", "(", "String", "serviceName", ",", "OvhWLANFrequencyEnum", "frequency", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/availableWLANChannel\"", ";",...
List available WLAN channel for this modem REST: GET /xdsl/{serviceName}/modem/availableWLANChannel @param frequency [required] WLAN frequency you want to retrieve channels @param serviceName [required] The internal name of your XDSL offer
[ "List", "available", "WLAN", "channel", "for", "this", "modem" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L760-L766
CenturyLinkCloud/mdw
mdw-workflow/src/com/centurylink/mdw/workflow/activity/timer/TimerWaitActivity.java
TimerWaitActivity.resumeWaiting
public final boolean resumeWaiting(InternalEvent event) throws ActivityException { // check if timer is expired at this time? try { ActivityInstance ai = getEngine().getActivityInstance(getActivityInstanceId()); Date expectedEndTime = ai.getEndDate(); long currentTime = DatabaseAccess.getCurrentTime(); if (currentTime>expectedEndTime.getTime()) { int moreSeconds = processTimerExpiration(); if (moreSeconds>0) sendDelayedResumeMessage(moreSeconds); else return true; } } catch (Exception e) { throw new ActivityException(-1, e.getMessage(), e); } EventWaitInstance received = registerWaitEvents(true,true); if (received!=null) { this.setReturnCode(received.getCompletionCode()); processOtherMessage(getExternalEventInstanceDetails(received.getMessageDocumentId())); handleEventCompletionCode(); return true; } else { return false; } }
java
public final boolean resumeWaiting(InternalEvent event) throws ActivityException { // check if timer is expired at this time? try { ActivityInstance ai = getEngine().getActivityInstance(getActivityInstanceId()); Date expectedEndTime = ai.getEndDate(); long currentTime = DatabaseAccess.getCurrentTime(); if (currentTime>expectedEndTime.getTime()) { int moreSeconds = processTimerExpiration(); if (moreSeconds>0) sendDelayedResumeMessage(moreSeconds); else return true; } } catch (Exception e) { throw new ActivityException(-1, e.getMessage(), e); } EventWaitInstance received = registerWaitEvents(true,true); if (received!=null) { this.setReturnCode(received.getCompletionCode()); processOtherMessage(getExternalEventInstanceDetails(received.getMessageDocumentId())); handleEventCompletionCode(); return true; } else { return false; } }
[ "public", "final", "boolean", "resumeWaiting", "(", "InternalEvent", "event", ")", "throws", "ActivityException", "{", "// check if timer is expired at this time?", "try", "{", "ActivityInstance", "ai", "=", "getEngine", "(", ")", ".", "getActivityInstance", "(", "getAc...
This method is made final for the class, as it contains internal logic handling resumption of waiting. It re-register the event waits including waiting for task to complete. If any event has already arrived, it processes it immediately. Customization should be done with the methods {@link #processOtherMessage(String, String)}, {@link #registerWaitEvents()}, and {@link #processTimerExpiration()}.
[ "This", "method", "is", "made", "final", "for", "the", "class", "as", "it", "contains", "internal", "logic", "handling", "resumption", "of", "waiting", ".", "It", "re", "-", "register", "the", "event", "waits", "including", "waiting", "for", "task", "to", ...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/src/com/centurylink/mdw/workflow/activity/timer/TimerWaitActivity.java#L221-L246
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/BufferedByteInputStream.java
BufferedByteInputStream.wrapInputStream
public static DataInputStream wrapInputStream(InputStream is, int bufferSize, int readBufferSize) { // wrapping BufferedByteInputStream in BufferedInputStream decreases // pressure on BBIS internal locks, and we read from the BBIS in // bigger chunks return new DataInputStream(new BufferedInputStream( new BufferedByteInputStream(is, bufferSize, readBufferSize))); }
java
public static DataInputStream wrapInputStream(InputStream is, int bufferSize, int readBufferSize) { // wrapping BufferedByteInputStream in BufferedInputStream decreases // pressure on BBIS internal locks, and we read from the BBIS in // bigger chunks return new DataInputStream(new BufferedInputStream( new BufferedByteInputStream(is, bufferSize, readBufferSize))); }
[ "public", "static", "DataInputStream", "wrapInputStream", "(", "InputStream", "is", ",", "int", "bufferSize", ",", "int", "readBufferSize", ")", "{", "// wrapping BufferedByteInputStream in BufferedInputStream decreases", "// pressure on BBIS internal locks, and we read from the BBIS...
Wrap given input stream with BufferedByteInputOutput. This is the only way to instantiate the buffered input stream. @param is underlying input stream @param bufferSize size of the in memory buffer @param readBufferSize size of the buffer used for reading from is
[ "Wrap", "given", "input", "stream", "with", "BufferedByteInputOutput", ".", "This", "is", "the", "only", "way", "to", "instantiate", "the", "buffered", "input", "stream", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BufferedByteInputStream.java#L57-L64
JoeKerouac/utils
src/main/java/com/joe/utils/secure/impl/SymmetryCipher.java
SymmetryCipher.buildInstance
public static CipherUtil buildInstance(Algorithms algorithms, String seed, int keySize) { String id = (algorithms.name() + seed + keySize).intern(); SecretKey key = KEY_CACHE.compute(id, (k, v) -> { if (v == null) { return KeyTools.buildKey(algorithms, seed, keySize); } else { return v; } }); return buildInstance(algorithms, key.getEncoded()); }
java
public static CipherUtil buildInstance(Algorithms algorithms, String seed, int keySize) { String id = (algorithms.name() + seed + keySize).intern(); SecretKey key = KEY_CACHE.compute(id, (k, v) -> { if (v == null) { return KeyTools.buildKey(algorithms, seed, keySize); } else { return v; } }); return buildInstance(algorithms, key.getEncoded()); }
[ "public", "static", "CipherUtil", "buildInstance", "(", "Algorithms", "algorithms", ",", "String", "seed", ",", "int", "keySize", ")", "{", "String", "id", "=", "(", "algorithms", ".", "name", "(", ")", "+", "seed", "+", "keySize", ")", ".", "intern", "(...
SymmetryCipher构造器 @param algorithms 算法,当前仅支持AES和DES @param seed 随机数种子 @param keySize keySize @return SymmetryCipher
[ "SymmetryCipher构造器" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/secure/impl/SymmetryCipher.java#L65-L75
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.updateProgressNotification
protected void updateProgressNotification(@NonNull final NotificationCompat.Builder builder, final int progress) { // Add Abort action to the notification if (progress != PROGRESS_ABORTED && progress != PROGRESS_COMPLETED) { final Intent abortIntent = new Intent(BROADCAST_ACTION); abortIntent.putExtra(EXTRA_ACTION, ACTION_ABORT); final PendingIntent pendingAbortIntent = PendingIntent.getBroadcast(this, 1, abortIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_action_notify_cancel, getString(R.string.dfu_action_abort), pendingAbortIntent); } }
java
protected void updateProgressNotification(@NonNull final NotificationCompat.Builder builder, final int progress) { // Add Abort action to the notification if (progress != PROGRESS_ABORTED && progress != PROGRESS_COMPLETED) { final Intent abortIntent = new Intent(BROADCAST_ACTION); abortIntent.putExtra(EXTRA_ACTION, ACTION_ABORT); final PendingIntent pendingAbortIntent = PendingIntent.getBroadcast(this, 1, abortIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_action_notify_cancel, getString(R.string.dfu_action_abort), pendingAbortIntent); } }
[ "protected", "void", "updateProgressNotification", "(", "@", "NonNull", "final", "NotificationCompat", ".", "Builder", "builder", ",", "final", "int", "progress", ")", "{", "// Add Abort action to the notification", "if", "(", "progress", "!=", "PROGRESS_ABORTED", "&&",...
This method allows you to update the notification showing the upload progress. @param builder notification builder.
[ "This", "method", "allows", "you", "to", "update", "the", "notification", "showing", "the", "upload", "progress", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1725-L1733
paypal/SeLion
server/src/main/java/com/paypal/selion/node/servlets/LogServlet.java
LogServlet.appendMoreLogsLink
private String appendMoreLogsLink(final String fileName, String url) throws IOException { FileBackedStringBuffer buffer = new FileBackedStringBuffer(); int index = retrieveIndexValueFromFileName(fileName); index++; File logFileName = retrieveFileFromLogsFolder(Integer.toString(index)); if (logFileName == null) { return ""; } // TODO put this html code in a template buffer.append("<form name ='myform' action=").append(url).append(" method= 'post'>"); buffer.append("<input type='hidden'").append(" name ='fileName'").append(" value ='") .append(logFileName.getName()).append("'>"); buffer.append("<a href= 'javascript: submitform();' > More Logs </a>"); buffer.append("</form>"); return buffer.toString(); }
java
private String appendMoreLogsLink(final String fileName, String url) throws IOException { FileBackedStringBuffer buffer = new FileBackedStringBuffer(); int index = retrieveIndexValueFromFileName(fileName); index++; File logFileName = retrieveFileFromLogsFolder(Integer.toString(index)); if (logFileName == null) { return ""; } // TODO put this html code in a template buffer.append("<form name ='myform' action=").append(url).append(" method= 'post'>"); buffer.append("<input type='hidden'").append(" name ='fileName'").append(" value ='") .append(logFileName.getName()).append("'>"); buffer.append("<a href= 'javascript: submitform();' > More Logs </a>"); buffer.append("</form>"); return buffer.toString(); }
[ "private", "String", "appendMoreLogsLink", "(", "final", "String", "fileName", ",", "String", "url", ")", "throws", "IOException", "{", "FileBackedStringBuffer", "buffer", "=", "new", "FileBackedStringBuffer", "(", ")", ";", "int", "index", "=", "retrieveIndexValueF...
This method helps to display More log information of the node machine. @param fileName It is log file name available in node machine current directory Logs folder, it is used to identify the current file to display in the web page. @param url It is node machine url (ex: http://10.232.88.10:5555) @return String vlaue to add Form in html page @throws IOException
[ "This", "method", "helps", "to", "display", "More", "log", "information", "of", "the", "node", "machine", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/node/servlets/LogServlet.java#L69-L85
googleapis/google-cloud-java
google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/LogEntry.java
LogEntry.of
public static LogEntry of(String logName, MonitoredResource resource, Payload<?> payload) { return newBuilder(payload).setLogName(logName).setResource(resource).build(); }
java
public static LogEntry of(String logName, MonitoredResource resource, Payload<?> payload) { return newBuilder(payload).setLogName(logName).setResource(resource).build(); }
[ "public", "static", "LogEntry", "of", "(", "String", "logName", ",", "MonitoredResource", "resource", ",", "Payload", "<", "?", ">", "payload", ")", "{", "return", "newBuilder", "(", "payload", ")", ".", "setLogName", "(", "logName", ")", ".", "setResource",...
Creates a {@code LogEntry} object given the log name, the monitored resource and the entry payload.
[ "Creates", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/LogEntry.java#L519-L521
appium/java-client
src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java
FeaturesMatchingResult.getRect2
public Rectangle getRect2() { verifyPropertyPresence(RECT2); //noinspection unchecked return mapToRect((Map<String, Object>) getCommandResult().get(RECT2)); }
java
public Rectangle getRect2() { verifyPropertyPresence(RECT2); //noinspection unchecked return mapToRect((Map<String, Object>) getCommandResult().get(RECT2)); }
[ "public", "Rectangle", "getRect2", "(", ")", "{", "verifyPropertyPresence", "(", "RECT2", ")", ";", "//noinspection unchecked", "return", "mapToRect", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", "getCommandResult", "(", ")", ".", "get", "(", "RE...
Returns a rect for the `points2` list. @return The bounding rect for the `points2` list or a zero rect if not enough matching points were found.
[ "Returns", "a", "rect", "for", "the", "points2", "list", "." ]
train
https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java#L104-L108
Stratio/bdt
src/main/java/com/stratio/qa/specs/DatabaseSpec.java
DatabaseSpec.createBasicMapping
@Given("^I create a Cassandra index named '(.+?)' in table '(.+?)' using magic_column '(.+?)' using keyspace '(.+?)'$") public void createBasicMapping(String index_name, String table, String column, String keyspace) throws Exception { String query = "CREATE INDEX " + index_name + " ON " + table + " (" + column + ");"; commonspec.getCassandraClient().executeQuery(query); }
java
@Given("^I create a Cassandra index named '(.+?)' in table '(.+?)' using magic_column '(.+?)' using keyspace '(.+?)'$") public void createBasicMapping(String index_name, String table, String column, String keyspace) throws Exception { String query = "CREATE INDEX " + index_name + " ON " + table + " (" + column + ");"; commonspec.getCassandraClient().executeQuery(query); }
[ "@", "Given", "(", "\"^I create a Cassandra index named '(.+?)' in table '(.+?)' using magic_column '(.+?)' using keyspace '(.+?)'$\"", ")", "public", "void", "createBasicMapping", "(", "String", "index_name", ",", "String", "table", ",", "String", "column", ",", "String", "key...
Create a basic Index. @param index_name index name @param table the table where index will be created. @param column the column where index will be saved @param keyspace keyspace used @throws Exception exception
[ "Create", "a", "basic", "Index", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L80-L84
Nexmo/nexmo-java
src/main/java/com/nexmo/client/account/AccountClient.java
AccountClient.createSecret
public SecretResponse createSecret(String apiKey, String secret) throws IOException, NexmoClientException { return createSecret(new CreateSecretRequest(apiKey, secret)); }
java
public SecretResponse createSecret(String apiKey, String secret) throws IOException, NexmoClientException { return createSecret(new CreateSecretRequest(apiKey, secret)); }
[ "public", "SecretResponse", "createSecret", "(", "String", "apiKey", ",", "String", "secret", ")", "throws", "IOException", ",", "NexmoClientException", "{", "return", "createSecret", "(", "new", "CreateSecretRequest", "(", "apiKey", ",", "secret", ")", ")", ";", ...
Create a secret to be used with a specific API key. @param apiKey The API key that the secret is to be used with. @param secret The contents of the secret. @return SecretResponse object which contains the created secret from the API. @throws IOException if a network error occurred contacting the Nexmo Account API @throws NexmoClientException if there was a problem wit hthe Nexmo request or response object indicating that the request was unsuccessful.
[ "Create", "a", "secret", "to", "be", "used", "with", "a", "specific", "API", "key", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/account/AccountClient.java#L178-L180
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/SchedulesInner.java
SchedulesInner.getAsync
public Observable<ScheduleInner> getAsync(String resourceGroupName, String automationAccountName, String scheduleName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, scheduleName).map(new Func1<ServiceResponse<ScheduleInner>, ScheduleInner>() { @Override public ScheduleInner call(ServiceResponse<ScheduleInner> response) { return response.body(); } }); }
java
public Observable<ScheduleInner> getAsync(String resourceGroupName, String automationAccountName, String scheduleName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, scheduleName).map(new Func1<ServiceResponse<ScheduleInner>, ScheduleInner>() { @Override public ScheduleInner call(ServiceResponse<ScheduleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ScheduleInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "scheduleName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountNa...
Retrieve the schedule identified by schedule name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param scheduleName The schedule name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ScheduleInner object
[ "Retrieve", "the", "schedule", "identified", "by", "schedule", "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/SchedulesInner.java#L330-L337
line/armeria
core/src/main/java/com/linecorp/armeria/common/stream/AbstractStreamMessageDuplicator.java
AbstractStreamMessageDuplicator.duplicateStream
public U duplicateStream(boolean lastStream) { if (!processor.isDuplicable()) { throw new IllegalStateException("duplicator is closed or last downstream is added."); } return doDuplicateStream(new ChildStreamMessage<>(this, processor, lastStream)); }
java
public U duplicateStream(boolean lastStream) { if (!processor.isDuplicable()) { throw new IllegalStateException("duplicator is closed or last downstream is added."); } return doDuplicateStream(new ChildStreamMessage<>(this, processor, lastStream)); }
[ "public", "U", "duplicateStream", "(", "boolean", "lastStream", ")", "{", "if", "(", "!", "processor", ".", "isDuplicable", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"duplicator is closed or last downstream is added.\"", ")", ";", "}", "r...
Creates a new {@link U} instance that publishes data from the {@code publisher} you create this factory with. If you specify the {@code lastStream} as {@code true}, it will prevent further creation of duplicate stream.
[ "Creates", "a", "new", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/stream/AbstractStreamMessageDuplicator.java#L124-L129
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Col.java
Col.setAlign
public void setAlign(String align) throws ApplicationException { align = StringUtil.toLowerCase(align); if (align.equals("left")) this.align = Table.ALIGN_LEFT; else if (align.equals("center")) this.align = Table.ALIGN_CENTER; else if (align.equals("right")) this.align = Table.ALIGN_RIGHT; else throw new ApplicationException("value [" + align + "] of attribute align from tag col is invalid", "valid values are [left, center, right]"); }
java
public void setAlign(String align) throws ApplicationException { align = StringUtil.toLowerCase(align); if (align.equals("left")) this.align = Table.ALIGN_LEFT; else if (align.equals("center")) this.align = Table.ALIGN_CENTER; else if (align.equals("right")) this.align = Table.ALIGN_RIGHT; else throw new ApplicationException("value [" + align + "] of attribute align from tag col is invalid", "valid values are [left, center, right]"); }
[ "public", "void", "setAlign", "(", "String", "align", ")", "throws", "ApplicationException", "{", "align", "=", "StringUtil", ".", "toLowerCase", "(", "align", ")", ";", "if", "(", "align", ".", "equals", "(", "\"left\"", ")", ")", "this", ".", "align", ...
set the value align Column alignment, Left, Right, or Center. @param align value to set @throws ApplicationException
[ "set", "the", "value", "align", "Column", "alignment", "Left", "Right", "or", "Center", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Col.java#L94-L100
Axway/Grapes
utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java
GrapesClient.postLicense
public void postLicense(final License license, final String user, final String password) throws GrapesCommunicationException, AuthenticationException { final Client client = getClient(user, password); final WebResource resource = client.resource(serverURL).path(RequestUtils.licenseResourcePath()); final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, license); client.destroy(); if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){ final String message = "Failed to POST license"; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } }
java
public void postLicense(final License license, final String user, final String password) throws GrapesCommunicationException, AuthenticationException { final Client client = getClient(user, password); final WebResource resource = client.resource(serverURL).path(RequestUtils.licenseResourcePath()); final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, license); client.destroy(); if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){ final String message = "Failed to POST license"; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } }
[ "public", "void", "postLicense", "(", "final", "License", "license", ",", "final", "String", "user", ",", "final", "String", "password", ")", "throws", "GrapesCommunicationException", ",", "AuthenticationException", "{", "final", "Client", "client", "=", "getClient"...
Post a license to the server @param license @param user @param password @throws GrapesCommunicationException @throws javax.naming.AuthenticationException
[ "Post", "a", "license", "to", "the", "server" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L668-L681
samskivert/samskivert
src/main/java/com/samskivert/util/CollectionUtil.java
CollectionUtil.addAll
@ReplacedBy("com.google.common.collect.Iterators#addAll(Collection, com.google.common.collect.Iterators#forEnumeration(Enumeration))") public static <T, C extends Collection<T>> C addAll (C col, Enumeration<? extends T> enm) { while (enm.hasMoreElements()) { col.add(enm.nextElement()); } return col; }
java
@ReplacedBy("com.google.common.collect.Iterators#addAll(Collection, com.google.common.collect.Iterators#forEnumeration(Enumeration))") public static <T, C extends Collection<T>> C addAll (C col, Enumeration<? extends T> enm) { while (enm.hasMoreElements()) { col.add(enm.nextElement()); } return col; }
[ "@", "ReplacedBy", "(", "\"com.google.common.collect.Iterators#addAll(Collection, com.google.common.collect.Iterators#forEnumeration(Enumeration))\"", ")", "public", "static", "<", "T", ",", "C", "extends", "Collection", "<", "T", ">", ">", "C", "addAll", "(", "C", "col", ...
Adds all items returned by the enumeration to the supplied collection and returns the supplied collection.
[ "Adds", "all", "items", "returned", "by", "the", "enumeration", "to", "the", "supplied", "collection", "and", "returns", "the", "supplied", "collection", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/CollectionUtil.java#L30-L37
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.getJobHistory
@Override public List<TaskStatusEvent> getJobHistory(final JobId jobId) throws JobDoesNotExistException { return getJobHistory(jobId, null); }
java
@Override public List<TaskStatusEvent> getJobHistory(final JobId jobId) throws JobDoesNotExistException { return getJobHistory(jobId, null); }
[ "@", "Override", "public", "List", "<", "TaskStatusEvent", ">", "getJobHistory", "(", "final", "JobId", "jobId", ")", "throws", "JobDoesNotExistException", "{", "return", "getJobHistory", "(", "jobId", ",", "null", ")", ";", "}" ]
Given a jobId, returns the N most recent events in its history in the cluster.
[ "Given", "a", "jobId", "returns", "the", "N", "most", "recent", "events", "in", "its", "history", "in", "the", "cluster", "." ]
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L284-L287
OpenLiberty/open-liberty
dev/com.ibm.ws.security.utility/src/com/ibm/ws/security/utility/tasks/CreateSSLCertificateTask.java
CreateSSLCertificateTask.createConfigFileIfNeeded
protected String createConfigFileIfNeeded(String serverDir, String[] commandLine, String xmlSnippet) { String utilityName = this.scriptName; String taskName = this.getTaskName(); final String MAGICAL_SENTINEL = "@!$#%$#%32543265k425k4/3nj5k43n?m2|5k4\\n5k2345"; /* * getArgumentValue() can return 3 possible values. * null - The ARG_OPT_CREATE_CONFIG_FILE option was provided, but no value was associated with it. * MAGICAL_SENTINEL - The ARG_OPT_CREATE_CONFIG_FILE option was not in the command-line at all. * ??? - The value associated with ARG_OPT_CREATE_CONFIG_FILE is ???. */ String targetFilepath = getArgumentValue(ARG_CREATE_CONFIG_FILE, commandLine, MAGICAL_SENTINEL); if (targetFilepath == MAGICAL_SENTINEL) { // the config file is not needed return xmlSnippet; } // note that generateConfigFileName() will handle the case where targetFilepath == null File outputFile = generateConfigFileName(utilityName, taskName, serverDir, targetFilepath); String xmlTemplate = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + NL + "<server description=\"This file was generated by the ''{0} {1}'' command on {2,date,yyyy-MM-dd HH:mm:ss z}.\">" + NL + "{3}" + NL + "</server>" + NL; String xmlData = MessageFormat.format(xmlTemplate, utilityName, taskName, Calendar.getInstance().getTime(), xmlSnippet); fileUtility.createParentDirectory(stdout, outputFile); fileUtility.writeToFile(stderr, xmlData, outputFile); String includeSnippet = " <include location=\"" + outputFile.getAbsolutePath() + "\" />" + NL; return includeSnippet; }
java
protected String createConfigFileIfNeeded(String serverDir, String[] commandLine, String xmlSnippet) { String utilityName = this.scriptName; String taskName = this.getTaskName(); final String MAGICAL_SENTINEL = "@!$#%$#%32543265k425k4/3nj5k43n?m2|5k4\\n5k2345"; /* * getArgumentValue() can return 3 possible values. * null - The ARG_OPT_CREATE_CONFIG_FILE option was provided, but no value was associated with it. * MAGICAL_SENTINEL - The ARG_OPT_CREATE_CONFIG_FILE option was not in the command-line at all. * ??? - The value associated with ARG_OPT_CREATE_CONFIG_FILE is ???. */ String targetFilepath = getArgumentValue(ARG_CREATE_CONFIG_FILE, commandLine, MAGICAL_SENTINEL); if (targetFilepath == MAGICAL_SENTINEL) { // the config file is not needed return xmlSnippet; } // note that generateConfigFileName() will handle the case where targetFilepath == null File outputFile = generateConfigFileName(utilityName, taskName, serverDir, targetFilepath); String xmlTemplate = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + NL + "<server description=\"This file was generated by the ''{0} {1}'' command on {2,date,yyyy-MM-dd HH:mm:ss z}.\">" + NL + "{3}" + NL + "</server>" + NL; String xmlData = MessageFormat.format(xmlTemplate, utilityName, taskName, Calendar.getInstance().getTime(), xmlSnippet); fileUtility.createParentDirectory(stdout, outputFile); fileUtility.writeToFile(stderr, xmlData, outputFile); String includeSnippet = " <include location=\"" + outputFile.getAbsolutePath() + "\" />" + NL; return includeSnippet; }
[ "protected", "String", "createConfigFileIfNeeded", "(", "String", "serverDir", ",", "String", "[", "]", "commandLine", ",", "String", "xmlSnippet", ")", "{", "String", "utilityName", "=", "this", ".", "scriptName", ";", "String", "taskName", "=", "this", ".", ...
This method acts like a filter for xml snippets. If the user provides the {@link #ARG_OPT_CREATE_CONFIG_FILE} option, then we will write it to a file and provide an include snippet. Otherwise, we just return the provided xml snippet. @param serverDir Path to the root of the server. e.g. /path/to/wlp/usr/servers/myServer/ @param commandLine The command-line arguments. @param xmlSnippet The xml configuration the task produced. @return An include snippet or the given xmlSnippet.
[ "This", "method", "acts", "like", "a", "filter", "for", "xml", "snippets", ".", "If", "the", "user", "provides", "the", "{", "@link", "#ARG_OPT_CREATE_CONFIG_FILE", "}", "option", "then", "we", "will", "write", "it", "to", "a", "file", "and", "provide", "a...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.utility/src/com/ibm/ws/security/utility/tasks/CreateSSLCertificateTask.java#L264-L299
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigValidator.java
ConfigValidator.generateConflictMap
protected Map<String, ConfigElementList> generateConflictMap(List<? extends ConfigElement> list) { return generateConflictMap(null, list); }
java
protected Map<String, ConfigElementList> generateConflictMap(List<? extends ConfigElement> list) { return generateConflictMap(null, list); }
[ "protected", "Map", "<", "String", ",", "ConfigElementList", ">", "generateConflictMap", "(", "List", "<", "?", "extends", "ConfigElement", ">", "list", ")", "{", "return", "generateConflictMap", "(", "null", ",", "list", ")", ";", "}" ]
Look for conflicts between single-valued attributes. No metatype registry entry is available. @param elements The configuration elements to test. @return A table of conflicts between the configuration elements.
[ "Look", "for", "conflicts", "between", "single", "-", "valued", "attributes", ".", "No", "metatype", "registry", "entry", "is", "available", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigValidator.java#L229-L231
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/CmsTriStateCheckBox.java
CmsTriStateCheckBox.setState
public void setState(State state, boolean fireEvent) { boolean changed = m_state != state; m_state = state; if (changed) { updateStyle(); } if (fireEvent) { ValueChangeEvent.fire(this, state); } }
java
public void setState(State state, boolean fireEvent) { boolean changed = m_state != state; m_state = state; if (changed) { updateStyle(); } if (fireEvent) { ValueChangeEvent.fire(this, state); } }
[ "public", "void", "setState", "(", "State", "state", ",", "boolean", "fireEvent", ")", "{", "boolean", "changed", "=", "m_state", "!=", "state", ";", "m_state", "=", "state", ";", "if", "(", "changed", ")", "{", "updateStyle", "(", ")", ";", "}", "if",...
Sets the state of the check box and optionally fires an event.<p> @param state the new state @param fireEvent true if a ValueChangeEvent should be fired
[ "Sets", "the", "state", "of", "the", "check", "box", "and", "optionally", "fires", "an", "event", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/CmsTriStateCheckBox.java#L121-L131
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Highlights.java
Highlights.getHighlights
public List<Highlight> getHighlights(Entity entity, Field field, Object instance) { if (field == null) { return getHighlights(entity, instance); } final List<Highlight> result = new ArrayList<Highlight>(); for (Highlight highlight : highlights) { if (!highlight.getScope().equals(INSTANCE)) { if (match(instance, field, highlight)) { result.add(highlight); } } } return result; }
java
public List<Highlight> getHighlights(Entity entity, Field field, Object instance) { if (field == null) { return getHighlights(entity, instance); } final List<Highlight> result = new ArrayList<Highlight>(); for (Highlight highlight : highlights) { if (!highlight.getScope().equals(INSTANCE)) { if (match(instance, field, highlight)) { result.add(highlight); } } } return result; }
[ "public", "List", "<", "Highlight", ">", "getHighlights", "(", "Entity", "entity", ",", "Field", "field", ",", "Object", "instance", ")", "{", "if", "(", "field", "==", "null", ")", "{", "return", "getHighlights", "(", "entity", ",", "instance", ")", ";"...
Return all the highlights that matches the given instance in the given field of the given entity @param entity The entity @param field The field @param instance The instance @return The highlight
[ "Return", "all", "the", "highlights", "that", "matches", "the", "given", "instance", "in", "the", "given", "field", "of", "the", "given", "entity" ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Highlights.java#L58-L71
jbundle/jbundle
app/program/db/src/main/java/org/jbundle/app/program/db/AnalysisLog.java
AnalysisLog.logAddRecord
public void logAddRecord(Rec record, int iSystemID) { try { this.getTable().setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE); this.getTable().getDatabase().setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.FALSE); this.addNew(); this.getField(AnalysisLog.SYSTEM_ID).setValue(iSystemID); this.getField(AnalysisLog.OBJECT_ID).setValue(Debug.getObjectID(record, false)); this.getField(AnalysisLog.CLASS_NAME).setString(Debug.getClassName(record)); this.getField(AnalysisLog.DATABASE_NAME).setString(record.getDatabaseName()); ((DateTimeField)this.getField(AnalysisLog.INIT_TIME)).setValue(DateTimeField.currentTime()); this.getField(AnalysisLog.RECORD_OWNER).setString(Debug.getClassName(((Record)record).getRecordOwner())); this.getField(AnalysisLog.STACK_TRACE).setString(Debug.getStackTrace()); this.add(); } catch (DBException ex) { ex.printStackTrace(); } }
java
public void logAddRecord(Rec record, int iSystemID) { try { this.getTable().setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE); this.getTable().getDatabase().setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.FALSE); this.addNew(); this.getField(AnalysisLog.SYSTEM_ID).setValue(iSystemID); this.getField(AnalysisLog.OBJECT_ID).setValue(Debug.getObjectID(record, false)); this.getField(AnalysisLog.CLASS_NAME).setString(Debug.getClassName(record)); this.getField(AnalysisLog.DATABASE_NAME).setString(record.getDatabaseName()); ((DateTimeField)this.getField(AnalysisLog.INIT_TIME)).setValue(DateTimeField.currentTime()); this.getField(AnalysisLog.RECORD_OWNER).setString(Debug.getClassName(((Record)record).getRecordOwner())); this.getField(AnalysisLog.STACK_TRACE).setString(Debug.getStackTrace()); this.add(); } catch (DBException ex) { ex.printStackTrace(); } }
[ "public", "void", "logAddRecord", "(", "Rec", "record", ",", "int", "iSystemID", ")", "{", "try", "{", "this", ".", "getTable", "(", ")", ".", "setProperty", "(", "DBParams", ".", "SUPRESSREMOTEDBMESSAGES", ",", "DBConstants", ".", "TRUE", ")", ";", "this"...
Log that this record has been added. Call this from the end of record.init @param record the record that is being added.
[ "Log", "that", "this", "record", "has", "been", "added", ".", "Call", "this", "from", "the", "end", "of", "record", ".", "init" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/AnalysisLog.java#L143-L161
sarxos/v4l4j
src/main/java/au/edu/jcu/v4l4j/VideoDevice.java
VideoDevice.initDeviceInfo
private void initDeviceInfo() throws V4L4JException{ //initialise deviceInfo deviceInfo = new DeviceInfo(v4l4jObject, deviceFile); ImageFormatList l = deviceInfo.getFormatList(); supportJPEG = l.getJPEGEncodableFormats().size()==0?false:true; supportRGB24 = l.getRGBEncodableFormats().size()==0?false:true; supportBGR24 = l.getBGREncodableFormats().size()==0?false:true; supportYUV420 = l.getYUVEncodableFormats().size()==0?false:true; supportYVU420 = l.getYVUEncodableFormats().size()==0?false:true; //initialise TunerList Vector<Tuner> v= new Vector<Tuner>(); doGetTunerActions(v4l4jObject); for(InputInfo i:deviceInfo.getInputs()){ try { v.add(new Tuner(v4l4jObject,i.getTunerInfo())); } catch (NoTunerException e) {} //no tuner for this input } if(v.size()!=0) tuners = new TunerList(v); }
java
private void initDeviceInfo() throws V4L4JException{ //initialise deviceInfo deviceInfo = new DeviceInfo(v4l4jObject, deviceFile); ImageFormatList l = deviceInfo.getFormatList(); supportJPEG = l.getJPEGEncodableFormats().size()==0?false:true; supportRGB24 = l.getRGBEncodableFormats().size()==0?false:true; supportBGR24 = l.getBGREncodableFormats().size()==0?false:true; supportYUV420 = l.getYUVEncodableFormats().size()==0?false:true; supportYVU420 = l.getYVUEncodableFormats().size()==0?false:true; //initialise TunerList Vector<Tuner> v= new Vector<Tuner>(); doGetTunerActions(v4l4jObject); for(InputInfo i:deviceInfo.getInputs()){ try { v.add(new Tuner(v4l4jObject,i.getTunerInfo())); } catch (NoTunerException e) {} //no tuner for this input } if(v.size()!=0) tuners = new TunerList(v); }
[ "private", "void", "initDeviceInfo", "(", ")", "throws", "V4L4JException", "{", "//initialise deviceInfo", "deviceInfo", "=", "new", "DeviceInfo", "(", "v4l4jObject", ",", "deviceFile", ")", ";", "ImageFormatList", "l", "=", "deviceInfo", ".", "getFormatList", "(", ...
This method initialises this VideoDevice with the information obtained from the {@link DeviceInfo}. This method must be called before any other methods. @throws V4L4JException if the device can not be initialised
[ "This", "method", "initialises", "this", "VideoDevice", "with", "the", "information", "obtained", "from", "the", "{" ]
train
https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/VideoDevice.java#L296-L318
haifengl/smile
math/src/main/java/smile/math/Random.java
Random.nextDoubles
public void nextDoubles(double[] d, double lo, double hi) { real.nextDoubles(d); double l = hi - lo; int n = d.length; for (int i = 0; i < n; i++) { d[i] = lo + l * d[i]; } }
java
public void nextDoubles(double[] d, double lo, double hi) { real.nextDoubles(d); double l = hi - lo; int n = d.length; for (int i = 0; i < n; i++) { d[i] = lo + l * d[i]; } }
[ "public", "void", "nextDoubles", "(", "double", "[", "]", "d", ",", "double", "lo", ",", "double", "hi", ")", "{", "real", ".", "nextDoubles", "(", "d", ")", ";", "double", "l", "=", "hi", "-", "lo", ";", "int", "n", "=", "d", ".", "length", ";...
Generate n uniform random numbers in the range [lo, hi) @param lo lower limit of range @param hi upper limit of range @param d array of random numbers to be generated
[ "Generate", "n", "uniform", "random", "numbers", "in", "the", "range", "[", "lo", "hi", ")" ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Random.java#L81-L89
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isMethodCall
public static boolean isMethodCall(Statement stmt, String methodObject, String methodName, int numArguments) { if (stmt instanceof ExpressionStatement) { Expression expression = ((ExpressionStatement) stmt).getExpression(); if (expression instanceof MethodCallExpression) { return isMethodCall(expression, methodObject, methodName, numArguments); } } return false; }
java
public static boolean isMethodCall(Statement stmt, String methodObject, String methodName, int numArguments) { if (stmt instanceof ExpressionStatement) { Expression expression = ((ExpressionStatement) stmt).getExpression(); if (expression instanceof MethodCallExpression) { return isMethodCall(expression, methodObject, methodName, numArguments); } } return false; }
[ "public", "static", "boolean", "isMethodCall", "(", "Statement", "stmt", ",", "String", "methodObject", ",", "String", "methodName", ",", "int", "numArguments", ")", "{", "if", "(", "stmt", "instanceof", "ExpressionStatement", ")", "{", "Expression", "expression",...
Return true only if the Statement represents a method call for the specified method object (receiver), method name, and with the specified number of arguments. @param stmt - the AST Statement @param methodObject - the name of the method object (receiver) @param methodName - the name of the method being called @param numArguments - the number of arguments passed into the method @return true only if the Statement is a method call matching the specified criteria
[ "Return", "true", "only", "if", "the", "Statement", "represents", "a", "method", "call", "for", "the", "specified", "method", "object", "(", "receiver", ")", "method", "name", "and", "with", "the", "specified", "number", "of", "arguments", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L292-L300
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java
GeoInterface.setLocation
public void setLocation(String photoId, GeoData location) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_LOCATION); parameters.put("photo_id", photoId); parameters.put("lat", String.valueOf(location.getLatitude())); parameters.put("lon", String.valueOf(location.getLongitude())); int accuracy = location.getAccuracy(); if (accuracy > 0) { parameters.put("accuracy", String.valueOf(location.getAccuracy())); } // Note: This method requires an HTTP POST request. Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); // This method has no specific response - It returns an empty sucess response // if it completes without error. if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void setLocation(String photoId, GeoData location) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_LOCATION); parameters.put("photo_id", photoId); parameters.put("lat", String.valueOf(location.getLatitude())); parameters.put("lon", String.valueOf(location.getLongitude())); int accuracy = location.getAccuracy(); if (accuracy > 0) { parameters.put("accuracy", String.valueOf(location.getAccuracy())); } // Note: This method requires an HTTP POST request. Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); // This method has no specific response - It returns an empty sucess response // if it completes without error. if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "setLocation", "(", "String", "photoId", ",", "GeoData", "location", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", ...
Sets the geo data (latitude and longitude and, optionally, the accuracy level) for a photo. Before users may assign location data to a photo they must define who, by default, may view that information. Users can edit this preference at <a href="http://www.flickr.com/account/geo/privacy/">flickr</a>. If a user has not set this preference, the API method will return an error. This method requires authentication with 'write' permission. @param photoId The id of the photo to cet permissions for. @param location geo data with optional accuracy (1-16), accuracy 0 to use the default. @throws FlickrException
[ "Sets", "the", "geo", "data", "(", "latitude", "and", "longitude", "and", "optionally", "the", "accuracy", "level", ")", "for", "a", "photo", ".", "Before", "users", "may", "assign", "location", "data", "to", "a", "photo", "they", "must", "define", "who", ...
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L162-L181
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitSee
@Override public R visitSee(SeeTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitSee(SeeTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitSee", "(", "SeeTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L333-L336
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.replaceNonMembers
public String replaceNonMembers(String input, char replacement) { if (!contains(replacement)) { throw new IllegalArgumentException(replacement + " is not a member of " + pattern); } return containsAll(input) ? input : replaceNonMembersImpl(input, replacement); }
java
public String replaceNonMembers(String input, char replacement) { if (!contains(replacement)) { throw new IllegalArgumentException(replacement + " is not a member of " + pattern); } return containsAll(input) ? input : replaceNonMembersImpl(input, replacement); }
[ "public", "String", "replaceNonMembers", "(", "String", "input", ",", "char", "replacement", ")", "{", "if", "(", "!", "contains", "(", "replacement", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "replacement", "+", "\" is not a member of \"", ...
Replace all characters in the input string with the replacement character.
[ "Replace", "all", "characters", "in", "the", "input", "string", "with", "the", "replacement", "character", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L203-L208
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.deleteEventHubConsumerGroup
public void deleteEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { deleteEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); }
java
public void deleteEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { deleteEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); }
[ "public", "void", "deleteEventHubConsumerGroup", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "eventHubEndpointName", ",", "String", "name", ")", "{", "deleteEventHubConsumerGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. @param name The name of the consumer group to delete. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Delete", "a", "consumer", "group", "from", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", ".", "Delete", "a", "consumer", "group", "from", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", "."...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L1977-L1979
googleapis/google-cloud-java
google-cloud-clients/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java
CloudSchedulerClient.updateJob
public final Job updateJob(Job job, FieldMask updateMask) { UpdateJobRequest request = UpdateJobRequest.newBuilder().setJob(job).setUpdateMask(updateMask).build(); return updateJob(request); }
java
public final Job updateJob(Job job, FieldMask updateMask) { UpdateJobRequest request = UpdateJobRequest.newBuilder().setJob(job).setUpdateMask(updateMask).build(); return updateJob(request); }
[ "public", "final", "Job", "updateJob", "(", "Job", "job", ",", "FieldMask", "updateMask", ")", "{", "UpdateJobRequest", "request", "=", "UpdateJobRequest", ".", "newBuilder", "(", ")", ".", "setJob", "(", "job", ")", ".", "setUpdateMask", "(", "updateMask", ...
Updates a job. <p>If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is returned. If the job does not exist, `NOT_FOUND` is returned. <p>If UpdateJob does not successfully return, it is possible for the job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED] state. A job in this state may not be executed. If this happens, retry the UpdateJob request until a successful response is received. <p>Sample code: <pre><code> try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { Job job = Job.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Job response = cloudSchedulerClient.updateJob(job, updateMask); } </code></pre> @param job Required. <p>The new job properties. [name][google.cloud.scheduler.v1beta1.Job.name] must be specified. <p>Output only fields cannot be modified using UpdateJob. Any value specified for an output only field will be ignored. @param updateMask A mask used to specify which fields of the job are being updated. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "a", "job", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java#L523-L528
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java
JDBCCallableStatement.getClob
public synchronized Clob getClob(int parameterIndex) throws SQLException { Object o = getObject(parameterIndex); if (o == null) { return null; } if (o instanceof ClobDataID) { return new JDBCClobClient(session, (ClobDataID) o); } throw Util.sqlException(ErrorCode.X_42561); }
java
public synchronized Clob getClob(int parameterIndex) throws SQLException { Object o = getObject(parameterIndex); if (o == null) { return null; } if (o instanceof ClobDataID) { return new JDBCClobClient(session, (ClobDataID) o); } throw Util.sqlException(ErrorCode.X_42561); }
[ "public", "synchronized", "Clob", "getClob", "(", "int", "parameterIndex", ")", "throws", "SQLException", "{", "Object", "o", "=", "getObject", "(", "parameterIndex", ")", ";", "if", "(", "o", "==", "null", ")", "{", "return", "null", ";", "}", "if", "("...
<!-- start generic documentation --> Retrieves the value of the designated JDBC <code>CLOB</code> parameter as a <code>java.sql.Clob</code> object in the Java programming language. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param parameterIndex the first parameter is 1, the second is 2, and so on @return the parameter value as a <code>Clob</code> object in the Java programming language. If the value was SQL <code>NULL</code>, the value <code>null</code> is returned. @exception SQLException if a database access error occurs or this method is called on a closed <code>CallableStatement</code> @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2 (JDK 1.1.x developers: read the overview for JDBCParameterMetaData)
[ "<!", "--", "start", "generic", "documentation", "--", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java#L1169-L1182
Impetus/Kundera
src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java
HBaseSchemaManager.createOrUpdateTable
private void createOrUpdateTable(String tablename, HTableDescriptor hTableDescriptor) { try { if (admin.isTableAvailable(tablename)) { admin.modifyTable(tablename, hTableDescriptor); } else { admin.createTable(hTableDescriptor); } } catch (IOException ioex) { logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex); throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem."); } }
java
private void createOrUpdateTable(String tablename, HTableDescriptor hTableDescriptor) { try { if (admin.isTableAvailable(tablename)) { admin.modifyTable(tablename, hTableDescriptor); } else { admin.createTable(hTableDescriptor); } } catch (IOException ioex) { logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex); throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem."); } }
[ "private", "void", "createOrUpdateTable", "(", "String", "tablename", ",", "HTableDescriptor", "hTableDescriptor", ")", "{", "try", "{", "if", "(", "admin", ".", "isTableAvailable", "(", "tablename", ")", ")", "{", "admin", ".", "modifyTable", "(", "tablename", ...
Creates the or update table. @param tablename the tablename @param hTableDescriptor the h table descriptor
[ "Creates", "the", "or", "update", "table", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java#L456-L474
op4j/op4j
src/main/java/org/op4j/functions/FnNumber.java
FnNumber.roundBigDecimal
public static final Function<BigDecimal,BigDecimal> roundBigDecimal(final int scale, final RoundingMode roundingMode) { return new RoundBigDecimal(scale, roundingMode); }
java
public static final Function<BigDecimal,BigDecimal> roundBigDecimal(final int scale, final RoundingMode roundingMode) { return new RoundBigDecimal(scale, roundingMode); }
[ "public", "static", "final", "Function", "<", "BigDecimal", ",", "BigDecimal", ">", "roundBigDecimal", "(", "final", "int", "scale", ",", "final", "RoundingMode", "roundingMode", ")", "{", "return", "new", "RoundBigDecimal", "(", "scale", ",", "roundingMode", ")...
<p> It rounds the target object with the specified scale and rounding mode </p> @param scale the scale to be used @param roundingMode the {@link RoundingMode} to round the input with @return the {@link BigDecimal}
[ "<p", ">", "It", "rounds", "the", "target", "object", "with", "the", "specified", "scale", "and", "rounding", "mode", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnNumber.java#L278-L280
mabe02/lanterna
src/main/java/com/googlecode/lanterna/terminal/IOSafeTerminalAdapter.java
IOSafeTerminalAdapter.createDoNothingOnExceptionAdapter
public static IOSafeTerminal createDoNothingOnExceptionAdapter(Terminal terminal) { if (terminal instanceof ExtendedTerminal) { // also handle Runtime-type: return createDoNothingOnExceptionAdapter((ExtendedTerminal)terminal); } else { return new IOSafeTerminalAdapter(terminal, new DoNothingAndOrReturnNull()); } }
java
public static IOSafeTerminal createDoNothingOnExceptionAdapter(Terminal terminal) { if (terminal instanceof ExtendedTerminal) { // also handle Runtime-type: return createDoNothingOnExceptionAdapter((ExtendedTerminal)terminal); } else { return new IOSafeTerminalAdapter(terminal, new DoNothingAndOrReturnNull()); } }
[ "public", "static", "IOSafeTerminal", "createDoNothingOnExceptionAdapter", "(", "Terminal", "terminal", ")", "{", "if", "(", "terminal", "instanceof", "ExtendedTerminal", ")", "{", "// also handle Runtime-type:", "return", "createDoNothingOnExceptionAdapter", "(", "(", "Ext...
Creates a wrapper around a Terminal that exposes it as a IOSafeTerminal. If any IOExceptions occur, they will be silently ignored and for those method with a non-void return type, null will be returned. @param terminal Terminal to wrap @return IOSafeTerminal wrapping the supplied terminal
[ "Creates", "a", "wrapper", "around", "a", "Terminal", "that", "exposes", "it", "as", "a", "IOSafeTerminal", ".", "If", "any", "IOExceptions", "occur", "they", "will", "be", "silently", "ignored", "and", "for", "those", "method", "with", "a", "non", "-", "v...
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/terminal/IOSafeTerminalAdapter.java#L83-L89
rjeschke/txtmark
src/main/java/com/github/rjeschke/txtmark/Utils.java
Utils.readUntil
public final static int readUntil(final StringBuilder out, final String in, final int start, final char end) { int pos = start; while (pos < in.length()) { final char ch = in.charAt(pos); if (ch == '\\' && pos + 1 < in.length()) { pos = escape(out, in.charAt(pos + 1), pos); } else { if (ch == end) { break; } out.append(ch); } pos++; } return (pos == in.length()) ? -1 : pos; }
java
public final static int readUntil(final StringBuilder out, final String in, final int start, final char end) { int pos = start; while (pos < in.length()) { final char ch = in.charAt(pos); if (ch == '\\' && pos + 1 < in.length()) { pos = escape(out, in.charAt(pos + 1), pos); } else { if (ch == end) { break; } out.append(ch); } pos++; } return (pos == in.length()) ? -1 : pos; }
[ "public", "final", "static", "int", "readUntil", "(", "final", "StringBuilder", "out", ",", "final", "String", "in", ",", "final", "int", "start", ",", "final", "char", "end", ")", "{", "int", "pos", "=", "start", ";", "while", "(", "pos", "<", "in", ...
Reads characters until the 'end' character is encountered. @param out The StringBuilder to write to. @param in The Input String. @param start Starting position. @param end End characters. @return The new position or -1 if no 'end' char was found.
[ "Reads", "characters", "until", "the", "end", "character", "is", "encountered", "." ]
train
https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L159-L181
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitVersion
@Override public R visitVersion(VersionTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitVersion(VersionTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitVersion", "(", "VersionTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L477-L480
dihedron/dihedron-commons
src/main/java/org/dihedron/core/reflection/Reflector.java
Reflector.setValueForKey
@SuppressWarnings({ "unchecked", "rawtypes" }) public void setValueForKey(Object key, Object value) throws ReflectorException { if(object == null) { logger.error("object is null: did you specify it using the 'inspect()' method?"); throw new ReflectorException("object is null: did you specify it using the 'inspect()' method?"); } if(object instanceof Map) { ((Map)object).put(key, value); } else { throw new ReflectorException("object is not a map"); } }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public void setValueForKey(Object key, Object value) throws ReflectorException { if(object == null) { logger.error("object is null: did you specify it using the 'inspect()' method?"); throw new ReflectorException("object is null: did you specify it using the 'inspect()' method?"); } if(object instanceof Map) { ((Map)object).put(key, value); } else { throw new ReflectorException("object is not a map"); } }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "void", "setValueForKey", "(", "Object", "key", ",", "Object", "value", ")", "throws", "ReflectorException", "{", "if", "(", "object", "==", "null", ")", "{", "logge...
If the object is a <code>Map</code> or a subclass, it sets the element corresponding to the given key. @param key the key corresponding to the element to be set. @param value the value to be set. @throws ReflectorException if the object is not <code>Map</code>.
[ "If", "the", "object", "is", "a", "<code", ">", "Map<", "/", "code", ">", "or", "a", "subclass", "it", "sets", "the", "element", "corresponding", "to", "the", "given", "key", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/reflection/Reflector.java#L353-L366
VoltDB/voltdb
src/catgen/in/javasrc/CatalogDiffEngine.java
CatalogDiffEngine.createViewDisallowedMessage
private String createViewDisallowedMessage(String viewName, String singleTableName) { boolean singleTable = (singleTableName != null); return String.format( "Unable to create %sview %s %sbecause the view definition uses operations that cannot always be applied if %s.", (singleTable ? "single table " : "multi-table "), viewName, (singleTable ? String.format("on table %s ", singleTableName) : ""), (singleTable ? "the table already contains data" : "none of the source tables are empty")); }
java
private String createViewDisallowedMessage(String viewName, String singleTableName) { boolean singleTable = (singleTableName != null); return String.format( "Unable to create %sview %s %sbecause the view definition uses operations that cannot always be applied if %s.", (singleTable ? "single table " : "multi-table "), viewName, (singleTable ? String.format("on table %s ", singleTableName) : ""), (singleTable ? "the table already contains data" : "none of the source tables are empty")); }
[ "private", "String", "createViewDisallowedMessage", "(", "String", "viewName", ",", "String", "singleTableName", ")", "{", "boolean", "singleTable", "=", "(", "singleTableName", "!=", "null", ")", ";", "return", "String", ".", "format", "(", "\"Unable to create %svi...
Return an error message asserting that we cannot create a view with a given name. @param viewName The name of the view we are refusing to create. @param singleTableName The name of the source table if there is one source table. If there are multiple tables this should be null. This only affects the wording of the error message. @return
[ "Return", "an", "error", "message", "asserting", "that", "we", "cannot", "create", "a", "view", "with", "a", "given", "name", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/catgen/in/javasrc/CatalogDiffEngine.java#L809-L823
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/NodeReportsInner.java
NodeReportsInner.getAsync
public Observable<DscNodeReportInner> getAsync(String resourceGroupName, String automationAccountName, String nodeId, String reportId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId, reportId).map(new Func1<ServiceResponse<DscNodeReportInner>, DscNodeReportInner>() { @Override public DscNodeReportInner call(ServiceResponse<DscNodeReportInner> response) { return response.body(); } }); }
java
public Observable<DscNodeReportInner> getAsync(String resourceGroupName, String automationAccountName, String nodeId, String reportId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId, reportId).map(new Func1<ServiceResponse<DscNodeReportInner>, DscNodeReportInner>() { @Override public DscNodeReportInner call(ServiceResponse<DscNodeReportInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DscNodeReportInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "nodeId", ",", "String", "reportId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName...
Retrieve the Dsc node report data by node id and report id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeId The Dsc node id. @param reportId The report id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscNodeReportInner object
[ "Retrieve", "the", "Dsc", "node", "report", "data", "by", "node", "id", "and", "report", "id", "." ]
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/NodeReportsInner.java#L376-L383
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.overrideSetting
public void overrideSetting(String name, boolean value) { overrides.put(name, Boolean.toString(value)); }
java
public void overrideSetting(String name, boolean value) { overrides.put(name, Boolean.toString(value)); }
[ "public", "void", "overrideSetting", "(", "String", "name", ",", "boolean", "value", ")", "{", "overrides", ".", "put", "(", "name", ",", "Boolean", ".", "toString", "(", "value", ")", ")", ";", "}" ]
Override the setting at runtime with the specified value. This change does not persist. @param name @param value
[ "Override", "the", "setting", "at", "runtime", "with", "the", "specified", "value", ".", "This", "change", "does", "not", "persist", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L1012-L1014
Falydoor/limesurvey-rc
src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java
LimesurveyRC.getSurveys
public Stream<LsSurvey> getSurveys() throws LimesurveyRCException { JsonElement result = callRC(new LsApiBody("list_surveys", getParamsWithKey())); List<LsSurvey> surveys = gson.fromJson(result, new TypeToken<List<LsSurvey>>() { }.getType()); return surveys.stream(); }
java
public Stream<LsSurvey> getSurveys() throws LimesurveyRCException { JsonElement result = callRC(new LsApiBody("list_surveys", getParamsWithKey())); List<LsSurvey> surveys = gson.fromJson(result, new TypeToken<List<LsSurvey>>() { }.getType()); return surveys.stream(); }
[ "public", "Stream", "<", "LsSurvey", ">", "getSurveys", "(", ")", "throws", "LimesurveyRCException", "{", "JsonElement", "result", "=", "callRC", "(", "new", "LsApiBody", "(", "\"list_surveys\"", ",", "getParamsWithKey", "(", ")", ")", ")", ";", "List", "<", ...
Gets all surveys. @return a stream of surveys @throws LimesurveyRCException the limesurvey rc exception
[ "Gets", "all", "surveys", "." ]
train
https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L325-L331
alkacon/opencms-core
src/org/opencms/main/OpenCmsCore.java
OpenCmsCore.getInstance
protected static OpenCmsCore getInstance() { if (m_errorCondition != null) { // OpenCms is not properly initialized throw new CmsInitException(m_errorCondition, false); } if (m_instance != null) { return m_instance; } synchronized (LOCK) { if (m_instance == null) { try { // create a new core object with runlevel 1 m_instance = new OpenCmsCore(); } catch (CmsInitException e) { // already initialized, this is all we need LOG.debug(e.getMessage(), e); } } } return m_instance; }
java
protected static OpenCmsCore getInstance() { if (m_errorCondition != null) { // OpenCms is not properly initialized throw new CmsInitException(m_errorCondition, false); } if (m_instance != null) { return m_instance; } synchronized (LOCK) { if (m_instance == null) { try { // create a new core object with runlevel 1 m_instance = new OpenCmsCore(); } catch (CmsInitException e) { // already initialized, this is all we need LOG.debug(e.getMessage(), e); } } } return m_instance; }
[ "protected", "static", "OpenCmsCore", "getInstance", "(", ")", "{", "if", "(", "m_errorCondition", "!=", "null", ")", "{", "// OpenCms is not properly initialized", "throw", "new", "CmsInitException", "(", "m_errorCondition", ",", "false", ")", ";", "}", "if", "("...
Returns the initialized OpenCms singleton instance.<p> @return the initialized OpenCms singleton instance
[ "Returns", "the", "initialized", "OpenCms", "singleton", "instance", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsCore.java#L355-L377
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java
Normalizer.setOption
@Deprecated public void setOption(int option,boolean value) { if (value) { options |= option; } else { options &= (~option); } norm2 = mode.getNormalizer2(options); }
java
@Deprecated public void setOption(int option,boolean value) { if (value) { options |= option; } else { options &= (~option); } norm2 = mode.getNormalizer2(options); }
[ "@", "Deprecated", "public", "void", "setOption", "(", "int", "option", ",", "boolean", "value", ")", "{", "if", "(", "value", ")", "{", "options", "|=", "option", ";", "}", "else", "{", "options", "&=", "(", "~", "option", ")", ";", "}", "norm2", ...
Set options that affect this <tt>Normalizer</tt>'s operation. Options do not change the basic composition or decomposition operation that is being performed , but they control whether certain optional portions of the operation are done. Currently the only available option is: <ul> <li>{@link #UNICODE_3_2} - Use Normalization conforming to Unicode version 3.2. </ul> @param option the option whose value is to be set. @param value the new setting for the option. Use <tt>true</tt> to turn the option on and <tt>false</tt> to turn it off. @see #getOption @deprecated ICU 56 @hide original deprecated declaration
[ "Set", "options", "that", "affect", "this", "<tt", ">", "Normalizer<", "/", "tt", ">", "s", "operation", ".", "Options", "do", "not", "change", "the", "basic", "composition", "or", "decomposition", "operation", "that", "is", "being", "performed", "but", "the...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java#L1799-L1807
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.buildJoinTreeForColumn
private void buildJoinTreeForColumn(String aColName, boolean useOuterJoin, UserAlias aUserAlias, Map pathClasses) { String pathName = SqlHelper.cleanPath(aColName); int sepPos = pathName.lastIndexOf("."); if (sepPos >= 0) { getTableAlias(pathName.substring(0, sepPos), useOuterJoin, aUserAlias, new String[]{pathName.substring(sepPos + 1)}, pathClasses); } }
java
private void buildJoinTreeForColumn(String aColName, boolean useOuterJoin, UserAlias aUserAlias, Map pathClasses) { String pathName = SqlHelper.cleanPath(aColName); int sepPos = pathName.lastIndexOf("."); if (sepPos >= 0) { getTableAlias(pathName.substring(0, sepPos), useOuterJoin, aUserAlias, new String[]{pathName.substring(sepPos + 1)}, pathClasses); } }
[ "private", "void", "buildJoinTreeForColumn", "(", "String", "aColName", ",", "boolean", "useOuterJoin", ",", "UserAlias", "aUserAlias", ",", "Map", "pathClasses", ")", "{", "String", "pathName", "=", "SqlHelper", ".", "cleanPath", "(", "aColName", ")", ";", "int...
build the Join-Information for name functions and the last segment are removed ie: avg(accounts.amount) -> accounts
[ "build", "the", "Join", "-", "Information", "for", "name", "functions", "and", "the", "last", "segment", "are", "removed", "ie", ":", "avg", "(", "accounts", ".", "amount", ")", "-", ">", "accounts" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L1711-L1721
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/form/SimpleFormValidator.java
SimpleFormValidator.valueLesserThan
public FormInputValidator valueLesserThan (VisValidatableTextField field, String errorMsg, float value, boolean validIfEqualsValue) { ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, new LesserThanValidator(value, validIfEqualsValue)); field.addValidator(wrapper); add(field); return wrapper; }
java
public FormInputValidator valueLesserThan (VisValidatableTextField field, String errorMsg, float value, boolean validIfEqualsValue) { ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, new LesserThanValidator(value, validIfEqualsValue)); field.addValidator(wrapper); add(field); return wrapper; }
[ "public", "FormInputValidator", "valueLesserThan", "(", "VisValidatableTextField", "field", ",", "String", "errorMsg", ",", "float", "value", ",", "boolean", "validIfEqualsValue", ")", "{", "ValidatorWrapper", "wrapper", "=", "new", "ValidatorWrapper", "(", "errorMsg", ...
Validates if entered text is lesser (or equal) than entered number <p> Can be used in combination with {@link #integerNumber(VisValidatableTextField, String)} to only allows integers.
[ "Validates", "if", "entered", "text", "is", "lesser", "(", "or", "equal", ")", "than", "entered", "number", "<p", ">", "Can", "be", "used", "in", "combination", "with", "{" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/form/SimpleFormValidator.java#L152-L157
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java
RolloutStatusCache.putRolloutGroupStatus
public void putRolloutGroupStatus(final Long groupId, final List<TotalTargetCountActionStatus> status) { final Cache cache = cacheManager.getCache(CACHE_GR_NAME); putIntoCache(groupId, status, cache); }
java
public void putRolloutGroupStatus(final Long groupId, final List<TotalTargetCountActionStatus> status) { final Cache cache = cacheManager.getCache(CACHE_GR_NAME); putIntoCache(groupId, status, cache); }
[ "public", "void", "putRolloutGroupStatus", "(", "final", "Long", "groupId", ",", "final", "List", "<", "TotalTargetCountActionStatus", ">", "status", ")", "{", "final", "Cache", "cache", "=", "cacheManager", ".", "getCache", "(", "CACHE_GR_NAME", ")", ";", "putI...
Put {@link TotalTargetCountActionStatus} for multiple {@link RolloutGroup}s into cache. @param groupId the cache entries belong to @param status list to cache
[ "Put", "{", "@link", "TotalTargetCountActionStatus", "}", "for", "multiple", "{", "@link", "RolloutGroup", "}", "s", "into", "cache", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java#L171-L174
aol/micro-server
micro-transactions/src/main/java/com/oath/micro/server/transactions/TransactionFlow.java
TransactionFlow.flatMap
public <R1> TransactionFlow<T,R1> flatMap(Function<R,TransactionFlow<T,R1>> fn){ return of(transactionTemplate,a -> fn.apply(transaction.apply(a)).transaction.apply(a)); }
java
public <R1> TransactionFlow<T,R1> flatMap(Function<R,TransactionFlow<T,R1>> fn){ return of(transactionTemplate,a -> fn.apply(transaction.apply(a)).transaction.apply(a)); }
[ "public", "<", "R1", ">", "TransactionFlow", "<", "T", ",", "R1", ">", "flatMap", "(", "Function", "<", "R", ",", "TransactionFlow", "<", "T", ",", "R1", ">", ">", "fn", ")", "{", "return", "of", "(", "transactionTemplate", ",", "a", "->", "fn", "....
Transform data in the context of a Transaction and optionally propgate to / join with a new TransactionalFlow * <pre> {code String result = TransactionFlow.of(transactionTemplate, this::load) .flatMap(this::newTransaction) .execute(10) .get(); } </pre> @param fn flatMap function to be applied @return Next stage in the transactional flow
[ "Transform", "data", "in", "the", "context", "of", "a", "Transaction", "and", "optionally", "propgate", "to", "/", "join", "with", "a", "new", "TransactionalFlow", "*", "<pre", ">", "{", "code", "String", "result", "=", "TransactionFlow", ".", "of", "(", "...
train
https://github.com/aol/micro-server/blob/5c7103c5b43d2f4d16350dbd2f9802af307c63f7/micro-transactions/src/main/java/com/oath/micro/server/transactions/TransactionFlow.java#L83-L85
jbundle/jcalendarbutton
src/main/java/org/jbundle/util/jcalendarbutton/JTimePopup.java
JTimePopup.createTimePopup
public static JTimePopup createTimePopup(String strDateParam, Date dateTarget, Component button, String strLanguage) { JPopupMenu popup = new JPopupMenu(); JComponent c = (JComponent)popup; //?.getContentPane(); c.setLayout(new BorderLayout()); JTimePopup calendar = new JTimePopup(strDateParam, dateTarget, strLanguage); JScrollPane scrollPane = new JScrollPane(calendar); if (calendar.getSelectedIndex() != -1) calendar.ensureIndexIsVisible(calendar.getSelectedIndex()); c.add(scrollPane, BorderLayout.CENTER); popup.show(button, button.getBounds().width, 0); return calendar; }
java
public static JTimePopup createTimePopup(String strDateParam, Date dateTarget, Component button, String strLanguage) { JPopupMenu popup = new JPopupMenu(); JComponent c = (JComponent)popup; //?.getContentPane(); c.setLayout(new BorderLayout()); JTimePopup calendar = new JTimePopup(strDateParam, dateTarget, strLanguage); JScrollPane scrollPane = new JScrollPane(calendar); if (calendar.getSelectedIndex() != -1) calendar.ensureIndexIsVisible(calendar.getSelectedIndex()); c.add(scrollPane, BorderLayout.CENTER); popup.show(button, button.getBounds().width, 0); return calendar; }
[ "public", "static", "JTimePopup", "createTimePopup", "(", "String", "strDateParam", ",", "Date", "dateTarget", ",", "Component", "button", ",", "String", "strLanguage", ")", "{", "JPopupMenu", "popup", "=", "new", "JPopupMenu", "(", ")", ";", "JComponent", "c", ...
Create this calendar in a popup menu and synchronize the text field on change. @param strDateParam The name of the date property (defaults to "date"). @param dateTarget The initial date for this button. @param strLanguage The language to use. @param button The calling button.
[ "Create", "this", "calendar", "in", "a", "popup", "menu", "and", "synchronize", "the", "text", "field", "on", "change", "." ]
train
https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JTimePopup.java#L218-L230
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/syslog_params.java
syslog_params.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { syslog_params_responses result = (syslog_params_responses) service.get_payload_formatter().string_to_resource(syslog_params_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.syslog_params_response_array); } syslog_params[] result_syslog_params = new syslog_params[result.syslog_params_response_array.length]; for(int i = 0; i < result.syslog_params_response_array.length; i++) { result_syslog_params[i] = result.syslog_params_response_array[i].syslog_params[0]; } return result_syslog_params; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { syslog_params_responses result = (syslog_params_responses) service.get_payload_formatter().string_to_resource(syslog_params_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.syslog_params_response_array); } syslog_params[] result_syslog_params = new syslog_params[result.syslog_params_response_array.length]; for(int i = 0; i < result.syslog_params_response_array.length; i++) { result_syslog_params[i] = result.syslog_params_response_array[i].syslog_params[0]; } return result_syslog_params; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "syslog_params_responses", "result", "=", "(", "syslog_params_responses", ")", "service", ".", "get_payload_fo...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/syslog_params.java#L268-L285
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationObjUtil.java
ValidationObjUtil.getSetterMethod
public static Method getSetterMethod(Class<?> cType, String fieldName, Class<?> paramType) { Class<?> subType = getSubType(paramType); String methodName = getMethodName(fieldName, SET_METHOD_PREFIX); try { return cType.getMethod(methodName, paramType); } catch (NoSuchMethodException e) { try { return cType.getMethod(methodName, subType); } catch (NoSuchMethodException e1) { //log.info("setter method not found : " + fieldName); return null; } } }
java
public static Method getSetterMethod(Class<?> cType, String fieldName, Class<?> paramType) { Class<?> subType = getSubType(paramType); String methodName = getMethodName(fieldName, SET_METHOD_PREFIX); try { return cType.getMethod(methodName, paramType); } catch (NoSuchMethodException e) { try { return cType.getMethod(methodName, subType); } catch (NoSuchMethodException e1) { //log.info("setter method not found : " + fieldName); return null; } } }
[ "public", "static", "Method", "getSetterMethod", "(", "Class", "<", "?", ">", "cType", ",", "String", "fieldName", ",", "Class", "<", "?", ">", "paramType", ")", "{", "Class", "<", "?", ">", "subType", "=", "getSubType", "(", "paramType", ")", ";", "St...
Gets setter method. @param cType the c type @param fieldName the field name @param paramType the param type @return the setter method
[ "Gets", "setter", "method", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationObjUtil.java#L160-L175
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.createAllInterface
private InterfaceInfo createAllInterface(String interfaceName, List<XsdElement> directElements, int interfaceIndex, String apiName) { String[] extendedInterfacesArr = new String[]{TEXT_GROUP}; ClassWriter classWriter = generateClass(interfaceName, JAVA_OBJECT, extendedInterfacesArr, getInterfaceSignature(extendedInterfacesArr, apiName), ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, apiName); directElements.forEach(child -> { generateMethodsForElement(classWriter, child, getFullClassTypeName(interfaceName, apiName), apiName); createElement(child, apiName); }); writeClassToFile(interfaceName, classWriter, apiName); List<String> methodNames = directElements.stream().map(XsdElement::getName).collect(Collectors.toList()); return new InterfaceInfo(interfaceName, interfaceIndex, methodNames); }
java
private InterfaceInfo createAllInterface(String interfaceName, List<XsdElement> directElements, int interfaceIndex, String apiName) { String[] extendedInterfacesArr = new String[]{TEXT_GROUP}; ClassWriter classWriter = generateClass(interfaceName, JAVA_OBJECT, extendedInterfacesArr, getInterfaceSignature(extendedInterfacesArr, apiName), ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, apiName); directElements.forEach(child -> { generateMethodsForElement(classWriter, child, getFullClassTypeName(interfaceName, apiName), apiName); createElement(child, apiName); }); writeClassToFile(interfaceName, classWriter, apiName); List<String> methodNames = directElements.stream().map(XsdElement::getName).collect(Collectors.toList()); return new InterfaceInfo(interfaceName, interfaceIndex, methodNames); }
[ "private", "InterfaceInfo", "createAllInterface", "(", "String", "interfaceName", ",", "List", "<", "XsdElement", ">", "directElements", ",", "int", "interfaceIndex", ",", "String", "apiName", ")", "{", "String", "[", "]", "extendedInterfacesArr", "=", "new", "Str...
Creates the interface based on the information present in the {@link XsdAll} objects. @param interfaceName The interface name. @param directElements The direct elements of the {@link XsdAll} element. Each one will be represented as a method in the all interface. @param interfaceIndex The current interface index. @param apiName The name of the generated fluent interface. @return A {@link InterfaceInfo} object containing relevant interface information.
[ "Creates", "the", "interface", "based", "on", "the", "information", "present", "in", "the", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L637-L652
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/config/serializer/DefaultSerializationProviderConfiguration.java
DefaultSerializationProviderConfiguration.addSerializerFor
public <T> DefaultSerializationProviderConfiguration addSerializerFor(Class<T> serializableClass, Class<? extends Serializer<T>> serializerClass) { return addSerializerFor(serializableClass, serializerClass, false); }
java
public <T> DefaultSerializationProviderConfiguration addSerializerFor(Class<T> serializableClass, Class<? extends Serializer<T>> serializerClass) { return addSerializerFor(serializableClass, serializerClass, false); }
[ "public", "<", "T", ">", "DefaultSerializationProviderConfiguration", "addSerializerFor", "(", "Class", "<", "T", ">", "serializableClass", ",", "Class", "<", "?", "extends", "Serializer", "<", "T", ">", ">", "serializerClass", ")", "{", "return", "addSerializerFo...
Adds a new {@link Serializer} mapping for the class {@code serializableClass} @param serializableClass the {@code Class} to add the mapping for @param serializerClass the {@link Serializer} type to use @param <T> the type of instances to be serialized / deserialized @return this configuration object @throws NullPointerException if any argument is null @throws IllegalArgumentException if a mapping for {@code serializableClass} already exists
[ "Adds", "a", "new", "{", "@link", "Serializer", "}", "mapping", "for", "the", "class", "{", "@code", "serializableClass", "}" ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/config/serializer/DefaultSerializationProviderConfiguration.java#L74-L76
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java
StylesContainer.writeStylesCommonStyles
public void writeStylesCommonStyles(final XMLUtil util, final Appendable appendable) throws IOException { final Iterable<ObjectStyle> styles = this.objectStylesContainer .getValues(Dest.STYLES_COMMON_STYLES); for (final ObjectStyle style : styles) assert !style.isHidden() : style.toString() + " - " + style.getName() + TableCellStyle.DEFAULT_CELL_STYLE.toString(); this.write(styles, util, appendable); }
java
public void writeStylesCommonStyles(final XMLUtil util, final Appendable appendable) throws IOException { final Iterable<ObjectStyle> styles = this.objectStylesContainer .getValues(Dest.STYLES_COMMON_STYLES); for (final ObjectStyle style : styles) assert !style.isHidden() : style.toString() + " - " + style.getName() + TableCellStyle.DEFAULT_CELL_STYLE.toString(); this.write(styles, util, appendable); }
[ "public", "void", "writeStylesCommonStyles", "(", "final", "XMLUtil", "util", ",", "final", "Appendable", "appendable", ")", "throws", "IOException", "{", "final", "Iterable", "<", "ObjectStyle", ">", "styles", "=", "this", ".", "objectStylesContainer", ".", "getV...
Write styles to styles.xml/common-styles @param util an util @param appendable the destination @throws IOException if an I/O error occurs
[ "Write", "styles", "to", "styles", ".", "xml", "/", "common", "-", "styles" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java#L444-L453
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/registry/AbstractInstanceRegistry.java
AbstractInstanceRegistry.internalCancel
protected boolean internalCancel(String appName, String id, boolean isReplication) { try { read.lock(); CANCEL.increment(isReplication); Map<String, Lease<InstanceInfo>> gMap = registry.get(appName); Lease<InstanceInfo> leaseToCancel = null; if (gMap != null) { leaseToCancel = gMap.remove(id); } synchronized (recentCanceledQueue) { recentCanceledQueue.add(new Pair<Long, String>(System.currentTimeMillis(), appName + "(" + id + ")")); } InstanceStatus instanceStatus = overriddenInstanceStatusMap.remove(id); if (instanceStatus != null) { logger.debug("Removed instance id {} from the overridden map which has value {}", id, instanceStatus.name()); } if (leaseToCancel == null) { CANCEL_NOT_FOUND.increment(isReplication); logger.warn("DS: Registry: cancel failed because Lease is not registered for: {}/{}", appName, id); return false; } else { leaseToCancel.cancel(); InstanceInfo instanceInfo = leaseToCancel.getHolder(); String vip = null; String svip = null; if (instanceInfo != null) { instanceInfo.setActionType(ActionType.DELETED); recentlyChangedQueue.add(new RecentlyChangedItem(leaseToCancel)); instanceInfo.setLastUpdatedTimestamp(); vip = instanceInfo.getVIPAddress(); svip = instanceInfo.getSecureVipAddress(); } invalidateCache(appName, vip, svip); logger.info("Cancelled instance {}/{} (replication={})", appName, id, isReplication); return true; } } finally { read.unlock(); } }
java
protected boolean internalCancel(String appName, String id, boolean isReplication) { try { read.lock(); CANCEL.increment(isReplication); Map<String, Lease<InstanceInfo>> gMap = registry.get(appName); Lease<InstanceInfo> leaseToCancel = null; if (gMap != null) { leaseToCancel = gMap.remove(id); } synchronized (recentCanceledQueue) { recentCanceledQueue.add(new Pair<Long, String>(System.currentTimeMillis(), appName + "(" + id + ")")); } InstanceStatus instanceStatus = overriddenInstanceStatusMap.remove(id); if (instanceStatus != null) { logger.debug("Removed instance id {} from the overridden map which has value {}", id, instanceStatus.name()); } if (leaseToCancel == null) { CANCEL_NOT_FOUND.increment(isReplication); logger.warn("DS: Registry: cancel failed because Lease is not registered for: {}/{}", appName, id); return false; } else { leaseToCancel.cancel(); InstanceInfo instanceInfo = leaseToCancel.getHolder(); String vip = null; String svip = null; if (instanceInfo != null) { instanceInfo.setActionType(ActionType.DELETED); recentlyChangedQueue.add(new RecentlyChangedItem(leaseToCancel)); instanceInfo.setLastUpdatedTimestamp(); vip = instanceInfo.getVIPAddress(); svip = instanceInfo.getSecureVipAddress(); } invalidateCache(appName, vip, svip); logger.info("Cancelled instance {}/{} (replication={})", appName, id, isReplication); return true; } } finally { read.unlock(); } }
[ "protected", "boolean", "internalCancel", "(", "String", "appName", ",", "String", "id", ",", "boolean", "isReplication", ")", "{", "try", "{", "read", ".", "lock", "(", ")", ";", "CANCEL", ".", "increment", "(", "isReplication", ")", ";", "Map", "<", "S...
{@link #cancel(String, String, boolean)} method is overridden by {@link PeerAwareInstanceRegistry}, so each cancel request is replicated to the peers. This is however not desired for expires which would be counted in the remote peers as valid cancellations, so self preservation mode would not kick-in.
[ "{" ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/registry/AbstractInstanceRegistry.java#L297-L336
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/property/PropertyAccessorHelper.java
PropertyAccessorHelper.getId
public static Object getId(Object entity, EntityMetadata metadata) { // If an Entity has been wrapped in a Proxy, we can call the Proxy // classes' getId() method if (entity instanceof EnhanceEntity) { return ((EnhanceEntity) entity).getEntityId(); } // Otherwise, as Kundera currently supports only field access, access // the underlying Entity's id field return getObject(entity, (Field) metadata.getIdAttribute().getJavaMember()); }
java
public static Object getId(Object entity, EntityMetadata metadata) { // If an Entity has been wrapped in a Proxy, we can call the Proxy // classes' getId() method if (entity instanceof EnhanceEntity) { return ((EnhanceEntity) entity).getEntityId(); } // Otherwise, as Kundera currently supports only field access, access // the underlying Entity's id field return getObject(entity, (Field) metadata.getIdAttribute().getJavaMember()); }
[ "public", "static", "Object", "getId", "(", "Object", "entity", ",", "EntityMetadata", "metadata", ")", "{", "// If an Entity has been wrapped in a Proxy, we can call the Proxy\r", "// classes' getId() method\r", "if", "(", "entity", "instanceof", "EnhanceEntity", ")", "{", ...
Get identifier of an entity object by invoking getXXX() method. @param entity the entity @param metadata the metadata @return the id @throws PropertyAccessException the property access exception
[ "Get", "identifier", "of", "an", "entity", "object", "by", "invoking", "getXXX", "()", "method", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/property/PropertyAccessorHelper.java#L233-L246
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/PhoneNumber.java
PhoneNumber.get
public static PhoneNumber get(final BandwidthClient client, final String phoneNumberId) throws Exception { assert(client != null && phoneNumberId != null); final String phoneNumberUri = client.getUserResourceInstanceUri(BandwidthConstants.PHONE_NUMBER_URI_PATH, phoneNumberId); final JSONObject phoneNumberObj = toJSONObject(client.get(phoneNumberUri, null)); final PhoneNumber number = new PhoneNumber(client, phoneNumberObj); return number; }
java
public static PhoneNumber get(final BandwidthClient client, final String phoneNumberId) throws Exception { assert(client != null && phoneNumberId != null); final String phoneNumberUri = client.getUserResourceInstanceUri(BandwidthConstants.PHONE_NUMBER_URI_PATH, phoneNumberId); final JSONObject phoneNumberObj = toJSONObject(client.get(phoneNumberUri, null)); final PhoneNumber number = new PhoneNumber(client, phoneNumberObj); return number; }
[ "public", "static", "PhoneNumber", "get", "(", "final", "BandwidthClient", "client", ",", "final", "String", "phoneNumberId", ")", "throws", "Exception", "{", "assert", "(", "client", "!=", "null", "&&", "phoneNumberId", "!=", "null", ")", ";", "final", "Strin...
Factory method for PhoneNumber. Returns PhoneNumber object @param client the client @param phoneNumberId the phone number id @return the PhoneNumber @throws IOException unexpected error.
[ "Factory", "method", "for", "PhoneNumber", ".", "Returns", "PhoneNumber", "object" ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/PhoneNumber.java#L53-L59
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.getInstance
public static final DateIntervalFormat getInstance(String skeleton, ULocale locale) { DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale); return new DateIntervalFormat(skeleton, locale, new SimpleDateFormat(generator.getBestPattern(skeleton), locale)); }
java
public static final DateIntervalFormat getInstance(String skeleton, ULocale locale) { DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale); return new DateIntervalFormat(skeleton, locale, new SimpleDateFormat(generator.getBestPattern(skeleton), locale)); }
[ "public", "static", "final", "DateIntervalFormat", "getInstance", "(", "String", "skeleton", ",", "ULocale", "locale", ")", "{", "DateTimePatternGenerator", "generator", "=", "DateTimePatternGenerator", ".", "getInstance", "(", "locale", ")", ";", "return", "new", "...
Construct a DateIntervalFormat from skeleton and a given locale. <P> In this factory method, the date interval pattern information is load from resource files. Users are encouraged to created date interval formatter this way and to use the pre-defined skeleton macros. <P> There are pre-defined skeletons in DateFormat, such as MONTH_DAY, YEAR_MONTH_WEEKDAY_DAY etc. Those skeletons have pre-defined interval patterns in resource files. Users are encouraged to use them. For example: DateIntervalFormat.getInstance(DateFormat.MONTH_DAY, false, loc); The given Locale provides the interval patterns. For example, for en_GB, if skeleton is YEAR_ABBR_MONTH_WEEKDAY_DAY, which is "yMMMEEEd", the interval patterns defined in resource file to above skeleton are: "EEE, d MMM, yyyy - EEE, d MMM, yyyy" for year differs, "EEE, d MMM - EEE, d MMM, yyyy" for month differs, "EEE, d - EEE, d MMM, yyyy" for day differs, @param skeleton the skeleton on which interval format based. @param locale the given locale @return a date time interval formatter.
[ "Construct", "a", "DateIntervalFormat", "from", "skeleton", "and", "a", "given", "locale", ".", "<P", ">", "In", "this", "factory", "method", "the", "date", "interval", "pattern", "information", "is", "load", "from", "resource", "files", ".", "Users", "are", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L467-L472
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.setAppLaunchCount
public static void setAppLaunchCount(Context context, long appLaunchCount) { SharedPreferences prefs = getSharedPreferences(context); SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, appLaunchCount); prefsEditor.commit(); }
java
public static void setAppLaunchCount(Context context, long appLaunchCount) { SharedPreferences prefs = getSharedPreferences(context); SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, appLaunchCount); prefsEditor.commit(); }
[ "public", "static", "void", "setAppLaunchCount", "(", "Context", "context", ",", "long", "appLaunchCount", ")", "{", "SharedPreferences", "prefs", "=", "getSharedPreferences", "(", "context", ")", ";", "SharedPreferences", ".", "Editor", "prefsEditor", "=", "prefs",...
Modify internal value. <p/> If you use this method, you might need to have a good understanding of this class code. @param context Context @param appLaunchCount Launch count of This application.
[ "Modify", "internal", "value", ".", "<p", "/", ">", "If", "you", "use", "this", "method", "you", "might", "need", "to", "have", "a", "good", "understanding", "of", "this", "class", "code", "." ]
train
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L307-L314
voldemort/voldemort
src/java/voldemort/utils/RebalanceUtils.java
RebalanceUtils.dumpClusterToFile
public static void dumpClusterToFile(String outputDirName, String fileName, Cluster cluster) { if(outputDirName != null) { File outputDir = new File(outputDirName); if(!outputDir.exists()) { Utils.mkdirs(outputDir); } try { FileUtils.writeStringToFile(new File(outputDirName, fileName), new ClusterMapper().writeCluster(cluster)); } catch(IOException e) { logger.error("IOException during dumpClusterToFile: " + e); } } }
java
public static void dumpClusterToFile(String outputDirName, String fileName, Cluster cluster) { if(outputDirName != null) { File outputDir = new File(outputDirName); if(!outputDir.exists()) { Utils.mkdirs(outputDir); } try { FileUtils.writeStringToFile(new File(outputDirName, fileName), new ClusterMapper().writeCluster(cluster)); } catch(IOException e) { logger.error("IOException during dumpClusterToFile: " + e); } } }
[ "public", "static", "void", "dumpClusterToFile", "(", "String", "outputDirName", ",", "String", "fileName", ",", "Cluster", "cluster", ")", "{", "if", "(", "outputDirName", "!=", "null", ")", "{", "File", "outputDir", "=", "new", "File", "(", "outputDirName", ...
Prints a cluster xml to a file. @param outputDirName @param fileName @param cluster
[ "Prints", "a", "cluster", "xml", "to", "a", "file", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L545-L560
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowOutputBinary.java
RowOutputBinary.writeIntData
public void writeIntData(int i, int position) { int temp = count; count = position; writeInt(i); if (count < temp) { count = temp; } }
java
public void writeIntData(int i, int position) { int temp = count; count = position; writeInt(i); if (count < temp) { count = temp; } }
[ "public", "void", "writeIntData", "(", "int", "i", ",", "int", "position", ")", "{", "int", "temp", "=", "count", ";", "count", "=", "position", ";", "writeInt", "(", "i", ")", ";", "if", "(", "count", "<", "temp", ")", "{", "count", "=", "temp", ...
fredt@users - comment - methods for writing column type, name and data size
[ "fredt" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowOutputBinary.java#L96-L107
finmath/finmath-lib
src/main/java/net/finmath/time/FloatingpointDate.java
FloatingpointDate.getDateFromFloatingPointDate
public static LocalDate getDateFromFloatingPointDate(LocalDate referenceDate, double floatingPointDate) { if(referenceDate == null) { return null; } return referenceDate.plusDays((int)Math.round(floatingPointDate*365.0)); }
java
public static LocalDate getDateFromFloatingPointDate(LocalDate referenceDate, double floatingPointDate) { if(referenceDate == null) { return null; } return referenceDate.plusDays((int)Math.round(floatingPointDate*365.0)); }
[ "public", "static", "LocalDate", "getDateFromFloatingPointDate", "(", "LocalDate", "referenceDate", ",", "double", "floatingPointDate", ")", "{", "if", "(", "referenceDate", "==", "null", ")", "{", "return", "null", ";", "}", "return", "referenceDate", ".", "plusD...
Convert a floating point date to a LocalDate. Note: This method currently performs a rounding to the next day. In a future extension intra-day time offsets may be considered. If referenceDate is null, the method returns null. @param referenceDate The reference date associated with \( t=0 \). @param floatingPointDate The value to the time offset \( t \). @return The date resulting from adding Math.round(fixingTime*365.0) days to referenceDate.
[ "Convert", "a", "floating", "point", "date", "to", "a", "LocalDate", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/FloatingpointDate.java#L100-L105
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.longBinaryOperator
public static LongBinaryOperator longBinaryOperator(CheckedLongBinaryOperator operator, Consumer<Throwable> handler) { return (l1, l2) -> { try { return operator.applyAsLong(l1, l2); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static LongBinaryOperator longBinaryOperator(CheckedLongBinaryOperator operator, Consumer<Throwable> handler) { return (l1, l2) -> { try { return operator.applyAsLong(l1, l2); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "LongBinaryOperator", "longBinaryOperator", "(", "CheckedLongBinaryOperator", "operator", ",", "Consumer", "<", "Throwable", ">", "handler", ")", "{", "return", "(", "l1", ",", "l2", ")", "->", "{", "try", "{", "return", "operator", ".", "a...
Wrap a {@link CheckedLongBinaryOperator} in a {@link LongBinaryOperator} with a custom handler for checked exceptions. <p> Example: <code><pre> LongStream.of(1L, 2L, 3L).reduce(Unchecked.longBinaryOperator( (l1, l2) -> { if (l2 &lt; 0L) throw new Exception("Only positive numbers allowed"); return l1 + l2; }, e -> { throw new IllegalStateException(e); } )); </pre></code>
[ "Wrap", "a", "{", "@link", "CheckedLongBinaryOperator", "}", "in", "a", "{", "@link", "LongBinaryOperator", "}", "with", "a", "custom", "handler", "for", "checked", "exceptions", ".", "<p", ">", "Example", ":", "<code", ">", "<pre", ">", "LongStream", ".", ...
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L595-L606
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java
CharsTrie.next
public Result next(int inUnit) { int pos=pos_; if(pos<0) { return Result.NO_MATCH; } int length=remainingMatchLength_; // Actual remaining match length minus 1. if(length>=0) { // Remaining part of a linear-match node. if(inUnit==chars_.charAt(pos++)) { remainingMatchLength_=--length; pos_=pos; int node; return (length<0 && (node=chars_.charAt(pos))>=kMinValueLead) ? valueResults_[node>>15] : Result.NO_VALUE; } else { stop(); return Result.NO_MATCH; } } return nextImpl(pos, inUnit); }
java
public Result next(int inUnit) { int pos=pos_; if(pos<0) { return Result.NO_MATCH; } int length=remainingMatchLength_; // Actual remaining match length minus 1. if(length>=0) { // Remaining part of a linear-match node. if(inUnit==chars_.charAt(pos++)) { remainingMatchLength_=--length; pos_=pos; int node; return (length<0 && (node=chars_.charAt(pos))>=kMinValueLead) ? valueResults_[node>>15] : Result.NO_VALUE; } else { stop(); return Result.NO_MATCH; } } return nextImpl(pos, inUnit); }
[ "public", "Result", "next", "(", "int", "inUnit", ")", "{", "int", "pos", "=", "pos_", ";", "if", "(", "pos", "<", "0", ")", "{", "return", "Result", ".", "NO_MATCH", ";", "}", "int", "length", "=", "remainingMatchLength_", ";", "// Actual remaining matc...
Traverses the trie from the current state for this input char. @param inUnit Input char value. Values below 0 and above 0xffff will never match. @return The match/value Result.
[ "Traverses", "the", "trie", "from", "the", "current", "state", "for", "this", "input", "char", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L169-L189
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
GridGraph.addDimension
public GridGraph addDimension(long size, boolean wrapEndpoints) { Preconditions.checkArgument(size >= 2, "Dimension size must be at least 2"); vertexCount = Math.multiplyExact(vertexCount, size); // prevent duplicate edges if (size == 2) { wrapEndpoints = false; } dimensions.add(new Tuple2<>(size, wrapEndpoints)); return this; }
java
public GridGraph addDimension(long size, boolean wrapEndpoints) { Preconditions.checkArgument(size >= 2, "Dimension size must be at least 2"); vertexCount = Math.multiplyExact(vertexCount, size); // prevent duplicate edges if (size == 2) { wrapEndpoints = false; } dimensions.add(new Tuple2<>(size, wrapEndpoints)); return this; }
[ "public", "GridGraph", "addDimension", "(", "long", "size", ",", "boolean", "wrapEndpoints", ")", "{", "Preconditions", ".", "checkArgument", "(", "size", ">=", "2", ",", "\"Dimension size must be at least 2\"", ")", ";", "vertexCount", "=", "Math", ".", "multiply...
Required configuration for each dimension of the graph. @param size number of vertices; dimensions of size 1 are prohibited due to having no effect on the generated graph @param wrapEndpoints whether to connect first and last vertices; this has no effect on dimensions of size 2 @return this
[ "Required", "configuration", "for", "each", "dimension", "of", "the", "graph", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java#L71-L84
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/content/CmsPropertyChange.java
CmsPropertyChange.setPropertyInFolder
private List setPropertyInFolder( String resourceRootPath, String propertyDefinition, String newValue, boolean recursive) throws CmsException, CmsVfsException { CmsObject cms = getCms(); // collect the resources to look up List resources = new ArrayList(); if (recursive) { resources = cms.readResources(resourceRootPath, CmsResourceFilter.IGNORE_EXPIRATION); } else { resources.add(resourceRootPath); } List changedResources = new ArrayList(resources.size()); CmsProperty newProperty = new CmsProperty(propertyDefinition, null, null); // create permission set and filter to check each resource for (int i = 0; i < resources.size(); i++) { // loop through found resources and check property values CmsResource res = (CmsResource)resources.get(i); CmsProperty property = cms.readPropertyObject(res, propertyDefinition, false); if (property.isNullProperty()) { // change structure value newProperty.setStructureValue(newValue); newProperty.setName(propertyDefinition); cms.writePropertyObject(cms.getRequestContext().removeSiteRoot(res.getRootPath()), newProperty); changedResources.add(res); } else { // nop } } return changedResources; }
java
private List setPropertyInFolder( String resourceRootPath, String propertyDefinition, String newValue, boolean recursive) throws CmsException, CmsVfsException { CmsObject cms = getCms(); // collect the resources to look up List resources = new ArrayList(); if (recursive) { resources = cms.readResources(resourceRootPath, CmsResourceFilter.IGNORE_EXPIRATION); } else { resources.add(resourceRootPath); } List changedResources = new ArrayList(resources.size()); CmsProperty newProperty = new CmsProperty(propertyDefinition, null, null); // create permission set and filter to check each resource for (int i = 0; i < resources.size(); i++) { // loop through found resources and check property values CmsResource res = (CmsResource)resources.get(i); CmsProperty property = cms.readPropertyObject(res, propertyDefinition, false); if (property.isNullProperty()) { // change structure value newProperty.setStructureValue(newValue); newProperty.setName(propertyDefinition); cms.writePropertyObject(cms.getRequestContext().removeSiteRoot(res.getRootPath()), newProperty); changedResources.add(res); } else { // nop } } return changedResources; }
[ "private", "List", "setPropertyInFolder", "(", "String", "resourceRootPath", ",", "String", "propertyDefinition", ",", "String", "newValue", ",", "boolean", "recursive", ")", "throws", "CmsException", ",", "CmsVfsException", "{", "CmsObject", "cms", "=", "getCms", "...
Sets the given property with the given value to the given resource (potentially recursiv) if it has not been set before.<p> Returns a list with all sub resources that have been modified this way.<p> @param resourceRootPath the resource on which property definition values are changed @param propertyDefinition the name of the propertydefinition to change the value @param newValue the new value of the propertydefinition @param recursive if true, change recursively all property values on sub-resources (only for folders) @return a list with the <code>{@link CmsResource}</code>'s where the property value has been changed @throws CmsVfsException for now only when the search for the oldvalue failed. @throws CmsException if operation was not successful
[ "Sets", "the", "given", "property", "with", "the", "given", "value", "to", "the", "given", "resource", "(", "potentially", "recursiv", ")", "if", "it", "has", "not", "been", "set", "before", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/content/CmsPropertyChange.java#L469-L503
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsAdditionalInfosDialog.java
CmsAdditionalInfosDialog.saveAddInfo
private void saveAddInfo(String key, String value) { int pos = key.indexOf("@"); String className = ""; if (pos > -1) { className = key.substring(pos + 1); key = key.substring(0, pos); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) { m_user.deleteAdditionalInfo(key); return; } if (pos < 0) { m_user.setAdditionalInfo(key, value); return; } Class<?> clazz; try { // try the class name clazz = Class.forName(className); } catch (Throwable e) { try { // try the class in the java.lang package clazz = Class.forName(Integer.class.getPackage().getName() + "." + className); } catch (Throwable e1) { clazz = String.class; } } m_user.setAdditionalInfo(key, CmsDataTypeUtil.parse(value, clazz)); }
java
private void saveAddInfo(String key, String value) { int pos = key.indexOf("@"); String className = ""; if (pos > -1) { className = key.substring(pos + 1); key = key.substring(0, pos); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) { m_user.deleteAdditionalInfo(key); return; } if (pos < 0) { m_user.setAdditionalInfo(key, value); return; } Class<?> clazz; try { // try the class name clazz = Class.forName(className); } catch (Throwable e) { try { // try the class in the java.lang package clazz = Class.forName(Integer.class.getPackage().getName() + "." + className); } catch (Throwable e1) { clazz = String.class; } } m_user.setAdditionalInfo(key, CmsDataTypeUtil.parse(value, clazz)); }
[ "private", "void", "saveAddInfo", "(", "String", "key", ",", "String", "value", ")", "{", "int", "pos", "=", "key", ".", "indexOf", "(", "\"@\"", ")", ";", "String", "className", "=", "\"\"", ";", "if", "(", "pos", ">", "-", "1", ")", "{", "classNa...
Adds additional info to user.<p> (Doesn't write the user)<p> @param key string @param value string
[ "Adds", "additional", "info", "to", "user", ".", "<p", ">", "(", "Doesn", "t", "write", "the", "user", ")", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsAdditionalInfosDialog.java#L283-L316