repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
messagebird/java-rest-api
api/src/main/java/com/messagebird/MessageBirdClient.java
MessageBirdClient.createTranscription
public TranscriptionResponse createTranscription(String callID, String legId, String recordingId, String language) throws UnauthorizedException, GeneralException { """ Function to view recording by call id , leg id and recording id @param callID Voice call ID @param legId Leg ID @param recordingId Recording ID @param language Language @return TranscriptionResponseList @throws UnauthorizedException if client is unauthorized @throws GeneralException general exception """ if (callID == null) { throw new IllegalArgumentException("Voice call ID must be specified."); } if (legId == null) { throw new IllegalArgumentException("Leg ID must be specified."); } if (recordingId == null) { throw new IllegalArgumentException("Recording ID must be specified."); } if (language == null) { throw new IllegalArgumentException("Language must be specified."); } if (!Arrays.asList(supportedLanguages).contains(language)) { throw new IllegalArgumentException("Your language is not allowed."); } String url = String.format( "%s%s/%s%s/%s%s/%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH, callID, LEGSPATH, legId, RECORDINGPATH, recordingId, TRANSCRIPTIONPATH); return messageBirdService.sendPayLoad(url, language, TranscriptionResponse.class); }
java
public TranscriptionResponse createTranscription(String callID, String legId, String recordingId, String language) throws UnauthorizedException, GeneralException { if (callID == null) { throw new IllegalArgumentException("Voice call ID must be specified."); } if (legId == null) { throw new IllegalArgumentException("Leg ID must be specified."); } if (recordingId == null) { throw new IllegalArgumentException("Recording ID must be specified."); } if (language == null) { throw new IllegalArgumentException("Language must be specified."); } if (!Arrays.asList(supportedLanguages).contains(language)) { throw new IllegalArgumentException("Your language is not allowed."); } String url = String.format( "%s%s/%s%s/%s%s/%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH, callID, LEGSPATH, legId, RECORDINGPATH, recordingId, TRANSCRIPTIONPATH); return messageBirdService.sendPayLoad(url, language, TranscriptionResponse.class); }
[ "public", "TranscriptionResponse", "createTranscription", "(", "String", "callID", ",", "String", "legId", ",", "String", "recordingId", ",", "String", "language", ")", "throws", "UnauthorizedException", ",", "GeneralException", "{", "if", "(", "callID", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Voice call ID must be specified.\"", ")", ";", "}", "if", "(", "legId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Leg ID must be specified.\"", ")", ";", "}", "if", "(", "recordingId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Recording ID must be specified.\"", ")", ";", "}", "if", "(", "language", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Language must be specified.\"", ")", ";", "}", "if", "(", "!", "Arrays", ".", "asList", "(", "supportedLanguages", ")", ".", "contains", "(", "language", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Your language is not allowed.\"", ")", ";", "}", "String", "url", "=", "String", ".", "format", "(", "\"%s%s/%s%s/%s%s/%s%s\"", ",", "VOICE_CALLS_BASE_URL", ",", "VOICECALLSPATH", ",", "callID", ",", "LEGSPATH", ",", "legId", ",", "RECORDINGPATH", ",", "recordingId", ",", "TRANSCRIPTIONPATH", ")", ";", "return", "messageBirdService", ".", "sendPayLoad", "(", "url", ",", "language", ",", "TranscriptionResponse", ".", "class", ")", ";", "}" ]
Function to view recording by call id , leg id and recording id @param callID Voice call ID @param legId Leg ID @param recordingId Recording ID @param language Language @return TranscriptionResponseList @throws UnauthorizedException if client is unauthorized @throws GeneralException general exception
[ "Function", "to", "view", "recording", "by", "call", "id", "leg", "id", "and", "recording", "id" ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L1084-L1118
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Locales.java
Locales.toLocale
public static Locale toLocale(String localeStr) { """ Builds a {@link java.util.Locale} from a String of the form en_US_foo into a Locale with language "en", country "US" and variant "foo". This will parse the output of {@link java.util.Locale#toString()}. @param localeStr The locale String to parse. @param defaultLocale The locale to use if localeStr is <tt>null</tt>. """ if ((localeStr == null) || (localeStr.trim().length() == 0) || ("_".equals(localeStr))) return Locale .getDefault(); int index = localeStr.indexOf('_'); if (index < 0) return new Locale(localeStr); String language = localeStr.substring(0, index); if (index == localeStr.length()) return new Locale(language); localeStr = localeStr.substring(index + 1); index = localeStr.indexOf('_'); if (index < 0) return new Locale(language, localeStr); String country = localeStr.substring(0, index); if (index == localeStr.length()) return new Locale(language, country); localeStr = localeStr.substring(index + 1); return new Locale(language, country, localeStr); }
java
public static Locale toLocale(String localeStr) { if ((localeStr == null) || (localeStr.trim().length() == 0) || ("_".equals(localeStr))) return Locale .getDefault(); int index = localeStr.indexOf('_'); if (index < 0) return new Locale(localeStr); String language = localeStr.substring(0, index); if (index == localeStr.length()) return new Locale(language); localeStr = localeStr.substring(index + 1); index = localeStr.indexOf('_'); if (index < 0) return new Locale(language, localeStr); String country = localeStr.substring(0, index); if (index == localeStr.length()) return new Locale(language, country); localeStr = localeStr.substring(index + 1); return new Locale(language, country, localeStr); }
[ "public", "static", "Locale", "toLocale", "(", "String", "localeStr", ")", "{", "if", "(", "(", "localeStr", "==", "null", ")", "||", "(", "localeStr", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "||", "(", "\"_\"", ".", "equals", "(", "localeStr", ")", ")", ")", "return", "Locale", ".", "getDefault", "(", ")", ";", "int", "index", "=", "localeStr", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "index", "<", "0", ")", "return", "new", "Locale", "(", "localeStr", ")", ";", "String", "language", "=", "localeStr", ".", "substring", "(", "0", ",", "index", ")", ";", "if", "(", "index", "==", "localeStr", ".", "length", "(", ")", ")", "return", "new", "Locale", "(", "language", ")", ";", "localeStr", "=", "localeStr", ".", "substring", "(", "index", "+", "1", ")", ";", "index", "=", "localeStr", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "index", "<", "0", ")", "return", "new", "Locale", "(", "language", ",", "localeStr", ")", ";", "String", "country", "=", "localeStr", ".", "substring", "(", "0", ",", "index", ")", ";", "if", "(", "index", "==", "localeStr", ".", "length", "(", ")", ")", "return", "new", "Locale", "(", "language", ",", "country", ")", ";", "localeStr", "=", "localeStr", ".", "substring", "(", "index", "+", "1", ")", ";", "return", "new", "Locale", "(", "language", ",", "country", ",", "localeStr", ")", ";", "}" ]
Builds a {@link java.util.Locale} from a String of the form en_US_foo into a Locale with language "en", country "US" and variant "foo". This will parse the output of {@link java.util.Locale#toString()}. @param localeStr The locale String to parse. @param defaultLocale The locale to use if localeStr is <tt>null</tt>.
[ "Builds", "a", "{", "@link", "java", ".", "util", ".", "Locale", "}", "from", "a", "String", "of", "the", "form", "en_US_foo", "into", "a", "Locale", "with", "language", "en", "country", "US", "and", "variant", "foo", ".", "This", "will", "parse", "the", "output", "of", "{", "@link", "java", ".", "util", ".", "Locale#toString", "()", "}", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Locales.java#L38-L57
VoltDB/voltdb
src/frontend/org/voltdb/iv2/MpRoSitePool.java
MpRoSitePool.completeWork
void completeWork(long txnId) { """ Inform the pool that the work associated with the given txnID is complete """ if (m_shuttingDown) { return; } MpRoSiteContext site = m_busySites.remove(txnId); if (site == null) { throw new RuntimeException("No busy site for txnID: " + txnId + " found, shouldn't happen."); } // check the catalog versions, only push back onto idle if the catalog hasn't changed // otherwise, just let it get garbage collected and let doWork() construct new ones for the // pool with the updated catalog. if (site.getCatalogCRC() == m_catalogContext.getCatalogCRC() && site.getCatalogVersion() == m_catalogContext.catalogVersion) { m_idleSites.push(site); } else { site.shutdown(); m_allSites.remove(site); } }
java
void completeWork(long txnId) { if (m_shuttingDown) { return; } MpRoSiteContext site = m_busySites.remove(txnId); if (site == null) { throw new RuntimeException("No busy site for txnID: " + txnId + " found, shouldn't happen."); } // check the catalog versions, only push back onto idle if the catalog hasn't changed // otherwise, just let it get garbage collected and let doWork() construct new ones for the // pool with the updated catalog. if (site.getCatalogCRC() == m_catalogContext.getCatalogCRC() && site.getCatalogVersion() == m_catalogContext.catalogVersion) { m_idleSites.push(site); } else { site.shutdown(); m_allSites.remove(site); } }
[ "void", "completeWork", "(", "long", "txnId", ")", "{", "if", "(", "m_shuttingDown", ")", "{", "return", ";", "}", "MpRoSiteContext", "site", "=", "m_busySites", ".", "remove", "(", "txnId", ")", ";", "if", "(", "site", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"No busy site for txnID: \"", "+", "txnId", "+", "\" found, shouldn't happen.\"", ")", ";", "}", "// check the catalog versions, only push back onto idle if the catalog hasn't changed", "// otherwise, just let it get garbage collected and let doWork() construct new ones for the", "// pool with the updated catalog.", "if", "(", "site", ".", "getCatalogCRC", "(", ")", "==", "m_catalogContext", ".", "getCatalogCRC", "(", ")", "&&", "site", ".", "getCatalogVersion", "(", ")", "==", "m_catalogContext", ".", "catalogVersion", ")", "{", "m_idleSites", ".", "push", "(", "site", ")", ";", "}", "else", "{", "site", ".", "shutdown", "(", ")", ";", "m_allSites", ".", "remove", "(", "site", ")", ";", "}", "}" ]
Inform the pool that the work associated with the given txnID is complete
[ "Inform", "the", "pool", "that", "the", "work", "associated", "with", "the", "given", "txnID", "is", "complete" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/MpRoSitePool.java#L250-L271
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setFinish
public void setFinish(int index, Date value) { """ Set a finish value. @param index finish index (1-10) @param value finish value """ set(selectField(TaskFieldLists.CUSTOM_FINISH, index), value); }
java
public void setFinish(int index, Date value) { set(selectField(TaskFieldLists.CUSTOM_FINISH, index), value); }
[ "public", "void", "setFinish", "(", "int", "index", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "CUSTOM_FINISH", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a finish value. @param index finish index (1-10) @param value finish value
[ "Set", "a", "finish", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L2067-L2070
sdl/odata
odata_edm/src/main/java/com/sdl/odata/edm/factory/annotations/AnnotationFunctionFactory.java
AnnotationFunctionFactory.getFullyQualifiedFunctionName
public static String getFullyQualifiedFunctionName(EdmFunction functionAnnotation, Class<?> functionClass) { """ Returned fully qualified function name using function annotation and class. @param functionAnnotation function annotation @param functionClass function class @return fully qualified function name """ String name = getTypeName(functionAnnotation, functionClass); String namespace = getNamespace(functionAnnotation, functionClass); return namespace + "." + name; }
java
public static String getFullyQualifiedFunctionName(EdmFunction functionAnnotation, Class<?> functionClass) { String name = getTypeName(functionAnnotation, functionClass); String namespace = getNamespace(functionAnnotation, functionClass); return namespace + "." + name; }
[ "public", "static", "String", "getFullyQualifiedFunctionName", "(", "EdmFunction", "functionAnnotation", ",", "Class", "<", "?", ">", "functionClass", ")", "{", "String", "name", "=", "getTypeName", "(", "functionAnnotation", ",", "functionClass", ")", ";", "String", "namespace", "=", "getNamespace", "(", "functionAnnotation", ",", "functionClass", ")", ";", "return", "namespace", "+", "\".\"", "+", "name", ";", "}" ]
Returned fully qualified function name using function annotation and class. @param functionAnnotation function annotation @param functionClass function class @return fully qualified function name
[ "Returned", "fully", "qualified", "function", "name", "using", "function", "annotation", "and", "class", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_edm/src/main/java/com/sdl/odata/edm/factory/annotations/AnnotationFunctionFactory.java#L107-L111
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/join/InnerJoinRecordReader.java
InnerJoinRecordReader.combine
protected boolean combine(Object[] srcs, TupleWritable dst) { """ Return true iff the tuple is full (all data sources contain this key). """ assert srcs.length == dst.size(); for (int i = 0; i < srcs.length; ++i) { if (!dst.has(i)) { return false; } } return true; }
java
protected boolean combine(Object[] srcs, TupleWritable dst) { assert srcs.length == dst.size(); for (int i = 0; i < srcs.length; ++i) { if (!dst.has(i)) { return false; } } return true; }
[ "protected", "boolean", "combine", "(", "Object", "[", "]", "srcs", ",", "TupleWritable", "dst", ")", "{", "assert", "srcs", ".", "length", "==", "dst", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "srcs", ".", "length", ";", "++", "i", ")", "{", "if", "(", "!", "dst", ".", "has", "(", "i", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Return true iff the tuple is full (all data sources contain this key).
[ "Return", "true", "iff", "the", "tuple", "is", "full", "(", "all", "data", "sources", "contain", "this", "key", ")", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/InnerJoinRecordReader.java#L41-L49
baratine/baratine
web/src/main/java/com/caucho/v5/web/builder/IncludeWebClass.java
IncludeWebClass.buildWebService
private static ServiceWeb buildWebService(WebBuilder builder, Function<RequestWeb,Object> beanFactory, Method method) { """ Builds a HTTP service from a method. <pre><code> &#64;Get void myMethod(&64;Query("id") id, Result&lt;String&gt; result); </code></pre> Method parameters are filled from the request. @param builder called to create the service @param beanFactory factory for the bean instance @param method method for the service """ Parameter []params = method.getParameters(); WebParam []webParam = new WebParam[params.length]; for (int i = 0; i < params.length; i++) { webParam[i] = buildParam(builder, params[i]); } return new WebServiceMethod(beanFactory, method, webParam); }
java
private static ServiceWeb buildWebService(WebBuilder builder, Function<RequestWeb,Object> beanFactory, Method method) { Parameter []params = method.getParameters(); WebParam []webParam = new WebParam[params.length]; for (int i = 0; i < params.length; i++) { webParam[i] = buildParam(builder, params[i]); } return new WebServiceMethod(beanFactory, method, webParam); }
[ "private", "static", "ServiceWeb", "buildWebService", "(", "WebBuilder", "builder", ",", "Function", "<", "RequestWeb", ",", "Object", ">", "beanFactory", ",", "Method", "method", ")", "{", "Parameter", "[", "]", "params", "=", "method", ".", "getParameters", "(", ")", ";", "WebParam", "[", "]", "webParam", "=", "new", "WebParam", "[", "params", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "params", ".", "length", ";", "i", "++", ")", "{", "webParam", "[", "i", "]", "=", "buildParam", "(", "builder", ",", "params", "[", "i", "]", ")", ";", "}", "return", "new", "WebServiceMethod", "(", "beanFactory", ",", "method", ",", "webParam", ")", ";", "}" ]
Builds a HTTP service from a method. <pre><code> &#64;Get void myMethod(&64;Query("id") id, Result&lt;String&gt; result); </code></pre> Method parameters are filled from the request. @param builder called to create the service @param beanFactory factory for the bean instance @param method method for the service
[ "Builds", "a", "HTTP", "service", "from", "a", "method", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/web/builder/IncludeWebClass.java#L402-L416
casbin/jcasbin
src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java
ManagementEnforcer.hasNamedPolicy
public boolean hasNamedPolicy(String ptype, String... params) { """ hasNamedPolicy determines whether a named authorization rule exists. @param ptype the policy type, can be "p", "p2", "p3", .. @param params the "p" policy rule. @return whether the rule exists. """ return hasNamedPolicy(ptype, Arrays.asList(params)); }
java
public boolean hasNamedPolicy(String ptype, String... params) { return hasNamedPolicy(ptype, Arrays.asList(params)); }
[ "public", "boolean", "hasNamedPolicy", "(", "String", "ptype", ",", "String", "...", "params", ")", "{", "return", "hasNamedPolicy", "(", "ptype", ",", "Arrays", ".", "asList", "(", "params", ")", ")", ";", "}" ]
hasNamedPolicy determines whether a named authorization rule exists. @param ptype the policy type, can be "p", "p2", "p3", .. @param params the "p" policy rule. @return whether the rule exists.
[ "hasNamedPolicy", "determines", "whether", "a", "named", "authorization", "rule", "exists", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java#L252-L254
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringBitmap.java
MutableRoaringBitmap.flip
public void flip(final long rangeStart, final long rangeEnd) { """ Modifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive). @param rangeStart inclusive beginning of range @param rangeEnd exclusive ending of range """ rangeSanityCheck(rangeStart, rangeEnd); if (rangeStart >= rangeEnd) { return; // empty range } final int hbStart = BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeStart)); final int lbStart = BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeStart)); final int hbLast = BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeEnd - 1)); final int lbLast = BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeEnd - 1)); for (int hb = hbStart; hb <= hbLast; ++hb) { // first container may contain partial range final int containerStart = (hb == hbStart) ? lbStart : 0; // last container may contain partial range final int containerLast = (hb == hbLast) ? lbLast : BufferUtil.maxLowBitAsInteger(); final int i = highLowContainer.getIndex((short) hb); if (i >= 0) { final MappeableContainer c = highLowContainer.getContainerAtIndex(i).inot(containerStart, containerLast + 1); if (!c.isEmpty()) { getMappeableRoaringArray().setContainerAtIndex(i, c); } else { getMappeableRoaringArray().removeAtIndex(i); } } else { getMappeableRoaringArray().insertNewKeyValueAt(-i - 1, (short) hb, MappeableContainer.rangeOfOnes(containerStart, containerLast + 1)); } } }
java
public void flip(final long rangeStart, final long rangeEnd) { rangeSanityCheck(rangeStart, rangeEnd); if (rangeStart >= rangeEnd) { return; // empty range } final int hbStart = BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeStart)); final int lbStart = BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeStart)); final int hbLast = BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeEnd - 1)); final int lbLast = BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeEnd - 1)); for (int hb = hbStart; hb <= hbLast; ++hb) { // first container may contain partial range final int containerStart = (hb == hbStart) ? lbStart : 0; // last container may contain partial range final int containerLast = (hb == hbLast) ? lbLast : BufferUtil.maxLowBitAsInteger(); final int i = highLowContainer.getIndex((short) hb); if (i >= 0) { final MappeableContainer c = highLowContainer.getContainerAtIndex(i).inot(containerStart, containerLast + 1); if (!c.isEmpty()) { getMappeableRoaringArray().setContainerAtIndex(i, c); } else { getMappeableRoaringArray().removeAtIndex(i); } } else { getMappeableRoaringArray().insertNewKeyValueAt(-i - 1, (short) hb, MappeableContainer.rangeOfOnes(containerStart, containerLast + 1)); } } }
[ "public", "void", "flip", "(", "final", "long", "rangeStart", ",", "final", "long", "rangeEnd", ")", "{", "rangeSanityCheck", "(", "rangeStart", ",", "rangeEnd", ")", ";", "if", "(", "rangeStart", ">=", "rangeEnd", ")", "{", "return", ";", "// empty range", "}", "final", "int", "hbStart", "=", "BufferUtil", ".", "toIntUnsigned", "(", "BufferUtil", ".", "highbits", "(", "rangeStart", ")", ")", ";", "final", "int", "lbStart", "=", "BufferUtil", ".", "toIntUnsigned", "(", "BufferUtil", ".", "lowbits", "(", "rangeStart", ")", ")", ";", "final", "int", "hbLast", "=", "BufferUtil", ".", "toIntUnsigned", "(", "BufferUtil", ".", "highbits", "(", "rangeEnd", "-", "1", ")", ")", ";", "final", "int", "lbLast", "=", "BufferUtil", ".", "toIntUnsigned", "(", "BufferUtil", ".", "lowbits", "(", "rangeEnd", "-", "1", ")", ")", ";", "for", "(", "int", "hb", "=", "hbStart", ";", "hb", "<=", "hbLast", ";", "++", "hb", ")", "{", "// first container may contain partial range", "final", "int", "containerStart", "=", "(", "hb", "==", "hbStart", ")", "?", "lbStart", ":", "0", ";", "// last container may contain partial range", "final", "int", "containerLast", "=", "(", "hb", "==", "hbLast", ")", "?", "lbLast", ":", "BufferUtil", ".", "maxLowBitAsInteger", "(", ")", ";", "final", "int", "i", "=", "highLowContainer", ".", "getIndex", "(", "(", "short", ")", "hb", ")", ";", "if", "(", "i", ">=", "0", ")", "{", "final", "MappeableContainer", "c", "=", "highLowContainer", ".", "getContainerAtIndex", "(", "i", ")", ".", "inot", "(", "containerStart", ",", "containerLast", "+", "1", ")", ";", "if", "(", "!", "c", ".", "isEmpty", "(", ")", ")", "{", "getMappeableRoaringArray", "(", ")", ".", "setContainerAtIndex", "(", "i", ",", "c", ")", ";", "}", "else", "{", "getMappeableRoaringArray", "(", ")", ".", "removeAtIndex", "(", "i", ")", ";", "}", "}", "else", "{", "getMappeableRoaringArray", "(", ")", ".", "insertNewKeyValueAt", "(", "-", "i", "-", "1", ",", "(", "short", ")", "hb", ",", "MappeableContainer", ".", "rangeOfOnes", "(", "containerStart", ",", "containerLast", "+", "1", ")", ")", ";", "}", "}", "}" ]
Modifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive). @param rangeStart inclusive beginning of range @param rangeEnd exclusive ending of range
[ "Modifies", "the", "current", "bitmap", "by", "complementing", "the", "bits", "in", "the", "given", "range", "from", "rangeStart", "(", "inclusive", ")", "rangeEnd", "(", "exclusive", ")", "." ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringBitmap.java#L1039-L1070
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/nio/PathFileObject.java
PathFileObject.createSiblingPathFileObject
static PathFileObject createSiblingPathFileObject(JavacPathFileManager fileManager, final Path path, final String relativePath) { """ Create a PathFileObject whose binary name can be inferred from the relative path to a sibling. """ return new PathFileObject(fileManager, path) { @Override String inferBinaryName(Iterable<? extends Path> paths) { return toBinaryName(relativePath, "/"); } }; }
java
static PathFileObject createSiblingPathFileObject(JavacPathFileManager fileManager, final Path path, final String relativePath) { return new PathFileObject(fileManager, path) { @Override String inferBinaryName(Iterable<? extends Path> paths) { return toBinaryName(relativePath, "/"); } }; }
[ "static", "PathFileObject", "createSiblingPathFileObject", "(", "JavacPathFileManager", "fileManager", ",", "final", "Path", "path", ",", "final", "String", "relativePath", ")", "{", "return", "new", "PathFileObject", "(", "fileManager", ",", "path", ")", "{", "@", "Override", "String", "inferBinaryName", "(", "Iterable", "<", "?", "extends", "Path", ">", "paths", ")", "{", "return", "toBinaryName", "(", "relativePath", ",", "\"/\"", ")", ";", "}", "}", ";", "}" ]
Create a PathFileObject whose binary name can be inferred from the relative path to a sibling.
[ "Create", "a", "PathFileObject", "whose", "binary", "name", "can", "be", "inferred", "from", "the", "relative", "path", "to", "a", "sibling", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java#L99-L107
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/UriEscaper.java
UriEscaper.escapeQueryParam
public static String escapeQueryParam(final String queryParam, final boolean strict) { """ Escapes a string as a URI query parameter (same as a strict query, but also escaping & and =) @param queryParam the parameter to escape @param strict whether or not to do strict escaping @return the escaped string """ return (strict ? STRICT_ESCAPER : ESCAPER).escapeQueryParam(queryParam); }
java
public static String escapeQueryParam(final String queryParam, final boolean strict) { return (strict ? STRICT_ESCAPER : ESCAPER).escapeQueryParam(queryParam); }
[ "public", "static", "String", "escapeQueryParam", "(", "final", "String", "queryParam", ",", "final", "boolean", "strict", ")", "{", "return", "(", "strict", "?", "STRICT_ESCAPER", ":", "ESCAPER", ")", ".", "escapeQueryParam", "(", "queryParam", ")", ";", "}" ]
Escapes a string as a URI query parameter (same as a strict query, but also escaping & and =) @param queryParam the parameter to escape @param strict whether or not to do strict escaping @return the escaped string
[ "Escapes", "a", "string", "as", "a", "URI", "query", "parameter", "(", "same", "as", "a", "strict", "query", "but", "also", "escaping", "&", "and", "=", ")" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/UriEscaper.java#L260-L262
xm-online/xm-commons
xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java
LogObjectPrinter.printCollectionAware
public static String printCollectionAware(final Object object, final boolean printBody) { """ Gets object representation with size for collection case. @param object object instance to log @param printBody if {@code true} then prevent object string representation @return object representation with size for collection case """ if (!printBody) { return PRINT_HIDDEN; } if (object == null) { return String.valueOf(object); } Class<?> clazz = object.getClass(); if (!Collection.class.isAssignableFrom(clazz)) { return String.valueOf(object); } return new StringBuilder().append("[<") .append(clazz.getSimpleName()) .append("> size = ") .append(Collection.class.cast(object).size()).append("]") .toString(); }
java
public static String printCollectionAware(final Object object, final boolean printBody) { if (!printBody) { return PRINT_HIDDEN; } if (object == null) { return String.valueOf(object); } Class<?> clazz = object.getClass(); if (!Collection.class.isAssignableFrom(clazz)) { return String.valueOf(object); } return new StringBuilder().append("[<") .append(clazz.getSimpleName()) .append("> size = ") .append(Collection.class.cast(object).size()).append("]") .toString(); }
[ "public", "static", "String", "printCollectionAware", "(", "final", "Object", "object", ",", "final", "boolean", "printBody", ")", "{", "if", "(", "!", "printBody", ")", "{", "return", "PRINT_HIDDEN", ";", "}", "if", "(", "object", "==", "null", ")", "{", "return", "String", ".", "valueOf", "(", "object", ")", ";", "}", "Class", "<", "?", ">", "clazz", "=", "object", ".", "getClass", "(", ")", ";", "if", "(", "!", "Collection", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", ")", "{", "return", "String", ".", "valueOf", "(", "object", ")", ";", "}", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"[<\"", ")", ".", "append", "(", "clazz", ".", "getSimpleName", "(", ")", ")", ".", "append", "(", "\"> size = \"", ")", ".", "append", "(", "Collection", ".", "class", ".", "cast", "(", "object", ")", ".", "size", "(", ")", ")", ".", "append", "(", "\"]\"", ")", ".", "toString", "(", ")", ";", "}" ]
Gets object representation with size for collection case. @param object object instance to log @param printBody if {@code true} then prevent object string representation @return object representation with size for collection case
[ "Gets", "object", "representation", "with", "size", "for", "collection", "case", "." ]
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java#L297-L317
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockWithChecksumFileWriter.java
BlockWithChecksumFileWriter.setChannelPosition
public void setChannelPosition(long dataOffset, long ckOffset) throws IOException { """ Sets the offset in the block to which the the next write will write data to. """ long channelSize = blockDataWriter.getChannelSize(); if (channelSize < dataOffset) { String fileName; if (datanode.data instanceof FSDataset) { FSDataset fsDataset = (FSDataset) datanode.data; fileName = fsDataset.getDatanodeBlockInfo(namespaceId, block) .getBlockDataFile().getTmpFile(namespaceId, block).toString(); } else { fileName = "unknown"; } String msg = "Trying to change block file offset of block " + block + " file " + fileName + " to " + dataOffset + " but actual size of file is " + blockDataWriter.getChannelSize(); throw new IOException(msg); } if (dataOffset > channelSize) { throw new IOException("Set position over the end of the data file."); } if (dataOffset % bytesPerChecksum != 0 && channelSize != dataOffset) { DFSClient.LOG.warn("Non-inline Checksum Block " + block + " channel size " + channelSize + " but data starts from " + dataOffset); } blockDataWriter.position(dataOffset); setChecksumOffset(ckOffset); }
java
public void setChannelPosition(long dataOffset, long ckOffset) throws IOException { long channelSize = blockDataWriter.getChannelSize(); if (channelSize < dataOffset) { String fileName; if (datanode.data instanceof FSDataset) { FSDataset fsDataset = (FSDataset) datanode.data; fileName = fsDataset.getDatanodeBlockInfo(namespaceId, block) .getBlockDataFile().getTmpFile(namespaceId, block).toString(); } else { fileName = "unknown"; } String msg = "Trying to change block file offset of block " + block + " file " + fileName + " to " + dataOffset + " but actual size of file is " + blockDataWriter.getChannelSize(); throw new IOException(msg); } if (dataOffset > channelSize) { throw new IOException("Set position over the end of the data file."); } if (dataOffset % bytesPerChecksum != 0 && channelSize != dataOffset) { DFSClient.LOG.warn("Non-inline Checksum Block " + block + " channel size " + channelSize + " but data starts from " + dataOffset); } blockDataWriter.position(dataOffset); setChecksumOffset(ckOffset); }
[ "public", "void", "setChannelPosition", "(", "long", "dataOffset", ",", "long", "ckOffset", ")", "throws", "IOException", "{", "long", "channelSize", "=", "blockDataWriter", ".", "getChannelSize", "(", ")", ";", "if", "(", "channelSize", "<", "dataOffset", ")", "{", "String", "fileName", ";", "if", "(", "datanode", ".", "data", "instanceof", "FSDataset", ")", "{", "FSDataset", "fsDataset", "=", "(", "FSDataset", ")", "datanode", ".", "data", ";", "fileName", "=", "fsDataset", ".", "getDatanodeBlockInfo", "(", "namespaceId", ",", "block", ")", ".", "getBlockDataFile", "(", ")", ".", "getTmpFile", "(", "namespaceId", ",", "block", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "fileName", "=", "\"unknown\"", ";", "}", "String", "msg", "=", "\"Trying to change block file offset of block \"", "+", "block", "+", "\" file \"", "+", "fileName", "+", "\" to \"", "+", "dataOffset", "+", "\" but actual size of file is \"", "+", "blockDataWriter", ".", "getChannelSize", "(", ")", ";", "throw", "new", "IOException", "(", "msg", ")", ";", "}", "if", "(", "dataOffset", ">", "channelSize", ")", "{", "throw", "new", "IOException", "(", "\"Set position over the end of the data file.\"", ")", ";", "}", "if", "(", "dataOffset", "%", "bytesPerChecksum", "!=", "0", "&&", "channelSize", "!=", "dataOffset", ")", "{", "DFSClient", ".", "LOG", ".", "warn", "(", "\"Non-inline Checksum Block \"", "+", "block", "+", "\" channel size \"", "+", "channelSize", "+", "\" but data starts from \"", "+", "dataOffset", ")", ";", "}", "blockDataWriter", ".", "position", "(", "dataOffset", ")", ";", "setChecksumOffset", "(", "ckOffset", ")", ";", "}" ]
Sets the offset in the block to which the the next write will write data to.
[ "Sets", "the", "offset", "in", "the", "block", "to", "which", "the", "the", "next", "write", "will", "write", "data", "to", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockWithChecksumFileWriter.java#L235-L263
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java
SingleListBox.setSelectedValue
public static final boolean setSelectedValue(ListBox list, String value, boolean addMissingValues) { """ Utility function to set the current value in a ListBox. @return returns true if the option corresponding to the value was successfully selected in the ListBox """ if (value == null) { list.setSelectedIndex(0); return false; } else { int index = findValueInListBox(list, value); if (index >= 0) { list.setSelectedIndex(index); return true; } if (addMissingValues) { list.addItem(value, value); // now that it's there, search again index = findValueInListBox(list, value); list.setSelectedIndex(index); return true; } return false; } }
java
public static final boolean setSelectedValue(ListBox list, String value, boolean addMissingValues) { if (value == null) { list.setSelectedIndex(0); return false; } else { int index = findValueInListBox(list, value); if (index >= 0) { list.setSelectedIndex(index); return true; } if (addMissingValues) { list.addItem(value, value); // now that it's there, search again index = findValueInListBox(list, value); list.setSelectedIndex(index); return true; } return false; } }
[ "public", "static", "final", "boolean", "setSelectedValue", "(", "ListBox", "list", ",", "String", "value", ",", "boolean", "addMissingValues", ")", "{", "if", "(", "value", "==", "null", ")", "{", "list", ".", "setSelectedIndex", "(", "0", ")", ";", "return", "false", ";", "}", "else", "{", "int", "index", "=", "findValueInListBox", "(", "list", ",", "value", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "list", ".", "setSelectedIndex", "(", "index", ")", ";", "return", "true", ";", "}", "if", "(", "addMissingValues", ")", "{", "list", ".", "addItem", "(", "value", ",", "value", ")", ";", "// now that it's there, search again", "index", "=", "findValueInListBox", "(", "list", ",", "value", ")", ";", "list", ".", "setSelectedIndex", "(", "index", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "}" ]
Utility function to set the current value in a ListBox. @return returns true if the option corresponding to the value was successfully selected in the ListBox
[ "Utility", "function", "to", "set", "the", "current", "value", "in", "a", "ListBox", "." ]
train
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java#L178-L201
aws/aws-sdk-java
aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/AWSJavaMailTransport.java
AWSJavaMailTransport.sendMessage
@Override public void sendMessage(Message msg, Address[] addresses) throws MessagingException, SendFailedException { """ Sends a MIME message through Amazon's E-mail Service with the specified recipients. Addresses that are passed into this method are merged with the ones already embedded in the message (duplicates are removed). @param msg A Mime type e-mail message to be sent @param addresses Additional e-mail addresses (RFC-822) to be included in the message """ checkConnection(); checkMessage(msg); checkAddresses(msg, addresses); collateRecipients(msg, addresses); SendRawEmailRequest req = prepareEmail(msg); sendEmail(msg, req); }
java
@Override public void sendMessage(Message msg, Address[] addresses) throws MessagingException, SendFailedException { checkConnection(); checkMessage(msg); checkAddresses(msg, addresses); collateRecipients(msg, addresses); SendRawEmailRequest req = prepareEmail(msg); sendEmail(msg, req); }
[ "@", "Override", "public", "void", "sendMessage", "(", "Message", "msg", ",", "Address", "[", "]", "addresses", ")", "throws", "MessagingException", ",", "SendFailedException", "{", "checkConnection", "(", ")", ";", "checkMessage", "(", "msg", ")", ";", "checkAddresses", "(", "msg", ",", "addresses", ")", ";", "collateRecipients", "(", "msg", ",", "addresses", ")", ";", "SendRawEmailRequest", "req", "=", "prepareEmail", "(", "msg", ")", ";", "sendEmail", "(", "msg", ",", "req", ")", ";", "}" ]
Sends a MIME message through Amazon's E-mail Service with the specified recipients. Addresses that are passed into this method are merged with the ones already embedded in the message (duplicates are removed). @param msg A Mime type e-mail message to be sent @param addresses Additional e-mail addresses (RFC-822) to be included in the message
[ "Sends", "a", "MIME", "message", "through", "Amazon", "s", "E", "-", "mail", "Service", "with", "the", "specified", "recipients", ".", "Addresses", "that", "are", "passed", "into", "this", "method", "are", "merged", "with", "the", "ones", "already", "embedded", "in", "the", "message", "(", "duplicates", "are", "removed", ")", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/AWSJavaMailTransport.java#L89-L101
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java
SparkStorageUtils.restoreSequenceFile
public static JavaRDD<List<Writable>> restoreSequenceFile(String path, JavaSparkContext sc) { """ Restore a {@code JavaRDD<List<Writable>>} previously saved with {@link #saveSequenceFile(String, JavaRDD)} @param path Path of the sequence file @param sc Spark context @return The restored RDD """ return restoreMapFile(path, sc).values(); }
java
public static JavaRDD<List<Writable>> restoreSequenceFile(String path, JavaSparkContext sc) { return restoreMapFile(path, sc).values(); }
[ "public", "static", "JavaRDD", "<", "List", "<", "Writable", ">", ">", "restoreSequenceFile", "(", "String", "path", ",", "JavaSparkContext", "sc", ")", "{", "return", "restoreMapFile", "(", "path", ",", "sc", ")", ".", "values", "(", ")", ";", "}" ]
Restore a {@code JavaRDD<List<Writable>>} previously saved with {@link #saveSequenceFile(String, JavaRDD)} @param path Path of the sequence file @param sc Spark context @return The restored RDD
[ "Restore", "a", "{", "@code", "JavaRDD<List<Writable", ">>", "}", "previously", "saved", "with", "{", "@link", "#saveSequenceFile", "(", "String", "JavaRDD", ")", "}" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java#L112-L114
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/OracleHelper.java
OracleHelper.psSetString
@Override public void psSetString(PreparedStatement pstmtImpl, int i, String x) throws SQLException { """ - allow for special handling of Oracle prepared statement setString """ int length = (x == null ? 0 : x.getBytes().length); if (tc.isDebugEnabled()) { Tr.debug(this, tc, "string length: " + length); } if (length > 4000) { if (tc.isDebugEnabled()) Tr.debug(this, tc, "Oracle setString length > 4000 bytes workaround."); /* * length in setCharacterStream is number of character in * stream */ pstmtImpl.setCharacterStream(i, new StringReader(x), x.length()); } else { pstmtImpl.setString(i, x); } }
java
@Override public void psSetString(PreparedStatement pstmtImpl, int i, String x) throws SQLException { int length = (x == null ? 0 : x.getBytes().length); if (tc.isDebugEnabled()) { Tr.debug(this, tc, "string length: " + length); } if (length > 4000) { if (tc.isDebugEnabled()) Tr.debug(this, tc, "Oracle setString length > 4000 bytes workaround."); /* * length in setCharacterStream is number of character in * stream */ pstmtImpl.setCharacterStream(i, new StringReader(x), x.length()); } else { pstmtImpl.setString(i, x); } }
[ "@", "Override", "public", "void", "psSetString", "(", "PreparedStatement", "pstmtImpl", ",", "int", "i", ",", "String", "x", ")", "throws", "SQLException", "{", "int", "length", "=", "(", "x", "==", "null", "?", "0", ":", "x", ".", "getBytes", "(", ")", ".", "length", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"string length: \"", "+", "length", ")", ";", "}", "if", "(", "length", ">", "4000", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"Oracle setString length > 4000 bytes workaround.\"", ")", ";", "/*\n * length in setCharacterStream is number of character in\n * stream\n */", "pstmtImpl", ".", "setCharacterStream", "(", "i", ",", "new", "StringReader", "(", "x", ")", ",", "x", ".", "length", "(", ")", ")", ";", "}", "else", "{", "pstmtImpl", ".", "setString", "(", "i", ",", "x", ")", ";", "}", "}" ]
- allow for special handling of Oracle prepared statement setString
[ "-", "allow", "for", "special", "handling", "of", "Oracle", "prepared", "statement", "setString" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/OracleHelper.java#L741-L760
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/auth/profile/ProfilesConfigFileWriter.java
ProfilesConfigFileWriter.dumpToFile
public static void dumpToFile(File destination, boolean overwrite, Profile... profiles) { """ Write all the credential profiles to a file. Note that this method will clobber the existing content in the destination file if it's in the overwrite mode. Use {@link #modifyOrInsertProfiles(File, Profile...)} instead, if you want to perform in-place modification on your existing credentials file. @param destination The destination file where the credentials will be written to. @param overwrite If true, this method If false, this method will throw exception if the file already exists. @param profiles All the credential profiles to be written. """ if (destination.exists() && !overwrite) { throw new SdkClientException( "The destination file already exists. " + "Set overwrite=true if you want to clobber the existing " + "content and completely re-write the file."); } OutputStreamWriter writer; try { writer = new OutputStreamWriter(new FileOutputStream(destination, false), StringUtils.UTF8); } catch (IOException ioe) { throw new SdkClientException( "Unable to open the destination file.", ioe); } try { final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile); } ProfilesConfigFileWriterHelper writerHelper = new ProfilesConfigFileWriterHelper(writer, modifications); writerHelper.writeWithoutExistingContent(); } finally { try { writer.close(); } catch (IOException ioe) {} } }
java
public static void dumpToFile(File destination, boolean overwrite, Profile... profiles) { if (destination.exists() && !overwrite) { throw new SdkClientException( "The destination file already exists. " + "Set overwrite=true if you want to clobber the existing " + "content and completely re-write the file."); } OutputStreamWriter writer; try { writer = new OutputStreamWriter(new FileOutputStream(destination, false), StringUtils.UTF8); } catch (IOException ioe) { throw new SdkClientException( "Unable to open the destination file.", ioe); } try { final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile); } ProfilesConfigFileWriterHelper writerHelper = new ProfilesConfigFileWriterHelper(writer, modifications); writerHelper.writeWithoutExistingContent(); } finally { try { writer.close(); } catch (IOException ioe) {} } }
[ "public", "static", "void", "dumpToFile", "(", "File", "destination", ",", "boolean", "overwrite", ",", "Profile", "...", "profiles", ")", "{", "if", "(", "destination", ".", "exists", "(", ")", "&&", "!", "overwrite", ")", "{", "throw", "new", "SdkClientException", "(", "\"The destination file already exists. \"", "+", "\"Set overwrite=true if you want to clobber the existing \"", "+", "\"content and completely re-write the file.\"", ")", ";", "}", "OutputStreamWriter", "writer", ";", "try", "{", "writer", "=", "new", "OutputStreamWriter", "(", "new", "FileOutputStream", "(", "destination", ",", "false", ")", ",", "StringUtils", ".", "UTF8", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "SdkClientException", "(", "\"Unable to open the destination file.\"", ",", "ioe", ")", ";", "}", "try", "{", "final", "Map", "<", "String", ",", "Profile", ">", "modifications", "=", "new", "LinkedHashMap", "<", "String", ",", "Profile", ">", "(", ")", ";", "for", "(", "Profile", "profile", ":", "profiles", ")", "{", "modifications", ".", "put", "(", "profile", ".", "getProfileName", "(", ")", ",", "profile", ")", ";", "}", "ProfilesConfigFileWriterHelper", "writerHelper", "=", "new", "ProfilesConfigFileWriterHelper", "(", "writer", ",", "modifications", ")", ";", "writerHelper", ".", "writeWithoutExistingContent", "(", ")", ";", "}", "finally", "{", "try", "{", "writer", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "}", "}", "}" ]
Write all the credential profiles to a file. Note that this method will clobber the existing content in the destination file if it's in the overwrite mode. Use {@link #modifyOrInsertProfiles(File, Profile...)} instead, if you want to perform in-place modification on your existing credentials file. @param destination The destination file where the credentials will be written to. @param overwrite If true, this method If false, this method will throw exception if the file already exists. @param profiles All the credential profiles to be written.
[ "Write", "all", "the", "credential", "profiles", "to", "a", "file", ".", "Note", "that", "this", "method", "will", "clobber", "the", "existing", "content", "in", "the", "destination", "file", "if", "it", "s", "in", "the", "overwrite", "mode", ".", "Use", "{", "@link", "#modifyOrInsertProfiles", "(", "File", "Profile", "...", ")", "}", "instead", "if", "you", "want", "to", "perform", "in", "-", "place", "modification", "on", "your", "existing", "credentials", "file", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/profile/ProfilesConfigFileWriter.java#L63-L92
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/JsonHelper.java
JsonHelper.sanitize
public static String sanitize(String value, boolean clean, Character... toEscape) { """ Escapes control characters in a string when you need to generate JSON. @param value input string @param clean if true will remove characters that match, if false will escape @param toEscape array of characters to escape. If not provided, it will escape or clean <code>'"','\\', '\t', '\b', '\n', '\r' '\f'</code>. This method will only escape or clean if provided chars are from this list. @return input string with control characters escaped or removed, depending on the <code>clean</code> flag. """ StringBuilder builder = new StringBuilder(); Map<Character, String> replacements = clean ? CLEAN_CHARS : REPLACEMENT_CHARS; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (toEscape == null) { if (replacements.containsKey(c)) { builder.append(replacements.get(c)); } else { builder.append(c); } } else { if (replacements.containsKey(c) && contains(toEscape, c)) { builder.append(replacements.get(c)); } else { builder.append(c); } } } return builder.toString(); }
java
public static String sanitize(String value, boolean clean, Character... toEscape) { StringBuilder builder = new StringBuilder(); Map<Character, String> replacements = clean ? CLEAN_CHARS : REPLACEMENT_CHARS; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (toEscape == null) { if (replacements.containsKey(c)) { builder.append(replacements.get(c)); } else { builder.append(c); } } else { if (replacements.containsKey(c) && contains(toEscape, c)) { builder.append(replacements.get(c)); } else { builder.append(c); } } } return builder.toString(); }
[ "public", "static", "String", "sanitize", "(", "String", "value", ",", "boolean", "clean", ",", "Character", "...", "toEscape", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "Map", "<", "Character", ",", "String", ">", "replacements", "=", "clean", "?", "CLEAN_CHARS", ":", "REPLACEMENT_CHARS", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "value", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "c", "=", "value", ".", "charAt", "(", "i", ")", ";", "if", "(", "toEscape", "==", "null", ")", "{", "if", "(", "replacements", ".", "containsKey", "(", "c", ")", ")", "{", "builder", ".", "append", "(", "replacements", ".", "get", "(", "c", ")", ")", ";", "}", "else", "{", "builder", ".", "append", "(", "c", ")", ";", "}", "}", "else", "{", "if", "(", "replacements", ".", "containsKey", "(", "c", ")", "&&", "contains", "(", "toEscape", ",", "c", ")", ")", "{", "builder", ".", "append", "(", "replacements", ".", "get", "(", "c", ")", ")", ";", "}", "else", "{", "builder", ".", "append", "(", "c", ")", ";", "}", "}", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Escapes control characters in a string when you need to generate JSON. @param value input string @param clean if true will remove characters that match, if false will escape @param toEscape array of characters to escape. If not provided, it will escape or clean <code>'"','\\', '\t', '\b', '\n', '\r' '\f'</code>. This method will only escape or clean if provided chars are from this list. @return input string with control characters escaped or removed, depending on the <code>clean</code> flag.
[ "Escapes", "control", "characters", "in", "a", "string", "when", "you", "need", "to", "generate", "JSON", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/JsonHelper.java#L196-L219
seedstack/i18n-addon
rest/src/main/java/org/seedstack/i18n/rest/internal/shared/WebAssertions.java
WebAssertions.assertNotBlank
public static void assertNotBlank(String actual, String message) { """ Throws a BadRequestException if actual is null. @param actual object @param message error message """ if (StringUtils.isBlank(actual)) { throw new BadRequestException(message); } }
java
public static void assertNotBlank(String actual, String message) { if (StringUtils.isBlank(actual)) { throw new BadRequestException(message); } }
[ "public", "static", "void", "assertNotBlank", "(", "String", "actual", ",", "String", "message", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "actual", ")", ")", "{", "throw", "new", "BadRequestException", "(", "message", ")", ";", "}", "}" ]
Throws a BadRequestException if actual is null. @param actual object @param message error message
[ "Throws", "a", "BadRequestException", "if", "actual", "is", "null", "." ]
train
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/shared/WebAssertions.java#L53-L57
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.rnnSetPreviousState
public void rnnSetPreviousState(int layer, Map<String, INDArray> state) { """ Set the state of the RNN layer, for use in {@link #rnnTimeStep(INDArray...)} @param layer The number/index of the layer. @param state The state to set the specified layer to """ rnnSetPreviousState(layers[layer].conf().getLayer().getLayerName(), state); }
java
public void rnnSetPreviousState(int layer, Map<String, INDArray> state) { rnnSetPreviousState(layers[layer].conf().getLayer().getLayerName(), state); }
[ "public", "void", "rnnSetPreviousState", "(", "int", "layer", ",", "Map", "<", "String", ",", "INDArray", ">", "state", ")", "{", "rnnSetPreviousState", "(", "layers", "[", "layer", "]", ".", "conf", "(", ")", ".", "getLayer", "(", ")", ".", "getLayerName", "(", ")", ",", "state", ")", ";", "}" ]
Set the state of the RNN layer, for use in {@link #rnnTimeStep(INDArray...)} @param layer The number/index of the layer. @param state The state to set the specified layer to
[ "Set", "the", "state", "of", "the", "RNN", "layer", "for", "use", "in", "{", "@link", "#rnnTimeStep", "(", "INDArray", "...", ")", "}" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3505-L3507
google/closure-compiler
src/com/google/javascript/jscomp/AstFactory.java
AstFactory.createAwait
Node createAwait(JSType jsType, Node value) { """ Returns a new {@code await} expression. @param jsType Type we expect to get back after the await @param value value to await """ Node result = IR.await(value); if (isAddingTypes()) { result.setJSType(checkNotNull(jsType)); } return result; }
java
Node createAwait(JSType jsType, Node value) { Node result = IR.await(value); if (isAddingTypes()) { result.setJSType(checkNotNull(jsType)); } return result; }
[ "Node", "createAwait", "(", "JSType", "jsType", ",", "Node", "value", ")", "{", "Node", "result", "=", "IR", ".", "await", "(", "value", ")", ";", "if", "(", "isAddingTypes", "(", ")", ")", "{", "result", ".", "setJSType", "(", "checkNotNull", "(", "jsType", ")", ")", ";", "}", "return", "result", ";", "}" ]
Returns a new {@code await} expression. @param jsType Type we expect to get back after the await @param value value to await
[ "Returns", "a", "new", "{", "@code", "await", "}", "expression", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L200-L206
amaembo/streamex
src/main/java/one/util/streamex/StreamEx.java
StreamEx.cartesianProduct
public static <T, U> StreamEx<U> cartesianProduct(Collection<? extends Collection<T>> source, U identity, BiFunction<U, ? super T, U> accumulator) { """ Returns a new {@code StreamEx} which elements are results of reduction of all possible tuples composed from the elements of supplied collection of collections. The whole stream forms an n-fold Cartesian product (or cross-product) of the input collections. <p> The reduction is performed using the provided identity object and the accumulator function which is capable to accumulate new element. The accumulator function must not modify the previous accumulated value, but must produce new value instead. That's because partially accumulated values are reused for subsequent elements. <p> This method is equivalent to the following: <pre> {@code StreamEx.cartesianProduct(source).map(list -> StreamEx.of(list).foldLeft(identity, accumulator))} </pre> <p> However it may perform much faster as partial reduction results are reused. <p> The supplied collection is assumed to be unchanged during the operation. @param <T> the type of the input elements @param <U> the type of the elements of the resulting stream @param source the input collection of collections which is used to generate the cross-product. @param identity the identity value @param accumulator a <a href="package-summary.html#NonInterference">non-interfering </a>, <a href="package-summary.html#Statelessness">stateless</a> function for incorporating an additional element from source collection into a stream element. @return the new stream. @see #cartesianProduct(Collection) @see #cartesianPower(int, Collection, Object, BiFunction) @since 0.4.0 """ if (source.isEmpty()) return of(identity); return of(new CrossSpliterator.Reducing<>(source, identity, accumulator)); }
java
public static <T, U> StreamEx<U> cartesianProduct(Collection<? extends Collection<T>> source, U identity, BiFunction<U, ? super T, U> accumulator) { if (source.isEmpty()) return of(identity); return of(new CrossSpliterator.Reducing<>(source, identity, accumulator)); }
[ "public", "static", "<", "T", ",", "U", ">", "StreamEx", "<", "U", ">", "cartesianProduct", "(", "Collection", "<", "?", "extends", "Collection", "<", "T", ">", ">", "source", ",", "U", "identity", ",", "BiFunction", "<", "U", ",", "?", "super", "T", ",", "U", ">", "accumulator", ")", "{", "if", "(", "source", ".", "isEmpty", "(", ")", ")", "return", "of", "(", "identity", ")", ";", "return", "of", "(", "new", "CrossSpliterator", ".", "Reducing", "<>", "(", "source", ",", "identity", ",", "accumulator", ")", ")", ";", "}" ]
Returns a new {@code StreamEx} which elements are results of reduction of all possible tuples composed from the elements of supplied collection of collections. The whole stream forms an n-fold Cartesian product (or cross-product) of the input collections. <p> The reduction is performed using the provided identity object and the accumulator function which is capable to accumulate new element. The accumulator function must not modify the previous accumulated value, but must produce new value instead. That's because partially accumulated values are reused for subsequent elements. <p> This method is equivalent to the following: <pre> {@code StreamEx.cartesianProduct(source).map(list -> StreamEx.of(list).foldLeft(identity, accumulator))} </pre> <p> However it may perform much faster as partial reduction results are reused. <p> The supplied collection is assumed to be unchanged during the operation. @param <T> the type of the input elements @param <U> the type of the elements of the resulting stream @param source the input collection of collections which is used to generate the cross-product. @param identity the identity value @param accumulator a <a href="package-summary.html#NonInterference">non-interfering </a>, <a href="package-summary.html#Statelessness">stateless</a> function for incorporating an additional element from source collection into a stream element. @return the new stream. @see #cartesianProduct(Collection) @see #cartesianPower(int, Collection, Object, BiFunction) @since 0.4.0
[ "Returns", "a", "new", "{", "@code", "StreamEx", "}", "which", "elements", "are", "results", "of", "reduction", "of", "all", "possible", "tuples", "composed", "from", "the", "elements", "of", "supplied", "collection", "of", "collections", ".", "The", "whole", "stream", "forms", "an", "n", "-", "fold", "Cartesian", "product", "(", "or", "cross", "-", "product", ")", "of", "the", "input", "collections", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L3139-L3144
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicated_server_serviceName_ip_GET
public ArrayList<String> dedicated_server_serviceName_ip_GET(String serviceName, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException { """ Get allowed durations for 'ip' option REST: GET /order/dedicated/server/{serviceName}/ip @param blockSize [required] IP block size @param organisationId [required] Your organisation id to add on block informations @param country [required] IP localization @param type [required] The type of IP @param serviceName [required] The internal name of your dedicated server """ String qPath = "/order/dedicated/server/{serviceName}/ip"; StringBuilder sb = path(qPath, serviceName); query(sb, "blockSize", blockSize); query(sb, "country", country); query(sb, "organisationId", organisationId); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> dedicated_server_serviceName_ip_GET(String serviceName, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/ip"; StringBuilder sb = path(qPath, serviceName); query(sb, "blockSize", blockSize); query(sb, "country", country); query(sb, "organisationId", organisationId); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "dedicated_server_serviceName_ip_GET", "(", "String", "serviceName", ",", "OvhIpBlockSizeEnum", "blockSize", ",", "OvhIpCountryEnum", "country", ",", "String", "organisationId", ",", "OvhIpTypeOrderableEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicated/server/{serviceName}/ip\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"blockSize\"", ",", "blockSize", ")", ";", "query", "(", "sb", ",", "\"country\"", ",", "country", ")", ";", "query", "(", "sb", ",", "\"organisationId\"", ",", "organisationId", ")", ";", "query", "(", "sb", ",", "\"type\"", ",", "type", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
Get allowed durations for 'ip' option REST: GET /order/dedicated/server/{serviceName}/ip @param blockSize [required] IP block size @param organisationId [required] Your organisation id to add on block informations @param country [required] IP localization @param type [required] The type of IP @param serviceName [required] The internal name of your dedicated server
[ "Get", "allowed", "durations", "for", "ip", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2388-L2397
mikepenz/FastAdapter
app/src/main/java/com/mikepenz/fastadapter/app/items/RadioButtonSampleItem.java
RadioButtonSampleItem.bindView
@Override public void bindView(ViewHolder viewHolder, List<Object> payloads) { """ binds the data of this item onto the viewHolder @param viewHolder the viewHolder of this item """ super.bindView(viewHolder, payloads); viewHolder.radioButton.setChecked(isSelected()); //set the text for the name StringHolder.applyTo(name, viewHolder.name); //set the text for the description or hide StringHolder.applyToOrHide(description, viewHolder.description); }
java
@Override public void bindView(ViewHolder viewHolder, List<Object> payloads) { super.bindView(viewHolder, payloads); viewHolder.radioButton.setChecked(isSelected()); //set the text for the name StringHolder.applyTo(name, viewHolder.name); //set the text for the description or hide StringHolder.applyToOrHide(description, viewHolder.description); }
[ "@", "Override", "public", "void", "bindView", "(", "ViewHolder", "viewHolder", ",", "List", "<", "Object", ">", "payloads", ")", "{", "super", ".", "bindView", "(", "viewHolder", ",", "payloads", ")", ";", "viewHolder", ".", "radioButton", ".", "setChecked", "(", "isSelected", "(", ")", ")", ";", "//set the text for the name", "StringHolder", ".", "applyTo", "(", "name", ",", "viewHolder", ".", "name", ")", ";", "//set the text for the description or hide", "StringHolder", ".", "applyToOrHide", "(", "description", ",", "viewHolder", ".", "description", ")", ";", "}" ]
binds the data of this item onto the viewHolder @param viewHolder the viewHolder of this item
[ "binds", "the", "data", "of", "this", "item", "onto", "the", "viewHolder" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/RadioButtonSampleItem.java#L81-L91
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionWindowed.java
ExpressionWindowed.voltAnnotateWindowedAggregateXML
public VoltXMLElement voltAnnotateWindowedAggregateXML(VoltXMLElement exp, SimpleColumnContext context) throws HSQLParseException { """ Create a VoltXMLElement for a windowed aggregate expression. The children are parts of the expression. For example, consider the expression <code>MAX(A+B) OVER (PARTITION BY E1, E2 ORDER BY E3 ASC)</code>. There will be these children. <ul> <li>A child named "winspec" with the windowed specification. This will have two children. <ul> <li>One will be named "partitionbyList", and will contain the expressions E1 and E2.</li> <li>The other will contain a list of expressions and sort orders for the order by list, &lt;E3, ASC&gt;.</li> </ul> </li> <li>All other children are the arguments to the aggregate. This would be <code>A+B</code> in the expression above. Note that there are no arguments to the rank functions, so this will be empty for the rank functions. </ul> @param exp @param context @return @throws HSQLParseException """ VoltXMLElement winspec = new VoltXMLElement("winspec"); exp.children.add(winspec); if (m_partitionByList.size() > 0) { VoltXMLElement pxe = new VoltXMLElement("partitionbyList"); winspec.children.add(pxe); for (Expression e : m_partitionByList) { pxe.children.add(e.voltGetXML(context, null)); } } VoltXMLElement rxe = new VoltXMLElement("orderbyList"); winspec.children.add(rxe); if (m_sortAndSlice != null) { for (int i = 0; i < m_sortAndSlice.exprList.size(); i++) { Expression e = (Expression) m_sortAndSlice.exprList.get(i); assert(e instanceof ExpressionOrderBy); ExpressionOrderBy expr = (ExpressionOrderBy)e; VoltXMLElement orderby = expr.voltGetXML(context, null); boolean isDescending = expr.isDescending(); orderby.attributes.put("descending", isDescending ? "true": "false"); rxe.children.add(orderby); } } return exp; }
java
public VoltXMLElement voltAnnotateWindowedAggregateXML(VoltXMLElement exp, SimpleColumnContext context) throws HSQLParseException { VoltXMLElement winspec = new VoltXMLElement("winspec"); exp.children.add(winspec); if (m_partitionByList.size() > 0) { VoltXMLElement pxe = new VoltXMLElement("partitionbyList"); winspec.children.add(pxe); for (Expression e : m_partitionByList) { pxe.children.add(e.voltGetXML(context, null)); } } VoltXMLElement rxe = new VoltXMLElement("orderbyList"); winspec.children.add(rxe); if (m_sortAndSlice != null) { for (int i = 0; i < m_sortAndSlice.exprList.size(); i++) { Expression e = (Expression) m_sortAndSlice.exprList.get(i); assert(e instanceof ExpressionOrderBy); ExpressionOrderBy expr = (ExpressionOrderBy)e; VoltXMLElement orderby = expr.voltGetXML(context, null); boolean isDescending = expr.isDescending(); orderby.attributes.put("descending", isDescending ? "true": "false"); rxe.children.add(orderby); } } return exp; }
[ "public", "VoltXMLElement", "voltAnnotateWindowedAggregateXML", "(", "VoltXMLElement", "exp", ",", "SimpleColumnContext", "context", ")", "throws", "HSQLParseException", "{", "VoltXMLElement", "winspec", "=", "new", "VoltXMLElement", "(", "\"winspec\"", ")", ";", "exp", ".", "children", ".", "add", "(", "winspec", ")", ";", "if", "(", "m_partitionByList", ".", "size", "(", ")", ">", "0", ")", "{", "VoltXMLElement", "pxe", "=", "new", "VoltXMLElement", "(", "\"partitionbyList\"", ")", ";", "winspec", ".", "children", ".", "add", "(", "pxe", ")", ";", "for", "(", "Expression", "e", ":", "m_partitionByList", ")", "{", "pxe", ".", "children", ".", "add", "(", "e", ".", "voltGetXML", "(", "context", ",", "null", ")", ")", ";", "}", "}", "VoltXMLElement", "rxe", "=", "new", "VoltXMLElement", "(", "\"orderbyList\"", ")", ";", "winspec", ".", "children", ".", "add", "(", "rxe", ")", ";", "if", "(", "m_sortAndSlice", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_sortAndSlice", ".", "exprList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "m_sortAndSlice", ".", "exprList", ".", "get", "(", "i", ")", ";", "assert", "(", "e", "instanceof", "ExpressionOrderBy", ")", ";", "ExpressionOrderBy", "expr", "=", "(", "ExpressionOrderBy", ")", "e", ";", "VoltXMLElement", "orderby", "=", "expr", ".", "voltGetXML", "(", "context", ",", "null", ")", ";", "boolean", "isDescending", "=", "expr", ".", "isDescending", "(", ")", ";", "orderby", ".", "attributes", ".", "put", "(", "\"descending\"", ",", "isDescending", "?", "\"true\"", ":", "\"false\"", ")", ";", "rxe", ".", "children", ".", "add", "(", "orderby", ")", ";", "}", "}", "return", "exp", ";", "}" ]
Create a VoltXMLElement for a windowed aggregate expression. The children are parts of the expression. For example, consider the expression <code>MAX(A+B) OVER (PARTITION BY E1, E2 ORDER BY E3 ASC)</code>. There will be these children. <ul> <li>A child named "winspec" with the windowed specification. This will have two children. <ul> <li>One will be named "partitionbyList", and will contain the expressions E1 and E2.</li> <li>The other will contain a list of expressions and sort orders for the order by list, &lt;E3, ASC&gt;.</li> </ul> </li> <li>All other children are the arguments to the aggregate. This would be <code>A+B</code> in the expression above. Note that there are no arguments to the rank functions, so this will be empty for the rank functions. </ul> @param exp @param context @return @throws HSQLParseException
[ "Create", "a", "VoltXMLElement", "for", "a", "windowed", "aggregate", "expression", ".", "The", "children", "are", "parts", "of", "the", "expression", ".", "For", "example", "consider", "the", "expression", "<code", ">", "MAX", "(", "A", "+", "B", ")", "OVER", "(", "PARTITION", "BY", "E1", "E2", "ORDER", "BY", "E3", "ASC", ")", "<", "/", "code", ">", ".", "There", "will", "be", "these", "children", ".", "<ul", ">", "<li", ">", "A", "child", "named", "winspec", "with", "the", "windowed", "specification", ".", "This", "will", "have", "two", "children", ".", "<ul", ">", "<li", ">", "One", "will", "be", "named", "partitionbyList", "and", "will", "contain", "the", "expressions", "E1", "and", "E2", ".", "<", "/", "li", ">", "<li", ">", "The", "other", "will", "contain", "a", "list", "of", "expressions", "and", "sort", "orders", "for", "the", "order", "by", "list", "&lt", ";", "E3", "ASC&gt", ";", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<", "/", "li", ">", "<li", ">", "All", "other", "children", "are", "the", "arguments", "to", "the", "aggregate", ".", "This", "would", "be", "<code", ">", "A", "+", "B<", "/", "code", ">", "in", "the", "expression", "above", ".", "Note", "that", "there", "are", "no", "arguments", "to", "the", "rank", "functions", "so", "this", "will", "be", "empty", "for", "the", "rank", "functions", ".", "<", "/", "ul", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionWindowed.java#L234-L261
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java
Director.fireInstallProgressEvent
public void fireInstallProgressEvent(int progress, InstallAsset installAsset) throws InstallException { """ Fires an install progress event to be displayed @param progress the progress integer @param installAsset the install asset necessitating the progress event @throws InstallException """ if (installAsset.isServerPackage()) fireProgressEvent(InstallProgressEvent.DEPLOY, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DEPLOYING", installAsset.toString()), true); else if (installAsset.isFeature()) { ESAAsset esaa = ((ESAAsset) installAsset); if (esaa.isPublic()) { String resourceName = (esaa.getShortName() == null) ? esaa.getDisplayName() : esaa.getShortName(); fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING", resourceName), true); } else if (!firePublicAssetOnly) { fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING_DEPENDENCY"), true); } } else { fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING", installAsset.toString()), true); } }
java
public void fireInstallProgressEvent(int progress, InstallAsset installAsset) throws InstallException { if (installAsset.isServerPackage()) fireProgressEvent(InstallProgressEvent.DEPLOY, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DEPLOYING", installAsset.toString()), true); else if (installAsset.isFeature()) { ESAAsset esaa = ((ESAAsset) installAsset); if (esaa.isPublic()) { String resourceName = (esaa.getShortName() == null) ? esaa.getDisplayName() : esaa.getShortName(); fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING", resourceName), true); } else if (!firePublicAssetOnly) { fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING_DEPENDENCY"), true); } } else { fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING", installAsset.toString()), true); } }
[ "public", "void", "fireInstallProgressEvent", "(", "int", "progress", ",", "InstallAsset", "installAsset", ")", "throws", "InstallException", "{", "if", "(", "installAsset", ".", "isServerPackage", "(", ")", ")", "fireProgressEvent", "(", "InstallProgressEvent", ".", "DEPLOY", ",", "progress", ",", "Messages", ".", "INSTALL_KERNEL_MESSAGES", ".", "getLogMessage", "(", "\"STATE_DEPLOYING\"", ",", "installAsset", ".", "toString", "(", ")", ")", ",", "true", ")", ";", "else", "if", "(", "installAsset", ".", "isFeature", "(", ")", ")", "{", "ESAAsset", "esaa", "=", "(", "(", "ESAAsset", ")", "installAsset", ")", ";", "if", "(", "esaa", ".", "isPublic", "(", ")", ")", "{", "String", "resourceName", "=", "(", "esaa", ".", "getShortName", "(", ")", "==", "null", ")", "?", "esaa", ".", "getDisplayName", "(", ")", ":", "esaa", ".", "getShortName", "(", ")", ";", "fireProgressEvent", "(", "InstallProgressEvent", ".", "INSTALL", ",", "progress", ",", "Messages", ".", "INSTALL_KERNEL_MESSAGES", ".", "getLogMessage", "(", "\"STATE_INSTALLING\"", ",", "resourceName", ")", ",", "true", ")", ";", "}", "else", "if", "(", "!", "firePublicAssetOnly", ")", "{", "fireProgressEvent", "(", "InstallProgressEvent", ".", "INSTALL", ",", "progress", ",", "Messages", ".", "INSTALL_KERNEL_MESSAGES", ".", "getLogMessage", "(", "\"STATE_INSTALLING_DEPENDENCY\"", ")", ",", "true", ")", ";", "}", "}", "else", "{", "fireProgressEvent", "(", "InstallProgressEvent", ".", "INSTALL", ",", "progress", ",", "Messages", ".", "INSTALL_KERNEL_MESSAGES", ".", "getLogMessage", "(", "\"STATE_INSTALLING\"", ",", "installAsset", ".", "toString", "(", ")", ")", ",", "true", ")", ";", "}", "}" ]
Fires an install progress event to be displayed @param progress the progress integer @param installAsset the install asset necessitating the progress event @throws InstallException
[ "Fires", "an", "install", "progress", "event", "to", "be", "displayed" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L198-L212
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.getImage
public BufferedImage getImage (String rset, String path, Colorization[] zations) { """ Like {@link #getImage(String,String)} but the specified colorizations are applied to the image before it is returned. """ if (StringUtil.isBlank(path)) { String errmsg = "Invalid image path [rset=" + rset + ", path=" + path + "]"; throw new IllegalArgumentException(errmsg); } return getImage(getImageKey(rset, path), zations); }
java
public BufferedImage getImage (String rset, String path, Colorization[] zations) { if (StringUtil.isBlank(path)) { String errmsg = "Invalid image path [rset=" + rset + ", path=" + path + "]"; throw new IllegalArgumentException(errmsg); } return getImage(getImageKey(rset, path), zations); }
[ "public", "BufferedImage", "getImage", "(", "String", "rset", ",", "String", "path", ",", "Colorization", "[", "]", "zations", ")", "{", "if", "(", "StringUtil", ".", "isBlank", "(", "path", ")", ")", "{", "String", "errmsg", "=", "\"Invalid image path [rset=\"", "+", "rset", "+", "\", path=\"", "+", "path", "+", "\"]\"", ";", "throw", "new", "IllegalArgumentException", "(", "errmsg", ")", ";", "}", "return", "getImage", "(", "getImageKey", "(", "rset", ",", "path", ")", ",", "zations", ")", ";", "}" ]
Like {@link #getImage(String,String)} but the specified colorizations are applied to the image before it is returned.
[ "Like", "{" ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L200-L207
remkop/picocli
src/main/java/picocli/groovy/PicocliBaseScript.java
PicocliBaseScript.printHelpMessage
public Object printHelpMessage(CommandLine commandLine, PrintStream stream) { """ If an &#064;Option whose {@code usageHelp} attribute is annotated as true appears in the arguments. then the script body is not run and this {@code printHelpMessage} method is called instead. The default behavior is to print the {@link CommandLine#usage(PrintStream)} to the specified stream. The return value becomes the return value for the Script.run which will be the exit code if we've been called from the command line. @param commandLine The CommandLine instance @param stream the stream to print the usage help message to @return The value that Script.run should return ({@code null} by default). @since 3.0 """ commandLine.usage(stream); return null; }
java
public Object printHelpMessage(CommandLine commandLine, PrintStream stream) { commandLine.usage(stream); return null; }
[ "public", "Object", "printHelpMessage", "(", "CommandLine", "commandLine", ",", "PrintStream", "stream", ")", "{", "commandLine", ".", "usage", "(", "stream", ")", ";", "return", "null", ";", "}" ]
If an &#064;Option whose {@code usageHelp} attribute is annotated as true appears in the arguments. then the script body is not run and this {@code printHelpMessage} method is called instead. The default behavior is to print the {@link CommandLine#usage(PrintStream)} to the specified stream. The return value becomes the return value for the Script.run which will be the exit code if we've been called from the command line. @param commandLine The CommandLine instance @param stream the stream to print the usage help message to @return The value that Script.run should return ({@code null} by default). @since 3.0
[ "If", "an", "&#064", ";", "Option", "whose", "{", "@code", "usageHelp", "}", "attribute", "is", "annotated", "as", "true", "appears", "in", "the", "arguments", ".", "then", "the", "script", "body", "is", "not", "run", "and", "this", "{", "@code", "printHelpMessage", "}", "method", "is", "called", "instead", ".", "The", "default", "behavior", "is", "to", "print", "the", "{", "@link", "CommandLine#usage", "(", "PrintStream", ")", "}", "to", "the", "specified", "stream", ".", "The", "return", "value", "becomes", "the", "return", "value", "for", "the", "Script", ".", "run", "which", "will", "be", "the", "exit", "code", "if", "we", "ve", "been", "called", "from", "the", "command", "line", "." ]
train
https://github.com/remkop/picocli/blob/3c5384f0d12817401d1921c3013c1282e2edcab2/src/main/java/picocli/groovy/PicocliBaseScript.java#L291-L294
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginController.java
PluginController.attachController
public void attachController(BaseComponent comp, IAutoWired controller) { """ Attaches a controller to the specified component and registers any recognized listeners to the plugin. @param comp Target component. @param controller Controller to attach. """ plugin.tryRegisterListener(controller, true); comp.wireController(controller); }
java
public void attachController(BaseComponent comp, IAutoWired controller) { plugin.tryRegisterListener(controller, true); comp.wireController(controller); }
[ "public", "void", "attachController", "(", "BaseComponent", "comp", ",", "IAutoWired", "controller", ")", "{", "plugin", ".", "tryRegisterListener", "(", "controller", ",", "true", ")", ";", "comp", ".", "wireController", "(", "controller", ")", ";", "}" ]
Attaches a controller to the specified component and registers any recognized listeners to the plugin. @param comp Target component. @param controller Controller to attach.
[ "Attaches", "a", "controller", "to", "the", "specified", "component", "and", "registers", "any", "recognized", "listeners", "to", "the", "plugin", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginController.java#L96-L99
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java
XmlStringBuilder.appendOptionalAttribute
public void appendOptionalAttribute(final String name, final boolean flag, final Object value) { """ <p> If the flag is true, add an xml attribute name+value pair to the end of this XmlStringBuilder <p> Eg. name="value" </p> @param name the name of the boolean attribute to be added. @param flag should this attribute be set. @param value the value of the attribute. """ if (flag) { appendAttribute(name, value); } }
java
public void appendOptionalAttribute(final String name, final boolean flag, final Object value) { if (flag) { appendAttribute(name, value); } }
[ "public", "void", "appendOptionalAttribute", "(", "final", "String", "name", ",", "final", "boolean", "flag", ",", "final", "Object", "value", ")", "{", "if", "(", "flag", ")", "{", "appendAttribute", "(", "name", ",", "value", ")", ";", "}", "}" ]
<p> If the flag is true, add an xml attribute name+value pair to the end of this XmlStringBuilder <p> Eg. name="value" </p> @param name the name of the boolean attribute to be added. @param flag should this attribute be set. @param value the value of the attribute.
[ "<p", ">", "If", "the", "flag", "is", "true", "add", "an", "xml", "attribute", "name", "+", "value", "pair", "to", "the", "end", "of", "this", "XmlStringBuilder", "<p", ">", "Eg", ".", "name", "=", "value", "<", "/", "p", ">" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java#L267-L271
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java
SchedulingSupport.isWithinMinuteOfIntervalStart
public static boolean isWithinMinuteOfIntervalStart(long time, int intervalInMinutes, int offsetInMinutes) { """ Useful for scheduling jobs checking every minute on the minute if an event should be triggered. @param time @param intervalInMinutes @param offsetInMinutes @return true if an interval starts this minute local time """ time += LOCAL_UTC_OFFSET; long interval = MINUTE_IN_MS * intervalInMinutes; long offset = calculateOffsetInMs(intervalInMinutes, offsetInMinutes); return (interval * ((time + HALF_MINUTE_IN_MS) / interval)) + offset == roundToMinute(time); }
java
public static boolean isWithinMinuteOfIntervalStart(long time, int intervalInMinutes, int offsetInMinutes) { time += LOCAL_UTC_OFFSET; long interval = MINUTE_IN_MS * intervalInMinutes; long offset = calculateOffsetInMs(intervalInMinutes, offsetInMinutes); return (interval * ((time + HALF_MINUTE_IN_MS) / interval)) + offset == roundToMinute(time); }
[ "public", "static", "boolean", "isWithinMinuteOfIntervalStart", "(", "long", "time", ",", "int", "intervalInMinutes", ",", "int", "offsetInMinutes", ")", "{", "time", "+=", "LOCAL_UTC_OFFSET", ";", "long", "interval", "=", "MINUTE_IN_MS", "*", "intervalInMinutes", ";", "long", "offset", "=", "calculateOffsetInMs", "(", "intervalInMinutes", ",", "offsetInMinutes", ")", ";", "return", "(", "interval", "*", "(", "(", "time", "+", "HALF_MINUTE_IN_MS", ")", "/", "interval", ")", ")", "+", "offset", "==", "roundToMinute", "(", "time", ")", ";", "}" ]
Useful for scheduling jobs checking every minute on the minute if an event should be triggered. @param time @param intervalInMinutes @param offsetInMinutes @return true if an interval starts this minute local time
[ "Useful", "for", "scheduling", "jobs", "checking", "every", "minute", "on", "the", "minute", "if", "an", "event", "should", "be", "triggered", ".", "@param", "time", "@param", "intervalInMinutes", "@param", "offsetInMinutes" ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java#L153-L161
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WisdomExecutor.java
WisdomExecutor.appendSystemPropertiesToCommandLine
private static void appendSystemPropertiesToCommandLine(AbstractWisdomMojo mojo, CommandLine cmd) { """ Appends the properties from the Maven session (user properties) to the command line. As the command line is intended to be a Chameleon process, arguments are passed using the {@literal -Dkey=value} syntax. @param mojo the mojo @param cmd the command line to extend """ Properties userProperties = mojo.session.getUserProperties(); if (userProperties != null) { //noinspection unchecked Enumeration<String> names = (Enumeration<String>) userProperties.propertyNames(); while (names.hasMoreElements()) { String name = names.nextElement(); cmd.addArgument("-D" + name + "=" + userProperties.getProperty(name)); } } }
java
private static void appendSystemPropertiesToCommandLine(AbstractWisdomMojo mojo, CommandLine cmd) { Properties userProperties = mojo.session.getUserProperties(); if (userProperties != null) { //noinspection unchecked Enumeration<String> names = (Enumeration<String>) userProperties.propertyNames(); while (names.hasMoreElements()) { String name = names.nextElement(); cmd.addArgument("-D" + name + "=" + userProperties.getProperty(name)); } } }
[ "private", "static", "void", "appendSystemPropertiesToCommandLine", "(", "AbstractWisdomMojo", "mojo", ",", "CommandLine", "cmd", ")", "{", "Properties", "userProperties", "=", "mojo", ".", "session", ".", "getUserProperties", "(", ")", ";", "if", "(", "userProperties", "!=", "null", ")", "{", "//noinspection unchecked", "Enumeration", "<", "String", ">", "names", "=", "(", "Enumeration", "<", "String", ">", ")", "userProperties", ".", "propertyNames", "(", ")", ";", "while", "(", "names", ".", "hasMoreElements", "(", ")", ")", "{", "String", "name", "=", "names", ".", "nextElement", "(", ")", ";", "cmd", ".", "addArgument", "(", "\"-D\"", "+", "name", "+", "\"=\"", "+", "userProperties", ".", "getProperty", "(", "name", ")", ")", ";", "}", "}", "}" ]
Appends the properties from the Maven session (user properties) to the command line. As the command line is intended to be a Chameleon process, arguments are passed using the {@literal -Dkey=value} syntax. @param mojo the mojo @param cmd the command line to extend
[ "Appends", "the", "properties", "from", "the", "Maven", "session", "(", "user", "properties", ")", "to", "the", "command", "line", ".", "As", "the", "command", "line", "is", "intended", "to", "be", "a", "Chameleon", "process", "arguments", "are", "passed", "using", "the", "{", "@literal", "-", "Dkey", "=", "value", "}", "syntax", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WisdomExecutor.java#L170-L180
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebProviderAuthenticatorProxy.java
WebProviderAuthenticatorProxy.attemptToRemoveLtpaToken
private void attemptToRemoveLtpaToken(WebRequest webRequest, HashMap<String, Object> props) { """ /* Remove LTPA token if this is not a FORM login and the JASPI provider has not committed the response. """ SSOCookieHelper ssoCh = webAppSecurityConfig.createSSOCookieHelper(); if (!isFormLogin(props)) { HttpServletResponse res = webRequest.getHttpServletResponse(); if (!res.isCommitted()) { ssoCh.removeSSOCookieFromResponse(res); } } }
java
private void attemptToRemoveLtpaToken(WebRequest webRequest, HashMap<String, Object> props) { SSOCookieHelper ssoCh = webAppSecurityConfig.createSSOCookieHelper(); if (!isFormLogin(props)) { HttpServletResponse res = webRequest.getHttpServletResponse(); if (!res.isCommitted()) { ssoCh.removeSSOCookieFromResponse(res); } } }
[ "private", "void", "attemptToRemoveLtpaToken", "(", "WebRequest", "webRequest", ",", "HashMap", "<", "String", ",", "Object", ">", "props", ")", "{", "SSOCookieHelper", "ssoCh", "=", "webAppSecurityConfig", ".", "createSSOCookieHelper", "(", ")", ";", "if", "(", "!", "isFormLogin", "(", "props", ")", ")", "{", "HttpServletResponse", "res", "=", "webRequest", ".", "getHttpServletResponse", "(", ")", ";", "if", "(", "!", "res", ".", "isCommitted", "(", ")", ")", "{", "ssoCh", ".", "removeSSOCookieFromResponse", "(", "res", ")", ";", "}", "}", "}" ]
/* Remove LTPA token if this is not a FORM login and the JASPI provider has not committed the response.
[ "/", "*", "Remove", "LTPA", "token", "if", "this", "is", "not", "a", "FORM", "login", "and", "the", "JASPI", "provider", "has", "not", "committed", "the", "response", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebProviderAuthenticatorProxy.java#L302-L310
integration-technology/amazon-mws-orders
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
MwsAQCall.getResponseHeaderMetadata
private MwsResponseHeaderMetadata getResponseHeaderMetadata(HttpResponse response) { """ Get the metadata from the response headers. @param response @return The metadata. """ Header requestIdHeader = response.getFirstHeader("x-mws-request-id"); String requestId = requestIdHeader == null ? null : requestIdHeader.getValue(); Header timestampHeader = response.getFirstHeader("x-mws-timestamp"); String timestamp = timestampHeader == null ? null : timestampHeader.getValue(); Header contextHeader = response.getFirstHeader("x-mws-response-context"); String contextString = contextHeader==null ? "" : contextHeader.getValue(); List<String> context = Collections.unmodifiableList(Arrays.asList(contextString.split(","))); Double quotaMax; try { Header quotaMaxHeader = response.getFirstHeader("x-mws-quota-max"); quotaMax = quotaMaxHeader == null ? null : Double.valueOf(quotaMaxHeader.getValue()); } catch (NumberFormatException ex) { quotaMax = null; } Double quotaRemaining; try { Header quotaRemainingHeader = response.getFirstHeader("x-mws-quota-remaining"); quotaRemaining = quotaRemainingHeader == null ? null : Double.valueOf(quotaRemainingHeader.getValue()); } catch (NumberFormatException ex) { quotaRemaining = null; } Date quotaResetDate; try { Header quotaResetHeader = response.getFirstHeader("x-mws-quota-resetsOn"); quotaResetDate = quotaResetHeader == null ? null : MwsUtl.parseTimestamp(quotaResetHeader.getValue()); } catch (java.text.ParseException ex) { quotaResetDate = null; } return new MwsResponseHeaderMetadata(requestId, context, timestamp, quotaMax, quotaRemaining, quotaResetDate); }
java
private MwsResponseHeaderMetadata getResponseHeaderMetadata(HttpResponse response) { Header requestIdHeader = response.getFirstHeader("x-mws-request-id"); String requestId = requestIdHeader == null ? null : requestIdHeader.getValue(); Header timestampHeader = response.getFirstHeader("x-mws-timestamp"); String timestamp = timestampHeader == null ? null : timestampHeader.getValue(); Header contextHeader = response.getFirstHeader("x-mws-response-context"); String contextString = contextHeader==null ? "" : contextHeader.getValue(); List<String> context = Collections.unmodifiableList(Arrays.asList(contextString.split(","))); Double quotaMax; try { Header quotaMaxHeader = response.getFirstHeader("x-mws-quota-max"); quotaMax = quotaMaxHeader == null ? null : Double.valueOf(quotaMaxHeader.getValue()); } catch (NumberFormatException ex) { quotaMax = null; } Double quotaRemaining; try { Header quotaRemainingHeader = response.getFirstHeader("x-mws-quota-remaining"); quotaRemaining = quotaRemainingHeader == null ? null : Double.valueOf(quotaRemainingHeader.getValue()); } catch (NumberFormatException ex) { quotaRemaining = null; } Date quotaResetDate; try { Header quotaResetHeader = response.getFirstHeader("x-mws-quota-resetsOn"); quotaResetDate = quotaResetHeader == null ? null : MwsUtl.parseTimestamp(quotaResetHeader.getValue()); } catch (java.text.ParseException ex) { quotaResetDate = null; } return new MwsResponseHeaderMetadata(requestId, context, timestamp, quotaMax, quotaRemaining, quotaResetDate); }
[ "private", "MwsResponseHeaderMetadata", "getResponseHeaderMetadata", "(", "HttpResponse", "response", ")", "{", "Header", "requestIdHeader", "=", "response", ".", "getFirstHeader", "(", "\"x-mws-request-id\"", ")", ";", "String", "requestId", "=", "requestIdHeader", "==", "null", "?", "null", ":", "requestIdHeader", ".", "getValue", "(", ")", ";", "Header", "timestampHeader", "=", "response", ".", "getFirstHeader", "(", "\"x-mws-timestamp\"", ")", ";", "String", "timestamp", "=", "timestampHeader", "==", "null", "?", "null", ":", "timestampHeader", ".", "getValue", "(", ")", ";", "Header", "contextHeader", "=", "response", ".", "getFirstHeader", "(", "\"x-mws-response-context\"", ")", ";", "String", "contextString", "=", "contextHeader", "==", "null", "?", "\"\"", ":", "contextHeader", ".", "getValue", "(", ")", ";", "List", "<", "String", ">", "context", "=", "Collections", ".", "unmodifiableList", "(", "Arrays", ".", "asList", "(", "contextString", ".", "split", "(", "\",\"", ")", ")", ")", ";", "Double", "quotaMax", ";", "try", "{", "Header", "quotaMaxHeader", "=", "response", ".", "getFirstHeader", "(", "\"x-mws-quota-max\"", ")", ";", "quotaMax", "=", "quotaMaxHeader", "==", "null", "?", "null", ":", "Double", ".", "valueOf", "(", "quotaMaxHeader", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "quotaMax", "=", "null", ";", "}", "Double", "quotaRemaining", ";", "try", "{", "Header", "quotaRemainingHeader", "=", "response", ".", "getFirstHeader", "(", "\"x-mws-quota-remaining\"", ")", ";", "quotaRemaining", "=", "quotaRemainingHeader", "==", "null", "?", "null", ":", "Double", ".", "valueOf", "(", "quotaRemainingHeader", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "quotaRemaining", "=", "null", ";", "}", "Date", "quotaResetDate", ";", "try", "{", "Header", "quotaResetHeader", "=", "response", ".", "getFirstHeader", "(", "\"x-mws-quota-resetsOn\"", ")", ";", "quotaResetDate", "=", "quotaResetHeader", "==", "null", "?", "null", ":", "MwsUtl", ".", "parseTimestamp", "(", "quotaResetHeader", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "java", ".", "text", ".", "ParseException", "ex", ")", "{", "quotaResetDate", "=", "null", ";", "}", "return", "new", "MwsResponseHeaderMetadata", "(", "requestId", ",", "context", ",", "timestamp", ",", "quotaMax", ",", "quotaRemaining", ",", "quotaResetDate", ")", ";", "}" ]
Get the metadata from the response headers. @param response @return The metadata.
[ "Get", "the", "metadata", "from", "the", "response", "headers", "." ]
train
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L131-L167
MGunlogson/CuckooFilter4J
src/main/java/com/github/mgunlogson/cuckoofilter4j/Utils.java
Utils.getBucketsNeeded
static long getBucketsNeeded(long maxKeys,double loadFactor,int bucketSize) { """ Calculates how many buckets are needed to hold the chosen number of keys, taking the standard load factor into account. @param maxKeys the number of keys the filter is expected to hold before insertion failure. @return The number of buckets needed """ /* * force a power-of-two bucket count so hash functions for bucket index * can hashBits%numBuckets and get randomly distributed index. See wiki * "Modulo Bias". Only time we can get perfectly distributed index is * when numBuckets is a power of 2. */ long bucketsNeeded = DoubleMath.roundToLong((1.0 / loadFactor) * maxKeys / bucketSize, RoundingMode.UP); // get next biggest power of 2 long bitPos = Long.highestOneBit(bucketsNeeded); if (bucketsNeeded > bitPos) bitPos = bitPos << 1; return bitPos; }
java
static long getBucketsNeeded(long maxKeys,double loadFactor,int bucketSize) { /* * force a power-of-two bucket count so hash functions for bucket index * can hashBits%numBuckets and get randomly distributed index. See wiki * "Modulo Bias". Only time we can get perfectly distributed index is * when numBuckets is a power of 2. */ long bucketsNeeded = DoubleMath.roundToLong((1.0 / loadFactor) * maxKeys / bucketSize, RoundingMode.UP); // get next biggest power of 2 long bitPos = Long.highestOneBit(bucketsNeeded); if (bucketsNeeded > bitPos) bitPos = bitPos << 1; return bitPos; }
[ "static", "long", "getBucketsNeeded", "(", "long", "maxKeys", ",", "double", "loadFactor", ",", "int", "bucketSize", ")", "{", "/*\r\n\t\t * force a power-of-two bucket count so hash functions for bucket index\r\n\t\t * can hashBits%numBuckets and get randomly distributed index. See wiki\r\n\t\t * \"Modulo Bias\". Only time we can get perfectly distributed index is\r\n\t\t * when numBuckets is a power of 2.\r\n\t\t */", "long", "bucketsNeeded", "=", "DoubleMath", ".", "roundToLong", "(", "(", "1.0", "/", "loadFactor", ")", "*", "maxKeys", "/", "bucketSize", ",", "RoundingMode", ".", "UP", ")", ";", "// get next biggest power of 2\r", "long", "bitPos", "=", "Long", ".", "highestOneBit", "(", "bucketsNeeded", ")", ";", "if", "(", "bucketsNeeded", ">", "bitPos", ")", "bitPos", "=", "bitPos", "<<", "1", ";", "return", "bitPos", ";", "}" ]
Calculates how many buckets are needed to hold the chosen number of keys, taking the standard load factor into account. @param maxKeys the number of keys the filter is expected to hold before insertion failure. @return The number of buckets needed
[ "Calculates", "how", "many", "buckets", "are", "needed", "to", "hold", "the", "chosen", "number", "of", "keys", "taking", "the", "standard", "load", "factor", "into", "account", "." ]
train
https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/Utils.java#L165-L178
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.convertTo
public <S, T> T convertTo(Class<T> output, Object object, Class<? extends Annotation> qualifier) { """ Convert an object to the given target class This method infers the source type for the conversion from the runtime type of object. @param output The target class to convert the object to @param object The object to be converted @param qualifier The qualifier for which the binding must be registered """ if (object == null) { return null; } @SuppressWarnings("unchecked") Converter<S, T> conv = (Converter<S, T>) determineConverter(object.getClass(), output, qualifier == null ? DefaultBinding.class : qualifier); if (conv == null) { @SuppressWarnings("unchecked") Class<S> inputClass = (Class<S>)object.getClass(); throw new NoConverterFoundException(new ConverterKey<S,T>(inputClass, output, qualifier == null ? DefaultBinding.class : qualifier)); } @SuppressWarnings("unchecked") S myObject = (S)object; return conv.convert(myObject); }
java
public <S, T> T convertTo(Class<T> output, Object object, Class<? extends Annotation> qualifier) { if (object == null) { return null; } @SuppressWarnings("unchecked") Converter<S, T> conv = (Converter<S, T>) determineConverter(object.getClass(), output, qualifier == null ? DefaultBinding.class : qualifier); if (conv == null) { @SuppressWarnings("unchecked") Class<S> inputClass = (Class<S>)object.getClass(); throw new NoConverterFoundException(new ConverterKey<S,T>(inputClass, output, qualifier == null ? DefaultBinding.class : qualifier)); } @SuppressWarnings("unchecked") S myObject = (S)object; return conv.convert(myObject); }
[ "public", "<", "S", ",", "T", ">", "T", "convertTo", "(", "Class", "<", "T", ">", "output", ",", "Object", "object", ",", "Class", "<", "?", "extends", "Annotation", ">", "qualifier", ")", "{", "if", "(", "object", "==", "null", ")", "{", "return", "null", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Converter", "<", "S", ",", "T", ">", "conv", "=", "(", "Converter", "<", "S", ",", "T", ">", ")", "determineConverter", "(", "object", ".", "getClass", "(", ")", ",", "output", ",", "qualifier", "==", "null", "?", "DefaultBinding", ".", "class", ":", "qualifier", ")", ";", "if", "(", "conv", "==", "null", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Class", "<", "S", ">", "inputClass", "=", "(", "Class", "<", "S", ">", ")", "object", ".", "getClass", "(", ")", ";", "throw", "new", "NoConverterFoundException", "(", "new", "ConverterKey", "<", "S", ",", "T", ">", "(", "inputClass", ",", "output", ",", "qualifier", "==", "null", "?", "DefaultBinding", ".", "class", ":", "qualifier", ")", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "S", "myObject", "=", "(", "S", ")", "object", ";", "return", "conv", ".", "convert", "(", "myObject", ")", ";", "}" ]
Convert an object to the given target class This method infers the source type for the conversion from the runtime type of object. @param output The target class to convert the object to @param object The object to be converted @param qualifier The qualifier for which the binding must be registered
[ "Convert", "an", "object", "to", "the", "given", "target", "class", "This", "method", "infers", "the", "source", "type", "for", "the", "conversion", "from", "the", "runtime", "type", "of", "object", "." ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L741-L759
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/hibernate/SpringPhysicalNamingStrategy.java
SpringPhysicalNamingStrategy.getIdentifier
protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { """ Get an identifier for the specified details. By default this method will return an identifier with the name adapted based on the result of {@link #isCaseInsensitive(JdbcEnvironment)} @param name the name of the identifier @param quoted if the identifier is quoted @param jdbcEnvironment the JDBC environment @return an identifier instance """ if (isCaseInsensitive(jdbcEnvironment)) { name = name.toLowerCase(Locale.ROOT); } return new Identifier(name, quoted); }
java
protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { if (isCaseInsensitive(jdbcEnvironment)) { name = name.toLowerCase(Locale.ROOT); } return new Identifier(name, quoted); }
[ "protected", "Identifier", "getIdentifier", "(", "String", "name", ",", "boolean", "quoted", ",", "JdbcEnvironment", "jdbcEnvironment", ")", "{", "if", "(", "isCaseInsensitive", "(", "jdbcEnvironment", ")", ")", "{", "name", "=", "name", ".", "toLowerCase", "(", "Locale", ".", "ROOT", ")", ";", "}", "return", "new", "Identifier", "(", "name", ",", "quoted", ")", ";", "}" ]
Get an identifier for the specified details. By default this method will return an identifier with the name adapted based on the result of {@link #isCaseInsensitive(JdbcEnvironment)} @param name the name of the identifier @param quoted if the identifier is quoted @param jdbcEnvironment the JDBC environment @return an identifier instance
[ "Get", "an", "identifier", "for", "the", "specified", "details", ".", "By", "default", "this", "method", "will", "return", "an", "identifier", "with", "the", "name", "adapted", "based", "on", "the", "result", "of", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/hibernate/SpringPhysicalNamingStrategy.java#L88-L94
qos-ch/slf4j
jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java
SLF4JLog.info
public void info(Object message, Throwable t) { """ Converts the first input parameter to String and then delegates to the wrapped <code>org.slf4j.Logger</code> instance. @param message the message to log. Converted to {@link String} @param t the exception to log """ logger.info(String.valueOf(message), t); }
java
public void info(Object message, Throwable t) { logger.info(String.valueOf(message), t); }
[ "public", "void", "info", "(", "Object", "message", ",", "Throwable", "t", ")", "{", "logger", ".", "info", "(", "String", ".", "valueOf", "(", "message", ")", ",", "t", ")", ";", "}" ]
Converts the first input parameter to String and then delegates to the wrapped <code>org.slf4j.Logger</code> instance. @param message the message to log. Converted to {@link String} @param t the exception to log
[ "Converts", "the", "first", "input", "parameter", "to", "String", "and", "then", "delegates", "to", "the", "wrapped", "<code", ">", "org", ".", "slf4j", ".", "Logger<", "/", "code", ">", "instance", "." ]
train
https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java#L164-L166
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/net/IpHelper.java
IpHelper.getLocalIpAddress
public static InetAddress getLocalIpAddress(String iface) throws RuntimeException { """ Returns the IP address associated with iface @param iface The interface name @return InetAddress The InetAddress of the interface (or null if none found) @throws RuntimeException On any error @since 1.0 """ try { NetworkInterface nic = NetworkInterface.getByName(iface); Enumeration<InetAddress> ips = nic.getInetAddresses(); InetAddress firstIP = null; while (ips != null && ips.hasMoreElements()) { InetAddress ip = ips.nextElement(); if (firstIP == null) firstIP = ip; if (log.isDebugEnabled()) log.debug("[IpHelper] {getLocalIpAddress} Considering locality: " + ip.getHostAddress()); if (!ip.isAnyLocalAddress()) { return ip; } } // Return the first IP (or null if no IPs were returned) return firstIP; } catch (SocketException e) { throw new RuntimeException("[IpHelper] {getLocalIpAddress}: Unable to acquire an IP", e); } }
java
public static InetAddress getLocalIpAddress(String iface) throws RuntimeException { try { NetworkInterface nic = NetworkInterface.getByName(iface); Enumeration<InetAddress> ips = nic.getInetAddresses(); InetAddress firstIP = null; while (ips != null && ips.hasMoreElements()) { InetAddress ip = ips.nextElement(); if (firstIP == null) firstIP = ip; if (log.isDebugEnabled()) log.debug("[IpHelper] {getLocalIpAddress} Considering locality: " + ip.getHostAddress()); if (!ip.isAnyLocalAddress()) { return ip; } } // Return the first IP (or null if no IPs were returned) return firstIP; } catch (SocketException e) { throw new RuntimeException("[IpHelper] {getLocalIpAddress}: Unable to acquire an IP", e); } }
[ "public", "static", "InetAddress", "getLocalIpAddress", "(", "String", "iface", ")", "throws", "RuntimeException", "{", "try", "{", "NetworkInterface", "nic", "=", "NetworkInterface", ".", "getByName", "(", "iface", ")", ";", "Enumeration", "<", "InetAddress", ">", "ips", "=", "nic", ".", "getInetAddresses", "(", ")", ";", "InetAddress", "firstIP", "=", "null", ";", "while", "(", "ips", "!=", "null", "&&", "ips", ".", "hasMoreElements", "(", ")", ")", "{", "InetAddress", "ip", "=", "ips", ".", "nextElement", "(", ")", ";", "if", "(", "firstIP", "==", "null", ")", "firstIP", "=", "ip", ";", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "log", ".", "debug", "(", "\"[IpHelper] {getLocalIpAddress} Considering locality: \"", "+", "ip", ".", "getHostAddress", "(", ")", ")", ";", "if", "(", "!", "ip", ".", "isAnyLocalAddress", "(", ")", ")", "{", "return", "ip", ";", "}", "}", "// Return the first IP (or null if no IPs were returned)", "return", "firstIP", ";", "}", "catch", "(", "SocketException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"[IpHelper] {getLocalIpAddress}: Unable to acquire an IP\"", ",", "e", ")", ";", "}", "}" ]
Returns the IP address associated with iface @param iface The interface name @return InetAddress The InetAddress of the interface (or null if none found) @throws RuntimeException On any error @since 1.0
[ "Returns", "the", "IP", "address", "associated", "with", "iface" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/net/IpHelper.java#L155-L186
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractTreeTableDataModel.java
AbstractTreeTableDataModel.getValueAt
@Override public final Object getValueAt(final int row, final int col) { """ Retrieves the value at the given row and column. This implementation delegates to {@link #getValueAt(TableTreeNode, int)}, which subclasses must implement. @param row the row index @param col the column index. @return the value for the specified cell. """ TableTreeNode rowNode = getNodeAtLine(row); return getValueAt(rowNode, col); }
java
@Override public final Object getValueAt(final int row, final int col) { TableTreeNode rowNode = getNodeAtLine(row); return getValueAt(rowNode, col); }
[ "@", "Override", "public", "final", "Object", "getValueAt", "(", "final", "int", "row", ",", "final", "int", "col", ")", "{", "TableTreeNode", "rowNode", "=", "getNodeAtLine", "(", "row", ")", ";", "return", "getValueAt", "(", "rowNode", ",", "col", ")", ";", "}" ]
Retrieves the value at the given row and column. This implementation delegates to {@link #getValueAt(TableTreeNode, int)}, which subclasses must implement. @param row the row index @param col the column index. @return the value for the specified cell.
[ "Retrieves", "the", "value", "at", "the", "given", "row", "and", "column", ".", "This", "implementation", "delegates", "to", "{", "@link", "#getValueAt", "(", "TableTreeNode", "int", ")", "}", "which", "subclasses", "must", "implement", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractTreeTableDataModel.java#L69-L73
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java
OUTRES.run
public OutlierResult run(Relation<? extends NumberVector> relation) { """ Main loop for OUTRES @param relation Relation to process @return Outlier detection result """ final DBIDs ids = relation.getDBIDs(); WritableDoubleDataStore ranks = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_STATIC); DoubleMinMax minmax = new DoubleMinMax(); KernelDensityEstimator kernel = new KernelDensityEstimator(relation, eps); long[] subspace = BitsUtil.zero(kernel.dim); FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("OUTRES scores", ids.size(), LOG) : null; for(DBIDIter iditer = ids.iter(); iditer.valid(); iditer.advance()) { BitsUtil.zeroI(subspace); double score = outresScore(0, subspace, iditer, kernel, ids); ranks.putDouble(iditer, score); minmax.put(score); LOG.incrementProcessed(progress); } LOG.ensureCompleted(progress); OutlierScoreMeta meta = new InvertedOutlierScoreMeta(minmax.getMin(), minmax.getMax(), 0., 1., 1.); return new OutlierResult(meta, new MaterializedDoubleRelation("OUTRES", "outres-score", ranks, ids)); }
java
public OutlierResult run(Relation<? extends NumberVector> relation) { final DBIDs ids = relation.getDBIDs(); WritableDoubleDataStore ranks = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_STATIC); DoubleMinMax minmax = new DoubleMinMax(); KernelDensityEstimator kernel = new KernelDensityEstimator(relation, eps); long[] subspace = BitsUtil.zero(kernel.dim); FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("OUTRES scores", ids.size(), LOG) : null; for(DBIDIter iditer = ids.iter(); iditer.valid(); iditer.advance()) { BitsUtil.zeroI(subspace); double score = outresScore(0, subspace, iditer, kernel, ids); ranks.putDouble(iditer, score); minmax.put(score); LOG.incrementProcessed(progress); } LOG.ensureCompleted(progress); OutlierScoreMeta meta = new InvertedOutlierScoreMeta(minmax.getMin(), minmax.getMax(), 0., 1., 1.); return new OutlierResult(meta, new MaterializedDoubleRelation("OUTRES", "outres-score", ranks, ids)); }
[ "public", "OutlierResult", "run", "(", "Relation", "<", "?", "extends", "NumberVector", ">", "relation", ")", "{", "final", "DBIDs", "ids", "=", "relation", ".", "getDBIDs", "(", ")", ";", "WritableDoubleDataStore", "ranks", "=", "DataStoreUtil", ".", "makeDoubleStorage", "(", "ids", ",", "DataStoreFactory", ".", "HINT_STATIC", ")", ";", "DoubleMinMax", "minmax", "=", "new", "DoubleMinMax", "(", ")", ";", "KernelDensityEstimator", "kernel", "=", "new", "KernelDensityEstimator", "(", "relation", ",", "eps", ")", ";", "long", "[", "]", "subspace", "=", "BitsUtil", ".", "zero", "(", "kernel", ".", "dim", ")", ";", "FiniteProgress", "progress", "=", "LOG", ".", "isVerbose", "(", ")", "?", "new", "FiniteProgress", "(", "\"OUTRES scores\"", ",", "ids", ".", "size", "(", ")", ",", "LOG", ")", ":", "null", ";", "for", "(", "DBIDIter", "iditer", "=", "ids", ".", "iter", "(", ")", ";", "iditer", ".", "valid", "(", ")", ";", "iditer", ".", "advance", "(", ")", ")", "{", "BitsUtil", ".", "zeroI", "(", "subspace", ")", ";", "double", "score", "=", "outresScore", "(", "0", ",", "subspace", ",", "iditer", ",", "kernel", ",", "ids", ")", ";", "ranks", ".", "putDouble", "(", "iditer", ",", "score", ")", ";", "minmax", ".", "put", "(", "score", ")", ";", "LOG", ".", "incrementProcessed", "(", "progress", ")", ";", "}", "LOG", ".", "ensureCompleted", "(", "progress", ")", ";", "OutlierScoreMeta", "meta", "=", "new", "InvertedOutlierScoreMeta", "(", "minmax", ".", "getMin", "(", ")", ",", "minmax", ".", "getMax", "(", ")", ",", "0.", ",", "1.", ",", "1.", ")", ";", "return", "new", "OutlierResult", "(", "meta", ",", "new", "MaterializedDoubleRelation", "(", "\"OUTRES\"", ",", "\"outres-score\"", ",", "ranks", ",", "ids", ")", ")", ";", "}" ]
Main loop for OUTRES @param relation Relation to process @return Outlier detection result
[ "Main", "loop", "for", "OUTRES" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java#L118-L139
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributeCollection.java
DBaseFileAttributeCollection.fireAttributeRemovedEvent
protected void fireAttributeRemovedEvent(String name, AttributeValue oldValue) { """ Fire the an attribute removal event. @param name is the name of the attribute for which the event occured. @param oldValue is the previous value of the attribute """ if (this.listeners != null && isEventFirable()) { final AttributeChangeEvent event = new AttributeChangeEvent( //source this, //type Type.REMOVAL, //old name name, //old value oldValue, //current name name, //current value oldValue); for (final AttributeChangeListener listener : this.listeners) { listener.onAttributeChangeEvent(event); } } }
java
protected void fireAttributeRemovedEvent(String name, AttributeValue oldValue) { if (this.listeners != null && isEventFirable()) { final AttributeChangeEvent event = new AttributeChangeEvent( //source this, //type Type.REMOVAL, //old name name, //old value oldValue, //current name name, //current value oldValue); for (final AttributeChangeListener listener : this.listeners) { listener.onAttributeChangeEvent(event); } } }
[ "protected", "void", "fireAttributeRemovedEvent", "(", "String", "name", ",", "AttributeValue", "oldValue", ")", "{", "if", "(", "this", ".", "listeners", "!=", "null", "&&", "isEventFirable", "(", ")", ")", "{", "final", "AttributeChangeEvent", "event", "=", "new", "AttributeChangeEvent", "(", "//source", "this", ",", "//type", "Type", ".", "REMOVAL", ",", "//old name", "name", ",", "//old value", "oldValue", ",", "//current name", "name", ",", "//current value", "oldValue", ")", ";", "for", "(", "final", "AttributeChangeListener", "listener", ":", "this", ".", "listeners", ")", "{", "listener", ".", "onAttributeChangeEvent", "(", "event", ")", ";", "}", "}", "}" ]
Fire the an attribute removal event. @param name is the name of the attribute for which the event occured. @param oldValue is the previous value of the attribute
[ "Fire", "the", "an", "attribute", "removal", "event", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributeCollection.java#L936-L955
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficpolicy.java
vpntrafficpolicy.get
public static vpntrafficpolicy get(nitro_service service, String name) throws Exception { """ Use this API to fetch vpntrafficpolicy resource of given name . """ vpntrafficpolicy obj = new vpntrafficpolicy(); obj.set_name(name); vpntrafficpolicy response = (vpntrafficpolicy) obj.get_resource(service); return response; }
java
public static vpntrafficpolicy get(nitro_service service, String name) throws Exception{ vpntrafficpolicy obj = new vpntrafficpolicy(); obj.set_name(name); vpntrafficpolicy response = (vpntrafficpolicy) obj.get_resource(service); return response; }
[ "public", "static", "vpntrafficpolicy", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "vpntrafficpolicy", "obj", "=", "new", "vpntrafficpolicy", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "vpntrafficpolicy", "response", "=", "(", "vpntrafficpolicy", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch vpntrafficpolicy resource of given name .
[ "Use", "this", "API", "to", "fetch", "vpntrafficpolicy", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficpolicy.java#L317-L322
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagUser.java
CmsJspTagUser.userTagAction
public static String userTagAction(String property, ServletRequest req) { """ Internal action method.<p> @param property the selected user property @param req the current request @return String the value of the selected user property """ CmsFlexController controller = CmsFlexController.getController(req); CmsObject cms = controller.getCmsObject(); CmsUser user = cms.getRequestContext().getCurrentUser(); if (property == null) { property = USER_PROPERTIES[0]; } String result = null; switch (USER_PROPERTIES_LIST.indexOf(property)) { case 0: // name result = user.getName(); break; case 1: // firstname result = user.getFirstname(); break; case 2: // lastname result = user.getLastname(); break; case 3: // email result = user.getEmail(); break; case 4: // street result = user.getAddress(); break; case 5: // zip result = user.getZipcode(); break; case 6: // city result = user.getCity(); break; case 7: // description result = user.getDescription(cms.getRequestContext().getLocale()); break; // following 3 attributes are no longer supported case 8: // group case 9: // currentgroup case 10: // defaultgroup result = ""; break; case 11: // otherstuff Iterator<String> it = user.getAdditionalInfo().keySet().iterator(); CmsMessageContainer msgContainer = Messages.get().container(Messages.GUI_TAG_USER_ADDITIONALINFO_0); result = Messages.getLocalizedMessage(msgContainer, req); while (it.hasNext()) { Object o = it.next(); result += " " + o + "=" + user.getAdditionalInfo((String)o); } break; case 12: // institution result = user.getInstitution(); break; default: msgContainer = Messages.get().container(Messages.GUI_ERR_INVALID_USER_PROP_1, property); result = Messages.getLocalizedMessage(msgContainer, req); } return result; }
java
public static String userTagAction(String property, ServletRequest req) { CmsFlexController controller = CmsFlexController.getController(req); CmsObject cms = controller.getCmsObject(); CmsUser user = cms.getRequestContext().getCurrentUser(); if (property == null) { property = USER_PROPERTIES[0]; } String result = null; switch (USER_PROPERTIES_LIST.indexOf(property)) { case 0: // name result = user.getName(); break; case 1: // firstname result = user.getFirstname(); break; case 2: // lastname result = user.getLastname(); break; case 3: // email result = user.getEmail(); break; case 4: // street result = user.getAddress(); break; case 5: // zip result = user.getZipcode(); break; case 6: // city result = user.getCity(); break; case 7: // description result = user.getDescription(cms.getRequestContext().getLocale()); break; // following 3 attributes are no longer supported case 8: // group case 9: // currentgroup case 10: // defaultgroup result = ""; break; case 11: // otherstuff Iterator<String> it = user.getAdditionalInfo().keySet().iterator(); CmsMessageContainer msgContainer = Messages.get().container(Messages.GUI_TAG_USER_ADDITIONALINFO_0); result = Messages.getLocalizedMessage(msgContainer, req); while (it.hasNext()) { Object o = it.next(); result += " " + o + "=" + user.getAdditionalInfo((String)o); } break; case 12: // institution result = user.getInstitution(); break; default: msgContainer = Messages.get().container(Messages.GUI_ERR_INVALID_USER_PROP_1, property); result = Messages.getLocalizedMessage(msgContainer, req); } return result; }
[ "public", "static", "String", "userTagAction", "(", "String", "property", ",", "ServletRequest", "req", ")", "{", "CmsFlexController", "controller", "=", "CmsFlexController", ".", "getController", "(", "req", ")", ";", "CmsObject", "cms", "=", "controller", ".", "getCmsObject", "(", ")", ";", "CmsUser", "user", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentUser", "(", ")", ";", "if", "(", "property", "==", "null", ")", "{", "property", "=", "USER_PROPERTIES", "[", "0", "]", ";", "}", "String", "result", "=", "null", ";", "switch", "(", "USER_PROPERTIES_LIST", ".", "indexOf", "(", "property", ")", ")", "{", "case", "0", ":", "// name", "result", "=", "user", ".", "getName", "(", ")", ";", "break", ";", "case", "1", ":", "// firstname", "result", "=", "user", ".", "getFirstname", "(", ")", ";", "break", ";", "case", "2", ":", "// lastname", "result", "=", "user", ".", "getLastname", "(", ")", ";", "break", ";", "case", "3", ":", "// email", "result", "=", "user", ".", "getEmail", "(", ")", ";", "break", ";", "case", "4", ":", "// street", "result", "=", "user", ".", "getAddress", "(", ")", ";", "break", ";", "case", "5", ":", "// zip", "result", "=", "user", ".", "getZipcode", "(", ")", ";", "break", ";", "case", "6", ":", "// city", "result", "=", "user", ".", "getCity", "(", ")", ";", "break", ";", "case", "7", ":", "// description", "result", "=", "user", ".", "getDescription", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ";", "break", ";", "// following 3 attributes are no longer supported", "case", "8", ":", "// group", "case", "9", ":", "// currentgroup", "case", "10", ":", "// defaultgroup", "result", "=", "\"\"", ";", "break", ";", "case", "11", ":", "// otherstuff", "Iterator", "<", "String", ">", "it", "=", "user", ".", "getAdditionalInfo", "(", ")", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "CmsMessageContainer", "msgContainer", "=", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "GUI_TAG_USER_ADDITIONALINFO_0", ")", ";", "result", "=", "Messages", ".", "getLocalizedMessage", "(", "msgContainer", ",", "req", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Object", "o", "=", "it", ".", "next", "(", ")", ";", "result", "+=", "\" \"", "+", "o", "+", "\"=\"", "+", "user", ".", "getAdditionalInfo", "(", "(", "String", ")", "o", ")", ";", "}", "break", ";", "case", "12", ":", "// institution", "result", "=", "user", ".", "getInstitution", "(", ")", ";", "break", ";", "default", ":", "msgContainer", "=", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "GUI_ERR_INVALID_USER_PROP_1", ",", "property", ")", ";", "result", "=", "Messages", ".", "getLocalizedMessage", "(", "msgContainer", ",", "req", ")", ";", "}", "return", "result", ";", "}" ]
Internal action method.<p> @param property the selected user property @param req the current request @return String the value of the selected user property
[ "Internal", "action", "method", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagUser.java#L87-L148
junit-team/junit4
src/main/java/org/junit/Assume.java
Assume.assumeThat
@Deprecated public static <T> void assumeThat(T actual, Matcher<T> matcher) { """ Call to assume that <code>actual</code> satisfies the condition specified by <code>matcher</code>. If not, the test halts and is ignored. Example: <pre>: assumeThat(1, is(1)); // passes foo(); // will execute assumeThat(0, is(1)); // assumption failure! test halts int x = 1 / 0; // will never execute </pre> @param <T> the static type accepted by the matcher (this can flag obvious compile-time problems such as {@code assumeThat(1, is("a"))} @param actual the computed value being compared @param matcher an expression, built of {@link Matcher}s, specifying allowed values @see org.hamcrest.CoreMatchers @see org.junit.matchers.JUnitMatchers @deprecated use {@code org.hamcrest.junit.MatcherAssume.assumeThat()} """ if (!matcher.matches(actual)) { throw new AssumptionViolatedException(actual, matcher); } }
java
@Deprecated public static <T> void assumeThat(T actual, Matcher<T> matcher) { if (!matcher.matches(actual)) { throw new AssumptionViolatedException(actual, matcher); } }
[ "@", "Deprecated", "public", "static", "<", "T", ">", "void", "assumeThat", "(", "T", "actual", ",", "Matcher", "<", "T", ">", "matcher", ")", "{", "if", "(", "!", "matcher", ".", "matches", "(", "actual", ")", ")", "{", "throw", "new", "AssumptionViolatedException", "(", "actual", ",", "matcher", ")", ";", "}", "}" ]
Call to assume that <code>actual</code> satisfies the condition specified by <code>matcher</code>. If not, the test halts and is ignored. Example: <pre>: assumeThat(1, is(1)); // passes foo(); // will execute assumeThat(0, is(1)); // assumption failure! test halts int x = 1 / 0; // will never execute </pre> @param <T> the static type accepted by the matcher (this can flag obvious compile-time problems such as {@code assumeThat(1, is("a"))} @param actual the computed value being compared @param matcher an expression, built of {@link Matcher}s, specifying allowed values @see org.hamcrest.CoreMatchers @see org.junit.matchers.JUnitMatchers @deprecated use {@code org.hamcrest.junit.MatcherAssume.assumeThat()}
[ "Call", "to", "assume", "that", "<code", ">", "actual<", "/", "code", ">", "satisfies", "the", "condition", "specified", "by", "<code", ">", "matcher<", "/", "code", ">", ".", "If", "not", "the", "test", "halts", "and", "is", "ignored", ".", "Example", ":", "<pre", ">", ":", "assumeThat", "(", "1", "is", "(", "1", "))", ";", "//", "passes", "foo", "()", ";", "//", "will", "execute", "assumeThat", "(", "0", "is", "(", "1", "))", ";", "//", "assumption", "failure!", "test", "halts", "int", "x", "=", "1", "/", "0", ";", "//", "will", "never", "execute", "<", "/", "pre", ">" ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/Assume.java#L105-L110
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java
StoredPaymentChannelClientStates.getChannel
@Nullable public StoredClientChannel getChannel(Sha256Hash id, Sha256Hash contractHash) { """ Finds a channel with the given id and contract hash and returns it, or returns null. """ lock.lock(); try { Set<StoredClientChannel> setChannels = mapChannels.get(id); for (StoredClientChannel channel : setChannels) { if (channel.contract.getTxId().equals(contractHash)) return channel; } return null; } finally { lock.unlock(); } }
java
@Nullable public StoredClientChannel getChannel(Sha256Hash id, Sha256Hash contractHash) { lock.lock(); try { Set<StoredClientChannel> setChannels = mapChannels.get(id); for (StoredClientChannel channel : setChannels) { if (channel.contract.getTxId().equals(contractHash)) return channel; } return null; } finally { lock.unlock(); } }
[ "@", "Nullable", "public", "StoredClientChannel", "getChannel", "(", "Sha256Hash", "id", ",", "Sha256Hash", "contractHash", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "Set", "<", "StoredClientChannel", ">", "setChannels", "=", "mapChannels", ".", "get", "(", "id", ")", ";", "for", "(", "StoredClientChannel", "channel", ":", "setChannels", ")", "{", "if", "(", "channel", ".", "contract", ".", "getTxId", "(", ")", ".", "equals", "(", "contractHash", ")", ")", "return", "channel", ";", "}", "return", "null", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
Finds a channel with the given id and contract hash and returns it, or returns null.
[ "Finds", "a", "channel", "with", "the", "given", "id", "and", "contract", "hash", "and", "returns", "it", "or", "returns", "null", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java#L169-L182
sd4324530/fastweixin
src/main/java/com/github/sd4324530/fastweixin/company/api/QYUserAPI.java
QYUserAPI.getList
public GetQYUserInfo4DepartmentResponse getList(Integer departmentId, boolean isLoop, Integer status) { """ 通过部门列表获取部门成员信息 @param departmentId 部门ID @param isLoop 是否递归获取子部门下面的成员 @param status 0获取全部成员,1获取已关注成员列表,2获取禁用成员列表,4获取未关注成员列表。status可叠加,未填写则默认为4 @return 部门成员详情信息 """ GetQYUserInfo4DepartmentResponse response; String url = BASE_API_URL + "cgi-bin/user/list?access_token=#&department_id=" + departmentId + "&fetch_child=" + (isLoop? 0 : 1) + "&status=" + status; BaseResponse r = executeGet(url); String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString(); response = JSONUtil.toBean(resultJson, GetQYUserInfo4DepartmentResponse.class); return response; }
java
public GetQYUserInfo4DepartmentResponse getList(Integer departmentId, boolean isLoop, Integer status){ GetQYUserInfo4DepartmentResponse response; String url = BASE_API_URL + "cgi-bin/user/list?access_token=#&department_id=" + departmentId + "&fetch_child=" + (isLoop? 0 : 1) + "&status=" + status; BaseResponse r = executeGet(url); String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString(); response = JSONUtil.toBean(resultJson, GetQYUserInfo4DepartmentResponse.class); return response; }
[ "public", "GetQYUserInfo4DepartmentResponse", "getList", "(", "Integer", "departmentId", ",", "boolean", "isLoop", ",", "Integer", "status", ")", "{", "GetQYUserInfo4DepartmentResponse", "response", ";", "String", "url", "=", "BASE_API_URL", "+", "\"cgi-bin/user/list?access_token=#&department_id=\"", "+", "departmentId", "+", "\"&fetch_child=\"", "+", "(", "isLoop", "?", "0", ":", "1", ")", "+", "\"&status=\"", "+", "status", ";", "BaseResponse", "r", "=", "executeGet", "(", "url", ")", ";", "String", "resultJson", "=", "isSuccess", "(", "r", ".", "getErrcode", "(", ")", ")", "?", "r", ".", "getErrmsg", "(", ")", ":", "r", ".", "toJsonString", "(", ")", ";", "response", "=", "JSONUtil", ".", "toBean", "(", "resultJson", ",", "GetQYUserInfo4DepartmentResponse", ".", "class", ")", ";", "return", "response", ";", "}" ]
通过部门列表获取部门成员信息 @param departmentId 部门ID @param isLoop 是否递归获取子部门下面的成员 @param status 0获取全部成员,1获取已关注成员列表,2获取禁用成员列表,4获取未关注成员列表。status可叠加,未填写则默认为4 @return 部门成员详情信息
[ "通过部门列表获取部门成员信息" ]
train
https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/company/api/QYUserAPI.java#L126-L133
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java
CleverTapAPI.createNotificationChannel
@SuppressWarnings("unused") public static void createNotificationChannel(final Context context, final String channelId, final CharSequence channelName, final String channelDescription, final int importance, final boolean showBadge) { """ Launches an asynchronous task to create the notification channel from CleverTap <p/> Use this method when implementing your own FCM/GCM handling mechanism. Refer to the SDK documentation for usage scenarios and examples. @param context A reference to an Android context @param channelId A String for setting the id of the notification channel @param channelName A String for setting the name of the notification channel @param channelDescription A String for setting the description of the notification channel @param importance An Integer value setting the importance of the notifications sent in this channel @param showBadge An boolean value as to whether this channel shows a badge """ final CleverTapAPI instance = getDefaultInstanceOrFirstOther(context); if (instance == null) { Logger.v("No CleverTap Instance found in CleverTapAPI#createNotificatonChannel"); return; } try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { instance.postAsyncSafely("createNotificationChannel", new Runnable() { @RequiresApi(api = Build.VERSION_CODES.O) @Override public void run() { NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); if (notificationManager == null) return; NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, importance); notificationChannel.setDescription(channelDescription); notificationChannel.setShowBadge(showBadge); notificationManager.createNotificationChannel(notificationChannel); instance.getConfigLogger().info(instance.getAccountId(),"Notification channel " + channelName.toString() + " has been created"); } }); } } catch (Throwable t){ instance.getConfigLogger().verbose(instance.getAccountId(),"Failure creating Notification Channel", t); } }
java
@SuppressWarnings("unused") public static void createNotificationChannel(final Context context, final String channelId, final CharSequence channelName, final String channelDescription, final int importance, final boolean showBadge) { final CleverTapAPI instance = getDefaultInstanceOrFirstOther(context); if (instance == null) { Logger.v("No CleverTap Instance found in CleverTapAPI#createNotificatonChannel"); return; } try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { instance.postAsyncSafely("createNotificationChannel", new Runnable() { @RequiresApi(api = Build.VERSION_CODES.O) @Override public void run() { NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); if (notificationManager == null) return; NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, importance); notificationChannel.setDescription(channelDescription); notificationChannel.setShowBadge(showBadge); notificationManager.createNotificationChannel(notificationChannel); instance.getConfigLogger().info(instance.getAccountId(),"Notification channel " + channelName.toString() + " has been created"); } }); } } catch (Throwable t){ instance.getConfigLogger().verbose(instance.getAccountId(),"Failure creating Notification Channel", t); } }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "void", "createNotificationChannel", "(", "final", "Context", "context", ",", "final", "String", "channelId", ",", "final", "CharSequence", "channelName", ",", "final", "String", "channelDescription", ",", "final", "int", "importance", ",", "final", "boolean", "showBadge", ")", "{", "final", "CleverTapAPI", "instance", "=", "getDefaultInstanceOrFirstOther", "(", "context", ")", ";", "if", "(", "instance", "==", "null", ")", "{", "Logger", ".", "v", "(", "\"No CleverTap Instance found in CleverTapAPI#createNotificatonChannel\"", ")", ";", "return", ";", "}", "try", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "O", ")", "{", "instance", ".", "postAsyncSafely", "(", "\"createNotificationChannel\"", ",", "new", "Runnable", "(", ")", "{", "@", "RequiresApi", "(", "api", "=", "Build", ".", "VERSION_CODES", ".", "O", ")", "@", "Override", "public", "void", "run", "(", ")", "{", "NotificationManager", "notificationManager", "=", "(", "NotificationManager", ")", "context", ".", "getSystemService", "(", "NOTIFICATION_SERVICE", ")", ";", "if", "(", "notificationManager", "==", "null", ")", "return", ";", "NotificationChannel", "notificationChannel", "=", "new", "NotificationChannel", "(", "channelId", ",", "channelName", ",", "importance", ")", ";", "notificationChannel", ".", "setDescription", "(", "channelDescription", ")", ";", "notificationChannel", ".", "setShowBadge", "(", "showBadge", ")", ";", "notificationManager", ".", "createNotificationChannel", "(", "notificationChannel", ")", ";", "instance", ".", "getConfigLogger", "(", ")", ".", "info", "(", "instance", ".", "getAccountId", "(", ")", ",", "\"Notification channel \"", "+", "channelName", ".", "toString", "(", ")", "+", "\" has been created\"", ")", ";", "}", "}", ")", ";", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "instance", ".", "getConfigLogger", "(", ")", ".", "verbose", "(", "instance", ".", "getAccountId", "(", ")", ",", "\"Failure creating Notification Channel\"", ",", "t", ")", ";", "}", "}" ]
Launches an asynchronous task to create the notification channel from CleverTap <p/> Use this method when implementing your own FCM/GCM handling mechanism. Refer to the SDK documentation for usage scenarios and examples. @param context A reference to an Android context @param channelId A String for setting the id of the notification channel @param channelName A String for setting the name of the notification channel @param channelDescription A String for setting the description of the notification channel @param importance An Integer value setting the importance of the notifications sent in this channel @param showBadge An boolean value as to whether this channel shows a badge
[ "Launches", "an", "asynchronous", "task", "to", "create", "the", "notification", "channel", "from", "CleverTap", "<p", "/", ">", "Use", "this", "method", "when", "implementing", "your", "own", "FCM", "/", "GCM", "handling", "mechanism", ".", "Refer", "to", "the", "SDK", "documentation", "for", "usage", "scenarios", "and", "examples", "." ]
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java#L5550-L5579
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java
IOManagerAsync.createBlockChannelReader
@Override public BlockChannelReader<MemorySegment> createBlockChannelReader(FileIOChannel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException { """ Creates a block channel reader that reads blocks from the given channel. The reader reads asynchronously, such that a read request is accepted, carried out at some (close) point in time, and the full segment is pushed to the given queue. @param channelID The descriptor for the channel to write to. @param returnQueue The queue to put the full buffers into. @return A block channel reader that reads from the given channel. @throws IOException Thrown, if the channel for the reader could not be opened. """ checkState(!isShutdown.get(), "I/O-Manager is shut down."); return new AsynchronousBlockReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, returnQueue); }
java
@Override public BlockChannelReader<MemorySegment> createBlockChannelReader(FileIOChannel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException { checkState(!isShutdown.get(), "I/O-Manager is shut down."); return new AsynchronousBlockReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, returnQueue); }
[ "@", "Override", "public", "BlockChannelReader", "<", "MemorySegment", ">", "createBlockChannelReader", "(", "FileIOChannel", ".", "ID", "channelID", ",", "LinkedBlockingQueue", "<", "MemorySegment", ">", "returnQueue", ")", "throws", "IOException", "{", "checkState", "(", "!", "isShutdown", ".", "get", "(", ")", ",", "\"I/O-Manager is shut down.\"", ")", ";", "return", "new", "AsynchronousBlockReader", "(", "channelID", ",", "this", ".", "readers", "[", "channelID", ".", "getThreadNum", "(", ")", "]", ".", "requestQueue", ",", "returnQueue", ")", ";", "}" ]
Creates a block channel reader that reads blocks from the given channel. The reader reads asynchronously, such that a read request is accepted, carried out at some (close) point in time, and the full segment is pushed to the given queue. @param channelID The descriptor for the channel to write to. @param returnQueue The queue to put the full buffers into. @return A block channel reader that reads from the given channel. @throws IOException Thrown, if the channel for the reader could not be opened.
[ "Creates", "a", "block", "channel", "reader", "that", "reads", "blocks", "from", "the", "given", "channel", ".", "The", "reader", "reads", "asynchronously", "such", "that", "a", "read", "request", "is", "accepted", "carried", "out", "at", "some", "(", "close", ")", "point", "in", "time", "and", "the", "full", "segment", "is", "pushed", "to", "the", "given", "queue", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java#L220-L226
aws/aws-sdk-java
aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/UpdateUserPoolRequest.java
UpdateUserPoolRequest.withUserPoolTags
public UpdateUserPoolRequest withUserPoolTags(java.util.Map<String, String> userPoolTags) { """ <p> The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria. </p> @param userPoolTags The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together. """ setUserPoolTags(userPoolTags); return this; }
java
public UpdateUserPoolRequest withUserPoolTags(java.util.Map<String, String> userPoolTags) { setUserPoolTags(userPoolTags); return this; }
[ "public", "UpdateUserPoolRequest", "withUserPoolTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "userPoolTags", ")", "{", "setUserPoolTags", "(", "userPoolTags", ")", ";", "return", "this", ";", "}" ]
<p> The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria. </p> @param userPoolTags The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tag", "keys", "and", "values", "to", "assign", "to", "the", "user", "pool", ".", "A", "tag", "is", "a", "label", "that", "you", "can", "use", "to", "categorize", "and", "manage", "user", "pools", "in", "different", "ways", "such", "as", "by", "purpose", "owner", "environment", "or", "other", "criteria", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/UpdateUserPoolRequest.java#L986-L989
app55/app55-java
src/support/java/org/apache/harmony/beans/internal/nls/Messages.java
Messages.getString
static public String getString(String msg, char arg) { """ Retrieves a message which takes 1 character argument. @param msg String the key to look up. @param arg char the character to insert in the formatted output. @return String the message for that key in the system message bundle. """ return getString(msg, new Object[] { String.valueOf(arg) }); }
java
static public String getString(String msg, char arg) { return getString(msg, new Object[] { String.valueOf(arg) }); }
[ "static", "public", "String", "getString", "(", "String", "msg", ",", "char", "arg", ")", "{", "return", "getString", "(", "msg", ",", "new", "Object", "[", "]", "{", "String", ".", "valueOf", "(", "arg", ")", "}", ")", ";", "}" ]
Retrieves a message which takes 1 character argument. @param msg String the key to look up. @param arg char the character to insert in the formatted output. @return String the message for that key in the system message bundle.
[ "Retrieves", "a", "message", "which", "takes", "1", "character", "argument", "." ]
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/org/apache/harmony/beans/internal/nls/Messages.java#L103-L106
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceFormatter.java
BaseTraceFormatter.messageLogFormat
public String messageLogFormat(LogRecord logRecord, String formattedVerboseMsg) { """ The messages log always uses the same/enhanced format, and relies on already formatted messages. This does the formatting needed to take a message suitable for console.log and wrap it to fit into messages.log. @param logRecord @param formattedVerboseMsg the result of {@link #formatVerboseMessage} @return Formatted string for messages.log """ // This is a very light trace format, based on enhanced: StringBuilder sb = new StringBuilder(256); String sym = getMarker(logRecord); String name = nonNullString(logRecord.getLoggerName(), logRecord.getSourceClassName()); sb.append('[').append(DateFormatHelper.formatTime(logRecord.getMillis(), useIsoDateFormat)).append("] "); sb.append(DataFormatHelper.getThreadId()).append(' '); formatFixedString(sb, name, enhancedNameLength); sb.append(sym); // sym has built-in padding sb.append(formattedVerboseMsg); if (logRecord.getThrown() != null) { String stackTrace = getStackTrace(logRecord); if (stackTrace != null) sb.append(LoggingConstants.nl).append(stackTrace); } return sb.toString(); }
java
public String messageLogFormat(LogRecord logRecord, String formattedVerboseMsg) { // This is a very light trace format, based on enhanced: StringBuilder sb = new StringBuilder(256); String sym = getMarker(logRecord); String name = nonNullString(logRecord.getLoggerName(), logRecord.getSourceClassName()); sb.append('[').append(DateFormatHelper.formatTime(logRecord.getMillis(), useIsoDateFormat)).append("] "); sb.append(DataFormatHelper.getThreadId()).append(' '); formatFixedString(sb, name, enhancedNameLength); sb.append(sym); // sym has built-in padding sb.append(formattedVerboseMsg); if (logRecord.getThrown() != null) { String stackTrace = getStackTrace(logRecord); if (stackTrace != null) sb.append(LoggingConstants.nl).append(stackTrace); } return sb.toString(); }
[ "public", "String", "messageLogFormat", "(", "LogRecord", "logRecord", ",", "String", "formattedVerboseMsg", ")", "{", "// This is a very light trace format, based on enhanced:", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "256", ")", ";", "String", "sym", "=", "getMarker", "(", "logRecord", ")", ";", "String", "name", "=", "nonNullString", "(", "logRecord", ".", "getLoggerName", "(", ")", ",", "logRecord", ".", "getSourceClassName", "(", ")", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ".", "append", "(", "DateFormatHelper", ".", "formatTime", "(", "logRecord", ".", "getMillis", "(", ")", ",", "useIsoDateFormat", ")", ")", ".", "append", "(", "\"] \"", ")", ";", "sb", ".", "append", "(", "DataFormatHelper", ".", "getThreadId", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "formatFixedString", "(", "sb", ",", "name", ",", "enhancedNameLength", ")", ";", "sb", ".", "append", "(", "sym", ")", ";", "// sym has built-in padding", "sb", ".", "append", "(", "formattedVerboseMsg", ")", ";", "if", "(", "logRecord", ".", "getThrown", "(", ")", "!=", "null", ")", "{", "String", "stackTrace", "=", "getStackTrace", "(", "logRecord", ")", ";", "if", "(", "stackTrace", "!=", "null", ")", "sb", ".", "append", "(", "LoggingConstants", ".", "nl", ")", ".", "append", "(", "stackTrace", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
The messages log always uses the same/enhanced format, and relies on already formatted messages. This does the formatting needed to take a message suitable for console.log and wrap it to fit into messages.log. @param logRecord @param formattedVerboseMsg the result of {@link #formatVerboseMessage} @return Formatted string for messages.log
[ "The", "messages", "log", "always", "uses", "the", "same", "/", "enhanced", "format", "and", "relies", "on", "already", "formatted", "messages", ".", "This", "does", "the", "formatting", "needed", "to", "take", "a", "message", "suitable", "for", "console", ".", "log", "and", "wrap", "it", "to", "fit", "into", "messages", ".", "log", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceFormatter.java#L458-L477
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/taglib/ImageTagUtils.java
ImageTagUtils.getImageUrl
public static String getImageUrl(String imgSrc, PageContext pageContext) { """ Sames as its counterpart, only meant to be used as a JSP EL function. @param imgSrc the image path @param pageContext the page context @return the image URL """ BinaryResourcesHandler imgRsHandler = (BinaryResourcesHandler) pageContext.getServletContext() .getAttribute(JawrConstant.BINARY_CONTEXT_ATTRIBUTE); if (null == imgRsHandler) throw new JawrLinkRenderingException( "You are using a Jawr image tag while the Jawr Image servlet has not been initialized. Initialization of Jawr Image servlet either failed or never occurred."); HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); return getImageUrl(imgSrc, imgRsHandler, request, response); }
java
public static String getImageUrl(String imgSrc, PageContext pageContext) { BinaryResourcesHandler imgRsHandler = (BinaryResourcesHandler) pageContext.getServletContext() .getAttribute(JawrConstant.BINARY_CONTEXT_ATTRIBUTE); if (null == imgRsHandler) throw new JawrLinkRenderingException( "You are using a Jawr image tag while the Jawr Image servlet has not been initialized. Initialization of Jawr Image servlet either failed or never occurred."); HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); return getImageUrl(imgSrc, imgRsHandler, request, response); }
[ "public", "static", "String", "getImageUrl", "(", "String", "imgSrc", ",", "PageContext", "pageContext", ")", "{", "BinaryResourcesHandler", "imgRsHandler", "=", "(", "BinaryResourcesHandler", ")", "pageContext", ".", "getServletContext", "(", ")", ".", "getAttribute", "(", "JawrConstant", ".", "BINARY_CONTEXT_ATTRIBUTE", ")", ";", "if", "(", "null", "==", "imgRsHandler", ")", "throw", "new", "JawrLinkRenderingException", "(", "\"You are using a Jawr image tag while the Jawr Image servlet has not been initialized. Initialization of Jawr Image servlet either failed or never occurred.\"", ")", ";", "HttpServletResponse", "response", "=", "(", "HttpServletResponse", ")", "pageContext", ".", "getResponse", "(", ")", ";", "HttpServletRequest", "request", "=", "(", "HttpServletRequest", ")", "pageContext", ".", "getRequest", "(", ")", ";", "return", "getImageUrl", "(", "imgSrc", ",", "imgRsHandler", ",", "request", ",", "response", ")", ";", "}" ]
Sames as its counterpart, only meant to be used as a JSP EL function. @param imgSrc the image path @param pageContext the page context @return the image URL
[ "Sames", "as", "its", "counterpart", "only", "meant", "to", "be", "used", "as", "a", "JSP", "EL", "function", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/taglib/ImageTagUtils.java#L180-L193
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getVersionColumns
@Override public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { """ Retrieves a description of a table's columns that are automatically updated when any value in a row is updated. """ checkClosed(); throw SQLError.noSupport(); }
java
@Override public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "ResultSet", "getVersionColumns", "(", "String", "catalog", ",", "String", "schema", ",", "String", "table", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Retrieves a description of a table's columns that are automatically updated when any value in a row is updated.
[ "Retrieves", "a", "description", "of", "a", "table", "s", "columns", "that", "are", "automatically", "updated", "when", "any", "value", "in", "a", "row", "is", "updated", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L926-L931
salesforce/Argus
ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java
AlertService.updateNotification
public Notification updateNotification(BigInteger alertId, BigInteger notificationId, Notification notification) throws IOException, TokenExpiredException { """ Updates an existing notification. @param alertId The ID of the alert that owns the notification. @param notificationId The ID of the notification to update. @param notification The updated notification information. @return The updated notification. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired """ String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications/" + notificationId.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, notification); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Notification.class); }
java
public Notification updateNotification(BigInteger alertId, BigInteger notificationId, Notification notification) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications/" + notificationId.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, notification); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Notification.class); }
[ "public", "Notification", "updateNotification", "(", "BigInteger", "alertId", ",", "BigInteger", "notificationId", ",", "Notification", "notification", ")", "throws", "IOException", ",", "TokenExpiredException", "{", "String", "requestUrl", "=", "RESOURCE", "+", "\"/\"", "+", "alertId", ".", "toString", "(", ")", "+", "\"/notifications/\"", "+", "notificationId", ".", "toString", "(", ")", ";", "ArgusResponse", "response", "=", "getClient", "(", ")", ".", "executeHttpRequest", "(", "ArgusHttpClient", ".", "RequestType", ".", "PUT", ",", "requestUrl", ",", "notification", ")", ";", "assertValidResponse", "(", "response", ",", "requestUrl", ")", ";", "return", "fromJson", "(", "response", ".", "getResult", "(", ")", ",", "Notification", ".", "class", ")", ";", "}" ]
Updates an existing notification. @param alertId The ID of the alert that owns the notification. @param notificationId The ID of the notification to update. @param notification The updated notification information. @return The updated notification. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired
[ "Updates", "an", "existing", "notification", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L297-L303
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java
GeneratedDi18nDaoImpl.queryByKey
public Iterable<Di18n> queryByKey(java.lang.String key) { """ query-by method for field key @param key the specified attribute @return an Iterable of Di18ns for the specified key """ return queryByField(null, Di18nMapper.Field.KEY.getFieldName(), key); }
java
public Iterable<Di18n> queryByKey(java.lang.String key) { return queryByField(null, Di18nMapper.Field.KEY.getFieldName(), key); }
[ "public", "Iterable", "<", "Di18n", ">", "queryByKey", "(", "java", ".", "lang", ".", "String", "key", ")", "{", "return", "queryByField", "(", "null", ",", "Di18nMapper", ".", "Field", ".", "KEY", ".", "getFieldName", "(", ")", ",", "key", ")", ";", "}" ]
query-by method for field key @param key the specified attribute @return an Iterable of Di18ns for the specified key
[ "query", "-", "by", "method", "for", "field", "key" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java#L70-L72
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.waitForHintText
public void waitForHintText(String hintText, int timeout) throws Exception { """ Waits for hint text to appear in an EditText @param hintText text to wait for @param timeout amount of time to wait """ int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for(int i=0; i < retryNum; i++) { ArrayList<View> imageViews = getCustomViews("EditText"); for(View v: imageViews) { if(((EditText)v).getHint() == null) continue; if(((EditText)v).getHint().equals(hintText) && v.getVisibility() == View.VISIBLE) return; } this.sleep(RETRY_PERIOD); } throw new Exception(String.format("Splash screen didn't disappear after %d ms", timeout)); }
java
public void waitForHintText(String hintText, int timeout) throws Exception { int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for(int i=0; i < retryNum; i++) { ArrayList<View> imageViews = getCustomViews("EditText"); for(View v: imageViews) { if(((EditText)v).getHint() == null) continue; if(((EditText)v).getHint().equals(hintText) && v.getVisibility() == View.VISIBLE) return; } this.sleep(RETRY_PERIOD); } throw new Exception(String.format("Splash screen didn't disappear after %d ms", timeout)); }
[ "public", "void", "waitForHintText", "(", "String", "hintText", ",", "int", "timeout", ")", "throws", "Exception", "{", "int", "RETRY_PERIOD", "=", "250", ";", "int", "retryNum", "=", "timeout", "/", "RETRY_PERIOD", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "retryNum", ";", "i", "++", ")", "{", "ArrayList", "<", "View", ">", "imageViews", "=", "getCustomViews", "(", "\"EditText\"", ")", ";", "for", "(", "View", "v", ":", "imageViews", ")", "{", "if", "(", "(", "(", "EditText", ")", "v", ")", ".", "getHint", "(", ")", "==", "null", ")", "continue", ";", "if", "(", "(", "(", "EditText", ")", "v", ")", ".", "getHint", "(", ")", ".", "equals", "(", "hintText", ")", "&&", "v", ".", "getVisibility", "(", ")", "==", "View", ".", "VISIBLE", ")", "return", ";", "}", "this", ".", "sleep", "(", "RETRY_PERIOD", ")", ";", "}", "throw", "new", "Exception", "(", "String", ".", "format", "(", "\"Splash screen didn't disappear after %d ms\"", ",", "timeout", ")", ")", ";", "}" ]
Waits for hint text to appear in an EditText @param hintText text to wait for @param timeout amount of time to wait
[ "Waits", "for", "hint", "text", "to", "appear", "in", "an", "EditText" ]
train
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L248-L267
prolificinteractive/material-calendarview
library/src/main/java/com/prolificinteractive/materialcalendarview/CalendarDay.java
CalendarDay.isInRange
public boolean isInRange(@Nullable CalendarDay minDate, @Nullable CalendarDay maxDate) { """ Determine if this day is within a specified range @param minDate the earliest day, may be null @param maxDate the latest day, may be null @return true if the between (inclusive) the min and max dates. """ return !(minDate != null && minDate.isAfter(this)) && !(maxDate != null && maxDate.isBefore(this)); }
java
public boolean isInRange(@Nullable CalendarDay minDate, @Nullable CalendarDay maxDate) { return !(minDate != null && minDate.isAfter(this)) && !(maxDate != null && maxDate.isBefore(this)); }
[ "public", "boolean", "isInRange", "(", "@", "Nullable", "CalendarDay", "minDate", ",", "@", "Nullable", "CalendarDay", "maxDate", ")", "{", "return", "!", "(", "minDate", "!=", "null", "&&", "minDate", ".", "isAfter", "(", "this", ")", ")", "&&", "!", "(", "maxDate", "!=", "null", "&&", "maxDate", ".", "isBefore", "(", "this", ")", ")", ";", "}" ]
Determine if this day is within a specified range @param minDate the earliest day, may be null @param maxDate the latest day, may be null @return true if the between (inclusive) the min and max dates.
[ "Determine", "if", "this", "day", "is", "within", "a", "specified", "range" ]
train
https://github.com/prolificinteractive/material-calendarview/blob/04fae8175fd034d0a7131f8cb253cae883a88aa2/library/src/main/java/com/prolificinteractive/materialcalendarview/CalendarDay.java#L112-L115
oboehm/jfachwert
src/main/java/de/jfachwert/bank/Waehrung.java
Waehrung.toCurrency
public static Currency toCurrency(String name) { """ Ermittelt aus dem uebergebenen String die entsprechende {@link Currency}. @param name z.B. "EUR" oder auch ein einzelnes Symbol @return die entsprechende Waehrung """ try { return Currency.getInstance(name); } catch (IllegalArgumentException iae) { if (name.length() <= 3) { for (Currency c : Currency.getAvailableCurrencies()) { if (matchesCurrency(name, c)) { return c; } } } return toFallbackCurrency(name, iae); } }
java
public static Currency toCurrency(String name) { try { return Currency.getInstance(name); } catch (IllegalArgumentException iae) { if (name.length() <= 3) { for (Currency c : Currency.getAvailableCurrencies()) { if (matchesCurrency(name, c)) { return c; } } } return toFallbackCurrency(name, iae); } }
[ "public", "static", "Currency", "toCurrency", "(", "String", "name", ")", "{", "try", "{", "return", "Currency", ".", "getInstance", "(", "name", ")", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "if", "(", "name", ".", "length", "(", ")", "<=", "3", ")", "{", "for", "(", "Currency", "c", ":", "Currency", ".", "getAvailableCurrencies", "(", ")", ")", "{", "if", "(", "matchesCurrency", "(", "name", ",", "c", ")", ")", "{", "return", "c", ";", "}", "}", "}", "return", "toFallbackCurrency", "(", "name", ",", "iae", ")", ";", "}", "}" ]
Ermittelt aus dem uebergebenen String die entsprechende {@link Currency}. @param name z.B. "EUR" oder auch ein einzelnes Symbol @return die entsprechende Waehrung
[ "Ermittelt", "aus", "dem", "uebergebenen", "String", "die", "entsprechende", "{", "@link", "Currency", "}", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Waehrung.java#L118-L131
tvesalainen/util
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
ChannelHelper.read
public static final long read(ReadableByteChannel channel, ByteBuffer[] dsts, int offset, int length) throws IOException { """ ScatteringChannel support @param channel @param dsts @param offset @param length @return @throws IOException """ long res = 0; for (int ii=0;ii<length;ii++) { ByteBuffer bb = dsts[ii+offset]; if (bb.hasRemaining()) { int rc = channel.read(bb); if (rc == -1) { if (res == 0) { return -1; } else { return res; } } res += rc; if (bb.hasRemaining()) { break; } } } return res; }
java
public static final long read(ReadableByteChannel channel, ByteBuffer[] dsts, int offset, int length) throws IOException { long res = 0; for (int ii=0;ii<length;ii++) { ByteBuffer bb = dsts[ii+offset]; if (bb.hasRemaining()) { int rc = channel.read(bb); if (rc == -1) { if (res == 0) { return -1; } else { return res; } } res += rc; if (bb.hasRemaining()) { break; } } } return res; }
[ "public", "static", "final", "long", "read", "(", "ReadableByteChannel", "channel", ",", "ByteBuffer", "[", "]", "dsts", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "long", "res", "=", "0", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "length", ";", "ii", "++", ")", "{", "ByteBuffer", "bb", "=", "dsts", "[", "ii", "+", "offset", "]", ";", "if", "(", "bb", ".", "hasRemaining", "(", ")", ")", "{", "int", "rc", "=", "channel", ".", "read", "(", "bb", ")", ";", "if", "(", "rc", "==", "-", "1", ")", "{", "if", "(", "res", "==", "0", ")", "{", "return", "-", "1", ";", "}", "else", "{", "return", "res", ";", "}", "}", "res", "+=", "rc", ";", "if", "(", "bb", ".", "hasRemaining", "(", ")", ")", "{", "break", ";", "}", "}", "}", "return", "res", ";", "}" ]
ScatteringChannel support @param channel @param dsts @param offset @param length @return @throws IOException
[ "ScatteringChannel", "support" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L187-L215
jenkinsci/jenkins
core/src/main/java/hudson/model/ParametersAction.java
ParametersAction.substitute
public String substitute(AbstractBuild<?,?> build, String text) { """ Performs a variable substitution to the given text and return it. """ return Util.replaceMacro(text,createVariableResolver(build)); }
java
public String substitute(AbstractBuild<?,?> build, String text) { return Util.replaceMacro(text,createVariableResolver(build)); }
[ "public", "String", "substitute", "(", "AbstractBuild", "<", "?", ",", "?", ">", "build", ",", "String", "text", ")", "{", "return", "Util", ".", "replaceMacro", "(", "text", ",", "createVariableResolver", "(", "build", ")", ")", ";", "}" ]
Performs a variable substitution to the given text and return it.
[ "Performs", "a", "variable", "substitution", "to", "the", "given", "text", "and", "return", "it", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ParametersAction.java#L154-L156
alkacon/opencms-core
src/org/opencms/xml/CmsXmlContentDefinition.java
CmsXmlContentDefinition.findSchemaTypesForPath
public boolean findSchemaTypesForPath(String path, BiConsumer<I_CmsXmlSchemaType, String> consumer) { """ Iterates over all schema types along a given xpath, starting from a root content definition.<p> @param path the path @param consumer a handler that consumes both the schema type and the remaining suffix of the path, relative to the schema type @return true if for all path components a schema type could be found """ path = CmsXmlUtils.removeAllXpathIndices(path); List<String> pathComponents = CmsXmlUtils.splitXpath(path); List<I_CmsXmlSchemaType> result = new ArrayList<>(); CmsXmlContentDefinition currentContentDef = this; for (int i = 0; i < pathComponents.size(); i++) { String pathComponent = pathComponents.get(i); if (currentContentDef == null) { return false; } I_CmsXmlSchemaType schemaType = currentContentDef.getSchemaType(pathComponent); if (schemaType == null) { return false; } else { String remainingPath = CmsStringUtil.listAsString( pathComponents.subList(i + 1, pathComponents.size()), "/"); consumer.accept(schemaType, remainingPath); result.add(schemaType); if (schemaType instanceof CmsXmlNestedContentDefinition) { currentContentDef = ((CmsXmlNestedContentDefinition)schemaType).getNestedContentDefinition(); } else { currentContentDef = null; // } } } return true; }
java
public boolean findSchemaTypesForPath(String path, BiConsumer<I_CmsXmlSchemaType, String> consumer) { path = CmsXmlUtils.removeAllXpathIndices(path); List<String> pathComponents = CmsXmlUtils.splitXpath(path); List<I_CmsXmlSchemaType> result = new ArrayList<>(); CmsXmlContentDefinition currentContentDef = this; for (int i = 0; i < pathComponents.size(); i++) { String pathComponent = pathComponents.get(i); if (currentContentDef == null) { return false; } I_CmsXmlSchemaType schemaType = currentContentDef.getSchemaType(pathComponent); if (schemaType == null) { return false; } else { String remainingPath = CmsStringUtil.listAsString( pathComponents.subList(i + 1, pathComponents.size()), "/"); consumer.accept(schemaType, remainingPath); result.add(schemaType); if (schemaType instanceof CmsXmlNestedContentDefinition) { currentContentDef = ((CmsXmlNestedContentDefinition)schemaType).getNestedContentDefinition(); } else { currentContentDef = null; // } } } return true; }
[ "public", "boolean", "findSchemaTypesForPath", "(", "String", "path", ",", "BiConsumer", "<", "I_CmsXmlSchemaType", ",", "String", ">", "consumer", ")", "{", "path", "=", "CmsXmlUtils", ".", "removeAllXpathIndices", "(", "path", ")", ";", "List", "<", "String", ">", "pathComponents", "=", "CmsXmlUtils", ".", "splitXpath", "(", "path", ")", ";", "List", "<", "I_CmsXmlSchemaType", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "CmsXmlContentDefinition", "currentContentDef", "=", "this", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pathComponents", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "pathComponent", "=", "pathComponents", ".", "get", "(", "i", ")", ";", "if", "(", "currentContentDef", "==", "null", ")", "{", "return", "false", ";", "}", "I_CmsXmlSchemaType", "schemaType", "=", "currentContentDef", ".", "getSchemaType", "(", "pathComponent", ")", ";", "if", "(", "schemaType", "==", "null", ")", "{", "return", "false", ";", "}", "else", "{", "String", "remainingPath", "=", "CmsStringUtil", ".", "listAsString", "(", "pathComponents", ".", "subList", "(", "i", "+", "1", ",", "pathComponents", ".", "size", "(", ")", ")", ",", "\"/\"", ")", ";", "consumer", ".", "accept", "(", "schemaType", ",", "remainingPath", ")", ";", "result", ".", "add", "(", "schemaType", ")", ";", "if", "(", "schemaType", "instanceof", "CmsXmlNestedContentDefinition", ")", "{", "currentContentDef", "=", "(", "(", "CmsXmlNestedContentDefinition", ")", "schemaType", ")", ".", "getNestedContentDefinition", "(", ")", ";", "}", "else", "{", "currentContentDef", "=", "null", ";", "//", "}", "}", "}", "return", "true", ";", "}" ]
Iterates over all schema types along a given xpath, starting from a root content definition.<p> @param path the path @param consumer a handler that consumes both the schema type and the remaining suffix of the path, relative to the schema type @return true if for all path components a schema type could be found
[ "Iterates", "over", "all", "schema", "types", "along", "a", "given", "xpath", "starting", "from", "a", "root", "content", "definition", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentDefinition.java#L1278-L1307
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java
ProjectTreeController.addCalendarException
private void addCalendarException(MpxjTreeNode parentNode, final ProjectCalendarException exception) { """ Add an exception to a calendar. @param parentNode parent node @param exception calendar exceptions """ MpxjTreeNode exceptionNode = new MpxjTreeNode(exception, CALENDAR_EXCEPTION_EXCLUDED_METHODS) { @Override public String toString() { return m_dateFormat.format(exception.getFromDate()); } }; parentNode.add(exceptionNode); addHours(exceptionNode, exception); }
java
private void addCalendarException(MpxjTreeNode parentNode, final ProjectCalendarException exception) { MpxjTreeNode exceptionNode = new MpxjTreeNode(exception, CALENDAR_EXCEPTION_EXCLUDED_METHODS) { @Override public String toString() { return m_dateFormat.format(exception.getFromDate()); } }; parentNode.add(exceptionNode); addHours(exceptionNode, exception); }
[ "private", "void", "addCalendarException", "(", "MpxjTreeNode", "parentNode", ",", "final", "ProjectCalendarException", "exception", ")", "{", "MpxjTreeNode", "exceptionNode", "=", "new", "MpxjTreeNode", "(", "exception", ",", "CALENDAR_EXCEPTION_EXCLUDED_METHODS", ")", "{", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "m_dateFormat", ".", "format", "(", "exception", ".", "getFromDate", "(", ")", ")", ";", "}", "}", ";", "parentNode", ".", "add", "(", "exceptionNode", ")", ";", "addHours", "(", "exceptionNode", ",", "exception", ")", ";", "}" ]
Add an exception to a calendar. @param parentNode parent node @param exception calendar exceptions
[ "Add", "an", "exception", "to", "a", "calendar", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L333-L344
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.beginResetSharedKeyAsync
public Observable<ConnectionResetSharedKeyInner> beginResetSharedKeyAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) { """ The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The virtual network gateway connection reset shared key Name. @param keyLength The virtual network connection reset shared key length, should between 1 and 128. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ConnectionResetSharedKeyInner object """ return beginResetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, keyLength).map(new Func1<ServiceResponse<ConnectionResetSharedKeyInner>, ConnectionResetSharedKeyInner>() { @Override public ConnectionResetSharedKeyInner call(ServiceResponse<ConnectionResetSharedKeyInner> response) { return response.body(); } }); }
java
public Observable<ConnectionResetSharedKeyInner> beginResetSharedKeyAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) { return beginResetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, keyLength).map(new Func1<ServiceResponse<ConnectionResetSharedKeyInner>, ConnectionResetSharedKeyInner>() { @Override public ConnectionResetSharedKeyInner call(ServiceResponse<ConnectionResetSharedKeyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ConnectionResetSharedKeyInner", ">", "beginResetSharedKeyAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "int", "keyLength", ")", "{", "return", "beginResetSharedKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayConnectionName", ",", "keyLength", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ConnectionResetSharedKeyInner", ">", ",", "ConnectionResetSharedKeyInner", ">", "(", ")", "{", "@", "Override", "public", "ConnectionResetSharedKeyInner", "call", "(", "ServiceResponse", "<", "ConnectionResetSharedKeyInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The virtual network gateway connection reset shared key Name. @param keyLength The virtual network connection reset shared key length, should between 1 and 128. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ConnectionResetSharedKeyInner object
[ "The", "VirtualNetworkGatewayConnectionResetSharedKey", "operation", "resets", "the", "virtual", "network", "gateway", "connection", "shared", "key", "for", "passed", "virtual", "network", "gateway", "connection", "in", "the", "specified", "resource", "group", "through", "Network", "resource", "provider", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L1323-L1330
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/boosting/WaggingNormal.java
WaggingNormal.setMean
public void setMean(double mean) { """ Sets the mean value used for the normal distribution @param mean the new mean value """ if(Double.isInfinite(mean) || Double.isNaN(mean)) throw new ArithmeticException("Mean must be a real number, not " + mean); ((Normal)getDistribution()).setMean(mean); }
java
public void setMean(double mean) { if(Double.isInfinite(mean) || Double.isNaN(mean)) throw new ArithmeticException("Mean must be a real number, not " + mean); ((Normal)getDistribution()).setMean(mean); }
[ "public", "void", "setMean", "(", "double", "mean", ")", "{", "if", "(", "Double", ".", "isInfinite", "(", "mean", ")", "||", "Double", ".", "isNaN", "(", "mean", ")", ")", "throw", "new", "ArithmeticException", "(", "\"Mean must be a real number, not \"", "+", "mean", ")", ";", "(", "(", "Normal", ")", "getDistribution", "(", ")", ")", ".", "setMean", "(", "mean", ")", ";", "}" ]
Sets the mean value used for the normal distribution @param mean the new mean value
[ "Sets", "the", "mean", "value", "used", "for", "the", "normal", "distribution" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/boosting/WaggingNormal.java#L66-L71
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java
VariantMetadataManager.removeIndividual
public void removeIndividual(String individualId, String studyId) { """ Remove an individual (from individual ID) of a given variant study metadata (from study ID). @param individualId Individual ID @param studyId Study ID """ // Sanity check if (StringUtils.isEmpty(individualId)) { logger.error("Individual ID {} is null or empty.", individualId); return; } VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId); if (variantStudyMetadata == null) { logger.error("Study not found. Check your study ID: '{}'", studyId); return; } if (variantStudyMetadata.getIndividuals() != null) { for (int i = 0; i < variantStudyMetadata.getIndividuals().size(); i++) { if (individualId.equals(variantStudyMetadata.getIndividuals().get(i).getId())) { variantStudyMetadata.getIndividuals().remove(i); return; } } } }
java
public void removeIndividual(String individualId, String studyId) { // Sanity check if (StringUtils.isEmpty(individualId)) { logger.error("Individual ID {} is null or empty.", individualId); return; } VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId); if (variantStudyMetadata == null) { logger.error("Study not found. Check your study ID: '{}'", studyId); return; } if (variantStudyMetadata.getIndividuals() != null) { for (int i = 0; i < variantStudyMetadata.getIndividuals().size(); i++) { if (individualId.equals(variantStudyMetadata.getIndividuals().get(i).getId())) { variantStudyMetadata.getIndividuals().remove(i); return; } } } }
[ "public", "void", "removeIndividual", "(", "String", "individualId", ",", "String", "studyId", ")", "{", "// Sanity check", "if", "(", "StringUtils", ".", "isEmpty", "(", "individualId", ")", ")", "{", "logger", ".", "error", "(", "\"Individual ID {} is null or empty.\"", ",", "individualId", ")", ";", "return", ";", "}", "VariantStudyMetadata", "variantStudyMetadata", "=", "getVariantStudyMetadata", "(", "studyId", ")", ";", "if", "(", "variantStudyMetadata", "==", "null", ")", "{", "logger", ".", "error", "(", "\"Study not found. Check your study ID: '{}'\"", ",", "studyId", ")", ";", "return", ";", "}", "if", "(", "variantStudyMetadata", ".", "getIndividuals", "(", ")", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "variantStudyMetadata", ".", "getIndividuals", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "individualId", ".", "equals", "(", "variantStudyMetadata", ".", "getIndividuals", "(", ")", ".", "get", "(", "i", ")", ".", "getId", "(", ")", ")", ")", "{", "variantStudyMetadata", ".", "getIndividuals", "(", ")", ".", "remove", "(", "i", ")", ";", "return", ";", "}", "}", "}", "}" ]
Remove an individual (from individual ID) of a given variant study metadata (from study ID). @param individualId Individual ID @param studyId Study ID
[ "Remove", "an", "individual", "(", "from", "individual", "ID", ")", "of", "a", "given", "variant", "study", "metadata", "(", "from", "study", "ID", ")", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java#L372-L392
Whiley/WhileyCompiler
src/main/java/wyil/util/AbstractTypedVisitor.java
AbstractTypedVisitor.selectReference
public Type.Reference selectReference(Type target, Expr expr, Environment environment) { """ <p> Given an arbitrary target type, filter out the target reference types. For example, consider the following method: </p> <pre> method f(int x): &int|null xs = new(x) ... </pre> <p> When type checking the expression <code>new(x)</code> the flow type checker will attempt to determine an <i>expected</i> reference type. In order to then determine the appropriate expected type for element expression <code>x</code> it filters <code>&int|null</code> down to just <code>&int</code>. </p> @param target Target type for this value @param expr Source expression for this value @author David J. Pearce """ Type.Reference type = asType(expr.getType(), Type.Reference.class); Type.Reference[] references = TYPE_REFERENCE_FILTER.apply(target); return selectCandidate(references, type, environment); }
java
public Type.Reference selectReference(Type target, Expr expr, Environment environment) { Type.Reference type = asType(expr.getType(), Type.Reference.class); Type.Reference[] references = TYPE_REFERENCE_FILTER.apply(target); return selectCandidate(references, type, environment); }
[ "public", "Type", ".", "Reference", "selectReference", "(", "Type", "target", ",", "Expr", "expr", ",", "Environment", "environment", ")", "{", "Type", ".", "Reference", "type", "=", "asType", "(", "expr", ".", "getType", "(", ")", ",", "Type", ".", "Reference", ".", "class", ")", ";", "Type", ".", "Reference", "[", "]", "references", "=", "TYPE_REFERENCE_FILTER", ".", "apply", "(", "target", ")", ";", "return", "selectCandidate", "(", "references", ",", "type", ",", "environment", ")", ";", "}" ]
<p> Given an arbitrary target type, filter out the target reference types. For example, consider the following method: </p> <pre> method f(int x): &int|null xs = new(x) ... </pre> <p> When type checking the expression <code>new(x)</code> the flow type checker will attempt to determine an <i>expected</i> reference type. In order to then determine the appropriate expected type for element expression <code>x</code> it filters <code>&int|null</code> down to just <code>&int</code>. </p> @param target Target type for this value @param expr Source expression for this value @author David J. Pearce
[ "<p", ">", "Given", "an", "arbitrary", "target", "type", "filter", "out", "the", "target", "reference", "types", ".", "For", "example", "consider", "the", "following", "method", ":", "<", "/", "p", ">" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/util/AbstractTypedVisitor.java#L1173-L1177
jpaoletti/java-presentation-manager
modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/actions/ActionSupport.java
ActionSupport.jSONSuccess
protected void jSONSuccess(PMStrutsContext ctx, Object object) throws PMForwardException { """ Just a helper to return a serialized object with jSON. Specially useful dealing with encoding problems """ final String toJson = new Gson().toJson(object); ctx.put(PM_VOID_TEXT, toJson); success(ctx, "converters/void.jsp", false); }
java
protected void jSONSuccess(PMStrutsContext ctx, Object object) throws PMForwardException { final String toJson = new Gson().toJson(object); ctx.put(PM_VOID_TEXT, toJson); success(ctx, "converters/void.jsp", false); }
[ "protected", "void", "jSONSuccess", "(", "PMStrutsContext", "ctx", ",", "Object", "object", ")", "throws", "PMForwardException", "{", "final", "String", "toJson", "=", "new", "Gson", "(", ")", ".", "toJson", "(", "object", ")", ";", "ctx", ".", "put", "(", "PM_VOID_TEXT", ",", "toJson", ")", ";", "success", "(", "ctx", ",", "\"converters/void.jsp\"", ",", "false", ")", ";", "}" ]
Just a helper to return a serialized object with jSON. Specially useful dealing with encoding problems
[ "Just", "a", "helper", "to", "return", "a", "serialized", "object", "with", "jSON", "." ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/actions/ActionSupport.java#L144-L148
julianhyde/quidem
src/main/java/net/hydromatic/quidem/Launcher.java
Launcher.main2
static int main2(PrintWriter out, PrintWriter err, List<String> args) { """ Creates a launcher, parses command line arguments, and runs Quidem. <p>Similar to a {@code main} method, but never calls {@link System#exit(int)}. @param out Writer to which to print output @param args Command-line arguments @return Operating system error code (0 = success, 1 = invalid arguments, 2 = other error) """ try { final Launcher launcher = new Launcher(args, out); final Quidem quidem; try { quidem = launcher.parse(); } catch (ParseException e) { return e.code; } quidem.execute(); return 0; } catch (Throwable e) { out.flush(); e.printStackTrace(err); return 2; } finally { out.flush(); err.flush(); } }
java
static int main2(PrintWriter out, PrintWriter err, List<String> args) { try { final Launcher launcher = new Launcher(args, out); final Quidem quidem; try { quidem = launcher.parse(); } catch (ParseException e) { return e.code; } quidem.execute(); return 0; } catch (Throwable e) { out.flush(); e.printStackTrace(err); return 2; } finally { out.flush(); err.flush(); } }
[ "static", "int", "main2", "(", "PrintWriter", "out", ",", "PrintWriter", "err", ",", "List", "<", "String", ">", "args", ")", "{", "try", "{", "final", "Launcher", "launcher", "=", "new", "Launcher", "(", "args", ",", "out", ")", ";", "final", "Quidem", "quidem", ";", "try", "{", "quidem", "=", "launcher", ".", "parse", "(", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "return", "e", ".", "code", ";", "}", "quidem", ".", "execute", "(", ")", ";", "return", "0", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "out", ".", "flush", "(", ")", ";", "e", ".", "printStackTrace", "(", "err", ")", ";", "return", "2", ";", "}", "finally", "{", "out", ".", "flush", "(", ")", ";", "err", ".", "flush", "(", ")", ";", "}", "}" ]
Creates a launcher, parses command line arguments, and runs Quidem. <p>Similar to a {@code main} method, but never calls {@link System#exit(int)}. @param out Writer to which to print output @param args Command-line arguments @return Operating system error code (0 = success, 1 = invalid arguments, 2 = other error)
[ "Creates", "a", "launcher", "parses", "command", "line", "arguments", "and", "runs", "Quidem", "." ]
train
https://github.com/julianhyde/quidem/blob/43dae9a1a181a03ed877adf5d612255ce2052972/src/main/java/net/hydromatic/quidem/Launcher.java#L75-L94
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/GroupsApi.java
GroupsApi.listGroupUsers
public UsersResponse listGroupUsers(String accountId, String groupId) throws ApiException { """ Gets a list of users in a group. Retrieves a list of users in a group. @param accountId The external account number (int) or account ID Guid. (required) @param groupId The ID of the group being accessed. (required) @return UsersResponse """ return listGroupUsers(accountId, groupId, null); }
java
public UsersResponse listGroupUsers(String accountId, String groupId) throws ApiException { return listGroupUsers(accountId, groupId, null); }
[ "public", "UsersResponse", "listGroupUsers", "(", "String", "accountId", ",", "String", "groupId", ")", "throws", "ApiException", "{", "return", "listGroupUsers", "(", "accountId", ",", "groupId", ",", "null", ")", ";", "}" ]
Gets a list of users in a group. Retrieves a list of users in a group. @param accountId The external account number (int) or account ID Guid. (required) @param groupId The ID of the group being accessed. (required) @return UsersResponse
[ "Gets", "a", "list", "of", "users", "in", "a", "group", ".", "Retrieves", "a", "list", "of", "users", "in", "a", "group", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/GroupsApi.java#L315-L317
Jasig/uPortal
uPortal-events/src/main/java/org/apereo/portal/events/tincan/converters/AbstractPortalEventToLrsStatementConverter.java
AbstractPortalEventToLrsStatementConverter.buildUrn
protected URI buildUrn(String... parts) { """ Build the URN for the LrsStatement. This method attaches creates the base URN. Additional elements can be attached. @param parts Additional URN elements. @return The formatted URI """ UrnBuilder builder = new UrnBuilder("UTF-8", "tincan", "uportal", "activities"); builder.add(parts); return builder.getUri(); }
java
protected URI buildUrn(String... parts) { UrnBuilder builder = new UrnBuilder("UTF-8", "tincan", "uportal", "activities"); builder.add(parts); return builder.getUri(); }
[ "protected", "URI", "buildUrn", "(", "String", "...", "parts", ")", "{", "UrnBuilder", "builder", "=", "new", "UrnBuilder", "(", "\"UTF-8\"", ",", "\"tincan\"", ",", "\"uportal\"", ",", "\"activities\"", ")", ";", "builder", ".", "add", "(", "parts", ")", ";", "return", "builder", ".", "getUri", "(", ")", ";", "}" ]
Build the URN for the LrsStatement. This method attaches creates the base URN. Additional elements can be attached. @param parts Additional URN elements. @return The formatted URI
[ "Build", "the", "URN", "for", "the", "LrsStatement", ".", "This", "method", "attaches", "creates", "the", "base", "URN", ".", "Additional", "elements", "can", "be", "attached", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-events/src/main/java/org/apereo/portal/events/tincan/converters/AbstractPortalEventToLrsStatementConverter.java#L125-L130
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.listNext
public PagedList<CloudJob> listNext(final String nextPageLink, final JobListNextOptions jobListNextOptions) { """ Lists all of the jobs in the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobListNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;CloudJob&gt; object if successful. """ ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders> response = listNextSinglePageAsync(nextPageLink, jobListNextOptions).toBlocking().single(); return new PagedList<CloudJob>(response.body()) { @Override public Page<CloudJob> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, jobListNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<CloudJob> listNext(final String nextPageLink, final JobListNextOptions jobListNextOptions) { ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders> response = listNextSinglePageAsync(nextPageLink, jobListNextOptions).toBlocking().single(); return new PagedList<CloudJob>(response.body()) { @Override public Page<CloudJob> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, jobListNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "CloudJob", ">", "listNext", "(", "final", "String", "nextPageLink", ",", "final", "JobListNextOptions", "jobListNextOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJob", ">", ",", "JobListHeaders", ">", "response", "=", "listNextSinglePageAsync", "(", "nextPageLink", ",", "jobListNextOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ";", "return", "new", "PagedList", "<", "CloudJob", ">", "(", "response", ".", "body", "(", ")", ")", "{", "@", "Override", "public", "Page", "<", "CloudJob", ">", "nextPage", "(", "String", "nextPageLink", ")", "{", "return", "listNextSinglePageAsync", "(", "nextPageLink", ",", "jobListNextOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}", "}", ";", "}" ]
Lists all of the jobs in the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobListNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;CloudJob&gt; object if successful.
[ "Lists", "all", "of", "the", "jobs", "in", "the", "specified", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3427-L3435
fuzzylite/jfuzzylite
jfuzzylite/src/main/java/com/fuzzylite/defuzzifier/Centroid.java
Centroid.defuzzify
@Override public double defuzzify(Term term, double minimum, double maximum) { """ Computes the centroid of a fuzzy set. The defuzzification process integrates over the fuzzy set utilizing the boundaries given as parameters. The integration algorithm is the midpoint rectangle method (https://en.wikipedia.org/wiki/Rectangle_method). @param term is the fuzzy set @param minimum is the minimum value of the fuzzy set @param maximum is the maximum value of the fuzzy set @return the `x`-coordinate of the centroid of the fuzzy set """ if (!Op.isFinite(minimum + maximum)) { return Double.NaN; } final int resolution = getResolution(); final double dx = (maximum - minimum) / resolution; double x, y; double area = 0; double xcentroid = 0; //double ycentroid = 0; for (int i = 0; i < resolution; ++i) { x = minimum + (i + 0.5) * dx; y = term.membership(x); xcentroid += y * x; //ycentroid += y * y; area += y; } //Final results not computed for efficiency //xcentroid /= area; //ycentroid /= 2 * area; //area *= dx; return xcentroid / area; }
java
@Override public double defuzzify(Term term, double minimum, double maximum) { if (!Op.isFinite(minimum + maximum)) { return Double.NaN; } final int resolution = getResolution(); final double dx = (maximum - minimum) / resolution; double x, y; double area = 0; double xcentroid = 0; //double ycentroid = 0; for (int i = 0; i < resolution; ++i) { x = minimum + (i + 0.5) * dx; y = term.membership(x); xcentroid += y * x; //ycentroid += y * y; area += y; } //Final results not computed for efficiency //xcentroid /= area; //ycentroid /= 2 * area; //area *= dx; return xcentroid / area; }
[ "@", "Override", "public", "double", "defuzzify", "(", "Term", "term", ",", "double", "minimum", ",", "double", "maximum", ")", "{", "if", "(", "!", "Op", ".", "isFinite", "(", "minimum", "+", "maximum", ")", ")", "{", "return", "Double", ".", "NaN", ";", "}", "final", "int", "resolution", "=", "getResolution", "(", ")", ";", "final", "double", "dx", "=", "(", "maximum", "-", "minimum", ")", "/", "resolution", ";", "double", "x", ",", "y", ";", "double", "area", "=", "0", ";", "double", "xcentroid", "=", "0", ";", "//double ycentroid = 0;", "for", "(", "int", "i", "=", "0", ";", "i", "<", "resolution", ";", "++", "i", ")", "{", "x", "=", "minimum", "+", "(", "i", "+", "0.5", ")", "*", "dx", ";", "y", "=", "term", ".", "membership", "(", "x", ")", ";", "xcentroid", "+=", "y", "*", "x", ";", "//ycentroid += y * y;", "area", "+=", "y", ";", "}", "//Final results not computed for efficiency", "//xcentroid /= area;", "//ycentroid /= 2 * area;", "//area *= dx;", "return", "xcentroid", "/", "area", ";", "}" ]
Computes the centroid of a fuzzy set. The defuzzification process integrates over the fuzzy set utilizing the boundaries given as parameters. The integration algorithm is the midpoint rectangle method (https://en.wikipedia.org/wiki/Rectangle_method). @param term is the fuzzy set @param minimum is the minimum value of the fuzzy set @param maximum is the maximum value of the fuzzy set @return the `x`-coordinate of the centroid of the fuzzy set
[ "Computes", "the", "centroid", "of", "a", "fuzzy", "set", ".", "The", "defuzzification", "process", "integrates", "over", "the", "fuzzy", "set", "utilizing", "the", "boundaries", "given", "as", "parameters", ".", "The", "integration", "algorithm", "is", "the", "midpoint", "rectangle", "method", "(", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Rectangle_method", ")", "." ]
train
https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/defuzzifier/Centroid.java#L53-L79
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/index/schema/analysis/SnowballAnalyzerBuilder.java
SnowballAnalyzerBuilder.buildAnalyzer
private static Analyzer buildAnalyzer(final String language, final CharArraySet stopwords) { """ Returns the snowball {@link Analyzer} for the specified language and stopwords. @param language The language code. The supported languages are English, French, Spanish, Portuguese, Italian, Romanian, German, Dutch, Swedish, Norwegian, Danish, Russian, Finnish, Irish, Hungarian, Turkish, Armenian, Basque and Catalan. @param stopwords The stop words. @return The snowball {@link Analyzer} for the specified language and stopwords. """ return new Analyzer() { protected TokenStreamComponents createComponents(String field, Reader reader) { final Tokenizer source = new StandardTokenizer(reader); TokenStream result = new StandardFilter(source); result = new LowerCaseFilter(result); result = new StopFilter(result, stopwords); result = new SnowballFilter(result, language); return new TokenStreamComponents(source, result); } }; }
java
private static Analyzer buildAnalyzer(final String language, final CharArraySet stopwords) { return new Analyzer() { protected TokenStreamComponents createComponents(String field, Reader reader) { final Tokenizer source = new StandardTokenizer(reader); TokenStream result = new StandardFilter(source); result = new LowerCaseFilter(result); result = new StopFilter(result, stopwords); result = new SnowballFilter(result, language); return new TokenStreamComponents(source, result); } }; }
[ "private", "static", "Analyzer", "buildAnalyzer", "(", "final", "String", "language", ",", "final", "CharArraySet", "stopwords", ")", "{", "return", "new", "Analyzer", "(", ")", "{", "protected", "TokenStreamComponents", "createComponents", "(", "String", "field", ",", "Reader", "reader", ")", "{", "final", "Tokenizer", "source", "=", "new", "StandardTokenizer", "(", "reader", ")", ";", "TokenStream", "result", "=", "new", "StandardFilter", "(", "source", ")", ";", "result", "=", "new", "LowerCaseFilter", "(", "result", ")", ";", "result", "=", "new", "StopFilter", "(", "result", ",", "stopwords", ")", ";", "result", "=", "new", "SnowballFilter", "(", "result", ",", "language", ")", ";", "return", "new", "TokenStreamComponents", "(", "source", ",", "result", ")", ";", "}", "}", ";", "}" ]
Returns the snowball {@link Analyzer} for the specified language and stopwords. @param language The language code. The supported languages are English, French, Spanish, Portuguese, Italian, Romanian, German, Dutch, Swedish, Norwegian, Danish, Russian, Finnish, Irish, Hungarian, Turkish, Armenian, Basque and Catalan. @param stopwords The stop words. @return The snowball {@link Analyzer} for the specified language and stopwords.
[ "Returns", "the", "snowball", "{", "@link", "Analyzer", "}", "for", "the", "specified", "language", "and", "stopwords", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/schema/analysis/SnowballAnalyzerBuilder.java#L105-L116
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.toBean
public static Object toBean( JSONObject jsonObject, Class beanClass ) { """ Creates a bean from a JSONObject, with a specific target class.<br> """ JsonConfig jsonConfig = new JsonConfig(); jsonConfig.setRootClass( beanClass ); return toBean( jsonObject, jsonConfig ); }
java
public static Object toBean( JSONObject jsonObject, Class beanClass ) { JsonConfig jsonConfig = new JsonConfig(); jsonConfig.setRootClass( beanClass ); return toBean( jsonObject, jsonConfig ); }
[ "public", "static", "Object", "toBean", "(", "JSONObject", "jsonObject", ",", "Class", "beanClass", ")", "{", "JsonConfig", "jsonConfig", "=", "new", "JsonConfig", "(", ")", ";", "jsonConfig", ".", "setRootClass", "(", "beanClass", ")", ";", "return", "toBean", "(", "jsonObject", ",", "jsonConfig", ")", ";", "}" ]
Creates a bean from a JSONObject, with a specific target class.<br>
[ "Creates", "a", "bean", "from", "a", "JSONObject", "with", "a", "specific", "target", "class", ".", "<br", ">" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L219-L223
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java
UTF16.valueOf
public static String valueOf(String source, int offset16) { """ Convenience method corresponding to String.valueOf(codepoint at offset16). Returns a one or two char string containing the UTF-32 value in UTF16 format. If offset16 indexes a surrogate character, the whole supplementary codepoint will be returned. If a validity check is required, use {@link android.icu.lang.UCharacter#isLegal(int)} on the codepoint at offset16 before calling. The result returned will be a newly created String obtained by calling source.substring(..) with the appropriate indexes. @param source The input string. @param offset16 The UTF16 index to the codepoint in source @return string value of char32 in UTF16 format """ switch (bounds(source, offset16)) { case LEAD_SURROGATE_BOUNDARY: return source.substring(offset16, offset16 + 2); case TRAIL_SURROGATE_BOUNDARY: return source.substring(offset16 - 1, offset16 + 1); default: return source.substring(offset16, offset16 + 1); } }
java
public static String valueOf(String source, int offset16) { switch (bounds(source, offset16)) { case LEAD_SURROGATE_BOUNDARY: return source.substring(offset16, offset16 + 2); case TRAIL_SURROGATE_BOUNDARY: return source.substring(offset16 - 1, offset16 + 1); default: return source.substring(offset16, offset16 + 1); } }
[ "public", "static", "String", "valueOf", "(", "String", "source", ",", "int", "offset16", ")", "{", "switch", "(", "bounds", "(", "source", ",", "offset16", ")", ")", "{", "case", "LEAD_SURROGATE_BOUNDARY", ":", "return", "source", ".", "substring", "(", "offset16", ",", "offset16", "+", "2", ")", ";", "case", "TRAIL_SURROGATE_BOUNDARY", ":", "return", "source", ".", "substring", "(", "offset16", "-", "1", ",", "offset16", "+", "1", ")", ";", "default", ":", "return", "source", ".", "substring", "(", "offset16", ",", "offset16", "+", "1", ")", ";", "}", "}" ]
Convenience method corresponding to String.valueOf(codepoint at offset16). Returns a one or two char string containing the UTF-32 value in UTF16 format. If offset16 indexes a surrogate character, the whole supplementary codepoint will be returned. If a validity check is required, use {@link android.icu.lang.UCharacter#isLegal(int)} on the codepoint at offset16 before calling. The result returned will be a newly created String obtained by calling source.substring(..) with the appropriate indexes. @param source The input string. @param offset16 The UTF16 index to the codepoint in source @return string value of char32 in UTF16 format
[ "Convenience", "method", "corresponding", "to", "String", ".", "valueOf", "(", "codepoint", "at", "offset16", ")", ".", "Returns", "a", "one", "or", "two", "char", "string", "containing", "the", "UTF", "-", "32", "value", "in", "UTF16", "format", ".", "If", "offset16", "indexes", "a", "surrogate", "character", "the", "whole", "supplementary", "codepoint", "will", "be", "returned", ".", "If", "a", "validity", "check", "is", "required", "use", "{", "@link", "android", ".", "icu", ".", "lang", ".", "UCharacter#isLegal", "(", "int", ")", "}", "on", "the", "codepoint", "at", "offset16", "before", "calling", ".", "The", "result", "returned", "will", "be", "a", "newly", "created", "String", "obtained", "by", "calling", "source", ".", "substring", "(", "..", ")", "with", "the", "appropriate", "indexes", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L660-L669
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java
ValidationUtils.validateNonNegative
public static void validateNonNegative(int[] data, String paramName) { """ Checks that all values are >= 0. @param data An array @param paramName The param name, for error reporting """ if(data == null) { return; } boolean nonnegative = true; for(int value : data){ if(value < 0) { nonnegative = false; } } Preconditions.checkArgument(nonnegative, "Values for %s must be >= 0, got: %s", paramName, data); }
java
public static void validateNonNegative(int[] data, String paramName){ if(data == null) { return; } boolean nonnegative = true; for(int value : data){ if(value < 0) { nonnegative = false; } } Preconditions.checkArgument(nonnegative, "Values for %s must be >= 0, got: %s", paramName, data); }
[ "public", "static", "void", "validateNonNegative", "(", "int", "[", "]", "data", ",", "String", "paramName", ")", "{", "if", "(", "data", "==", "null", ")", "{", "return", ";", "}", "boolean", "nonnegative", "=", "true", ";", "for", "(", "int", "value", ":", "data", ")", "{", "if", "(", "value", "<", "0", ")", "{", "nonnegative", "=", "false", ";", "}", "}", "Preconditions", ".", "checkArgument", "(", "nonnegative", ",", "\"Values for %s must be >= 0, got: %s\"", ",", "paramName", ",", "data", ")", ";", "}" ]
Checks that all values are >= 0. @param data An array @param paramName The param name, for error reporting
[ "Checks", "that", "all", "values", "are", ">", "=", "0", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L61-L77
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java
ProcessContext.setACModel
public void setACModel(AbstractACModel<?> acModel, boolean notifyListeners) { """ Sets the access control model which is used to determine authorized subjects for activity execution.<br> This method checks, if the access control model is compatible with the log context, i.e. is contains all subjects and activities of the log context. @param acModel An access control model. @param notifyListeners """ Validate.notNull(acModel); if (this.acModel == acModel) { return; } validateACModel(acModel); this.acModel = acModel; acModel.getContext().addContextListener(this); if (notifyListeners) { processContextListenerSupport.notifyACModelSet(acModel); } }
java
public void setACModel(AbstractACModel<?> acModel, boolean notifyListeners) { Validate.notNull(acModel); if (this.acModel == acModel) { return; } validateACModel(acModel); this.acModel = acModel; acModel.getContext().addContextListener(this); if (notifyListeners) { processContextListenerSupport.notifyACModelSet(acModel); } }
[ "public", "void", "setACModel", "(", "AbstractACModel", "<", "?", ">", "acModel", ",", "boolean", "notifyListeners", ")", "{", "Validate", ".", "notNull", "(", "acModel", ")", ";", "if", "(", "this", ".", "acModel", "==", "acModel", ")", "{", "return", ";", "}", "validateACModel", "(", "acModel", ")", ";", "this", ".", "acModel", "=", "acModel", ";", "acModel", ".", "getContext", "(", ")", ".", "addContextListener", "(", "this", ")", ";", "if", "(", "notifyListeners", ")", "{", "processContextListenerSupport", ".", "notifyACModelSet", "(", "acModel", ")", ";", "}", "}" ]
Sets the access control model which is used to determine authorized subjects for activity execution.<br> This method checks, if the access control model is compatible with the log context, i.e. is contains all subjects and activities of the log context. @param acModel An access control model. @param notifyListeners
[ "Sets", "the", "access", "control", "model", "which", "is", "used", "to", "determine", "authorized", "subjects", "for", "activity", "execution", ".", "<br", ">", "This", "method", "checks", "if", "the", "access", "control", "model", "is", "compatible", "with", "the", "log", "context", "i", ".", "e", ".", "is", "contains", "all", "subjects", "and", "activities", "of", "the", "log", "context", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L464-L475
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/onesample/KolmogorovSmirnovOneSample.java
KolmogorovSmirnovOneSample.normalDistribution
public static double normalDistribution(Double x, AssociativeArray params) { """ Cumulative Normal Distribution Method. This method is called via reflection. @param x @param params : AssociativeArray("mean"=>mean,"variance"=>variance) @return """ double mean= params.getDouble("mean"); double variance= params.getDouble("variance"); //standardize the x value double z=(x-mean)/Math.sqrt(variance); return ContinuousDistributions.gaussCdf(z); }
java
public static double normalDistribution(Double x, AssociativeArray params) { double mean= params.getDouble("mean"); double variance= params.getDouble("variance"); //standardize the x value double z=(x-mean)/Math.sqrt(variance); return ContinuousDistributions.gaussCdf(z); }
[ "public", "static", "double", "normalDistribution", "(", "Double", "x", ",", "AssociativeArray", "params", ")", "{", "double", "mean", "=", "params", ".", "getDouble", "(", "\"mean\"", ")", ";", "double", "variance", "=", "params", ".", "getDouble", "(", "\"variance\"", ")", ";", "//standardize the x value", "double", "z", "=", "(", "x", "-", "mean", ")", "/", "Math", ".", "sqrt", "(", "variance", ")", ";", "return", "ContinuousDistributions", ".", "gaussCdf", "(", "z", ")", ";", "}" ]
Cumulative Normal Distribution Method. This method is called via reflection. @param x @param params : AssociativeArray("mean"=>mean,"variance"=>variance) @return
[ "Cumulative", "Normal", "Distribution", "Method", ".", "This", "method", "is", "called", "via", "reflection", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/onesample/KolmogorovSmirnovOneSample.java#L106-L114
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/BindPath.java
BindPath.addListeners
public void addListeners(PropertyChangeListener listener, Object newObject, Set updateSet) { """ Add listeners to a specific object. Updates the bould flags and update set @param listener This listener to attach. @param newObject The object we should read our property off of. @param updateSet The list of objects we have added listeners to """ removeListeners(); if (newObject != null) { // check for local synthetics TriggerBinding syntheticTrigger = getSyntheticTriggerBinding(newObject); MetaClass mc = InvokerHelper.getMetaClass(newObject); if (syntheticTrigger != null) { PropertyBinding psb = new PropertyBinding(newObject, propertyName); PropertyChangeProxyTargetBinding proxytb = new PropertyChangeProxyTargetBinding(newObject, propertyName, listener); syntheticFullBinding = syntheticTrigger.createBinding(psb, proxytb); syntheticFullBinding.bind(); updateSet.add(newObject); } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", NAME_PARAMS).isEmpty()) { InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", new Object[] {propertyName, listener}); localListener = listener; updateSet.add(newObject); } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", GLOBAL_PARAMS).isEmpty()) { InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", listener); globalListener = listener; updateSet.add(newObject); } } currentObject = newObject; }
java
public void addListeners(PropertyChangeListener listener, Object newObject, Set updateSet) { removeListeners(); if (newObject != null) { // check for local synthetics TriggerBinding syntheticTrigger = getSyntheticTriggerBinding(newObject); MetaClass mc = InvokerHelper.getMetaClass(newObject); if (syntheticTrigger != null) { PropertyBinding psb = new PropertyBinding(newObject, propertyName); PropertyChangeProxyTargetBinding proxytb = new PropertyChangeProxyTargetBinding(newObject, propertyName, listener); syntheticFullBinding = syntheticTrigger.createBinding(psb, proxytb); syntheticFullBinding.bind(); updateSet.add(newObject); } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", NAME_PARAMS).isEmpty()) { InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", new Object[] {propertyName, listener}); localListener = listener; updateSet.add(newObject); } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", GLOBAL_PARAMS).isEmpty()) { InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", listener); globalListener = listener; updateSet.add(newObject); } } currentObject = newObject; }
[ "public", "void", "addListeners", "(", "PropertyChangeListener", "listener", ",", "Object", "newObject", ",", "Set", "updateSet", ")", "{", "removeListeners", "(", ")", ";", "if", "(", "newObject", "!=", "null", ")", "{", "// check for local synthetics", "TriggerBinding", "syntheticTrigger", "=", "getSyntheticTriggerBinding", "(", "newObject", ")", ";", "MetaClass", "mc", "=", "InvokerHelper", ".", "getMetaClass", "(", "newObject", ")", ";", "if", "(", "syntheticTrigger", "!=", "null", ")", "{", "PropertyBinding", "psb", "=", "new", "PropertyBinding", "(", "newObject", ",", "propertyName", ")", ";", "PropertyChangeProxyTargetBinding", "proxytb", "=", "new", "PropertyChangeProxyTargetBinding", "(", "newObject", ",", "propertyName", ",", "listener", ")", ";", "syntheticFullBinding", "=", "syntheticTrigger", ".", "createBinding", "(", "psb", ",", "proxytb", ")", ";", "syntheticFullBinding", ".", "bind", "(", ")", ";", "updateSet", ".", "add", "(", "newObject", ")", ";", "}", "else", "if", "(", "!", "mc", ".", "respondsTo", "(", "newObject", ",", "\"addPropertyChangeListener\"", ",", "NAME_PARAMS", ")", ".", "isEmpty", "(", ")", ")", "{", "InvokerHelper", ".", "invokeMethod", "(", "newObject", ",", "\"addPropertyChangeListener\"", ",", "new", "Object", "[", "]", "{", "propertyName", ",", "listener", "}", ")", ";", "localListener", "=", "listener", ";", "updateSet", ".", "add", "(", "newObject", ")", ";", "}", "else", "if", "(", "!", "mc", ".", "respondsTo", "(", "newObject", ",", "\"addPropertyChangeListener\"", ",", "GLOBAL_PARAMS", ")", ".", "isEmpty", "(", ")", ")", "{", "InvokerHelper", ".", "invokeMethod", "(", "newObject", ",", "\"addPropertyChangeListener\"", ",", "listener", ")", ";", "globalListener", "=", "listener", ";", "updateSet", ".", "add", "(", "newObject", ")", ";", "}", "}", "currentObject", "=", "newObject", ";", "}" ]
Add listeners to a specific object. Updates the bould flags and update set @param listener This listener to attach. @param newObject The object we should read our property off of. @param updateSet The list of objects we have added listeners to
[ "Add", "listeners", "to", "a", "specific", "object", ".", "Updates", "the", "bould", "flags", "and", "update", "set" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/BindPath.java#L155-L179
grobmeier/postmark4j
src/main/java/de/grobmeier/postmark/PostmarkClient.java
PostmarkClient.sendMessage
public PostmarkResponse sendMessage(String from, String to, String replyTo, String cc, String bcc, String subject, String body, boolean isHTML, String tag, List<NameValuePair> headers) throws PostmarkException { """ Sends a message through the Postmark API. All email addresses must be valid, and the sender must be a valid sender signature according to Postmark. To obtain a valid sender signature, log in to Postmark and navigate to: http://postmarkapp.com/signatures. @param from An email address for a sender @param to An email address for a recipient @param replyTo An email address for the reply-to @param cc An email address for CC @param bcc An email address for BCC @param subject The message subject line @param body The message body @param isHTML Is the body text HTML @param tag A tag to identify the message in postmark @param headers A collection of additional mail headers to send with the message @return {@link PostmarkResponse} with details about the transaction @throws PostmarkException when something goes wrong """ PostmarkMessage message = new PostmarkMessage(from, to, replyTo, subject, bcc, cc, body, isHTML, tag, headers); return sendMessage(message); }
java
public PostmarkResponse sendMessage(String from, String to, String replyTo, String cc, String bcc, String subject, String body, boolean isHTML, String tag, List<NameValuePair> headers) throws PostmarkException { PostmarkMessage message = new PostmarkMessage(from, to, replyTo, subject, bcc, cc, body, isHTML, tag, headers); return sendMessage(message); }
[ "public", "PostmarkResponse", "sendMessage", "(", "String", "from", ",", "String", "to", ",", "String", "replyTo", ",", "String", "cc", ",", "String", "bcc", ",", "String", "subject", ",", "String", "body", ",", "boolean", "isHTML", ",", "String", "tag", ",", "List", "<", "NameValuePair", ">", "headers", ")", "throws", "PostmarkException", "{", "PostmarkMessage", "message", "=", "new", "PostmarkMessage", "(", "from", ",", "to", ",", "replyTo", ",", "subject", ",", "bcc", ",", "cc", ",", "body", ",", "isHTML", ",", "tag", ",", "headers", ")", ";", "return", "sendMessage", "(", "message", ")", ";", "}" ]
Sends a message through the Postmark API. All email addresses must be valid, and the sender must be a valid sender signature according to Postmark. To obtain a valid sender signature, log in to Postmark and navigate to: http://postmarkapp.com/signatures. @param from An email address for a sender @param to An email address for a recipient @param replyTo An email address for the reply-to @param cc An email address for CC @param bcc An email address for BCC @param subject The message subject line @param body The message body @param isHTML Is the body text HTML @param tag A tag to identify the message in postmark @param headers A collection of additional mail headers to send with the message @return {@link PostmarkResponse} with details about the transaction @throws PostmarkException when something goes wrong
[ "Sends", "a", "message", "through", "the", "Postmark", "API", ".", "All", "email", "addresses", "must", "be", "valid", "and", "the", "sender", "must", "be", "a", "valid", "sender", "signature", "according", "to", "Postmark", ".", "To", "obtain", "a", "valid", "sender", "signature", "log", "in", "to", "Postmark", "and", "navigate", "to", ":", "http", ":", "//", "postmarkapp", ".", "com", "/", "signatures", "." ]
train
https://github.com/grobmeier/postmark4j/blob/245732bd03c67c1eb1ad734625838f4ffe2a96f0/src/main/java/de/grobmeier/postmark/PostmarkClient.java#L161-L164
alkacon/opencms-core
src/org/opencms/workplace/editors/directedit/CmsAdvancedDirectEditProvider.java
CmsAdvancedDirectEditProvider.startDirectEditDisabled
public String startDirectEditDisabled(CmsDirectEditParams params, CmsDirectEditResourceInfo resourceInfo) { """ Returns the start HTML for a disabled direct edit button.<p> @param params the direct edit parameters @param resourceInfo contains information about the resource to edit @return the start HTML for a disabled direct edit button """ StringBuffer result = new StringBuffer(256); result.append("<!-- EDIT BLOCK START (DISABLED): "); result.append(params.m_resourceName); result.append(" ["); result.append(resourceInfo.getResource().getState()); result.append("] "); if (!resourceInfo.getLock().isUnlocked()) { result.append(" locked "); result.append(resourceInfo.getLock().getProject().getName()); } result.append(" -->\n"); return result.toString(); }
java
public String startDirectEditDisabled(CmsDirectEditParams params, CmsDirectEditResourceInfo resourceInfo) { StringBuffer result = new StringBuffer(256); result.append("<!-- EDIT BLOCK START (DISABLED): "); result.append(params.m_resourceName); result.append(" ["); result.append(resourceInfo.getResource().getState()); result.append("] "); if (!resourceInfo.getLock().isUnlocked()) { result.append(" locked "); result.append(resourceInfo.getLock().getProject().getName()); } result.append(" -->\n"); return result.toString(); }
[ "public", "String", "startDirectEditDisabled", "(", "CmsDirectEditParams", "params", ",", "CmsDirectEditResourceInfo", "resourceInfo", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "256", ")", ";", "result", ".", "append", "(", "\"<!-- EDIT BLOCK START (DISABLED): \"", ")", ";", "result", ".", "append", "(", "params", ".", "m_resourceName", ")", ";", "result", ".", "append", "(", "\" [\"", ")", ";", "result", ".", "append", "(", "resourceInfo", ".", "getResource", "(", ")", ".", "getState", "(", ")", ")", ";", "result", ".", "append", "(", "\"] \"", ")", ";", "if", "(", "!", "resourceInfo", ".", "getLock", "(", ")", ".", "isUnlocked", "(", ")", ")", "{", "result", ".", "append", "(", "\" locked \"", ")", ";", "result", ".", "append", "(", "resourceInfo", ".", "getLock", "(", ")", ".", "getProject", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "result", ".", "append", "(", "\" -->\\n\"", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Returns the start HTML for a disabled direct edit button.<p> @param params the direct edit parameters @param resourceInfo contains information about the resource to edit @return the start HTML for a disabled direct edit button
[ "Returns", "the", "start", "HTML", "for", "a", "disabled", "direct", "edit", "button", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/directedit/CmsAdvancedDirectEditProvider.java#L297-L312
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java
DifferentialFunctionFactory.matchCondition
public SDVariable matchCondition(SDVariable in, Condition condition) { """ Returns a boolean mask of equal shape to the input, where the condition is satisfied @param in Input @param condition Condition @return Boolean mask """ return new MatchConditionTransform(sameDiff(), in, condition).outputVariable(); }
java
public SDVariable matchCondition(SDVariable in, Condition condition) { return new MatchConditionTransform(sameDiff(), in, condition).outputVariable(); }
[ "public", "SDVariable", "matchCondition", "(", "SDVariable", "in", ",", "Condition", "condition", ")", "{", "return", "new", "MatchConditionTransform", "(", "sameDiff", "(", ")", ",", "in", ",", "condition", ")", ".", "outputVariable", "(", ")", ";", "}" ]
Returns a boolean mask of equal shape to the input, where the condition is satisfied @param in Input @param condition Condition @return Boolean mask
[ "Returns", "a", "boolean", "mask", "of", "equal", "shape", "to", "the", "input", "where", "the", "condition", "is", "satisfied" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L723-L725
jledit/jledit
core/src/main/java/org/jledit/jline/TerminalLineSettings.java
TerminalLineSettings.getProperty
protected static int getProperty(String name, String stty) { """ <p> Parses a stty output (provided by stty -a) and return the value of a given property. </p> @param name property name. @param stty string resulting of stty -a execution. @return value of the given property. """ // try the first kind of regex Pattern pattern = Pattern.compile(name + "\\s+=\\s+([^;]*)[;\\n\\r]"); Matcher matcher = pattern.matcher(stty); if (!matcher.find()) { // try a second kind of regex pattern = Pattern.compile(name + "\\s+([^;]*)[;\\n\\r]"); matcher = pattern.matcher(stty); if (!matcher.find()) { // try a second try of regex pattern = Pattern.compile("(\\S*)\\s+" + name); matcher = pattern.matcher(stty); if (!matcher.find()) { return -1; } } } return parseControlChar(matcher.group(1)); }
java
protected static int getProperty(String name, String stty) { // try the first kind of regex Pattern pattern = Pattern.compile(name + "\\s+=\\s+([^;]*)[;\\n\\r]"); Matcher matcher = pattern.matcher(stty); if (!matcher.find()) { // try a second kind of regex pattern = Pattern.compile(name + "\\s+([^;]*)[;\\n\\r]"); matcher = pattern.matcher(stty); if (!matcher.find()) { // try a second try of regex pattern = Pattern.compile("(\\S*)\\s+" + name); matcher = pattern.matcher(stty); if (!matcher.find()) { return -1; } } } return parseControlChar(matcher.group(1)); }
[ "protected", "static", "int", "getProperty", "(", "String", "name", ",", "String", "stty", ")", "{", "// try the first kind of regex", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "name", "+", "\"\\\\s+=\\\\s+([^;]*)[;\\\\n\\\\r]\"", ")", ";", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "stty", ")", ";", "if", "(", "!", "matcher", ".", "find", "(", ")", ")", "{", "// try a second kind of regex", "pattern", "=", "Pattern", ".", "compile", "(", "name", "+", "\"\\\\s+([^;]*)[;\\\\n\\\\r]\"", ")", ";", "matcher", "=", "pattern", ".", "matcher", "(", "stty", ")", ";", "if", "(", "!", "matcher", ".", "find", "(", ")", ")", "{", "// try a second try of regex", "pattern", "=", "Pattern", ".", "compile", "(", "\"(\\\\S*)\\\\s+\"", "+", "name", ")", ";", "matcher", "=", "pattern", ".", "matcher", "(", "stty", ")", ";", "if", "(", "!", "matcher", ".", "find", "(", ")", ")", "{", "return", "-", "1", ";", "}", "}", "}", "return", "parseControlChar", "(", "matcher", ".", "group", "(", "1", ")", ")", ";", "}" ]
<p> Parses a stty output (provided by stty -a) and return the value of a given property. </p> @param name property name. @param stty string resulting of stty -a execution. @return value of the given property.
[ "<p", ">", "Parses", "a", "stty", "output", "(", "provided", "by", "stty", "-", "a", ")", "and", "return", "the", "value", "of", "a", "given", "property", ".", "<", "/", "p", ">" ]
train
https://github.com/jledit/jledit/blob/ced2c4b44330664adb65f8be4c8fff780ccaa6fd/core/src/main/java/org/jledit/jline/TerminalLineSettings.java#L108-L126
alkacon/opencms-core
src/org/opencms/synchronize/CmsSynchronize.java
CmsSynchronize.getFileInRfs
private File getFileInRfs(String res) { """ Gets the corresponding file to a resource in the VFS. <p> @param res path to the resource inside the VFS @return the corresponding file in the FS """ String path = m_destinationPathInRfs + res.substring(0, res.lastIndexOf("/")); String fileName = res.substring(res.lastIndexOf("/") + 1); return new File(path, fileName); }
java
private File getFileInRfs(String res) { String path = m_destinationPathInRfs + res.substring(0, res.lastIndexOf("/")); String fileName = res.substring(res.lastIndexOf("/") + 1); return new File(path, fileName); }
[ "private", "File", "getFileInRfs", "(", "String", "res", ")", "{", "String", "path", "=", "m_destinationPathInRfs", "+", "res", ".", "substring", "(", "0", ",", "res", ".", "lastIndexOf", "(", "\"/\"", ")", ")", ";", "String", "fileName", "=", "res", ".", "substring", "(", "res", ".", "lastIndexOf", "(", "\"/\"", ")", "+", "1", ")", ";", "return", "new", "File", "(", "path", ",", "fileName", ")", ";", "}" ]
Gets the corresponding file to a resource in the VFS. <p> @param res path to the resource inside the VFS @return the corresponding file in the FS
[ "Gets", "the", "corresponding", "file", "to", "a", "resource", "in", "the", "VFS", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/synchronize/CmsSynchronize.java#L495-L500
Azure/azure-sdk-for-java
datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java
FilesInner.updateAsync
public Observable<ProjectFileInner> updateAsync(String groupName, String serviceName, String projectName, String fileName, ProjectFileInner parameters) { """ Update a file. This method updates an existing file. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @param fileName Name of the File @param parameters Information about the file @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProjectFileInner object """ return updateWithServiceResponseAsync(groupName, serviceName, projectName, fileName, parameters).map(new Func1<ServiceResponse<ProjectFileInner>, ProjectFileInner>() { @Override public ProjectFileInner call(ServiceResponse<ProjectFileInner> response) { return response.body(); } }); }
java
public Observable<ProjectFileInner> updateAsync(String groupName, String serviceName, String projectName, String fileName, ProjectFileInner parameters) { return updateWithServiceResponseAsync(groupName, serviceName, projectName, fileName, parameters).map(new Func1<ServiceResponse<ProjectFileInner>, ProjectFileInner>() { @Override public ProjectFileInner call(ServiceResponse<ProjectFileInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProjectFileInner", ">", "updateAsync", "(", "String", "groupName", ",", "String", "serviceName", ",", "String", "projectName", ",", "String", "fileName", ",", "ProjectFileInner", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "groupName", ",", "serviceName", ",", "projectName", ",", "fileName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ProjectFileInner", ">", ",", "ProjectFileInner", ">", "(", ")", "{", "@", "Override", "public", "ProjectFileInner", "call", "(", "ServiceResponse", "<", "ProjectFileInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Update a file. This method updates an existing file. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @param fileName Name of the File @param parameters Information about the file @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProjectFileInner object
[ "Update", "a", "file", ".", "This", "method", "updates", "an", "existing", "file", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java#L604-L611
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/LegacySpy.java
LegacySpy.expectAtLeast
@Deprecated public C expectAtLeast(int allowedStatements, Threads threadMatcher) { """ Alias for {@link #expectBetween(int, int, Threads, Query)} with arguments {@code allowedStatements}, {@link Integer#MAX_VALUE}, {@code threads}, {@link Query#ANY} @since 2.0 """ return expect(SqlQueries.minQueries(allowedStatements).threads(threadMatcher)); }
java
@Deprecated public C expectAtLeast(int allowedStatements, Threads threadMatcher) { return expect(SqlQueries.minQueries(allowedStatements).threads(threadMatcher)); }
[ "@", "Deprecated", "public", "C", "expectAtLeast", "(", "int", "allowedStatements", ",", "Threads", "threadMatcher", ")", "{", "return", "expect", "(", "SqlQueries", ".", "minQueries", "(", "allowedStatements", ")", ".", "threads", "(", "threadMatcher", ")", ")", ";", "}" ]
Alias for {@link #expectBetween(int, int, Threads, Query)} with arguments {@code allowedStatements}, {@link Integer#MAX_VALUE}, {@code threads}, {@link Query#ANY} @since 2.0
[ "Alias", "for", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L503-L506
kirgor/enklib
ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java
Bean.createProxy
protected <T> T createProxy(Class<T> interfaceClass) throws Exception { """ Creates data proxy of specified class for current invocation SQL session. @param interfaceClass Class of proxy interface. @param <T> Type of the proxy interface. @throws Exception """ return createProxy(interfaceClass, getSession()); }
java
protected <T> T createProxy(Class<T> interfaceClass) throws Exception { return createProxy(interfaceClass, getSession()); }
[ "protected", "<", "T", ">", "T", "createProxy", "(", "Class", "<", "T", ">", "interfaceClass", ")", "throws", "Exception", "{", "return", "createProxy", "(", "interfaceClass", ",", "getSession", "(", ")", ")", ";", "}" ]
Creates data proxy of specified class for current invocation SQL session. @param interfaceClass Class of proxy interface. @param <T> Type of the proxy interface. @throws Exception
[ "Creates", "data", "proxy", "of", "specified", "class", "for", "current", "invocation", "SQL", "session", "." ]
train
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L200-L202
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.listCapabilitiesAsync
public Observable<List<CapabilityInner>> listCapabilitiesAsync(String resourceGroupName, String name) { """ List all capabilities of an App Service plan. List all capabilities of an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;CapabilityInner&gt; object """ return listCapabilitiesWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<CapabilityInner>>, List<CapabilityInner>>() { @Override public List<CapabilityInner> call(ServiceResponse<List<CapabilityInner>> response) { return response.body(); } }); }
java
public Observable<List<CapabilityInner>> listCapabilitiesAsync(String resourceGroupName, String name) { return listCapabilitiesWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<CapabilityInner>>, List<CapabilityInner>>() { @Override public List<CapabilityInner> call(ServiceResponse<List<CapabilityInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "CapabilityInner", ">", ">", "listCapabilitiesAsync", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "listCapabilitiesWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "CapabilityInner", ">", ">", ",", "List", "<", "CapabilityInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "CapabilityInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "CapabilityInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List all capabilities of an App Service plan. List all capabilities of an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;CapabilityInner&gt; object
[ "List", "all", "capabilities", "of", "an", "App", "Service", "plan", ".", "List", "all", "capabilities", "of", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1070-L1077
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/crypto/DeterministicHierarchy.java
DeterministicHierarchy.get
public DeterministicKey get(List<ChildNumber> path, boolean relativePath, boolean create) { """ Returns a key for the given path, optionally creating it. @param path the path to the key @param relativePath whether the path is relative to the root path @param create whether the key corresponding to path should be created (with any necessary ancestors) if it doesn't exist already @return next newly created key using the child derivation function @throws IllegalArgumentException if create is false and the path was not found. """ ImmutableList<ChildNumber> absolutePath = relativePath ? ImmutableList.<ChildNumber>builder().addAll(rootPath).addAll(path).build() : ImmutableList.copyOf(path); if (!keys.containsKey(absolutePath)) { if (!create) throw new IllegalArgumentException(String.format(Locale.US, "No key found for %s path %s.", relativePath ? "relative" : "absolute", HDUtils.formatPath(path))); checkArgument(absolutePath.size() > 0, "Can't derive the master key: nothing to derive from."); DeterministicKey parent = get(absolutePath.subList(0, absolutePath.size() - 1), false, true); putKey(HDKeyDerivation.deriveChildKey(parent, absolutePath.get(absolutePath.size() - 1))); } return keys.get(absolutePath); }
java
public DeterministicKey get(List<ChildNumber> path, boolean relativePath, boolean create) { ImmutableList<ChildNumber> absolutePath = relativePath ? ImmutableList.<ChildNumber>builder().addAll(rootPath).addAll(path).build() : ImmutableList.copyOf(path); if (!keys.containsKey(absolutePath)) { if (!create) throw new IllegalArgumentException(String.format(Locale.US, "No key found for %s path %s.", relativePath ? "relative" : "absolute", HDUtils.formatPath(path))); checkArgument(absolutePath.size() > 0, "Can't derive the master key: nothing to derive from."); DeterministicKey parent = get(absolutePath.subList(0, absolutePath.size() - 1), false, true); putKey(HDKeyDerivation.deriveChildKey(parent, absolutePath.get(absolutePath.size() - 1))); } return keys.get(absolutePath); }
[ "public", "DeterministicKey", "get", "(", "List", "<", "ChildNumber", ">", "path", ",", "boolean", "relativePath", ",", "boolean", "create", ")", "{", "ImmutableList", "<", "ChildNumber", ">", "absolutePath", "=", "relativePath", "?", "ImmutableList", ".", "<", "ChildNumber", ">", "builder", "(", ")", ".", "addAll", "(", "rootPath", ")", ".", "addAll", "(", "path", ")", ".", "build", "(", ")", ":", "ImmutableList", ".", "copyOf", "(", "path", ")", ";", "if", "(", "!", "keys", ".", "containsKey", "(", "absolutePath", ")", ")", "{", "if", "(", "!", "create", ")", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "Locale", ".", "US", ",", "\"No key found for %s path %s.\"", ",", "relativePath", "?", "\"relative\"", ":", "\"absolute\"", ",", "HDUtils", ".", "formatPath", "(", "path", ")", ")", ")", ";", "checkArgument", "(", "absolutePath", ".", "size", "(", ")", ">", "0", ",", "\"Can't derive the master key: nothing to derive from.\"", ")", ";", "DeterministicKey", "parent", "=", "get", "(", "absolutePath", ".", "subList", "(", "0", ",", "absolutePath", ".", "size", "(", ")", "-", "1", ")", ",", "false", ",", "true", ")", ";", "putKey", "(", "HDKeyDerivation", ".", "deriveChildKey", "(", "parent", ",", "absolutePath", ".", "get", "(", "absolutePath", ".", "size", "(", ")", "-", "1", ")", ")", ")", ";", "}", "return", "keys", ".", "get", "(", "absolutePath", ")", ";", "}" ]
Returns a key for the given path, optionally creating it. @param path the path to the key @param relativePath whether the path is relative to the root path @param create whether the key corresponding to path should be created (with any necessary ancestors) if it doesn't exist already @return next newly created key using the child derivation function @throws IllegalArgumentException if create is false and the path was not found.
[ "Returns", "a", "key", "for", "the", "given", "path", "optionally", "creating", "it", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicHierarchy.java#L83-L96
mapbox/mapbox-plugins-android
plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java
BuildingPlugin.setMinZoomLevel
public void setMinZoomLevel(@FloatRange(from = MINIMUM_ZOOM, to = MAXIMUM_ZOOM) float minZoomLevel) { """ Change the building min zoom level. This is the minimum zoom level where buildings will start to show. useful to limit showing buildings at higher zoom levels. @param minZoomLevel a {@code float} value between the maps minimum and maximum zoom level which defines at which level the buildings should show up @since 0.1.0 """ this.minZoomLevel = minZoomLevel; if (!style.isFullyLoaded()) { // We are in progress of loading a new style return; } fillExtrusionLayer.setMinZoom(minZoomLevel); }
java
public void setMinZoomLevel(@FloatRange(from = MINIMUM_ZOOM, to = MAXIMUM_ZOOM) float minZoomLevel) { this.minZoomLevel = minZoomLevel; if (!style.isFullyLoaded()) { // We are in progress of loading a new style return; } fillExtrusionLayer.setMinZoom(minZoomLevel); }
[ "public", "void", "setMinZoomLevel", "(", "@", "FloatRange", "(", "from", "=", "MINIMUM_ZOOM", ",", "to", "=", "MAXIMUM_ZOOM", ")", "float", "minZoomLevel", ")", "{", "this", ".", "minZoomLevel", "=", "minZoomLevel", ";", "if", "(", "!", "style", ".", "isFullyLoaded", "(", ")", ")", "{", "// We are in progress of loading a new style", "return", ";", "}", "fillExtrusionLayer", ".", "setMinZoom", "(", "minZoomLevel", ")", ";", "}" ]
Change the building min zoom level. This is the minimum zoom level where buildings will start to show. useful to limit showing buildings at higher zoom levels. @param minZoomLevel a {@code float} value between the maps minimum and maximum zoom level which defines at which level the buildings should show up @since 0.1.0
[ "Change", "the", "building", "min", "zoom", "level", ".", "This", "is", "the", "minimum", "zoom", "level", "where", "buildings", "will", "start", "to", "show", ".", "useful", "to", "limit", "showing", "buildings", "at", "higher", "zoom", "levels", "." ]
train
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java#L196-L205
azkaban/azkaban
azkaban-common/src/main/java/azkaban/executor/FetchActiveFlowDao.java
FetchActiveFlowDao.fetchActiveFlows
Map<Integer, Pair<ExecutionReference, ExecutableFlow>> fetchActiveFlows() throws ExecutorManagerException { """ Fetch flows that are dispatched and not yet finished. @return active flows map @throws ExecutorManagerException the executor manager exception """ try { return this.dbOperator.query(FetchActiveExecutableFlows.FETCH_ACTIVE_EXECUTABLE_FLOWS, new FetchActiveExecutableFlows()); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching active flows", e); } }
java
Map<Integer, Pair<ExecutionReference, ExecutableFlow>> fetchActiveFlows() throws ExecutorManagerException { try { return this.dbOperator.query(FetchActiveExecutableFlows.FETCH_ACTIVE_EXECUTABLE_FLOWS, new FetchActiveExecutableFlows()); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching active flows", e); } }
[ "Map", "<", "Integer", ",", "Pair", "<", "ExecutionReference", ",", "ExecutableFlow", ">", ">", "fetchActiveFlows", "(", ")", "throws", "ExecutorManagerException", "{", "try", "{", "return", "this", ".", "dbOperator", ".", "query", "(", "FetchActiveExecutableFlows", ".", "FETCH_ACTIVE_EXECUTABLE_FLOWS", ",", "new", "FetchActiveExecutableFlows", "(", ")", ")", ";", "}", "catch", "(", "final", "SQLException", "e", ")", "{", "throw", "new", "ExecutorManagerException", "(", "\"Error fetching active flows\"", ",", "e", ")", ";", "}", "}" ]
Fetch flows that are dispatched and not yet finished. @return active flows map @throws ExecutorManagerException the executor manager exception
[ "Fetch", "flows", "that", "are", "dispatched", "and", "not", "yet", "finished", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/FetchActiveFlowDao.java#L145-L153
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java
MemorizeTransactionProxy.memorize
protected static Statement memorize(final Statement target, final ConnectionHandle connectionHandle) { """ Wrap Statement with a proxy. @param target statement handle @param connectionHandle originating bonecp connection @return Proxy to a statement. """ return (Statement) Proxy.newProxyInstance( StatementProxy.class.getClassLoader(), new Class[] {StatementProxy.class}, new MemorizeTransactionProxy(target, connectionHandle)); }
java
protected static Statement memorize(final Statement target, final ConnectionHandle connectionHandle) { return (Statement) Proxy.newProxyInstance( StatementProxy.class.getClassLoader(), new Class[] {StatementProxy.class}, new MemorizeTransactionProxy(target, connectionHandle)); }
[ "protected", "static", "Statement", "memorize", "(", "final", "Statement", "target", ",", "final", "ConnectionHandle", "connectionHandle", ")", "{", "return", "(", "Statement", ")", "Proxy", ".", "newProxyInstance", "(", "StatementProxy", ".", "class", ".", "getClassLoader", "(", ")", ",", "new", "Class", "[", "]", "{", "StatementProxy", ".", "class", "}", ",", "new", "MemorizeTransactionProxy", "(", "target", ",", "connectionHandle", ")", ")", ";", "}" ]
Wrap Statement with a proxy. @param target statement handle @param connectionHandle originating bonecp connection @return Proxy to a statement.
[ "Wrap", "Statement", "with", "a", "proxy", "." ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java#L92-L97
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java
PrivacyListManager.updatePrivacyList
public void updatePrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ The client has edited an existing list. It updates the server content with the resulting list of privacy items. The {@link PrivacyItem} list MUST contain all elements in the list (not the "delta"). @param listName the list that has changed its content. @param privacyItems a List with every privacy item in the list. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException """ // Build the privacy package to add or update the new list Privacy request = new Privacy(); request.setPrivacyList(listName, privacyItems); // Send the package to the server setRequest(request); }
java
public void updatePrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // Build the privacy package to add or update the new list Privacy request = new Privacy(); request.setPrivacyList(listName, privacyItems); // Send the package to the server setRequest(request); }
[ "public", "void", "updatePrivacyList", "(", "String", "listName", ",", "List", "<", "PrivacyItem", ">", "privacyItems", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "// Build the privacy package to add or update the new list", "Privacy", "request", "=", "new", "Privacy", "(", ")", ";", "request", ".", "setPrivacyList", "(", "listName", ",", "privacyItems", ")", ";", "// Send the package to the server", "setRequest", "(", "request", ")", ";", "}" ]
The client has edited an existing list. It updates the server content with the resulting list of privacy items. The {@link PrivacyItem} list MUST contain all elements in the list (not the "delta"). @param listName the list that has changed its content. @param privacyItems a List with every privacy item in the list. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "The", "client", "has", "edited", "an", "existing", "list", ".", "It", "updates", "the", "server", "content", "with", "the", "resulting", "list", "of", "privacy", "items", ".", "The", "{", "@link", "PrivacyItem", "}", "list", "MUST", "contain", "all", "elements", "in", "the", "list", "(", "not", "the", "delta", ")", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L522-L529
OpenLiberty/open-liberty
dev/wlp-generateRepositoryContent/src/com/ibm/ws/wlp/repository/esa/GenerateEsas.java
GenerateEsas.addFileResource
public void addFileResource(File installRoot, final Set<String> content, String locString) { """ Adds a file resource to the set of file paths. @param installRoot The install root where we are getting files from @param content The content to add the file paths to @param locString The location string from the feature resource """ String[] locs; if (locString.contains(",")) { locs = locString.split(","); } else { locs = new String[] { locString }; } for (String loc : locs) { File test = new File(loc); if (!test.isAbsolute()) { test = new File(installRoot, loc); } loc = test.getAbsolutePath(); content.add(loc); } }
java
public void addFileResource(File installRoot, final Set<String> content, String locString) { String[] locs; if (locString.contains(",")) { locs = locString.split(","); } else { locs = new String[] { locString }; } for (String loc : locs) { File test = new File(loc); if (!test.isAbsolute()) { test = new File(installRoot, loc); } loc = test.getAbsolutePath(); content.add(loc); } }
[ "public", "void", "addFileResource", "(", "File", "installRoot", ",", "final", "Set", "<", "String", ">", "content", ",", "String", "locString", ")", "{", "String", "[", "]", "locs", ";", "if", "(", "locString", ".", "contains", "(", "\",\"", ")", ")", "{", "locs", "=", "locString", ".", "split", "(", "\",\"", ")", ";", "}", "else", "{", "locs", "=", "new", "String", "[", "]", "{", "locString", "}", ";", "}", "for", "(", "String", "loc", ":", "locs", ")", "{", "File", "test", "=", "new", "File", "(", "loc", ")", ";", "if", "(", "!", "test", ".", "isAbsolute", "(", ")", ")", "{", "test", "=", "new", "File", "(", "installRoot", ",", "loc", ")", ";", "}", "loc", "=", "test", ".", "getAbsolutePath", "(", ")", ";", "content", ".", "add", "(", "loc", ")", ";", "}", "}" ]
Adds a file resource to the set of file paths. @param installRoot The install root where we are getting files from @param content The content to add the file paths to @param locString The location string from the feature resource
[ "Adds", "a", "file", "resource", "to", "the", "set", "of", "file", "paths", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp-generateRepositoryContent/src/com/ibm/ws/wlp/repository/esa/GenerateEsas.java#L671-L688
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.findAll
@Override public List<CPInstance> findAll(int start, int end) { """ Returns a range of all the cp instances. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPInstanceModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of cp instances @param end the upper bound of the range of cp instances (not inclusive) @return the range of cp instances """ return findAll(start, end, null); }
java
@Override public List<CPInstance> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CPInstance", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp instances. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPInstanceModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of cp instances @param end the upper bound of the range of cp instances (not inclusive) @return the range of cp instances
[ "Returns", "a", "range", "of", "all", "the", "cp", "instances", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L7911-L7914
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/miner/ControlsStateChangeDetailedMiner.java
ControlsStateChangeDetailedMiner.writeResult
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out) throws IOException { """ Writes the result as "A modifications-of-A B gains-of-B loss-of-B", where A and B are gene symbols, and whitespace is tab. Modifications are comma separated. @param matches pattern search result @param out output stream """ writeResultDetailed(matches, out, 5); }
java
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out) throws IOException { writeResultDetailed(matches, out, 5); }
[ "public", "void", "writeResult", "(", "Map", "<", "BioPAXElement", ",", "List", "<", "Match", ">", ">", "matches", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "writeResultDetailed", "(", "matches", ",", "out", ",", "5", ")", ";", "}" ]
Writes the result as "A modifications-of-A B gains-of-B loss-of-B", where A and B are gene symbols, and whitespace is tab. Modifications are comma separated. @param matches pattern search result @param out output stream
[ "Writes", "the", "result", "as", "A", "modifications", "-", "of", "-", "A", "B", "gains", "-", "of", "-", "B", "loss", "-", "of", "-", "B", "where", "A", "and", "B", "are", "gene", "symbols", "and", "whitespace", "is", "tab", ".", "Modifications", "are", "comma", "separated", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/ControlsStateChangeDetailedMiner.java#L49-L53
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Scroller.java
Scroller.scrollListToLine
public <T extends AbsListView> void scrollListToLine(final T view, final int line) { """ Scroll the list to a given line @param view the {@link AbsListView} to scroll @param line the line to scroll to """ if(view == null) Assert.fail("AbsListView is null!"); final int lineToMoveTo; if(view instanceof GridView) { lineToMoveTo = line+1; } else { lineToMoveTo = line; } inst.runOnMainSync(new Runnable(){ public void run(){ view.setSelection(lineToMoveTo); } }); }
java
public <T extends AbsListView> void scrollListToLine(final T view, final int line){ if(view == null) Assert.fail("AbsListView is null!"); final int lineToMoveTo; if(view instanceof GridView) { lineToMoveTo = line+1; } else { lineToMoveTo = line; } inst.runOnMainSync(new Runnable(){ public void run(){ view.setSelection(lineToMoveTo); } }); }
[ "public", "<", "T", "extends", "AbsListView", ">", "void", "scrollListToLine", "(", "final", "T", "view", ",", "final", "int", "line", ")", "{", "if", "(", "view", "==", "null", ")", "Assert", ".", "fail", "(", "\"AbsListView is null!\"", ")", ";", "final", "int", "lineToMoveTo", ";", "if", "(", "view", "instanceof", "GridView", ")", "{", "lineToMoveTo", "=", "line", "+", "1", ";", "}", "else", "{", "lineToMoveTo", "=", "line", ";", "}", "inst", ".", "runOnMainSync", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "view", ".", "setSelection", "(", "lineToMoveTo", ")", ";", "}", "}", ")", ";", "}" ]
Scroll the list to a given line @param view the {@link AbsListView} to scroll @param line the line to scroll to
[ "Scroll", "the", "list", "to", "a", "given", "line" ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Scroller.java#L318-L335
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.setBoolean
public static void setBoolean(MemorySegment[] segments, int offset, boolean value) { """ set boolean from segments. @param segments target segments. @param offset value offset. """ if (inFirstSegment(segments, offset, 1)) { segments[0].putBoolean(offset, value); } else { setBooleanMultiSegments(segments, offset, value); } }
java
public static void setBoolean(MemorySegment[] segments, int offset, boolean value) { if (inFirstSegment(segments, offset, 1)) { segments[0].putBoolean(offset, value); } else { setBooleanMultiSegments(segments, offset, value); } }
[ "public", "static", "void", "setBoolean", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ",", "boolean", "value", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "1", ")", ")", "{", "segments", "[", "0", "]", ".", "putBoolean", "(", "offset", ",", "value", ")", ";", "}", "else", "{", "setBooleanMultiSegments", "(", "segments", ",", "offset", ",", "value", ")", ";", "}", "}" ]
set boolean from segments. @param segments target segments. @param offset value offset.
[ "set", "boolean", "from", "segments", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L555-L561