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
hayribakici/infiniteviewpager
infiniteviewpager/src/com/thehayro/view/InfinitePagerAdapter.java
InfinitePagerAdapter.instantiateItem
@Override public final Object instantiateItem(final ViewGroup container, final int position) { """ This method is only called, when this pagerAdapter is initialized. """ if (Constants.DEBUG) { Log.i("InfiniteViewPager", String.format("instantiating position %s", position)); } final PageModel<T> model = createPageModel(position); mPageModels[position] = model; container.addView(model.getParentView()); return model; }
java
@Override public final Object instantiateItem(final ViewGroup container, final int position) { if (Constants.DEBUG) { Log.i("InfiniteViewPager", String.format("instantiating position %s", position)); } final PageModel<T> model = createPageModel(position); mPageModels[position] = model; container.addView(model.getParentView()); return model; }
[ "@", "Override", "public", "final", "Object", "instantiateItem", "(", "final", "ViewGroup", "container", ",", "final", "int", "position", ")", "{", "if", "(", "Constants", ".", "DEBUG", ")", "{", "Log", ".", "i", "(", "\"InfiniteViewPager\"", ",", "String", ".", "format", "(", "\"instantiating position %s\"", ",", "position", ")", ")", ";", "}", "final", "PageModel", "<", "T", ">", "model", "=", "createPageModel", "(", "position", ")", ";", "mPageModels", "[", "position", "]", "=", "model", ";", "container", ".", "addView", "(", "model", ".", "getParentView", "(", ")", ")", ";", "return", "model", ";", "}" ]
This method is only called, when this pagerAdapter is initialized.
[ "This", "method", "is", "only", "called", "when", "this", "pagerAdapter", "is", "initialized", "." ]
train
https://github.com/hayribakici/infiniteviewpager/blob/cb3ca2a3833bbb3aeef02b9693787987b970bb89/infiniteviewpager/src/com/thehayro/view/InfinitePagerAdapter.java#L63-L72
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_accountName_filter_name_rule_POST
public OvhTaskFilter domain_account_accountName_filter_name_rule_POST(String domain, String accountName, String name, String header, OvhDomainFilterOperandEnum operand, String value) throws IOException { """ Create new rule for filter REST: POST /email/domain/{domain}/account/{accountName}/filter/{name}/rule @param value [required] Rule parameter of filter @param operand [required] Rule of filter @param header [required] Header to be filtered @param domain [required] Name of your domain name @param accountName [required] Name of account @param name [required] Filter name """ String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/rule"; StringBuilder sb = path(qPath, domain, accountName, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "header", header); addBody(o, "operand", operand); addBody(o, "value", value); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskFilter.class); }
java
public OvhTaskFilter domain_account_accountName_filter_name_rule_POST(String domain, String accountName, String name, String header, OvhDomainFilterOperandEnum operand, String value) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/rule"; StringBuilder sb = path(qPath, domain, accountName, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "header", header); addBody(o, "operand", operand); addBody(o, "value", value); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskFilter.class); }
[ "public", "OvhTaskFilter", "domain_account_accountName_filter_name_rule_POST", "(", "String", "domain", ",", "String", "accountName", ",", "String", "name", ",", "String", "header", ",", "OvhDomainFilterOperandEnum", "operand", ",", "String", "value", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/account/{accountName}/filter/{name}/rule\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "domain", ",", "accountName", ",", "name", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"header\"", ",", "header", ")", ";", "addBody", "(", "o", ",", "\"operand\"", ",", "operand", ")", ";", "addBody", "(", "o", ",", "\"value\"", ",", "value", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTaskFilter", ".", "class", ")", ";", "}" ]
Create new rule for filter REST: POST /email/domain/{domain}/account/{accountName}/filter/{name}/rule @param value [required] Rule parameter of filter @param operand [required] Rule of filter @param header [required] Header to be filtered @param domain [required] Name of your domain name @param accountName [required] Name of account @param name [required] Filter name
[ "Create", "new", "rule", "for", "filter" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L703-L712
daimajia/AndroidSwipeLayout
library/src/main/java/com/daimajia/swipe/SwipeLayout.java
SwipeLayout.addRevealListener
public void addRevealListener(int childId, OnRevealListener l) { """ bind a view with a specific {@link com.daimajia.swipe.SwipeLayout.OnRevealListener} @param childId the view id. @param l the target {@link com.daimajia.swipe.SwipeLayout.OnRevealListener} """ View child = findViewById(childId); if (child == null) { throw new IllegalArgumentException("Child does not belong to SwipeListener."); } if (!mShowEntirely.containsKey(child)) { mShowEntirely.put(child, false); } if (mRevealListeners.get(child) == null) mRevealListeners.put(child, new ArrayList<OnRevealListener>()); mRevealListeners.get(child).add(l); }
java
public void addRevealListener(int childId, OnRevealListener l) { View child = findViewById(childId); if (child == null) { throw new IllegalArgumentException("Child does not belong to SwipeListener."); } if (!mShowEntirely.containsKey(child)) { mShowEntirely.put(child, false); } if (mRevealListeners.get(child) == null) mRevealListeners.put(child, new ArrayList<OnRevealListener>()); mRevealListeners.get(child).add(l); }
[ "public", "void", "addRevealListener", "(", "int", "childId", ",", "OnRevealListener", "l", ")", "{", "View", "child", "=", "findViewById", "(", "childId", ")", ";", "if", "(", "child", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Child does not belong to SwipeListener.\"", ")", ";", "}", "if", "(", "!", "mShowEntirely", ".", "containsKey", "(", "child", ")", ")", "{", "mShowEntirely", ".", "put", "(", "child", ",", "false", ")", ";", "}", "if", "(", "mRevealListeners", ".", "get", "(", "child", ")", "==", "null", ")", "mRevealListeners", ".", "put", "(", "child", ",", "new", "ArrayList", "<", "OnRevealListener", ">", "(", ")", ")", ";", "mRevealListeners", ".", "get", "(", "child", ")", ".", "add", "(", "l", ")", ";", "}" ]
bind a view with a specific {@link com.daimajia.swipe.SwipeLayout.OnRevealListener} @param childId the view id. @param l the target {@link com.daimajia.swipe.SwipeLayout.OnRevealListener}
[ "bind", "a", "view", "with", "a", "specific", "{", "@link", "com", ".", "daimajia", ".", "swipe", ".", "SwipeLayout", ".", "OnRevealListener", "}" ]
train
https://github.com/daimajia/AndroidSwipeLayout/blob/5f8678b04751fb8510a88586b22e07ccf64bca99/library/src/main/java/com/daimajia/swipe/SwipeLayout.java#L176-L189
EdwardRaff/JSAT
JSAT/src/jsat/distributions/Distribution.java
Distribution.invCdf
public double invCdf(double p) { """ Computes the inverse Cumulative Density Function (CDF<sup>-1</sup>) at the given point. It takes in a value in the range of [0, 1] and returns the value x, such that CDF(x) = <tt>p</tt> @param p the probability value @return the value such that the CDF would return <tt>p</tt> """ if (p < 0 || p > 1) throw new ArithmeticException("Value of p must be in the range [0,1], not " + p); double a = Double.isInfinite(min()) ? Double.MIN_VALUE : min(); double b = Double.isInfinite(max()) ? Double.MAX_VALUE : max(); //default case, lets just do a root finding on the CDF for the specific value of p return Zeroin.root(a, b, (x) -> cdf(x) - p); }
java
public double invCdf(double p) { if (p < 0 || p > 1) throw new ArithmeticException("Value of p must be in the range [0,1], not " + p); double a = Double.isInfinite(min()) ? Double.MIN_VALUE : min(); double b = Double.isInfinite(max()) ? Double.MAX_VALUE : max(); //default case, lets just do a root finding on the CDF for the specific value of p return Zeroin.root(a, b, (x) -> cdf(x) - p); }
[ "public", "double", "invCdf", "(", "double", "p", ")", "{", "if", "(", "p", "<", "0", "||", "p", ">", "1", ")", "throw", "new", "ArithmeticException", "(", "\"Value of p must be in the range [0,1], not \"", "+", "p", ")", ";", "double", "a", "=", "Double", ".", "isInfinite", "(", "min", "(", ")", ")", "?", "Double", ".", "MIN_VALUE", ":", "min", "(", ")", ";", "double", "b", "=", "Double", ".", "isInfinite", "(", "max", "(", ")", ")", "?", "Double", ".", "MAX_VALUE", ":", "max", "(", ")", ";", "//default case, lets just do a root finding on the CDF for the specific value of p\r", "return", "Zeroin", ".", "root", "(", "a", ",", "b", ",", "(", "x", ")", "-", ">", "(", "x", ")", "-", "p", ")", ";", "}" ]
Computes the inverse Cumulative Density Function (CDF<sup>-1</sup>) at the given point. It takes in a value in the range of [0, 1] and returns the value x, such that CDF(x) = <tt>p</tt> @param p the probability value @return the value such that the CDF would return <tt>p</tt>
[ "Computes", "the", "inverse", "Cumulative", "Density", "Function", "(", "CDF<sup", ">", "-", "1<", "/", "sup", ">", ")", "at", "the", "given", "point", ".", "It", "takes", "in", "a", "value", "in", "the", "range", "of", "[", "0", "1", "]", "and", "returns", "the", "value", "x", "such", "that", "CDF", "(", "x", ")", "=", "<tt", ">", "p<", "/", "tt", ">" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/Distribution.java#L53-L62
linkedin/dexmaker
dexmaker/src/main/java/com/android/dx/Code.java
Code.addCatchClause
public void addCatchClause(TypeId<? extends Throwable> toCatch, Label catchClause) { """ Registers {@code catchClause} as a branch target for all instructions in this frame that throw a class assignable to {@code toCatch}. This includes methods invoked from this frame. Deregister the clause using {@link #removeCatchClause removeCatchClause()}. It is an error to register a catch clause without also {@link #mark marking it} in the same {@code Code} instance. """ if (catchTypes.contains(toCatch)) { throw new IllegalArgumentException("Already caught: " + toCatch); } adopt(catchClause); catchTypes.add(toCatch); catches = toTypeList(catchTypes); catchLabels.add(catchClause); }
java
public void addCatchClause(TypeId<? extends Throwable> toCatch, Label catchClause) { if (catchTypes.contains(toCatch)) { throw new IllegalArgumentException("Already caught: " + toCatch); } adopt(catchClause); catchTypes.add(toCatch); catches = toTypeList(catchTypes); catchLabels.add(catchClause); }
[ "public", "void", "addCatchClause", "(", "TypeId", "<", "?", "extends", "Throwable", ">", "toCatch", ",", "Label", "catchClause", ")", "{", "if", "(", "catchTypes", ".", "contains", "(", "toCatch", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Already caught: \"", "+", "toCatch", ")", ";", "}", "adopt", "(", "catchClause", ")", ";", "catchTypes", ".", "add", "(", "toCatch", ")", ";", "catches", "=", "toTypeList", "(", "catchTypes", ")", ";", "catchLabels", ".", "add", "(", "catchClause", ")", ";", "}" ]
Registers {@code catchClause} as a branch target for all instructions in this frame that throw a class assignable to {@code toCatch}. This includes methods invoked from this frame. Deregister the clause using {@link #removeCatchClause removeCatchClause()}. It is an error to register a catch clause without also {@link #mark marking it} in the same {@code Code} instance.
[ "Registers", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L363-L371
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java
DerInputStream.getLength
static int getLength(int lenByte, InputStream in) throws IOException { """ /* Get a length from the input stream, allowing for at most 32 bits of encoding to be used. (Not the same as getting a tagged integer!) @return the length or -1 if indefinite length found. @exception IOException on parsing error or unsupported lengths. """ int value, tmp; tmp = lenByte; if ((tmp & 0x080) == 0x00) { // short form, 1 byte datum value = tmp; } else { // long form or indefinite tmp &= 0x07f; /* * NOTE: tmp == 0 indicates indefinite length encoded data. * tmp > 4 indicates more than 4Gb of data. */ if (tmp == 0) return -1; if (tmp < 0 || tmp > 4) throw new IOException("DerInputStream.getLength(): lengthTag=" + tmp + ", " + ((tmp < 0) ? "incorrect DER encoding." : "too big.")); for (value = 0; tmp > 0; tmp --) { value <<= 8; value += 0x0ff & in.read(); } if (value < 0) { throw new IOException("DerInputStream.getLength(): " + "Invalid length bytes"); } } return value; }
java
static int getLength(int lenByte, InputStream in) throws IOException { int value, tmp; tmp = lenByte; if ((tmp & 0x080) == 0x00) { // short form, 1 byte datum value = tmp; } else { // long form or indefinite tmp &= 0x07f; /* * NOTE: tmp == 0 indicates indefinite length encoded data. * tmp > 4 indicates more than 4Gb of data. */ if (tmp == 0) return -1; if (tmp < 0 || tmp > 4) throw new IOException("DerInputStream.getLength(): lengthTag=" + tmp + ", " + ((tmp < 0) ? "incorrect DER encoding." : "too big.")); for (value = 0; tmp > 0; tmp --) { value <<= 8; value += 0x0ff & in.read(); } if (value < 0) { throw new IOException("DerInputStream.getLength(): " + "Invalid length bytes"); } } return value; }
[ "static", "int", "getLength", "(", "int", "lenByte", ",", "InputStream", "in", ")", "throws", "IOException", "{", "int", "value", ",", "tmp", ";", "tmp", "=", "lenByte", ";", "if", "(", "(", "tmp", "&", "0x080", ")", "==", "0x00", ")", "{", "// short form, 1 byte datum", "value", "=", "tmp", ";", "}", "else", "{", "// long form or indefinite", "tmp", "&=", "0x07f", ";", "/*\n * NOTE: tmp == 0 indicates indefinite length encoded data.\n * tmp > 4 indicates more than 4Gb of data.\n */", "if", "(", "tmp", "==", "0", ")", "return", "-", "1", ";", "if", "(", "tmp", "<", "0", "||", "tmp", ">", "4", ")", "throw", "new", "IOException", "(", "\"DerInputStream.getLength(): lengthTag=\"", "+", "tmp", "+", "\", \"", "+", "(", "(", "tmp", "<", "0", ")", "?", "\"incorrect DER encoding.\"", ":", "\"too big.\"", ")", ")", ";", "for", "(", "value", "=", "0", ";", "tmp", ">", "0", ";", "tmp", "--", ")", "{", "value", "<<=", "8", ";", "value", "+=", "0x0ff", "&", "in", ".", "read", "(", ")", ";", "}", "if", "(", "value", "<", "0", ")", "{", "throw", "new", "IOException", "(", "\"DerInputStream.getLength(): \"", "+", "\"Invalid length bytes\"", ")", ";", "}", "}", "return", "value", ";", "}" ]
/* Get a length from the input stream, allowing for at most 32 bits of encoding to be used. (Not the same as getting a tagged integer!) @return the length or -1 if indefinite length found. @exception IOException on parsing error or unsupported lengths.
[ "/", "*", "Get", "a", "length", "from", "the", "input", "stream", "allowing", "for", "at", "most", "32", "bits", "of", "encoding", "to", "be", "used", ".", "(", "Not", "the", "same", "as", "getting", "a", "tagged", "integer!", ")" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L583-L613
upwork/java-upwork
src/com/Upwork/api/OAuthClient.java
OAuthClient.sendGetRequest
private JSONObject sendGetRequest(String url, Integer type, HashMap<String, String> params) throws JSONException { """ Send signed GET OAuth request @param url Relative URL @param type Type of HTTP request (HTTP method) @param params Hash of parameters @throws JSONException If JSON object is invalid or request was abnormal @return {@link JSONObject} JSON Object that contains data from response """ String fullUrl = getFullUrl(url); HttpGet request = new HttpGet(fullUrl); if (params != null) { URI uri; String query = ""; try { URIBuilder uriBuilder = new URIBuilder(request.getURI()); // encode values and add them to the request for (Map.Entry<String, String> entry : params.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); // to prevent double encoding, we need to create query string ourself // uriBuilder.addParameter(key, URLEncoder.encode(value).replace("%3B", ";")); query = query + key + "=" + value.replace("&", "&amp;") + "&"; // what the hell is going on in java - no adequate way to encode query string // lets temporary replace "&" in the value, to encode it manually later } // this routine will encode query string uriBuilder.setCustomQuery(query); uri = uriBuilder.build(); // re-create request to have validly encoded ampersand request = new HttpGet(fullUrl + "?" + uri.getRawQuery().replace("&amp;", "%26")); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { mOAuthConsumer.sign(request); } catch (OAuthException e) { e.printStackTrace(); } return UpworkRestClient.getJSONObject(request, type); }
java
private JSONObject sendGetRequest(String url, Integer type, HashMap<String, String> params) throws JSONException { String fullUrl = getFullUrl(url); HttpGet request = new HttpGet(fullUrl); if (params != null) { URI uri; String query = ""; try { URIBuilder uriBuilder = new URIBuilder(request.getURI()); // encode values and add them to the request for (Map.Entry<String, String> entry : params.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); // to prevent double encoding, we need to create query string ourself // uriBuilder.addParameter(key, URLEncoder.encode(value).replace("%3B", ";")); query = query + key + "=" + value.replace("&", "&amp;") + "&"; // what the hell is going on in java - no adequate way to encode query string // lets temporary replace "&" in the value, to encode it manually later } // this routine will encode query string uriBuilder.setCustomQuery(query); uri = uriBuilder.build(); // re-create request to have validly encoded ampersand request = new HttpGet(fullUrl + "?" + uri.getRawQuery().replace("&amp;", "%26")); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { mOAuthConsumer.sign(request); } catch (OAuthException e) { e.printStackTrace(); } return UpworkRestClient.getJSONObject(request, type); }
[ "private", "JSONObject", "sendGetRequest", "(", "String", "url", ",", "Integer", "type", ",", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "String", "fullUrl", "=", "getFullUrl", "(", "url", ")", ";", "HttpGet", "request", "=", "new", "HttpGet", "(", "fullUrl", ")", ";", "if", "(", "params", "!=", "null", ")", "{", "URI", "uri", ";", "String", "query", "=", "\"\"", ";", "try", "{", "URIBuilder", "uriBuilder", "=", "new", "URIBuilder", "(", "request", ".", "getURI", "(", ")", ")", ";", "// encode values and add them to the request", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "params", ".", "entrySet", "(", ")", ")", "{", "String", "key", "=", "entry", ".", "getKey", "(", ")", ";", "String", "value", "=", "entry", ".", "getValue", "(", ")", ";", "// to prevent double encoding, we need to create query string ourself", "// uriBuilder.addParameter(key, URLEncoder.encode(value).replace(\"%3B\", \";\"));", "query", "=", "query", "+", "key", "+", "\"=\"", "+", "value", ".", "replace", "(", "\"&\"", ",", "\"&amp;\"", ")", "+", "\"&\"", ";", "// what the hell is going on in java - no adequate way to encode query string", "// lets temporary replace \"&\" in the value, to encode it manually later", "}", "// this routine will encode query string", "uriBuilder", ".", "setCustomQuery", "(", "query", ")", ";", "uri", "=", "uriBuilder", ".", "build", "(", ")", ";", "// re-create request to have validly encoded ampersand", "request", "=", "new", "HttpGet", "(", "fullUrl", "+", "\"?\"", "+", "uri", ".", "getRawQuery", "(", ")", ".", "replace", "(", "\"&amp;\"", ",", "\"%26\"", ")", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "// TODO Auto-generated catch block", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "try", "{", "mOAuthConsumer", ".", "sign", "(", "request", ")", ";", "}", "catch", "(", "OAuthException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "UpworkRestClient", ".", "getJSONObject", "(", "request", ",", "type", ")", ";", "}" ]
Send signed GET OAuth request @param url Relative URL @param type Type of HTTP request (HTTP method) @param params Hash of parameters @throws JSONException If JSON object is invalid or request was abnormal @return {@link JSONObject} JSON Object that contains data from response
[ "Send", "signed", "GET", "OAuth", "request" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L272-L312
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.getSiteAnalysisSlot
public DiagnosticAnalysisInner getSiteAnalysisSlot(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, String slot) { """ Get Site Analysis. Get Site Analysis. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param analysisName Analysis Name @param slot Slot - optional @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DiagnosticAnalysisInner object if successful. """ return getSiteAnalysisSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName, slot).toBlocking().single().body(); }
java
public DiagnosticAnalysisInner getSiteAnalysisSlot(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, String slot) { return getSiteAnalysisSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName, slot).toBlocking().single().body(); }
[ "public", "DiagnosticAnalysisInner", "getSiteAnalysisSlot", "(", "String", "resourceGroupName", ",", "String", "siteName", ",", "String", "diagnosticCategory", ",", "String", "analysisName", ",", "String", "slot", ")", "{", "return", "getSiteAnalysisSlotWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ",", "diagnosticCategory", ",", "analysisName", ",", "slot", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get Site Analysis. Get Site Analysis. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param analysisName Analysis Name @param slot Slot - optional @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DiagnosticAnalysisInner object if successful.
[ "Get", "Site", "Analysis", ".", "Get", "Site", "Analysis", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1735-L1737
Ordinastie/MalisisCore
src/main/java/net/malisis/core/MalisisCore.java
MalisisCore.message
public static void message(Object text, Object... data) { """ Displays a text in the chat.<br> Client side calls will display italic and grey text.<br> Server side calls will display white text. The text will be sent to all clients connected. @param text the text @param data the data """ String txt = text != null ? text.toString() : "null"; if (text instanceof Object[]) txt = Arrays.deepToString((Object[]) text); //on server simply log messages if (!MalisisCore.isClient()) { log.info(String.format(txt, data)); return; } TextComponentString msg = new TextComponentString(I18n.format(txt, data)); if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { MinecraftServer server = FMLCommonHandler.instance().getSidedDelegate().getServer(); if (server != null) server.getPlayerList().sendMessage(msg); } else { EntityPlayer player = Utils.getClientPlayer(); if (player == null) return; Style cs = new Style(); cs.setItalic(true); cs.setColor(TextFormatting.GRAY); msg.setStyle(cs); player.sendMessage(msg); } }
java
public static void message(Object text, Object... data) { String txt = text != null ? text.toString() : "null"; if (text instanceof Object[]) txt = Arrays.deepToString((Object[]) text); //on server simply log messages if (!MalisisCore.isClient()) { log.info(String.format(txt, data)); return; } TextComponentString msg = new TextComponentString(I18n.format(txt, data)); if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { MinecraftServer server = FMLCommonHandler.instance().getSidedDelegate().getServer(); if (server != null) server.getPlayerList().sendMessage(msg); } else { EntityPlayer player = Utils.getClientPlayer(); if (player == null) return; Style cs = new Style(); cs.setItalic(true); cs.setColor(TextFormatting.GRAY); msg.setStyle(cs); player.sendMessage(msg); } }
[ "public", "static", "void", "message", "(", "Object", "text", ",", "Object", "...", "data", ")", "{", "String", "txt", "=", "text", "!=", "null", "?", "text", ".", "toString", "(", ")", ":", "\"null\"", ";", "if", "(", "text", "instanceof", "Object", "[", "]", ")", "txt", "=", "Arrays", ".", "deepToString", "(", "(", "Object", "[", "]", ")", "text", ")", ";", "//on server simply log messages", "if", "(", "!", "MalisisCore", ".", "isClient", "(", ")", ")", "{", "log", ".", "info", "(", "String", ".", "format", "(", "txt", ",", "data", ")", ")", ";", "return", ";", "}", "TextComponentString", "msg", "=", "new", "TextComponentString", "(", "I18n", ".", "format", "(", "txt", ",", "data", ")", ")", ";", "if", "(", "FMLCommonHandler", ".", "instance", "(", ")", ".", "getEffectiveSide", "(", ")", "==", "Side", ".", "SERVER", ")", "{", "MinecraftServer", "server", "=", "FMLCommonHandler", ".", "instance", "(", ")", ".", "getSidedDelegate", "(", ")", ".", "getServer", "(", ")", ";", "if", "(", "server", "!=", "null", ")", "server", ".", "getPlayerList", "(", ")", ".", "sendMessage", "(", "msg", ")", ";", "}", "else", "{", "EntityPlayer", "player", "=", "Utils", ".", "getClientPlayer", "(", ")", ";", "if", "(", "player", "==", "null", ")", "return", ";", "Style", "cs", "=", "new", "Style", "(", ")", ";", "cs", ".", "setItalic", "(", "true", ")", ";", "cs", ".", "setColor", "(", "TextFormatting", ".", "GRAY", ")", ";", "msg", ".", "setStyle", "(", "cs", ")", ";", "player", ".", "sendMessage", "(", "msg", ")", ";", "}", "}" ]
Displays a text in the chat.<br> Client side calls will display italic and grey text.<br> Server side calls will display white text. The text will be sent to all clients connected. @param text the text @param data the data
[ "Displays", "a", "text", "in", "the", "chat", ".", "<br", ">", "Client", "side", "calls", "will", "display", "italic", "and", "grey", "text", ".", "<br", ">", "Server", "side", "calls", "will", "display", "white", "text", ".", "The", "text", "will", "be", "sent", "to", "all", "clients", "connected", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/MalisisCore.java#L329-L362
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201902/creativewrapperservice/GetActiveCreativeWrappers.java
GetActiveCreativeWrappers.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { """ Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. """ CreativeWrapperServiceInterface creativeWrapperService = adManagerServices.get(session, CreativeWrapperServiceInterface.class); // Create a statement to select creative wrappers. StatementBuilder statementBuilder = new StatementBuilder() .where("status = :status") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("status", CreativeWrapperStatus.ACTIVE.toString()); // Retrieve a small amount of creative wrappers at a time, paging through // until all creative wrappers have been retrieved. int totalResultSetSize = 0; do { CreativeWrapperPage page = creativeWrapperService.getCreativeWrappersByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each creative wrapper. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (CreativeWrapper creativeWrapper : page.getResults()) { System.out.printf( "%d) Creative wrapper with ID %d and label ID %d was found.%n", i++, creativeWrapper.getId(), creativeWrapper.getLabelId()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { CreativeWrapperServiceInterface creativeWrapperService = adManagerServices.get(session, CreativeWrapperServiceInterface.class); // Create a statement to select creative wrappers. StatementBuilder statementBuilder = new StatementBuilder() .where("status = :status") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("status", CreativeWrapperStatus.ACTIVE.toString()); // Retrieve a small amount of creative wrappers at a time, paging through // until all creative wrappers have been retrieved. int totalResultSetSize = 0; do { CreativeWrapperPage page = creativeWrapperService.getCreativeWrappersByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each creative wrapper. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (CreativeWrapper creativeWrapper : page.getResults()) { System.out.printf( "%d) Creative wrapper with ID %d and label ID %d was found.%n", i++, creativeWrapper.getId(), creativeWrapper.getLabelId()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "CreativeWrapperServiceInterface", "creativeWrapperService", "=", "adManagerServices", ".", "get", "(", "session", ",", "CreativeWrapperServiceInterface", ".", "class", ")", ";", "// Create a statement to select creative wrappers.", "StatementBuilder", "statementBuilder", "=", "new", "StatementBuilder", "(", ")", ".", "where", "(", "\"status = :status\"", ")", ".", "orderBy", "(", "\"id ASC\"", ")", ".", "limit", "(", "StatementBuilder", ".", "SUGGESTED_PAGE_LIMIT", ")", ".", "withBindVariableValue", "(", "\"status\"", ",", "CreativeWrapperStatus", ".", "ACTIVE", ".", "toString", "(", ")", ")", ";", "// Retrieve a small amount of creative wrappers at a time, paging through", "// until all creative wrappers have been retrieved.", "int", "totalResultSetSize", "=", "0", ";", "do", "{", "CreativeWrapperPage", "page", "=", "creativeWrapperService", ".", "getCreativeWrappersByStatement", "(", "statementBuilder", ".", "toStatement", "(", ")", ")", ";", "if", "(", "page", ".", "getResults", "(", ")", "!=", "null", ")", "{", "// Print out some information for each creative wrapper.", "totalResultSetSize", "=", "page", ".", "getTotalResultSetSize", "(", ")", ";", "int", "i", "=", "page", ".", "getStartIndex", "(", ")", ";", "for", "(", "CreativeWrapper", "creativeWrapper", ":", "page", ".", "getResults", "(", ")", ")", "{", "System", ".", "out", ".", "printf", "(", "\"%d) Creative wrapper with ID %d and label ID %d was found.%n\"", ",", "i", "++", ",", "creativeWrapper", ".", "getId", "(", ")", ",", "creativeWrapper", ".", "getLabelId", "(", ")", ")", ";", "}", "}", "statementBuilder", ".", "increaseOffsetBy", "(", "StatementBuilder", ".", "SUGGESTED_PAGE_LIMIT", ")", ";", "}", "while", "(", "statementBuilder", ".", "getOffset", "(", ")", "<", "totalResultSetSize", ")", ";", "System", ".", "out", ".", "printf", "(", "\"Number of results found: %d%n\"", ",", "totalResultSetSize", ")", ";", "}" ]
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/creativewrapperservice/GetActiveCreativeWrappers.java#L52-L87
jfinal/jfinal
src/main/java/com/jfinal/template/ext/spring/JFinalViewResolver.java
JFinalViewResolver.loadView
protected View loadView(String viewName, Locale locale) throws Exception { """ 支持 jfinal enjoy、jsp、freemarker、velocity 四类模板共存于一个项目中 注意:这里采用识别 ".jsp"、".ftl"、".vm" 模板后缀名的方式来实现功能 所以 jfinal enjoy 模板不要采用上述三种后缀名,否则功能将失效 还要注意与 jsp、freemarker、velocity 以外类型模板共存使用时 需要改造该方法 """ String suffix = getSuffix(); if (".jsp".equals(suffix) || ".ftl".equals(suffix) || ".vm".equals(suffix)) { return null; } else { return super.loadView(viewName, locale); } }
java
protected View loadView(String viewName, Locale locale) throws Exception { String suffix = getSuffix(); if (".jsp".equals(suffix) || ".ftl".equals(suffix) || ".vm".equals(suffix)) { return null; } else { return super.loadView(viewName, locale); } }
[ "protected", "View", "loadView", "(", "String", "viewName", ",", "Locale", "locale", ")", "throws", "Exception", "{", "String", "suffix", "=", "getSuffix", "(", ")", ";", "if", "(", "\".jsp\"", ".", "equals", "(", "suffix", ")", "||", "\".ftl\"", ".", "equals", "(", "suffix", ")", "||", "\".vm\"", ".", "equals", "(", "suffix", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "super", ".", "loadView", "(", "viewName", ",", "locale", ")", ";", "}", "}" ]
支持 jfinal enjoy、jsp、freemarker、velocity 四类模板共存于一个项目中 注意:这里采用识别 ".jsp"、".ftl"、".vm" 模板后缀名的方式来实现功能 所以 jfinal enjoy 模板不要采用上述三种后缀名,否则功能将失效 还要注意与 jsp、freemarker、velocity 以外类型模板共存使用时 需要改造该方法
[ "支持", "jfinal", "enjoy、jsp、freemarker、velocity", "四类模板共存于一个项目中" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/template/ext/spring/JFinalViewResolver.java#L262-L269
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java
IndexImage.getIndexedImage
public static BufferedImage getIndexedImage(BufferedImage pImage, int pNumberOfColors, int pHints) { """ Converts the input image (must be {@code TYPE_INT_RGB} or {@code TYPE_INT_ARGB}) to an indexed image. Generating an adaptive palette with the given number of colors. Dithering, transparency and color selection is controlled with the {@code pHints}parameter. <p/> The image returned is a new image, the input image is not modified. @param pImage the BufferedImage to index @param pNumberOfColors the number of colors for the image @param pHints hints that control output quality and speed. @return the indexed BufferedImage. The image will be of type {@code BufferedImage.TYPE_BYTE_INDEXED} or {@code BufferedImage.TYPE_BYTE_BINARY}, and use an {@code IndexColorModel}. @see #DITHER_DIFFUSION @see #DITHER_NONE @see #COLOR_SELECTION_FAST @see #COLOR_SELECTION_QUALITY @see #TRANSPARENCY_OPAQUE @see #TRANSPARENCY_BITMASK @see BufferedImage#TYPE_BYTE_INDEXED @see BufferedImage#TYPE_BYTE_BINARY @see IndexColorModel """ return getIndexedImage(pImage, pNumberOfColors, null, pHints); }
java
public static BufferedImage getIndexedImage(BufferedImage pImage, int pNumberOfColors, int pHints) { return getIndexedImage(pImage, pNumberOfColors, null, pHints); }
[ "public", "static", "BufferedImage", "getIndexedImage", "(", "BufferedImage", "pImage", ",", "int", "pNumberOfColors", ",", "int", "pHints", ")", "{", "return", "getIndexedImage", "(", "pImage", ",", "pNumberOfColors", ",", "null", ",", "pHints", ")", ";", "}" ]
Converts the input image (must be {@code TYPE_INT_RGB} or {@code TYPE_INT_ARGB}) to an indexed image. Generating an adaptive palette with the given number of colors. Dithering, transparency and color selection is controlled with the {@code pHints}parameter. <p/> The image returned is a new image, the input image is not modified. @param pImage the BufferedImage to index @param pNumberOfColors the number of colors for the image @param pHints hints that control output quality and speed. @return the indexed BufferedImage. The image will be of type {@code BufferedImage.TYPE_BYTE_INDEXED} or {@code BufferedImage.TYPE_BYTE_BINARY}, and use an {@code IndexColorModel}. @see #DITHER_DIFFUSION @see #DITHER_NONE @see #COLOR_SELECTION_FAST @see #COLOR_SELECTION_QUALITY @see #TRANSPARENCY_OPAQUE @see #TRANSPARENCY_BITMASK @see BufferedImage#TYPE_BYTE_INDEXED @see BufferedImage#TYPE_BYTE_BINARY @see IndexColorModel
[ "Converts", "the", "input", "image", "(", "must", "be", "{", "@code", "TYPE_INT_RGB", "}", "or", "{", "@code", "TYPE_INT_ARGB", "}", ")", "to", "an", "indexed", "image", ".", "Generating", "an", "adaptive", "palette", "with", "the", "given", "number", "of", "colors", ".", "Dithering", "transparency", "and", "color", "selection", "is", "controlled", "with", "the", "{", "@code", "pHints", "}", "parameter", ".", "<p", "/", ">", "The", "image", "returned", "is", "a", "new", "image", "the", "input", "image", "is", "not", "modified", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java#L1092-L1094
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/DoubleIntegerArrayQuickSort.java
DoubleIntegerArrayQuickSort.insertionSort
private static void insertionSort(double[] keys, int[] vals, final int start, final int end) { """ Sort via insertion sort. @param keys Keys @param vals Values @param start Interval start @param end Interval end """ // Classic insertion sort. for(int i = start + 1; i < end; i++) { for(int j = i; j > start; j--) { if(keys[j] >= keys[j - 1]) { break; } swap(keys, vals, j, j - 1); } } }
java
private static void insertionSort(double[] keys, int[] vals, final int start, final int end) { // Classic insertion sort. for(int i = start + 1; i < end; i++) { for(int j = i; j > start; j--) { if(keys[j] >= keys[j - 1]) { break; } swap(keys, vals, j, j - 1); } } }
[ "private", "static", "void", "insertionSort", "(", "double", "[", "]", "keys", ",", "int", "[", "]", "vals", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "// Classic insertion sort.", "for", "(", "int", "i", "=", "start", "+", "1", ";", "i", "<", "end", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "i", ";", "j", ">", "start", ";", "j", "--", ")", "{", "if", "(", "keys", "[", "j", "]", ">=", "keys", "[", "j", "-", "1", "]", ")", "{", "break", ";", "}", "swap", "(", "keys", ",", "vals", ",", "j", ",", "j", "-", "1", ")", ";", "}", "}", "}" ]
Sort via insertion sort. @param keys Keys @param vals Values @param start Interval start @param end Interval end
[ "Sort", "via", "insertion", "sort", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/DoubleIntegerArrayQuickSort.java#L195-L205
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java
EsMarshalling.unmarshallGatewaySummary
public static GatewaySummaryBean unmarshallGatewaySummary(Map<String, Object> map) { """ Unmarshals the given map source into a bean. @param map the search hit map @return the gateway summary """ GatewaySummaryBean bean = new GatewaySummaryBean(); bean.setId(asString(map.get("id"))); bean.setName(asString(map.get("name"))); if (map.containsKey("description")) { bean.setDescription(asString(map.get("description"))); } bean.setType(asEnum(map.get("type"), GatewayType.class)); postMarshall(bean); return bean; }
java
public static GatewaySummaryBean unmarshallGatewaySummary(Map<String, Object> map) { GatewaySummaryBean bean = new GatewaySummaryBean(); bean.setId(asString(map.get("id"))); bean.setName(asString(map.get("name"))); if (map.containsKey("description")) { bean.setDescription(asString(map.get("description"))); } bean.setType(asEnum(map.get("type"), GatewayType.class)); postMarshall(bean); return bean; }
[ "public", "static", "GatewaySummaryBean", "unmarshallGatewaySummary", "(", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "GatewaySummaryBean", "bean", "=", "new", "GatewaySummaryBean", "(", ")", ";", "bean", ".", "setId", "(", "asString", "(", "map", ".", "get", "(", "\"id\"", ")", ")", ")", ";", "bean", ".", "setName", "(", "asString", "(", "map", ".", "get", "(", "\"name\"", ")", ")", ")", ";", "if", "(", "map", ".", "containsKey", "(", "\"description\"", ")", ")", "{", "bean", ".", "setDescription", "(", "asString", "(", "map", ".", "get", "(", "\"description\"", ")", ")", ")", ";", "}", "bean", ".", "setType", "(", "asEnum", "(", "map", ".", "get", "(", "\"type\"", ")", ",", "GatewayType", ".", "class", ")", ")", ";", "postMarshall", "(", "bean", ")", ";", "return", "bean", ";", "}" ]
Unmarshals the given map source into a bean. @param map the search hit map @return the gateway summary
[ "Unmarshals", "the", "given", "map", "source", "into", "a", "bean", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L1232-L1242
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizer.java
AggressiveUrlCanonicalizer.doStripRegexMatch
protected boolean doStripRegexMatch(StringBuilder url, Matcher matcher) { """ Run a regex against a StringBuilder, removing group 1 if it matches. Assumes the regex has a form that wants to strip elements of the passed string. Assumes that if a match, group 1 should be removed @param url Url to search in. @param matcher Matcher whose form yields a group to remove @return true if the StringBuilder was modified """ if(matcher != null && matcher.matches()) { url.delete(matcher.start(1), matcher.end(1)); return true; } return false; }
java
protected boolean doStripRegexMatch(StringBuilder url, Matcher matcher) { if(matcher != null && matcher.matches()) { url.delete(matcher.start(1), matcher.end(1)); return true; } return false; }
[ "protected", "boolean", "doStripRegexMatch", "(", "StringBuilder", "url", ",", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "!=", "null", "&&", "matcher", ".", "matches", "(", ")", ")", "{", "url", ".", "delete", "(", "matcher", ".", "start", "(", "1", ")", ",", "matcher", ".", "end", "(", "1", ")", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Run a regex against a StringBuilder, removing group 1 if it matches. Assumes the regex has a form that wants to strip elements of the passed string. Assumes that if a match, group 1 should be removed @param url Url to search in. @param matcher Matcher whose form yields a group to remove @return true if the StringBuilder was modified
[ "Run", "a", "regex", "against", "a", "StringBuilder", "removing", "group", "1", "if", "it", "matches", "." ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizer.java#L199-L205
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/parser/ParseTree.java
ParseTree.setParent
public void setParent( IParseTree l ) { """ Sets the parent location. Note the parent location must cover a superset of the specified location's area. @param l The parent location. """ if( l != null && !l.contains( this ) && getLength() > 0 ) { throw new IllegalArgumentException( "Attempted set the parent location, but the parent location's area is not a superset of this location's area." ); } if( _pe != null ) { ParsedElement parentElement = (ParsedElement)_pe.getParent(); if( parentElement != null ) { ParseTree oldParent = parentElement.getLocation(); if( oldParent != null ) { oldParent._children.remove( this ); } } _pe.setParent( l == null ? null : ((ParseTree)l)._pe ); } }
java
public void setParent( IParseTree l ) { if( l != null && !l.contains( this ) && getLength() > 0 ) { throw new IllegalArgumentException( "Attempted set the parent location, but the parent location's area is not a superset of this location's area." ); } if( _pe != null ) { ParsedElement parentElement = (ParsedElement)_pe.getParent(); if( parentElement != null ) { ParseTree oldParent = parentElement.getLocation(); if( oldParent != null ) { oldParent._children.remove( this ); } } _pe.setParent( l == null ? null : ((ParseTree)l)._pe ); } }
[ "public", "void", "setParent", "(", "IParseTree", "l", ")", "{", "if", "(", "l", "!=", "null", "&&", "!", "l", ".", "contains", "(", "this", ")", "&&", "getLength", "(", ")", ">", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Attempted set the parent location, but the parent location's area is not a superset of this location's area.\"", ")", ";", "}", "if", "(", "_pe", "!=", "null", ")", "{", "ParsedElement", "parentElement", "=", "(", "ParsedElement", ")", "_pe", ".", "getParent", "(", ")", ";", "if", "(", "parentElement", "!=", "null", ")", "{", "ParseTree", "oldParent", "=", "parentElement", ".", "getLocation", "(", ")", ";", "if", "(", "oldParent", "!=", "null", ")", "{", "oldParent", ".", "_children", ".", "remove", "(", "this", ")", ";", "}", "}", "_pe", ".", "setParent", "(", "l", "==", "null", "?", "null", ":", "(", "(", "ParseTree", ")", "l", ")", ".", "_pe", ")", ";", "}", "}" ]
Sets the parent location. Note the parent location must cover a superset of the specified location's area. @param l The parent location.
[ "Sets", "the", "parent", "location", ".", "Note", "the", "parent", "location", "must", "cover", "a", "superset", "of", "the", "specified", "location", "s", "area", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParseTree.java#L373-L392
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java
CommercePriceEntryPersistenceImpl.findAll
@Override public List<CommercePriceEntry> findAll() { """ Returns all the commerce price entries. @return the commerce price entries """ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommercePriceEntry> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommercePriceEntry", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce price entries. @return the commerce price entries
[ "Returns", "all", "the", "commerce", "price", "entries", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java#L4899-L4902
alipay/sofa-rpc
extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/AloneBoltClientConnectionManager.java
AloneBoltClientConnectionManager.closeConnection
public void closeConnection(RpcClient rpcClient, ClientTransportConfig transportConfig, Url url) { """ 关闭长连接 @param rpcClient bolt客户端 @param transportConfig 传输层配置 @param url 传输层地址 """ if (rpcClient == null || transportConfig == null || url == null) { return; } //TODO do not close }
java
public void closeConnection(RpcClient rpcClient, ClientTransportConfig transportConfig, Url url) { if (rpcClient == null || transportConfig == null || url == null) { return; } //TODO do not close }
[ "public", "void", "closeConnection", "(", "RpcClient", "rpcClient", ",", "ClientTransportConfig", "transportConfig", ",", "Url", "url", ")", "{", "if", "(", "rpcClient", "==", "null", "||", "transportConfig", "==", "null", "||", "url", "==", "null", ")", "{", "return", ";", "}", "//TODO do not close", "}" ]
关闭长连接 @param rpcClient bolt客户端 @param transportConfig 传输层配置 @param url 传输层地址
[ "关闭长连接" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/AloneBoltClientConnectionManager.java#L74-L79
skuzzle/jeve
jeve/src/main/java/de/skuzzle/jeve/providers/EventStackImpl.java
EventStackImpl.pushEvent
public <L extends Listener> void pushEvent(Event<?, L> event) { """ Pushes the event onto the event stack. This action must be performed immediately before the event is being dispatched. Additionally, after the event has been dispatched, it has to be {@link #popEvent(Event) popped} off the stack again. @param <L> Type of the listener. @param event The event which will be dispatched. @see #popEvent(Event) """ synchronized (this.stack) { this.stack.push(event); } }
java
public <L extends Listener> void pushEvent(Event<?, L> event) { synchronized (this.stack) { this.stack.push(event); } }
[ "public", "<", "L", "extends", "Listener", ">", "void", "pushEvent", "(", "Event", "<", "?", ",", "L", ">", "event", ")", "{", "synchronized", "(", "this", ".", "stack", ")", "{", "this", ".", "stack", ".", "push", "(", "event", ")", ";", "}", "}" ]
Pushes the event onto the event stack. This action must be performed immediately before the event is being dispatched. Additionally, after the event has been dispatched, it has to be {@link #popEvent(Event) popped} off the stack again. @param <L> Type of the listener. @param event The event which will be dispatched. @see #popEvent(Event)
[ "Pushes", "the", "event", "onto", "the", "event", "stack", ".", "This", "action", "must", "be", "performed", "immediately", "before", "the", "event", "is", "being", "dispatched", ".", "Additionally", "after", "the", "event", "has", "been", "dispatched", "it", "has", "to", "be", "{", "@link", "#popEvent", "(", "Event", ")", "popped", "}", "off", "the", "stack", "again", "." ]
train
https://github.com/skuzzle/jeve/blob/42cc18947c9c8596c34410336e4e375e9fcd7c47/jeve/src/main/java/de/skuzzle/jeve/providers/EventStackImpl.java#L99-L103
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java
EscapedFunctions2.sqlweek
public static void sqlweek(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { """ week translation @param buf The buffer to append into @param parsedArgs arguments @throws SQLException if something wrong happens """ singleArgumentFunctionCall(buf, "extract(week from ", "week", parsedArgs); }
java
public static void sqlweek(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { singleArgumentFunctionCall(buf, "extract(week from ", "week", parsedArgs); }
[ "public", "static", "void", "sqlweek", "(", "StringBuilder", "buf", ",", "List", "<", "?", "extends", "CharSequence", ">", "parsedArgs", ")", "throws", "SQLException", "{", "singleArgumentFunctionCall", "(", "buf", ",", "\"extract(week from \"", ",", "\"week\"", ",", "parsedArgs", ")", ";", "}" ]
week translation @param buf The buffer to append into @param parsedArgs arguments @throws SQLException if something wrong happens
[ "week", "translation" ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L475-L477
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java
AmazonDynamoDBClient.batchGetItem
public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest) throws AmazonServiceException, AmazonClientException { """ <p> Retrieves the attributes for multiple items from multiple tables using their primary keys. </p> <p> The maximum number of item attributes that can be retrieved for a single operation is 100. Also, the number of items retrieved is constrained by a 1 MB the size limit. If the response size limit is exceeded or a partial result is returned due to an internal processing failure, Amazon DynamoDB returns an <code>UnprocessedKeys</code> value so you can retry the operation starting with the next item to get. </p> <p> Amazon DynamoDB automatically adjusts the number of items returned per page to enforce this limit. For example, even if you ask to retrieve 100 items, but each individual item is 50k in size, the system returns 20 items and an appropriate <code>UnprocessedKeys</code> value so you can get the next page of results. If necessary, your application needs its own logic to assemble the pages of results into one set. </p> @param batchGetItemRequest Container for the necessary parameters to execute the BatchGetItem service method on AmazonDynamoDB. @return The response from the BatchGetItem service method, as returned by AmazonDynamoDB. @throws ProvisionedThroughputExceededException @throws InternalServerErrorException @throws ResourceNotFoundException @throws AmazonClientException If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available. @throws AmazonServiceException If an error response is returned by AmazonDynamoDB indicating either a problem with the data in the request, or a server side issue. """ ExecutionContext executionContext = createExecutionContext(batchGetItemRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); Request<BatchGetItemRequest> request = marshall(batchGetItemRequest, new BatchGetItemRequestMarshaller(), executionContext.getAwsRequestMetrics()); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); Unmarshaller<BatchGetItemResult, JsonUnmarshallerContext> unmarshaller = new BatchGetItemResultJsonUnmarshaller(); JsonResponseHandler<BatchGetItemResult> responseHandler = new JsonResponseHandler<BatchGetItemResult>(unmarshaller); return invoke(request, responseHandler, executionContext); }
java
public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest) throws AmazonServiceException, AmazonClientException { ExecutionContext executionContext = createExecutionContext(batchGetItemRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); Request<BatchGetItemRequest> request = marshall(batchGetItemRequest, new BatchGetItemRequestMarshaller(), executionContext.getAwsRequestMetrics()); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); Unmarshaller<BatchGetItemResult, JsonUnmarshallerContext> unmarshaller = new BatchGetItemResultJsonUnmarshaller(); JsonResponseHandler<BatchGetItemResult> responseHandler = new JsonResponseHandler<BatchGetItemResult>(unmarshaller); return invoke(request, responseHandler, executionContext); }
[ "public", "BatchGetItemResult", "batchGetItem", "(", "BatchGetItemRequest", "batchGetItemRequest", ")", "throws", "AmazonServiceException", ",", "AmazonClientException", "{", "ExecutionContext", "executionContext", "=", "createExecutionContext", "(", "batchGetItemRequest", ")", ";", "AWSRequestMetrics", "awsRequestMetrics", "=", "executionContext", ".", "getAwsRequestMetrics", "(", ")", ";", "Request", "<", "BatchGetItemRequest", ">", "request", "=", "marshall", "(", "batchGetItemRequest", ",", "new", "BatchGetItemRequestMarshaller", "(", ")", ",", "executionContext", ".", "getAwsRequestMetrics", "(", ")", ")", ";", "// Binds the request metrics to the current request.", "request", ".", "setAWSRequestMetrics", "(", "awsRequestMetrics", ")", ";", "Unmarshaller", "<", "BatchGetItemResult", ",", "JsonUnmarshallerContext", ">", "unmarshaller", "=", "new", "BatchGetItemResultJsonUnmarshaller", "(", ")", ";", "JsonResponseHandler", "<", "BatchGetItemResult", ">", "responseHandler", "=", "new", "JsonResponseHandler", "<", "BatchGetItemResult", ">", "(", "unmarshaller", ")", ";", "return", "invoke", "(", "request", ",", "responseHandler", ",", "executionContext", ")", ";", "}" ]
<p> Retrieves the attributes for multiple items from multiple tables using their primary keys. </p> <p> The maximum number of item attributes that can be retrieved for a single operation is 100. Also, the number of items retrieved is constrained by a 1 MB the size limit. If the response size limit is exceeded or a partial result is returned due to an internal processing failure, Amazon DynamoDB returns an <code>UnprocessedKeys</code> value so you can retry the operation starting with the next item to get. </p> <p> Amazon DynamoDB automatically adjusts the number of items returned per page to enforce this limit. For example, even if you ask to retrieve 100 items, but each individual item is 50k in size, the system returns 20 items and an appropriate <code>UnprocessedKeys</code> value so you can get the next page of results. If necessary, your application needs its own logic to assemble the pages of results into one set. </p> @param batchGetItemRequest Container for the necessary parameters to execute the BatchGetItem service method on AmazonDynamoDB. @return The response from the BatchGetItem service method, as returned by AmazonDynamoDB. @throws ProvisionedThroughputExceededException @throws InternalServerErrorException @throws ResourceNotFoundException @throws AmazonClientException If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available. @throws AmazonServiceException If an error response is returned by AmazonDynamoDB indicating either a problem with the data in the request, or a server side issue.
[ "<p", ">", "Retrieves", "the", "attributes", "for", "multiple", "items", "from", "multiple", "tables", "using", "their", "primary", "keys", ".", "<", "/", "p", ">", "<p", ">", "The", "maximum", "number", "of", "item", "attributes", "that", "can", "be", "retrieved", "for", "a", "single", "operation", "is", "100", ".", "Also", "the", "number", "of", "items", "retrieved", "is", "constrained", "by", "a", "1", "MB", "the", "size", "limit", ".", "If", "the", "response", "size", "limit", "is", "exceeded", "or", "a", "partial", "result", "is", "returned", "due", "to", "an", "internal", "processing", "failure", "Amazon", "DynamoDB", "returns", "an", "<code", ">", "UnprocessedKeys<", "/", "code", ">", "value", "so", "you", "can", "retry", "the", "operation", "starting", "with", "the", "next", "item", "to", "get", ".", "<", "/", "p", ">", "<p", ">", "Amazon", "DynamoDB", "automatically", "adjusts", "the", "number", "of", "items", "returned", "per", "page", "to", "enforce", "this", "limit", ".", "For", "example", "even", "if", "you", "ask", "to", "retrieve", "100", "items", "but", "each", "individual", "item", "is", "50k", "in", "size", "the", "system", "returns", "20", "items", "and", "an", "appropriate", "<code", ">", "UnprocessedKeys<", "/", "code", ">", "value", "so", "you", "can", "get", "the", "next", "page", "of", "results", ".", "If", "necessary", "your", "application", "needs", "its", "own", "logic", "to", "assemble", "the", "pages", "of", "results", "into", "one", "set", ".", "<", "/", "p", ">" ]
train
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L908-L920
igniterealtime/Smack
smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java
JingleSession.createJingleError
public IQ createJingleError(IQ iq, JingleError jingleError) { """ Complete and send an error. Complete all the null fields in an IQ error response, using the session information we have or some info from the incoming packet. @param iq The Jingle stanza we are responding to @param jingleError the IQ stanza we want to complete and send """ IQ errorPacket = null; if (jingleError != null) { // TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.Condition.undefined_condition); builder.addExtension(jingleError); errorPacket = IQ.createErrorResponse(iq, builder); // errorPacket.addExtension(jingleError); // NO! Let the normal state machinery do all of the sending. // getConnection().sendStanza(perror); LOGGER.severe("Error sent: " + errorPacket.toXML()); } return errorPacket; }
java
public IQ createJingleError(IQ iq, JingleError jingleError) { IQ errorPacket = null; if (jingleError != null) { // TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.Condition.undefined_condition); builder.addExtension(jingleError); errorPacket = IQ.createErrorResponse(iq, builder); // errorPacket.addExtension(jingleError); // NO! Let the normal state machinery do all of the sending. // getConnection().sendStanza(perror); LOGGER.severe("Error sent: " + errorPacket.toXML()); } return errorPacket; }
[ "public", "IQ", "createJingleError", "(", "IQ", "iq", ",", "JingleError", "jingleError", ")", "{", "IQ", "errorPacket", "=", "null", ";", "if", "(", "jingleError", "!=", "null", ")", "{", "// TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways", "StanzaError", ".", "Builder", "builder", "=", "StanzaError", ".", "getBuilder", "(", "StanzaError", ".", "Condition", ".", "undefined_condition", ")", ";", "builder", ".", "addExtension", "(", "jingleError", ")", ";", "errorPacket", "=", "IQ", ".", "createErrorResponse", "(", "iq", ",", "builder", ")", ";", "// errorPacket.addExtension(jingleError);", "// NO! Let the normal state machinery do all of the sending.", "// getConnection().sendStanza(perror);", "LOGGER", ".", "severe", "(", "\"Error sent: \"", "+", "errorPacket", ".", "toXML", "(", ")", ")", ";", "}", "return", "errorPacket", ";", "}" ]
Complete and send an error. Complete all the null fields in an IQ error response, using the session information we have or some info from the incoming packet. @param iq The Jingle stanza we are responding to @param jingleError the IQ stanza we want to complete and send
[ "Complete", "and", "send", "an", "error", ".", "Complete", "all", "the", "null", "fields", "in", "an", "IQ", "error", "response", "using", "the", "session", "information", "we", "have", "or", "some", "info", "from", "the", "incoming", "packet", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L1052-L1068
primefaces/primefaces
src/main/java/org/primefaces/renderkit/CoreRenderer.java
CoreRenderer.renderDummyMarkup
protected void renderDummyMarkup(FacesContext context, UIComponent component, String clientId) throws IOException { """ Used by script-only widget to fix #3265 and allow updating of the component. @param context the {@link FacesContext}. @param component the widget without actual HTML markup. @param clientId the component clientId. @throws IOException """ ResponseWriter writer = context.getResponseWriter(); writer.startElement("div", null); writer.writeAttribute("id", clientId, null); writer.writeAttribute("style", "display: none;", null); renderPassThruAttributes(context, component, null); writer.endElement("div"); }
java
protected void renderDummyMarkup(FacesContext context, UIComponent component, String clientId) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("div", null); writer.writeAttribute("id", clientId, null); writer.writeAttribute("style", "display: none;", null); renderPassThruAttributes(context, component, null); writer.endElement("div"); }
[ "protected", "void", "renderDummyMarkup", "(", "FacesContext", "context", ",", "UIComponent", "component", ",", "String", "clientId", ")", "throws", "IOException", "{", "ResponseWriter", "writer", "=", "context", ".", "getResponseWriter", "(", ")", ";", "writer", ".", "startElement", "(", "\"div\"", ",", "null", ")", ";", "writer", ".", "writeAttribute", "(", "\"id\"", ",", "clientId", ",", "null", ")", ";", "writer", ".", "writeAttribute", "(", "\"style\"", ",", "\"display: none;\"", ",", "null", ")", ";", "renderPassThruAttributes", "(", "context", ",", "component", ",", "null", ")", ";", "writer", ".", "endElement", "(", "\"div\"", ")", ";", "}" ]
Used by script-only widget to fix #3265 and allow updating of the component. @param context the {@link FacesContext}. @param component the widget without actual HTML markup. @param clientId the component clientId. @throws IOException
[ "Used", "by", "script", "-", "only", "widget", "to", "fix", "#3265", "and", "allow", "updating", "of", "the", "component", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/renderkit/CoreRenderer.java#L821-L831
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.create
public static Call create(final Map <String, Object>params) throws Exception { """ Dials a call, from a phone number to a phone number. @param params the call params @return the call @throws IOException unexpected error. """ assert (params != null); return create(BandwidthClient.getInstance(), params); }
java
public static Call create(final Map <String, Object>params) throws Exception { assert (params != null); return create(BandwidthClient.getInstance(), params); }
[ "public", "static", "Call", "create", "(", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "assert", "(", "params", "!=", "null", ")", ";", "return", "create", "(", "BandwidthClient", ".", "getInstance", "(", ")", ",", "params", ")", ";", "}" ]
Dials a call, from a phone number to a phone number. @param params the call params @return the call @throws IOException unexpected error.
[ "Dials", "a", "call", "from", "a", "phone", "number", "to", "a", "phone", "number", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L139-L144
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java
Node.getSubscriptionOptions
public SubscribeForm getSubscriptionOptions(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Returns a SubscribeForm for subscriptions, from which you can create an answer form to be submitted via the {@link #sendConfigurationForm(Form)}. @param jid @return A subscription options form @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException """ return getSubscriptionOptions(jid, null); }
java
public SubscribeForm getSubscriptionOptions(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getSubscriptionOptions(jid, null); }
[ "public", "SubscribeForm", "getSubscriptionOptions", "(", "String", "jid", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "return", "getSubscriptionOptions", "(", "jid", ",", "null", ")", ";", "}" ]
Returns a SubscribeForm for subscriptions, from which you can create an answer form to be submitted via the {@link #sendConfigurationForm(Form)}. @param jid @return A subscription options form @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Returns", "a", "SubscribeForm", "for", "subscriptions", "from", "which", "you", "can", "create", "an", "answer", "form", "to", "be", "submitted", "via", "the", "{", "@link", "#sendConfigurationForm", "(", "Form", ")", "}", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L466-L468
ebean-orm/querybean-agent-now-merged-into-ebean-agent-
src/main/java/io/ebean/typequery/agent/ClassInfo.java
ClassInfo.addField
public void addField(int access, String name, String desc, String signature) { """ Add the type query bean field. We will create a 'property access' method for each field. """ if (((access & Opcodes.ACC_PUBLIC) != 0)) { if (fields == null) { fields = new ArrayList<>(); } if ((access & Opcodes.ACC_STATIC) == 0) { fields.add(new FieldInfo(this, name, desc, signature)); } } }
java
public void addField(int access, String name, String desc, String signature) { if (((access & Opcodes.ACC_PUBLIC) != 0)) { if (fields == null) { fields = new ArrayList<>(); } if ((access & Opcodes.ACC_STATIC) == 0) { fields.add(new FieldInfo(this, name, desc, signature)); } } }
[ "public", "void", "addField", "(", "int", "access", ",", "String", "name", ",", "String", "desc", ",", "String", "signature", ")", "{", "if", "(", "(", "(", "access", "&", "Opcodes", ".", "ACC_PUBLIC", ")", "!=", "0", ")", ")", "{", "if", "(", "fields", "==", "null", ")", "{", "fields", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "if", "(", "(", "access", "&", "Opcodes", ".", "ACC_STATIC", ")", "==", "0", ")", "{", "fields", ".", "add", "(", "new", "FieldInfo", "(", "this", ",", "name", ",", "desc", ",", "signature", ")", ")", ";", "}", "}", "}" ]
Add the type query bean field. We will create a 'property access' method for each field.
[ "Add", "the", "type", "query", "bean", "field", ".", "We", "will", "create", "a", "property", "access", "method", "for", "each", "field", "." ]
train
https://github.com/ebean-orm/querybean-agent-now-merged-into-ebean-agent-/blob/a063554fabdbed15ff5e10ad0a0b53b67e039006/src/main/java/io/ebean/typequery/agent/ClassInfo.java#L103-L113
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.overTheBox_serviceName_migrate_GET
public OvhOrder overTheBox_serviceName_migrate_GET(String serviceName, Boolean hardware, String offer, String shippingContactID, OvhShippingMethodEnum shippingMethod, Long shippingRelayID) throws IOException { """ Get prices and contracts information REST: GET /order/overTheBox/{serviceName}/migrate @param offer [required] Offer name to migrate to @param shippingContactID [required] Contact ID to deliver to @param shippingRelayID [required] Relay ID to deliver to. Needed if shipping is mondialRelay @param shippingMethod [required] How do you want your shipment shipped @param hardware [required] If you want to migrate with a new hardware @param serviceName [required] The internal name of your overTheBox offer API beta """ String qPath = "/order/overTheBox/{serviceName}/migrate"; StringBuilder sb = path(qPath, serviceName); query(sb, "hardware", hardware); query(sb, "offer", offer); query(sb, "shippingContactID", shippingContactID); query(sb, "shippingMethod", shippingMethod); query(sb, "shippingRelayID", shippingRelayID); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder overTheBox_serviceName_migrate_GET(String serviceName, Boolean hardware, String offer, String shippingContactID, OvhShippingMethodEnum shippingMethod, Long shippingRelayID) throws IOException { String qPath = "/order/overTheBox/{serviceName}/migrate"; StringBuilder sb = path(qPath, serviceName); query(sb, "hardware", hardware); query(sb, "offer", offer); query(sb, "shippingContactID", shippingContactID); query(sb, "shippingMethod", shippingMethod); query(sb, "shippingRelayID", shippingRelayID); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "overTheBox_serviceName_migrate_GET", "(", "String", "serviceName", ",", "Boolean", "hardware", ",", "String", "offer", ",", "String", "shippingContactID", ",", "OvhShippingMethodEnum", "shippingMethod", ",", "Long", "shippingRelayID", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/overTheBox/{serviceName}/migrate\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"hardware\"", ",", "hardware", ")", ";", "query", "(", "sb", ",", "\"offer\"", ",", "offer", ")", ";", "query", "(", "sb", ",", "\"shippingContactID\"", ",", "shippingContactID", ")", ";", "query", "(", "sb", ",", "\"shippingMethod\"", ",", "shippingMethod", ")", ";", "query", "(", "sb", ",", "\"shippingRelayID\"", ",", "shippingRelayID", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/overTheBox/{serviceName}/migrate @param offer [required] Offer name to migrate to @param shippingContactID [required] Contact ID to deliver to @param shippingRelayID [required] Relay ID to deliver to. Needed if shipping is mondialRelay @param shippingMethod [required] How do you want your shipment shipped @param hardware [required] If you want to migrate with a new hardware @param serviceName [required] The internal name of your overTheBox offer API beta
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3152-L3162
asciidoctor/asciidoctorj
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/ProcessorProxyUtil.java
ProcessorProxyUtil.defineAnnotatedMethods
public static void defineAnnotatedMethods(RubyClass rubyClass, Class<?> proxyClass) { """ Defines the annotated methods of the given class and all super classes as {@link org.jruby.RubyClass#defineAnnotatedMethods(Class)} does not handle inherited methods. @param rubyClass @param proxyClass """ Class<?> currentClass = proxyClass; while (currentClass != RubyObject.class) { rubyClass.defineAnnotatedMethods(currentClass); currentClass = currentClass.getSuperclass(); } }
java
public static void defineAnnotatedMethods(RubyClass rubyClass, Class<?> proxyClass) { Class<?> currentClass = proxyClass; while (currentClass != RubyObject.class) { rubyClass.defineAnnotatedMethods(currentClass); currentClass = currentClass.getSuperclass(); } }
[ "public", "static", "void", "defineAnnotatedMethods", "(", "RubyClass", "rubyClass", ",", "Class", "<", "?", ">", "proxyClass", ")", "{", "Class", "<", "?", ">", "currentClass", "=", "proxyClass", ";", "while", "(", "currentClass", "!=", "RubyObject", ".", "class", ")", "{", "rubyClass", ".", "defineAnnotatedMethods", "(", "currentClass", ")", ";", "currentClass", "=", "currentClass", ".", "getSuperclass", "(", ")", ";", "}", "}" ]
Defines the annotated methods of the given class and all super classes as {@link org.jruby.RubyClass#defineAnnotatedMethods(Class)} does not handle inherited methods. @param rubyClass @param proxyClass
[ "Defines", "the", "annotated", "methods", "of", "the", "given", "class", "and", "all", "super", "classes", "as", "{" ]
train
https://github.com/asciidoctor/asciidoctorj/blob/e348c9a12b54c33fea7b05d70224c007e2ee75a9/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/ProcessorProxyUtil.java#L50-L56
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java
ApacheHTTPClient.createMethod
protected HttpMethodBase createMethod(String url,HTTPMethod httpMethod) { """ This function creates and returns a new HTTP method. @param url The target URL @param httpMethod The HTTP method to use @return The new HTTP method """ if(httpMethod==null) { throw new FaxException("HTTP method not provided."); } if((url==null)||(url.length()==0)) { throw new FaxException("HTTP URL not provided."); } //create method HttpMethodBase httpMethodClient=null; switch(httpMethod) { case POST: httpMethodClient=new PostMethod(url); break; case GET: httpMethodClient=new GetMethod(url); break; case PUT: httpMethodClient=new PutMethod(url); break; } return httpMethodClient; }
java
protected HttpMethodBase createMethod(String url,HTTPMethod httpMethod) { if(httpMethod==null) { throw new FaxException("HTTP method not provided."); } if((url==null)||(url.length()==0)) { throw new FaxException("HTTP URL not provided."); } //create method HttpMethodBase httpMethodClient=null; switch(httpMethod) { case POST: httpMethodClient=new PostMethod(url); break; case GET: httpMethodClient=new GetMethod(url); break; case PUT: httpMethodClient=new PutMethod(url); break; } return httpMethodClient; }
[ "protected", "HttpMethodBase", "createMethod", "(", "String", "url", ",", "HTTPMethod", "httpMethod", ")", "{", "if", "(", "httpMethod", "==", "null", ")", "{", "throw", "new", "FaxException", "(", "\"HTTP method not provided.\"", ")", ";", "}", "if", "(", "(", "url", "==", "null", ")", "||", "(", "url", ".", "length", "(", ")", "==", "0", ")", ")", "{", "throw", "new", "FaxException", "(", "\"HTTP URL not provided.\"", ")", ";", "}", "//create method", "HttpMethodBase", "httpMethodClient", "=", "null", ";", "switch", "(", "httpMethod", ")", "{", "case", "POST", ":", "httpMethodClient", "=", "new", "PostMethod", "(", "url", ")", ";", "break", ";", "case", "GET", ":", "httpMethodClient", "=", "new", "GetMethod", "(", "url", ")", ";", "break", ";", "case", "PUT", ":", "httpMethodClient", "=", "new", "PutMethod", "(", "url", ")", ";", "break", ";", "}", "return", "httpMethodClient", ";", "}" ]
This function creates and returns a new HTTP method. @param url The target URL @param httpMethod The HTTP method to use @return The new HTTP method
[ "This", "function", "creates", "and", "returns", "a", "new", "HTTP", "method", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java#L71-L98
pushtorefresh/storio
storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/operations/put/PutResult.java
PutResult.newUpdateResult
@NonNull public static PutResult newUpdateResult( int numberOfRowsUpdated, @NonNull Set<String> affectedTables, @Nullable Collection<String> affectedTags ) { """ Creates {@link PutResult} of update. @param numberOfRowsUpdated number of rows that were updated, must be {@code >= 0}. @param affectedTables tables that were affected. @param affectedTags notification tags that were affected. @return new {@link PutResult} instance. """ return new PutResult(null, numberOfRowsUpdated, affectedTables, nonNullSet(affectedTags)); }
java
@NonNull public static PutResult newUpdateResult( int numberOfRowsUpdated, @NonNull Set<String> affectedTables, @Nullable Collection<String> affectedTags ) { return new PutResult(null, numberOfRowsUpdated, affectedTables, nonNullSet(affectedTags)); }
[ "@", "NonNull", "public", "static", "PutResult", "newUpdateResult", "(", "int", "numberOfRowsUpdated", ",", "@", "NonNull", "Set", "<", "String", ">", "affectedTables", ",", "@", "Nullable", "Collection", "<", "String", ">", "affectedTags", ")", "{", "return", "new", "PutResult", "(", "null", ",", "numberOfRowsUpdated", ",", "affectedTables", ",", "nonNullSet", "(", "affectedTags", ")", ")", ";", "}" ]
Creates {@link PutResult} of update. @param numberOfRowsUpdated number of rows that were updated, must be {@code >= 0}. @param affectedTables tables that were affected. @param affectedTags notification tags that were affected. @return new {@link PutResult} instance.
[ "Creates", "{", "@link", "PutResult", "}", "of", "update", "." ]
train
https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/operations/put/PutResult.java#L142-L149
killbill/killbill
invoice/src/main/java/org/killbill/billing/invoice/dao/InvoiceDaoHelper.java
InvoiceDaoHelper.createAdjustmentItem
public InvoiceItemModelDao createAdjustmentItem(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final UUID invoiceId, final UUID invoiceItemId, final BigDecimal positiveAdjAmount, final Currency currency, final LocalDate effectiveDate, final InternalCallContext context) throws InvoiceApiException { """ Create an adjustment for a given invoice item. This just creates the object in memory, it doesn't write it to disk. @param invoiceId the invoice id @param invoiceItemId the invoice item id to adjust @param effectiveDate adjustment effective date, in the account timezone @param positiveAdjAmount the amount to adjust. Pass null to adjust the full amount of the original item @param currency the currency of the amount. Pass null to default to the original currency used @return the adjustment item """ // First, retrieve the invoice item in question final InvoiceItemSqlDao invoiceItemSqlDao = entitySqlDaoWrapperFactory.become(InvoiceItemSqlDao.class); final InvoiceItemModelDao invoiceItemToBeAdjusted = invoiceItemSqlDao.getById(invoiceItemId.toString(), context); if (invoiceItemToBeAdjusted == null) { throw new InvoiceApiException(ErrorCode.INVOICE_ITEM_NOT_FOUND, invoiceItemId); } // Validate the invoice it belongs to if (!invoiceItemToBeAdjusted.getInvoiceId().equals(invoiceId)) { throw new InvoiceApiException(ErrorCode.INVOICE_INVALID_FOR_INVOICE_ITEM_ADJUSTMENT, invoiceItemId, invoiceId); } // Retrieve the amount and currency if needed final BigDecimal amountToAdjust = MoreObjects.firstNonNull(positiveAdjAmount, invoiceItemToBeAdjusted.getAmount()); // TODO - should we enforce the currency (and respect the original one) here if the amount passed was null? final Currency currencyForAdjustment = MoreObjects.firstNonNull(currency, invoiceItemToBeAdjusted.getCurrency()); // Finally, create the adjustment // Note! The amount is negated here! return new InvoiceItemModelDao(context.getCreatedDate(), InvoiceItemType.ITEM_ADJ, invoiceItemToBeAdjusted.getInvoiceId(), invoiceItemToBeAdjusted.getAccountId(), null, null, null, invoiceItemToBeAdjusted.getProductName(), invoiceItemToBeAdjusted.getPlanName(), invoiceItemToBeAdjusted.getPhaseName(), invoiceItemToBeAdjusted.getUsageName(), effectiveDate, effectiveDate, amountToAdjust.negate(), null, currencyForAdjustment, invoiceItemToBeAdjusted.getId()); }
java
public InvoiceItemModelDao createAdjustmentItem(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final UUID invoiceId, final UUID invoiceItemId, final BigDecimal positiveAdjAmount, final Currency currency, final LocalDate effectiveDate, final InternalCallContext context) throws InvoiceApiException { // First, retrieve the invoice item in question final InvoiceItemSqlDao invoiceItemSqlDao = entitySqlDaoWrapperFactory.become(InvoiceItemSqlDao.class); final InvoiceItemModelDao invoiceItemToBeAdjusted = invoiceItemSqlDao.getById(invoiceItemId.toString(), context); if (invoiceItemToBeAdjusted == null) { throw new InvoiceApiException(ErrorCode.INVOICE_ITEM_NOT_FOUND, invoiceItemId); } // Validate the invoice it belongs to if (!invoiceItemToBeAdjusted.getInvoiceId().equals(invoiceId)) { throw new InvoiceApiException(ErrorCode.INVOICE_INVALID_FOR_INVOICE_ITEM_ADJUSTMENT, invoiceItemId, invoiceId); } // Retrieve the amount and currency if needed final BigDecimal amountToAdjust = MoreObjects.firstNonNull(positiveAdjAmount, invoiceItemToBeAdjusted.getAmount()); // TODO - should we enforce the currency (and respect the original one) here if the amount passed was null? final Currency currencyForAdjustment = MoreObjects.firstNonNull(currency, invoiceItemToBeAdjusted.getCurrency()); // Finally, create the adjustment // Note! The amount is negated here! return new InvoiceItemModelDao(context.getCreatedDate(), InvoiceItemType.ITEM_ADJ, invoiceItemToBeAdjusted.getInvoiceId(), invoiceItemToBeAdjusted.getAccountId(), null, null, null, invoiceItemToBeAdjusted.getProductName(), invoiceItemToBeAdjusted.getPlanName(), invoiceItemToBeAdjusted.getPhaseName(), invoiceItemToBeAdjusted.getUsageName(), effectiveDate, effectiveDate, amountToAdjust.negate(), null, currencyForAdjustment, invoiceItemToBeAdjusted.getId()); }
[ "public", "InvoiceItemModelDao", "createAdjustmentItem", "(", "final", "EntitySqlDaoWrapperFactory", "entitySqlDaoWrapperFactory", ",", "final", "UUID", "invoiceId", ",", "final", "UUID", "invoiceItemId", ",", "final", "BigDecimal", "positiveAdjAmount", ",", "final", "Currency", "currency", ",", "final", "LocalDate", "effectiveDate", ",", "final", "InternalCallContext", "context", ")", "throws", "InvoiceApiException", "{", "// First, retrieve the invoice item in question", "final", "InvoiceItemSqlDao", "invoiceItemSqlDao", "=", "entitySqlDaoWrapperFactory", ".", "become", "(", "InvoiceItemSqlDao", ".", "class", ")", ";", "final", "InvoiceItemModelDao", "invoiceItemToBeAdjusted", "=", "invoiceItemSqlDao", ".", "getById", "(", "invoiceItemId", ".", "toString", "(", ")", ",", "context", ")", ";", "if", "(", "invoiceItemToBeAdjusted", "==", "null", ")", "{", "throw", "new", "InvoiceApiException", "(", "ErrorCode", ".", "INVOICE_ITEM_NOT_FOUND", ",", "invoiceItemId", ")", ";", "}", "// Validate the invoice it belongs to", "if", "(", "!", "invoiceItemToBeAdjusted", ".", "getInvoiceId", "(", ")", ".", "equals", "(", "invoiceId", ")", ")", "{", "throw", "new", "InvoiceApiException", "(", "ErrorCode", ".", "INVOICE_INVALID_FOR_INVOICE_ITEM_ADJUSTMENT", ",", "invoiceItemId", ",", "invoiceId", ")", ";", "}", "// Retrieve the amount and currency if needed", "final", "BigDecimal", "amountToAdjust", "=", "MoreObjects", ".", "firstNonNull", "(", "positiveAdjAmount", ",", "invoiceItemToBeAdjusted", ".", "getAmount", "(", ")", ")", ";", "// TODO - should we enforce the currency (and respect the original one) here if the amount passed was null?", "final", "Currency", "currencyForAdjustment", "=", "MoreObjects", ".", "firstNonNull", "(", "currency", ",", "invoiceItemToBeAdjusted", ".", "getCurrency", "(", ")", ")", ";", "// Finally, create the adjustment", "// Note! The amount is negated here!", "return", "new", "InvoiceItemModelDao", "(", "context", ".", "getCreatedDate", "(", ")", ",", "InvoiceItemType", ".", "ITEM_ADJ", ",", "invoiceItemToBeAdjusted", ".", "getInvoiceId", "(", ")", ",", "invoiceItemToBeAdjusted", ".", "getAccountId", "(", ")", ",", "null", ",", "null", ",", "null", ",", "invoiceItemToBeAdjusted", ".", "getProductName", "(", ")", ",", "invoiceItemToBeAdjusted", ".", "getPlanName", "(", ")", ",", "invoiceItemToBeAdjusted", ".", "getPhaseName", "(", ")", ",", "invoiceItemToBeAdjusted", ".", "getUsageName", "(", ")", ",", "effectiveDate", ",", "effectiveDate", ",", "amountToAdjust", ".", "negate", "(", ")", ",", "null", ",", "currencyForAdjustment", ",", "invoiceItemToBeAdjusted", ".", "getId", "(", ")", ")", ";", "}" ]
Create an adjustment for a given invoice item. This just creates the object in memory, it doesn't write it to disk. @param invoiceId the invoice id @param invoiceItemId the invoice item id to adjust @param effectiveDate adjustment effective date, in the account timezone @param positiveAdjAmount the amount to adjust. Pass null to adjust the full amount of the original item @param currency the currency of the amount. Pass null to default to the original currency used @return the adjustment item
[ "Create", "an", "adjustment", "for", "a", "given", "invoice", "item", ".", "This", "just", "creates", "the", "object", "in", "memory", "it", "doesn", "t", "write", "it", "to", "disk", "." ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/dao/InvoiceDaoHelper.java#L199-L224
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
CacheableWorkspaceDataManager.getCachedItemData
protected ItemData getCachedItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException { """ Get cached ItemData. @param parentData parent @param name Item name @param itemType item type @return ItemData @throws RepositoryException error """ return cache.isEnabled() ? cache.get(parentData.getIdentifier(), name, itemType) : null; }
java
protected ItemData getCachedItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException { return cache.isEnabled() ? cache.get(parentData.getIdentifier(), name, itemType) : null; }
[ "protected", "ItemData", "getCachedItemData", "(", "NodeData", "parentData", ",", "QPathEntry", "name", ",", "ItemType", "itemType", ")", "throws", "RepositoryException", "{", "return", "cache", ".", "isEnabled", "(", ")", "?", "cache", ".", "get", "(", "parentData", ".", "getIdentifier", "(", ")", ",", "name", ",", "itemType", ")", ":", "null", ";", "}" ]
Get cached ItemData. @param parentData parent @param name Item name @param itemType item type @return ItemData @throws RepositoryException error
[ "Get", "cached", "ItemData", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1284-L1288
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/complex/CmsDataViewClientWidget.java
CmsDataViewClientWidget.isTrue
private boolean isTrue(JSONObject obj, String property) { """ Checks if a property in a JSON object is either the boolean value 'true' or a string representation of that value.<p> @param obj the JSON object @param property the property name @return true if the value represents the boolean 'true' """ JSONValue val = obj.get(property); if (val == null) { return false; } boolean stringTrue = ((val.isString() != null) && Boolean.parseBoolean(val.isString().stringValue())); boolean boolTrue = ((val.isBoolean() != null) && val.isBoolean().booleanValue()); return stringTrue || boolTrue; }
java
private boolean isTrue(JSONObject obj, String property) { JSONValue val = obj.get(property); if (val == null) { return false; } boolean stringTrue = ((val.isString() != null) && Boolean.parseBoolean(val.isString().stringValue())); boolean boolTrue = ((val.isBoolean() != null) && val.isBoolean().booleanValue()); return stringTrue || boolTrue; }
[ "private", "boolean", "isTrue", "(", "JSONObject", "obj", ",", "String", "property", ")", "{", "JSONValue", "val", "=", "obj", ".", "get", "(", "property", ")", ";", "if", "(", "val", "==", "null", ")", "{", "return", "false", ";", "}", "boolean", "stringTrue", "=", "(", "(", "val", ".", "isString", "(", ")", "!=", "null", ")", "&&", "Boolean", ".", "parseBoolean", "(", "val", ".", "isString", "(", ")", ".", "stringValue", "(", ")", ")", ")", ";", "boolean", "boolTrue", "=", "(", "(", "val", ".", "isBoolean", "(", ")", "!=", "null", ")", "&&", "val", ".", "isBoolean", "(", ")", ".", "booleanValue", "(", ")", ")", ";", "return", "stringTrue", "||", "boolTrue", ";", "}" ]
Checks if a property in a JSON object is either the boolean value 'true' or a string representation of that value.<p> @param obj the JSON object @param property the property name @return true if the value represents the boolean 'true'
[ "Checks", "if", "a", "property", "in", "a", "JSON", "object", "is", "either", "the", "boolean", "value", "true", "or", "a", "string", "representation", "of", "that", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/complex/CmsDataViewClientWidget.java#L198-L207
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.security/src/com/ibm/ws/ejbcontainer/security/internal/EJBSecurityCollaboratorImpl.java
EJBSecurityCollaboratorImpl.setUnauthenticatedSubjectIfNeeded
private boolean setUnauthenticatedSubjectIfNeeded(Subject invokedSubject, Subject receivedSubject) { """ If invoked and received cred are null, then set the unauthenticated subject. @param invokedSubject @param receivedSubject @return {@code true} if the unauthenticated subject was set, {@code false} otherwise. """ if ((invokedSubject == null) && (receivedSubject == null)) { // create the unauthenticated subject and set as the invocation subject subjectManager.setInvocationSubject(unauthenticatedSubjectServiceRef.getService().getUnauthenticatedSubject()); return true; } return false; }
java
private boolean setUnauthenticatedSubjectIfNeeded(Subject invokedSubject, Subject receivedSubject) { if ((invokedSubject == null) && (receivedSubject == null)) { // create the unauthenticated subject and set as the invocation subject subjectManager.setInvocationSubject(unauthenticatedSubjectServiceRef.getService().getUnauthenticatedSubject()); return true; } return false; }
[ "private", "boolean", "setUnauthenticatedSubjectIfNeeded", "(", "Subject", "invokedSubject", ",", "Subject", "receivedSubject", ")", "{", "if", "(", "(", "invokedSubject", "==", "null", ")", "&&", "(", "receivedSubject", "==", "null", ")", ")", "{", "// create the unauthenticated subject and set as the invocation subject", "subjectManager", ".", "setInvocationSubject", "(", "unauthenticatedSubjectServiceRef", ".", "getService", "(", ")", ".", "getUnauthenticatedSubject", "(", ")", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
If invoked and received cred are null, then set the unauthenticated subject. @param invokedSubject @param receivedSubject @return {@code true} if the unauthenticated subject was set, {@code false} otherwise.
[ "If", "invoked", "and", "received", "cred", "are", "null", "then", "set", "the", "unauthenticated", "subject", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.security/src/com/ibm/ws/ejbcontainer/security/internal/EJBSecurityCollaboratorImpl.java#L701-L708
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java
CudaAffinityManager.replicateToDevice
@Override public DataBuffer replicateToDevice(Integer deviceId, DataBuffer buffer) { """ This method replicates given DataBuffer, and places it to target device. @param deviceId target deviceId @param buffer @return """ if (buffer == null) return null; int currentDeviceId = AtomicAllocator.getInstance().getDeviceId(); if (currentDeviceId != deviceId) { Nd4j.getMemoryManager().releaseCurrentContext(); NativeOpsHolder.getInstance().getDeviceNativeOps().setDevice(deviceId); Nd4j.getAffinityManager().attachThreadToDevice(Thread.currentThread().getId(), deviceId); } DataBuffer dstBuffer = Nd4j.createBuffer(buffer.dataType(), buffer.length(), false); AtomicAllocator.getInstance().memcpy(dstBuffer, buffer); if (currentDeviceId != deviceId) { Nd4j.getMemoryManager().releaseCurrentContext(); NativeOpsHolder.getInstance().getDeviceNativeOps().setDevice(currentDeviceId); Nd4j.getAffinityManager().attachThreadToDevice(Thread.currentThread().getId(), currentDeviceId); } return dstBuffer; }
java
@Override public DataBuffer replicateToDevice(Integer deviceId, DataBuffer buffer) { if (buffer == null) return null; int currentDeviceId = AtomicAllocator.getInstance().getDeviceId(); if (currentDeviceId != deviceId) { Nd4j.getMemoryManager().releaseCurrentContext(); NativeOpsHolder.getInstance().getDeviceNativeOps().setDevice(deviceId); Nd4j.getAffinityManager().attachThreadToDevice(Thread.currentThread().getId(), deviceId); } DataBuffer dstBuffer = Nd4j.createBuffer(buffer.dataType(), buffer.length(), false); AtomicAllocator.getInstance().memcpy(dstBuffer, buffer); if (currentDeviceId != deviceId) { Nd4j.getMemoryManager().releaseCurrentContext(); NativeOpsHolder.getInstance().getDeviceNativeOps().setDevice(currentDeviceId); Nd4j.getAffinityManager().attachThreadToDevice(Thread.currentThread().getId(), currentDeviceId); } return dstBuffer; }
[ "@", "Override", "public", "DataBuffer", "replicateToDevice", "(", "Integer", "deviceId", ",", "DataBuffer", "buffer", ")", "{", "if", "(", "buffer", "==", "null", ")", "return", "null", ";", "int", "currentDeviceId", "=", "AtomicAllocator", ".", "getInstance", "(", ")", ".", "getDeviceId", "(", ")", ";", "if", "(", "currentDeviceId", "!=", "deviceId", ")", "{", "Nd4j", ".", "getMemoryManager", "(", ")", ".", "releaseCurrentContext", "(", ")", ";", "NativeOpsHolder", ".", "getInstance", "(", ")", ".", "getDeviceNativeOps", "(", ")", ".", "setDevice", "(", "deviceId", ")", ";", "Nd4j", ".", "getAffinityManager", "(", ")", ".", "attachThreadToDevice", "(", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ",", "deviceId", ")", ";", "}", "DataBuffer", "dstBuffer", "=", "Nd4j", ".", "createBuffer", "(", "buffer", ".", "dataType", "(", ")", ",", "buffer", ".", "length", "(", ")", ",", "false", ")", ";", "AtomicAllocator", ".", "getInstance", "(", ")", ".", "memcpy", "(", "dstBuffer", ",", "buffer", ")", ";", "if", "(", "currentDeviceId", "!=", "deviceId", ")", "{", "Nd4j", ".", "getMemoryManager", "(", ")", ".", "releaseCurrentContext", "(", ")", ";", "NativeOpsHolder", ".", "getInstance", "(", ")", ".", "getDeviceNativeOps", "(", ")", ".", "setDevice", "(", "currentDeviceId", ")", ";", "Nd4j", ".", "getAffinityManager", "(", ")", ".", "attachThreadToDevice", "(", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ",", "currentDeviceId", ")", ";", "}", "return", "dstBuffer", ";", "}" ]
This method replicates given DataBuffer, and places it to target device. @param deviceId target deviceId @param buffer @return
[ "This", "method", "replicates", "given", "DataBuffer", "and", "places", "it", "to", "target", "device", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java#L309-L331
redkale/redkale
src/org/redkale/convert/json/JsonByteBufferWriter.java
JsonByteBufferWriter.writeTo
@Override public void writeTo(final boolean quote, final String value) { """ <b>注意:</b> 该String值不能为null且不会进行转义, 只用于不含需要转义字符的字符串,例如enum、double、BigInteger转换的String @param quote 是否写入双引号 @param value String值 """ char[] chs = Utility.charArray(value); writeTo(-1, quote, chs, 0, chs.length); }
java
@Override public void writeTo(final boolean quote, final String value) { char[] chs = Utility.charArray(value); writeTo(-1, quote, chs, 0, chs.length); }
[ "@", "Override", "public", "void", "writeTo", "(", "final", "boolean", "quote", ",", "final", "String", "value", ")", "{", "char", "[", "]", "chs", "=", "Utility", ".", "charArray", "(", "value", ")", ";", "writeTo", "(", "-", "1", ",", "quote", ",", "chs", ",", "0", ",", "chs", ".", "length", ")", ";", "}" ]
<b>注意:</b> 该String值不能为null且不会进行转义, 只用于不含需要转义字符的字符串,例如enum、double、BigInteger转换的String @param quote 是否写入双引号 @param value String值
[ "<b", ">", "注意:<", "/", "b", ">", "该String值不能为null且不会进行转义,", "只用于不含需要转义字符的字符串,例如enum、double、BigInteger转换的String" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/convert/json/JsonByteBufferWriter.java#L240-L244
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/i18n/MessageBuilder.java
MessageBuilder.define
public void define(final MessageItem key, final MessageResource forcedValue) { """ Override a parameter value. @param key the parameter item key @param forcedValue the overridden value """ this.overriddenMessageMap.put(key, forcedValue); set(getParamKey(key), forcedValue); }
java
public void define(final MessageItem key, final MessageResource forcedValue) { this.overriddenMessageMap.put(key, forcedValue); set(getParamKey(key), forcedValue); }
[ "public", "void", "define", "(", "final", "MessageItem", "key", ",", "final", "MessageResource", "forcedValue", ")", "{", "this", ".", "overriddenMessageMap", ".", "put", "(", "key", ",", "forcedValue", ")", ";", "set", "(", "getParamKey", "(", "key", ")", ",", "forcedValue", ")", ";", "}" ]
Override a parameter value. @param key the parameter item key @param forcedValue the overridden value
[ "Override", "a", "parameter", "value", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/i18n/MessageBuilder.java#L218-L221
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/TraceId.java
TraceId.fromBytes
public static TraceId fromBytes(byte[] src) { """ Returns a {@code TraceId} built from a byte representation. @param src the representation of the {@code TraceId}. @return a {@code TraceId} whose representation is given by the {@code src} parameter. @throws NullPointerException if {@code src} is null. @throws IllegalArgumentException if {@code src.length} is not {@link TraceId#SIZE}. @since 0.5 """ Utils.checkNotNull(src, "src"); Utils.checkArgument(src.length == SIZE, "Invalid size: expected %s, got %s", SIZE, src.length); return fromBytes(src, 0); }
java
public static TraceId fromBytes(byte[] src) { Utils.checkNotNull(src, "src"); Utils.checkArgument(src.length == SIZE, "Invalid size: expected %s, got %s", SIZE, src.length); return fromBytes(src, 0); }
[ "public", "static", "TraceId", "fromBytes", "(", "byte", "[", "]", "src", ")", "{", "Utils", ".", "checkNotNull", "(", "src", ",", "\"src\"", ")", ";", "Utils", ".", "checkArgument", "(", "src", ".", "length", "==", "SIZE", ",", "\"Invalid size: expected %s, got %s\"", ",", "SIZE", ",", "src", ".", "length", ")", ";", "return", "fromBytes", "(", "src", ",", "0", ")", ";", "}" ]
Returns a {@code TraceId} built from a byte representation. @param src the representation of the {@code TraceId}. @return a {@code TraceId} whose representation is given by the {@code src} parameter. @throws NullPointerException if {@code src} is null. @throws IllegalArgumentException if {@code src.length} is not {@link TraceId#SIZE}. @since 0.5
[ "Returns", "a", "{", "@code", "TraceId", "}", "built", "from", "a", "byte", "representation", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/TraceId.java#L68-L72
seedstack/w20-bridge-addon
specs/src/main/java/org/seedstack/w20/ConfiguredModule.java
ConfiguredModule.putConfigurationValue
@JsonAnySetter public void putConfigurationValue(String key, Object value) { """ Put a value in the module configuration map. @param key the key. @param value the value. """ this.configuration.put(key, value); }
java
@JsonAnySetter public void putConfigurationValue(String key, Object value) { this.configuration.put(key, value); }
[ "@", "JsonAnySetter", "public", "void", "putConfigurationValue", "(", "String", "key", ",", "Object", "value", ")", "{", "this", ".", "configuration", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Put a value in the module configuration map. @param key the key. @param value the value.
[ "Put", "a", "value", "in", "the", "module", "configuration", "map", "." ]
train
https://github.com/seedstack/w20-bridge-addon/blob/94c997a9392f10a1bf1655e7f25bf2f6f328ce20/specs/src/main/java/org/seedstack/w20/ConfiguredModule.java#L89-L92
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/NonAtomicVolatileUpdate.java
NonAtomicVolatileUpdate.variableFromCompoundAssignmentTree
private static Matcher<CompoundAssignmentTree> variableFromCompoundAssignmentTree( final Matcher<ExpressionTree> exprMatcher) { """ Extracts the variable from a CompoundAssignmentTree and applies a matcher to it. """ return new Matcher<CompoundAssignmentTree>() { @Override public boolean matches(CompoundAssignmentTree tree, VisitorState state) { return exprMatcher.matches(tree.getVariable(), state); } }; }
java
private static Matcher<CompoundAssignmentTree> variableFromCompoundAssignmentTree( final Matcher<ExpressionTree> exprMatcher) { return new Matcher<CompoundAssignmentTree>() { @Override public boolean matches(CompoundAssignmentTree tree, VisitorState state) { return exprMatcher.matches(tree.getVariable(), state); } }; }
[ "private", "static", "Matcher", "<", "CompoundAssignmentTree", ">", "variableFromCompoundAssignmentTree", "(", "final", "Matcher", "<", "ExpressionTree", ">", "exprMatcher", ")", "{", "return", "new", "Matcher", "<", "CompoundAssignmentTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "CompoundAssignmentTree", "tree", ",", "VisitorState", "state", ")", "{", "return", "exprMatcher", ".", "matches", "(", "tree", ".", "getVariable", "(", ")", ",", "state", ")", ";", "}", "}", ";", "}" ]
Extracts the variable from a CompoundAssignmentTree and applies a matcher to it.
[ "Extracts", "the", "variable", "from", "a", "CompoundAssignmentTree", "and", "applies", "a", "matcher", "to", "it", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/NonAtomicVolatileUpdate.java#L68-L76
sahan/IckleBot
icklebot/src/main/java/com/lonepulse/icklebot/util/PermissionUtils.java
PermissionUtils.isGranted
public static boolean isGranted(Object context, String permission) { """ <p>Takes a permission and determines if its's granted.</p> <p>Use {@link Manifest.permission} to reference permission constants.</p> @param context the permissible {@link Context} @param permissions the {@link permission} to test @return {@code true} if all the permissions are granted @since 1.1.0 """ if(ContextUtils.discover(context) .checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) { return true; } else { return false; } }
java
public static boolean isGranted(Object context, String permission) { if(ContextUtils.discover(context) .checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) { return true; } else { return false; } }
[ "public", "static", "boolean", "isGranted", "(", "Object", "context", ",", "String", "permission", ")", "{", "if", "(", "ContextUtils", ".", "discover", "(", "context", ")", ".", "checkCallingOrSelfPermission", "(", "permission", ")", "==", "PackageManager", ".", "PERMISSION_GRANTED", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
<p>Takes a permission and determines if its's granted.</p> <p>Use {@link Manifest.permission} to reference permission constants.</p> @param context the permissible {@link Context} @param permissions the {@link permission} to test @return {@code true} if all the permissions are granted @since 1.1.0
[ "<p", ">", "Takes", "a", "permission", "and", "determines", "if", "its", "s", "granted", ".", "<", "/", "p", ">" ]
train
https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/util/PermissionUtils.java#L120-L131
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/BeatFinder.java
BeatFinder.isPacketLongEnough
private boolean isPacketLongEnough(DatagramPacket packet, int expectedLength, String name) { """ Helper method to check that we got the right size packet. @param packet a packet that has been received @param expectedLength the number of bytes we expect it to contain @param name the description of the packet in case we need to report issues with the length @return {@code true} if enough bytes were received to process the packet """ final int length = packet.getLength(); if (length < expectedLength) { logger.warn("Ignoring too-short " + name + " packet; expecting " + expectedLength + " bytes and got " + length + "."); return false; } if (length > expectedLength) { logger.warn("Processing too-long " + name + " packet; expecting " + expectedLength + " bytes and got " + length + "."); } return true; }
java
private boolean isPacketLongEnough(DatagramPacket packet, int expectedLength, String name) { final int length = packet.getLength(); if (length < expectedLength) { logger.warn("Ignoring too-short " + name + " packet; expecting " + expectedLength + " bytes and got " + length + "."); return false; } if (length > expectedLength) { logger.warn("Processing too-long " + name + " packet; expecting " + expectedLength + " bytes and got " + length + "."); } return true; }
[ "private", "boolean", "isPacketLongEnough", "(", "DatagramPacket", "packet", ",", "int", "expectedLength", ",", "String", "name", ")", "{", "final", "int", "length", "=", "packet", ".", "getLength", "(", ")", ";", "if", "(", "length", "<", "expectedLength", ")", "{", "logger", ".", "warn", "(", "\"Ignoring too-short \"", "+", "name", "+", "\" packet; expecting \"", "+", "expectedLength", "+", "\" bytes and got \"", "+", "length", "+", "\".\"", ")", ";", "return", "false", ";", "}", "if", "(", "length", ">", "expectedLength", ")", "{", "logger", ".", "warn", "(", "\"Processing too-long \"", "+", "name", "+", "\" packet; expecting \"", "+", "expectedLength", "+", "\" bytes and got \"", "+", "length", "+", "\".\"", ")", ";", "}", "return", "true", ";", "}" ]
Helper method to check that we got the right size packet. @param packet a packet that has been received @param expectedLength the number of bytes we expect it to contain @param name the description of the packet in case we need to report issues with the length @return {@code true} if enough bytes were received to process the packet
[ "Helper", "method", "to", "check", "that", "we", "got", "the", "right", "size", "packet", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/BeatFinder.java#L72-L86
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/utils/SocialWebUtils.java
SocialWebUtils.removeRequestUrlAndParameters
public void removeRequestUrlAndParameters(HttpServletRequest request, HttpServletResponse response) { """ Invalidates the original request URL cookie or removes the same respective session attributes, depending on how the data was saved. """ ReferrerURLCookieHandler referrerURLCookieHandler = getCookieHandler(); referrerURLCookieHandler.invalidateReferrerURLCookie(request, response, ReferrerURLCookieHandler.REFERRER_URL_COOKIENAME); WebAppSecurityConfig webAppSecConfig = getWebAppSecurityConfig(); if (isPostDataSavedInCookie(webAppSecConfig)) { deleteCookie(request, response, PostParameterHelper.POSTPARAM_COOKIE, webAppSecConfig); } else { removePostParameterSessionAttributes(request); } }
java
public void removeRequestUrlAndParameters(HttpServletRequest request, HttpServletResponse response) { ReferrerURLCookieHandler referrerURLCookieHandler = getCookieHandler(); referrerURLCookieHandler.invalidateReferrerURLCookie(request, response, ReferrerURLCookieHandler.REFERRER_URL_COOKIENAME); WebAppSecurityConfig webAppSecConfig = getWebAppSecurityConfig(); if (isPostDataSavedInCookie(webAppSecConfig)) { deleteCookie(request, response, PostParameterHelper.POSTPARAM_COOKIE, webAppSecConfig); } else { removePostParameterSessionAttributes(request); } }
[ "public", "void", "removeRequestUrlAndParameters", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "ReferrerURLCookieHandler", "referrerURLCookieHandler", "=", "getCookieHandler", "(", ")", ";", "referrerURLCookieHandler", ".", "invalidateReferrerURLCookie", "(", "request", ",", "response", ",", "ReferrerURLCookieHandler", ".", "REFERRER_URL_COOKIENAME", ")", ";", "WebAppSecurityConfig", "webAppSecConfig", "=", "getWebAppSecurityConfig", "(", ")", ";", "if", "(", "isPostDataSavedInCookie", "(", "webAppSecConfig", ")", ")", "{", "deleteCookie", "(", "request", ",", "response", ",", "PostParameterHelper", ".", "POSTPARAM_COOKIE", ",", "webAppSecConfig", ")", ";", "}", "else", "{", "removePostParameterSessionAttributes", "(", "request", ")", ";", "}", "}" ]
Invalidates the original request URL cookie or removes the same respective session attributes, depending on how the data was saved.
[ "Invalidates", "the", "original", "request", "URL", "cookie", "or", "removes", "the", "same", "respective", "session", "attributes", "depending", "on", "how", "the", "data", "was", "saved", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/utils/SocialWebUtils.java#L238-L248
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/ByteArrayUtil.java
ByteArrayUtil.getLongLE
public static long getLongLE(final byte[] array, final int offset) { """ Get a <i>long</i> from the given byte array starting at the given offset in little endian order. There is no bounds checking. @param array source byte array @param offset source offset @return the <i>long</i> """ return ( array[offset ] & 0XFFL ) | ((array[offset + 1] & 0XFFL) << 8) | ((array[offset + 2] & 0XFFL) << 16) | ((array[offset + 3] & 0XFFL) << 24) | ((array[offset + 4] & 0XFFL) << 32) | ((array[offset + 5] & 0XFFL) << 40) | ((array[offset + 6] & 0XFFL) << 48) | ((array[offset + 7] & 0XFFL) << 56); }
java
public static long getLongLE(final byte[] array, final int offset) { return ( array[offset ] & 0XFFL ) | ((array[offset + 1] & 0XFFL) << 8) | ((array[offset + 2] & 0XFFL) << 16) | ((array[offset + 3] & 0XFFL) << 24) | ((array[offset + 4] & 0XFFL) << 32) | ((array[offset + 5] & 0XFFL) << 40) | ((array[offset + 6] & 0XFFL) << 48) | ((array[offset + 7] & 0XFFL) << 56); }
[ "public", "static", "long", "getLongLE", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ")", "{", "return", "(", "array", "[", "offset", "]", "&", "0XFF", "L", ")", "|", "(", "(", "array", "[", "offset", "+", "1", "]", "&", "0XFF", "L", ")", "<<", "8", ")", "|", "(", "(", "array", "[", "offset", "+", "2", "]", "&", "0XFF", "L", ")", "<<", "16", ")", "|", "(", "(", "array", "[", "offset", "+", "3", "]", "&", "0XFF", "L", ")", "<<", "24", ")", "|", "(", "(", "array", "[", "offset", "+", "4", "]", "&", "0XFF", "L", ")", "<<", "32", ")", "|", "(", "(", "array", "[", "offset", "+", "5", "]", "&", "0XFF", "L", ")", "<<", "40", ")", "|", "(", "(", "array", "[", "offset", "+", "6", "]", "&", "0XFF", "L", ")", "<<", "48", ")", "|", "(", "(", "array", "[", "offset", "+", "7", "]", "&", "0XFF", "L", ")", "<<", "56", ")", ";", "}" ]
Get a <i>long</i> from the given byte array starting at the given offset in little endian order. There is no bounds checking. @param array source byte array @param offset source offset @return the <i>long</i>
[ "Get", "a", "<i", ">", "long<", "/", "i", ">", "from", "the", "given", "byte", "array", "starting", "at", "the", "given", "offset", "in", "little", "endian", "order", ".", "There", "is", "no", "bounds", "checking", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/ByteArrayUtil.java#L125-L134
box/box-java-sdk
src/main/java/com/box/sdk/BoxGroup.java
BoxGroup.getAllGroups
public static Iterable<BoxGroup.Info> getAllGroups(final BoxAPIConnection api, String ... fields) { """ Gets an iterable of all the groups in the enterprise. @param api the API connection to be used when retrieving the groups. @param fields the fields to retrieve. @return an iterable containing info about all the groups. """ final QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } return new Iterable<BoxGroup.Info>() { public Iterator<BoxGroup.Info> iterator() { URL url = GROUPS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()); return new BoxGroupIterator(api, url); } }; }
java
public static Iterable<BoxGroup.Info> getAllGroups(final BoxAPIConnection api, String ... fields) { final QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } return new Iterable<BoxGroup.Info>() { public Iterator<BoxGroup.Info> iterator() { URL url = GROUPS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()); return new BoxGroupIterator(api, url); } }; }
[ "public", "static", "Iterable", "<", "BoxGroup", ".", "Info", ">", "getAllGroups", "(", "final", "BoxAPIConnection", "api", ",", "String", "...", "fields", ")", "{", "final", "QueryStringBuilder", "builder", "=", "new", "QueryStringBuilder", "(", ")", ";", "if", "(", "fields", ".", "length", ">", "0", ")", "{", "builder", ".", "appendParam", "(", "\"fields\"", ",", "fields", ")", ";", "}", "return", "new", "Iterable", "<", "BoxGroup", ".", "Info", ">", "(", ")", "{", "public", "Iterator", "<", "BoxGroup", ".", "Info", ">", "iterator", "(", ")", "{", "URL", "url", "=", "GROUPS_URL_TEMPLATE", ".", "buildWithQuery", "(", "api", ".", "getBaseURL", "(", ")", ",", "builder", ".", "toString", "(", ")", ")", ";", "return", "new", "BoxGroupIterator", "(", "api", ",", "url", ")", ";", "}", "}", ";", "}" ]
Gets an iterable of all the groups in the enterprise. @param api the API connection to be used when retrieving the groups. @param fields the fields to retrieve. @return an iterable containing info about all the groups.
[ "Gets", "an", "iterable", "of", "all", "the", "groups", "in", "the", "enterprise", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxGroup.java#L130-L141
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/model/CMAWebhook.java
CMAWebhook.setBasicAuthorization
public CMAWebhook setBasicAuthorization(String user, String password) { """ Set authorization parameter for basic HTTP authorization on the url to be called by this webhook. @param user username to be used @param password password to be used (cannot be retrieved, only updated!) @return this webhook for chaining. """ this.user = user; this.password = password; return this; }
java
public CMAWebhook setBasicAuthorization(String user, String password) { this.user = user; this.password = password; return this; }
[ "public", "CMAWebhook", "setBasicAuthorization", "(", "String", "user", ",", "String", "password", ")", "{", "this", ".", "user", "=", "user", ";", "this", ".", "password", "=", "password", ";", "return", "this", ";", "}" ]
Set authorization parameter for basic HTTP authorization on the url to be called by this webhook. @param user username to be used @param password password to be used (cannot be retrieved, only updated!) @return this webhook for chaining.
[ "Set", "authorization", "parameter", "for", "basic", "HTTP", "authorization", "on", "the", "url", "to", "be", "called", "by", "this", "webhook", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/model/CMAWebhook.java#L132-L136
morfologik/morfologik-stemming
morfologik-fsa/src/main/java/morfologik/fsa/FSA5.java
FSA5.getRightLanguageCount
@Override public int getRightLanguageCount(int node) { """ Returns the number encoded at the given node. The number equals the count of the set of suffixes reachable from <code>node</code> (called its right language). """ assert getFlags().contains(FSAFlags.NUMBERS) : "This FSA was not compiled with NUMBERS."; return decodeFromBytes(arcs, node, nodeDataLength); }
java
@Override public int getRightLanguageCount(int node) { assert getFlags().contains(FSAFlags.NUMBERS) : "This FSA was not compiled with NUMBERS."; return decodeFromBytes(arcs, node, nodeDataLength); }
[ "@", "Override", "public", "int", "getRightLanguageCount", "(", "int", "node", ")", "{", "assert", "getFlags", "(", ")", ".", "contains", "(", "FSAFlags", ".", "NUMBERS", ")", ":", "\"This FSA was not compiled with NUMBERS.\"", ";", "return", "decodeFromBytes", "(", "arcs", ",", "node", ",", "nodeDataLength", ")", ";", "}" ]
Returns the number encoded at the given node. The number equals the count of the set of suffixes reachable from <code>node</code> (called its right language).
[ "Returns", "the", "number", "encoded", "at", "the", "given", "node", ".", "The", "number", "equals", "the", "count", "of", "the", "set", "of", "suffixes", "reachable", "from", "<code", ">", "node<", "/", "code", ">", "(", "called", "its", "right", "language", ")", "." ]
train
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa/src/main/java/morfologik/fsa/FSA5.java#L247-L251
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java
GVRShaderData.setVec2
public void setVec2(String key, float x, float y) { """ Set the value for a floating point vector of length 2. @param key name of uniform to set. @param x new X value @param y new Y value @see #getVec2 @see #getFloatVec(String) """ checkKeyIsUniform(key); NativeShaderData.setVec2(getNative(), key, x, y); }
java
public void setVec2(String key, float x, float y) { checkKeyIsUniform(key); NativeShaderData.setVec2(getNative(), key, x, y); }
[ "public", "void", "setVec2", "(", "String", "key", ",", "float", "x", ",", "float", "y", ")", "{", "checkKeyIsUniform", "(", "key", ")", ";", "NativeShaderData", ".", "setVec2", "(", "getNative", "(", ")", ",", "key", ",", "x", ",", "y", ")", ";", "}" ]
Set the value for a floating point vector of length 2. @param key name of uniform to set. @param x new X value @param y new Y value @see #getVec2 @see #getFloatVec(String)
[ "Set", "the", "value", "for", "a", "floating", "point", "vector", "of", "length", "2", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java#L324-L328
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.bytesToDouble
public static final double bytesToDouble( byte[] data, int[] offset ) { """ Return the <code>double</code> represented by the bytes in <code>data</code> staring at offset <code>offset[0]</code>. @param data the array from which to read @param offset A single element array whose first element is the index in data from which to begin reading on function entry, and which on function exit has been incremented by the number of bytes read. @return the value of the <code>double</code> decoded """ long bits = bytesToLong(data, offset); return Double.longBitsToDouble(bits); }
java
public static final double bytesToDouble( byte[] data, int[] offset ) { long bits = bytesToLong(data, offset); return Double.longBitsToDouble(bits); }
[ "public", "static", "final", "double", "bytesToDouble", "(", "byte", "[", "]", "data", ",", "int", "[", "]", "offset", ")", "{", "long", "bits", "=", "bytesToLong", "(", "data", ",", "offset", ")", ";", "return", "Double", ".", "longBitsToDouble", "(", "bits", ")", ";", "}" ]
Return the <code>double</code> represented by the bytes in <code>data</code> staring at offset <code>offset[0]</code>. @param data the array from which to read @param offset A single element array whose first element is the index in data from which to begin reading on function entry, and which on function exit has been incremented by the number of bytes read. @return the value of the <code>double</code> decoded
[ "Return", "the", "<code", ">", "double<", "/", "code", ">", "represented", "by", "the", "bytes", "in", "<code", ">", "data<", "/", "code", ">", "staring", "at", "offset", "<code", ">", "offset", "[", "0", "]", "<", "/", "code", ">", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L217-L221
cdk/cdk
tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/MM2BasedParameterSetReader.java
MM2BasedParameterSetReader.setAtomTypes
private void setAtomTypes(IChemObjectBuilder builder) throws Exception { """ Read and stores the atom types in a vector @exception Exception Description of the Exception """ String name = ""; String rootType = ""; int an = 0; int rl = 255; int gl = 20; int bl = 147; int maxbond = 0; double mass = 0.0; st.nextToken(); String sid = st.nextToken(); rootType = st.nextToken(); name = st.nextToken(); String san = st.nextToken(); String sam = st.nextToken(); String smaxbond = st.nextToken(); try { mass = new Double(sam).doubleValue(); an = Integer.parseInt(san); maxbond = Integer.parseInt(smaxbond); } catch (NumberFormatException nfe) { throw new IOException("AtomTypeTable.ReadAtypes: " + "Malformed Number"); } IAtomType atomType = builder.newInstance(IAtomType.class, name, rootType); atomType.setAtomicNumber(an); atomType.setExactMass(mass); atomType.setMassNumber(massNumber(an, mass)); atomType.setFormalNeighbourCount(maxbond); atomType.setSymbol(rootType); Color co = new Color(rl, gl, bl); atomType.setProperty("org.openscience.cdk.renderer.color", co); atomType.setAtomTypeName(sid); atomTypes.add(atomType); }
java
private void setAtomTypes(IChemObjectBuilder builder) throws Exception { String name = ""; String rootType = ""; int an = 0; int rl = 255; int gl = 20; int bl = 147; int maxbond = 0; double mass = 0.0; st.nextToken(); String sid = st.nextToken(); rootType = st.nextToken(); name = st.nextToken(); String san = st.nextToken(); String sam = st.nextToken(); String smaxbond = st.nextToken(); try { mass = new Double(sam).doubleValue(); an = Integer.parseInt(san); maxbond = Integer.parseInt(smaxbond); } catch (NumberFormatException nfe) { throw new IOException("AtomTypeTable.ReadAtypes: " + "Malformed Number"); } IAtomType atomType = builder.newInstance(IAtomType.class, name, rootType); atomType.setAtomicNumber(an); atomType.setExactMass(mass); atomType.setMassNumber(massNumber(an, mass)); atomType.setFormalNeighbourCount(maxbond); atomType.setSymbol(rootType); Color co = new Color(rl, gl, bl); atomType.setProperty("org.openscience.cdk.renderer.color", co); atomType.setAtomTypeName(sid); atomTypes.add(atomType); }
[ "private", "void", "setAtomTypes", "(", "IChemObjectBuilder", "builder", ")", "throws", "Exception", "{", "String", "name", "=", "\"\"", ";", "String", "rootType", "=", "\"\"", ";", "int", "an", "=", "0", ";", "int", "rl", "=", "255", ";", "int", "gl", "=", "20", ";", "int", "bl", "=", "147", ";", "int", "maxbond", "=", "0", ";", "double", "mass", "=", "0.0", ";", "st", ".", "nextToken", "(", ")", ";", "String", "sid", "=", "st", ".", "nextToken", "(", ")", ";", "rootType", "=", "st", ".", "nextToken", "(", ")", ";", "name", "=", "st", ".", "nextToken", "(", ")", ";", "String", "san", "=", "st", ".", "nextToken", "(", ")", ";", "String", "sam", "=", "st", ".", "nextToken", "(", ")", ";", "String", "smaxbond", "=", "st", ".", "nextToken", "(", ")", ";", "try", "{", "mass", "=", "new", "Double", "(", "sam", ")", ".", "doubleValue", "(", ")", ";", "an", "=", "Integer", ".", "parseInt", "(", "san", ")", ";", "maxbond", "=", "Integer", ".", "parseInt", "(", "smaxbond", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "throw", "new", "IOException", "(", "\"AtomTypeTable.ReadAtypes: \"", "+", "\"Malformed Number\"", ")", ";", "}", "IAtomType", "atomType", "=", "builder", ".", "newInstance", "(", "IAtomType", ".", "class", ",", "name", ",", "rootType", ")", ";", "atomType", ".", "setAtomicNumber", "(", "an", ")", ";", "atomType", ".", "setExactMass", "(", "mass", ")", ";", "atomType", ".", "setMassNumber", "(", "massNumber", "(", "an", ",", "mass", ")", ")", ";", "atomType", ".", "setFormalNeighbourCount", "(", "maxbond", ")", ";", "atomType", ".", "setSymbol", "(", "rootType", ")", ";", "Color", "co", "=", "new", "Color", "(", "rl", ",", "gl", ",", "bl", ")", ";", "atomType", ".", "setProperty", "(", "\"org.openscience.cdk.renderer.color\"", ",", "co", ")", ";", "atomType", ".", "setAtomTypeName", "(", "sid", ")", ";", "atomTypes", ".", "add", "(", "atomType", ")", ";", "}" ]
Read and stores the atom types in a vector @exception Exception Description of the Exception
[ "Read", "and", "stores", "the", "atom", "types", "in", "a", "vector" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/MM2BasedParameterSetReader.java#L250-L287
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Config.java
Config.getProperty
public static String getProperty(Class<?> aClass, String key) { """ Retrieves a configuration property as a String object. <p/> Loads the file if not already initialized. @param aClass the calling class @param key property key @return Value of the property as a string or null if no property found. """ return getSettings().getProperty(aClass, key); }
java
public static String getProperty(Class<?> aClass, String key) { return getSettings().getProperty(aClass, key); }
[ "public", "static", "String", "getProperty", "(", "Class", "<", "?", ">", "aClass", ",", "String", "key", ")", "{", "return", "getSettings", "(", ")", ".", "getProperty", "(", "aClass", ",", "key", ")", ";", "}" ]
Retrieves a configuration property as a String object. <p/> Loads the file if not already initialized. @param aClass the calling class @param key property key @return Value of the property as a string or null if no property found.
[ "Retrieves", "a", "configuration", "property", "as", "a", "String", "object", ".", "<p", "/", ">", "Loads", "the", "file", "if", "not", "already", "initialized", "." ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Config.java#L202-L205
jbundle/jbundle
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/html/HTMLServlet.java
HTMLServlet.addBrowserProperties
public void addBrowserProperties(HttpServletRequest req, PropertyOwner servletTask) { """ Add the browser properties to this servlet task. @param req @param servletTask """ String strBrowser = this.getBrowser(req); String strOS = this.getOS(req); servletTask.setProperty(DBParams.BROWSER, strBrowser); servletTask.setProperty(DBParams.OS, strOS); }
java
public void addBrowserProperties(HttpServletRequest req, PropertyOwner servletTask) { String strBrowser = this.getBrowser(req); String strOS = this.getOS(req); servletTask.setProperty(DBParams.BROWSER, strBrowser); servletTask.setProperty(DBParams.OS, strOS); }
[ "public", "void", "addBrowserProperties", "(", "HttpServletRequest", "req", ",", "PropertyOwner", "servletTask", ")", "{", "String", "strBrowser", "=", "this", ".", "getBrowser", "(", "req", ")", ";", "String", "strOS", "=", "this", ".", "getOS", "(", "req", ")", ";", "servletTask", ".", "setProperty", "(", "DBParams", ".", "BROWSER", ",", "strBrowser", ")", ";", "servletTask", ".", "setProperty", "(", "DBParams", ".", "OS", ",", "strOS", ")", ";", "}" ]
Add the browser properties to this servlet task. @param req @param servletTask
[ "Add", "the", "browser", "properties", "to", "this", "servlet", "task", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/html/HTMLServlet.java#L154-L160
inkstand-io/scribble
scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java
HttpServerBuilder.contentFrom
public HttpServerBuilder contentFrom(String contextRoot, String contentResource) { """ Defines a ZIP resource on the classpath that provides the static content the server should host. @param contextRoot the root path to the content @param contentResource the name of the classpath resource denoting a file that should be hosted. If the file denotes a zip file, its content is hosted instead of the file itself. The path may be absolute or relative to the caller of the method. @return this builder """ URL resource = resolver.resolve(contentResource,CallStack.getCallerClass()); resources.put(contextRoot, resource); return this; }
java
public HttpServerBuilder contentFrom(String contextRoot, String contentResource){ URL resource = resolver.resolve(contentResource,CallStack.getCallerClass()); resources.put(contextRoot, resource); return this; }
[ "public", "HttpServerBuilder", "contentFrom", "(", "String", "contextRoot", ",", "String", "contentResource", ")", "{", "URL", "resource", "=", "resolver", ".", "resolve", "(", "contentResource", ",", "CallStack", ".", "getCallerClass", "(", ")", ")", ";", "resources", ".", "put", "(", "contextRoot", ",", "resource", ")", ";", "return", "this", ";", "}" ]
Defines a ZIP resource on the classpath that provides the static content the server should host. @param contextRoot the root path to the content @param contentResource the name of the classpath resource denoting a file that should be hosted. If the file denotes a zip file, its content is hosted instead of the file itself. The path may be absolute or relative to the caller of the method. @return this builder
[ "Defines", "a", "ZIP", "resource", "on", "the", "classpath", "that", "provides", "the", "static", "content", "the", "server", "should", "host", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java#L86-L90
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java
MapApi.getNullable
public static Object getNullable(final Map map, final Object... path) { """ Get object value by path. @param map subject @param path nodes to walk in map @return value """ return getNullable(map, Object.class, path); }
java
public static Object getNullable(final Map map, final Object... path) { return getNullable(map, Object.class, path); }
[ "public", "static", "Object", "getNullable", "(", "final", "Map", "map", ",", "final", "Object", "...", "path", ")", "{", "return", "getNullable", "(", "map", ",", "Object", ".", "class", ",", "path", ")", ";", "}" ]
Get object value by path. @param map subject @param path nodes to walk in map @return value
[ "Get", "object", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java#L147-L149
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuObjectUtil.java
GosuObjectUtil.defaultIfNull
public static Object defaultIfNull(Object object, Object defaultValue) { """ <p>Returns a default value if the object passed is <code>null</code>.</p> <p/> <pre> ObjectUtils.defaultIfNull(null, null) = null ObjectUtils.defaultIfNull(null, "") = "" ObjectUtils.defaultIfNull(null, "zz") = "zz" ObjectUtils.defaultIfNull("abc", *) = "abc" ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE </pre> @param object the <code>Object</code> to test, may be <code>null</code> @param defaultValue the default value to return, may be <code>null</code> @return <code>object</code> if it is not <code>null</code>, defaultValue otherwise """ return object != null ? object : defaultValue; }
java
public static Object defaultIfNull(Object object, Object defaultValue) { return object != null ? object : defaultValue; }
[ "public", "static", "Object", "defaultIfNull", "(", "Object", "object", ",", "Object", "defaultValue", ")", "{", "return", "object", "!=", "null", "?", "object", ":", "defaultValue", ";", "}" ]
<p>Returns a default value if the object passed is <code>null</code>.</p> <p/> <pre> ObjectUtils.defaultIfNull(null, null) = null ObjectUtils.defaultIfNull(null, "") = "" ObjectUtils.defaultIfNull(null, "zz") = "zz" ObjectUtils.defaultIfNull("abc", *) = "abc" ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE </pre> @param object the <code>Object</code> to test, may be <code>null</code> @param defaultValue the default value to return, may be <code>null</code> @return <code>object</code> if it is not <code>null</code>, defaultValue otherwise
[ "<p", ">", "Returns", "a", "default", "value", "if", "the", "object", "passed", "is", "<code", ">", "null<", "/", "code", ">", ".", "<", "/", "p", ">", "<p", "/", ">", "<pre", ">", "ObjectUtils", ".", "defaultIfNull", "(", "null", "null", ")", "=", "null", "ObjectUtils", ".", "defaultIfNull", "(", "null", ")", "=", "ObjectUtils", ".", "defaultIfNull", "(", "null", "zz", ")", "=", "zz", "ObjectUtils", ".", "defaultIfNull", "(", "abc", "*", ")", "=", "abc", "ObjectUtils", ".", "defaultIfNull", "(", "Boolean", ".", "TRUE", "*", ")", "=", "Boolean", ".", "TRUE", "<", "/", "pre", ">" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuObjectUtil.java#L62-L64
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringBitmap.java
MutableRoaringBitmap.flip
@Deprecated public void flip(final int rangeStart, final int 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 @deprecated use the version where longs specify the range """ if (rangeStart >= 0) { flip((long) rangeStart, (long) rangeEnd); } else { // rangeStart being -ve and rangeEnd being positive is not expected) // so assume both -ve flip(rangeStart & 0xFFFFFFFFL, rangeEnd & 0xFFFFFFFFL); } }
java
@Deprecated public void flip(final int rangeStart, final int rangeEnd) { if (rangeStart >= 0) { flip((long) rangeStart, (long) rangeEnd); } else { // rangeStart being -ve and rangeEnd being positive is not expected) // so assume both -ve flip(rangeStart & 0xFFFFFFFFL, rangeEnd & 0xFFFFFFFFL); } }
[ "@", "Deprecated", "public", "void", "flip", "(", "final", "int", "rangeStart", ",", "final", "int", "rangeEnd", ")", "{", "if", "(", "rangeStart", ">=", "0", ")", "{", "flip", "(", "(", "long", ")", "rangeStart", ",", "(", "long", ")", "rangeEnd", ")", ";", "}", "else", "{", "// rangeStart being -ve and rangeEnd being positive is not expected)", "// so assume both -ve", "flip", "(", "rangeStart", "&", "0xFFFFFFFF", "L", ",", "rangeEnd", "&", "0xFFFFFFFF", "L", ")", ";", "}", "}" ]
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 @deprecated use the version where longs specify the 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#L1081-L1090
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SpringUtils.java
SpringUtils.getBean
public static <T> T getBean(ApplicationContext appContext, String id, Class<T> clazz) { """ Gets a bean by its id and class. @param appContext @param id @param clazz @return """ try { return appContext.getBean(id, clazz); } catch (BeansException e) { return null; } }
java
public static <T> T getBean(ApplicationContext appContext, String id, Class<T> clazz) { try { return appContext.getBean(id, clazz); } catch (BeansException e) { return null; } }
[ "public", "static", "<", "T", ">", "T", "getBean", "(", "ApplicationContext", "appContext", ",", "String", "id", ",", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "return", "appContext", ".", "getBean", "(", "id", ",", "clazz", ")", ";", "}", "catch", "(", "BeansException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Gets a bean by its id and class. @param appContext @param id @param clazz @return
[ "Gets", "a", "bean", "by", "its", "id", "and", "class", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SpringUtils.java#L58-L64
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuStringUtil.java
GosuStringUtil.ordinalIndexOf
public static int ordinalIndexOf(String str, String searchStr, int ordinal) { """ <p>Finds the n-th index within a String, handling <code>null</code>. This method uses {@link String#indexOf(String)}.</p> <p>A <code>null</code> String will return <code>-1</code>.</p> <pre> GosuStringUtil.ordinalIndexOf(null, *, *) = -1 GosuStringUtil.ordinalIndexOf(*, null, *) = -1 GosuStringUtil.ordinalIndexOf("", "", *) = 0 GosuStringUtil.ordinalIndexOf("aabaabaa", "a", 1) = 0 GosuStringUtil.ordinalIndexOf("aabaabaa", "a", 2) = 1 GosuStringUtil.ordinalIndexOf("aabaabaa", "b", 1) = 2 GosuStringUtil.ordinalIndexOf("aabaabaa", "b", 2) = 5 GosuStringUtil.ordinalIndexOf("aabaabaa", "ab", 1) = 1 GosuStringUtil.ordinalIndexOf("aabaabaa", "ab", 2) = 4 GosuStringUtil.ordinalIndexOf("aabaabaa", "", 1) = 0 GosuStringUtil.ordinalIndexOf("aabaabaa", "", 2) = 0 </pre> @param str the String to check, may be null @param searchStr the String to find, may be null @param ordinal the n-th <code>searchStr</code> to find @return the n-th index of the search String, <code>-1</code> (<code>INDEX_NOT_FOUND</code>) if no match or <code>null</code> string input @since 2.1 """ if (str == null || searchStr == null || ordinal <= 0) { return INDEX_NOT_FOUND; } if (searchStr.length() == 0) { return 0; } int found = 0; int index = INDEX_NOT_FOUND; do { index = str.indexOf(searchStr, index + 1); if (index < 0) { return index; } found++; } while (found < ordinal); return index; }
java
public static int ordinalIndexOf(String str, String searchStr, int ordinal) { if (str == null || searchStr == null || ordinal <= 0) { return INDEX_NOT_FOUND; } if (searchStr.length() == 0) { return 0; } int found = 0; int index = INDEX_NOT_FOUND; do { index = str.indexOf(searchStr, index + 1); if (index < 0) { return index; } found++; } while (found < ordinal); return index; }
[ "public", "static", "int", "ordinalIndexOf", "(", "String", "str", ",", "String", "searchStr", ",", "int", "ordinal", ")", "{", "if", "(", "str", "==", "null", "||", "searchStr", "==", "null", "||", "ordinal", "<=", "0", ")", "{", "return", "INDEX_NOT_FOUND", ";", "}", "if", "(", "searchStr", ".", "length", "(", ")", "==", "0", ")", "{", "return", "0", ";", "}", "int", "found", "=", "0", ";", "int", "index", "=", "INDEX_NOT_FOUND", ";", "do", "{", "index", "=", "str", ".", "indexOf", "(", "searchStr", ",", "index", "+", "1", ")", ";", "if", "(", "index", "<", "0", ")", "{", "return", "index", ";", "}", "found", "++", ";", "}", "while", "(", "found", "<", "ordinal", ")", ";", "return", "index", ";", "}" ]
<p>Finds the n-th index within a String, handling <code>null</code>. This method uses {@link String#indexOf(String)}.</p> <p>A <code>null</code> String will return <code>-1</code>.</p> <pre> GosuStringUtil.ordinalIndexOf(null, *, *) = -1 GosuStringUtil.ordinalIndexOf(*, null, *) = -1 GosuStringUtil.ordinalIndexOf("", "", *) = 0 GosuStringUtil.ordinalIndexOf("aabaabaa", "a", 1) = 0 GosuStringUtil.ordinalIndexOf("aabaabaa", "a", 2) = 1 GosuStringUtil.ordinalIndexOf("aabaabaa", "b", 1) = 2 GosuStringUtil.ordinalIndexOf("aabaabaa", "b", 2) = 5 GosuStringUtil.ordinalIndexOf("aabaabaa", "ab", 1) = 1 GosuStringUtil.ordinalIndexOf("aabaabaa", "ab", 2) = 4 GosuStringUtil.ordinalIndexOf("aabaabaa", "", 1) = 0 GosuStringUtil.ordinalIndexOf("aabaabaa", "", 2) = 0 </pre> @param str the String to check, may be null @param searchStr the String to find, may be null @param ordinal the n-th <code>searchStr</code> to find @return the n-th index of the search String, <code>-1</code> (<code>INDEX_NOT_FOUND</code>) if no match or <code>null</code> string input @since 2.1
[ "<p", ">", "Finds", "the", "n", "-", "th", "index", "within", "a", "String", "handling", "<code", ">", "null<", "/", "code", ">", ".", "This", "method", "uses", "{", "@link", "String#indexOf", "(", "String", ")", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L770-L787
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/ParameterResolverImpl.java
ParameterResolverImpl.applyConfiguredValues
private SortedSet<String> applyConfiguredValues(ResourceResolver resolver, String configurationId, Map<String, Object> parameterValues, SortedSet<String> ancestorLockedParameterNames) { """ Apply configured values for given configuration id (except those for which the parameter names are locked on a higher configuration level). @param resolver Resource resolver @param configurationId Configuration id @param parameterValues Parameter values @param ancestorLockedParameterNames Set of locked parameter names on the configuration levels above. @return Set of locked parameter names on this configuration level combined with the from the levels above. """ // get data from persistence ParameterPersistenceData data = parameterPersistence.getData(resolver, configurationId); // ensure the types provided by persistence are valid Map<String, Object> configuredValues = ensureValidValueTypes(data.getValues()); // put parameter values to map (respect locked parameter names that may be defined on ancestor level) if (!ancestorLockedParameterNames.isEmpty()) { for (Map.Entry<String, Object> entry : configuredValues.entrySet()) { if (!ancestorLockedParameterNames.contains(entry.getKey())) { parameterValues.put(entry.getKey(), entry.getValue()); } } } else { parameterValues.putAll(configuredValues); } // aggregate set of locked parameter names from ancestor levels and this level return mergeSets(ancestorLockedParameterNames, data.getLockedParameterNames()); }
java
private SortedSet<String> applyConfiguredValues(ResourceResolver resolver, String configurationId, Map<String, Object> parameterValues, SortedSet<String> ancestorLockedParameterNames) { // get data from persistence ParameterPersistenceData data = parameterPersistence.getData(resolver, configurationId); // ensure the types provided by persistence are valid Map<String, Object> configuredValues = ensureValidValueTypes(data.getValues()); // put parameter values to map (respect locked parameter names that may be defined on ancestor level) if (!ancestorLockedParameterNames.isEmpty()) { for (Map.Entry<String, Object> entry : configuredValues.entrySet()) { if (!ancestorLockedParameterNames.contains(entry.getKey())) { parameterValues.put(entry.getKey(), entry.getValue()); } } } else { parameterValues.putAll(configuredValues); } // aggregate set of locked parameter names from ancestor levels and this level return mergeSets(ancestorLockedParameterNames, data.getLockedParameterNames()); }
[ "private", "SortedSet", "<", "String", ">", "applyConfiguredValues", "(", "ResourceResolver", "resolver", ",", "String", "configurationId", ",", "Map", "<", "String", ",", "Object", ">", "parameterValues", ",", "SortedSet", "<", "String", ">", "ancestorLockedParameterNames", ")", "{", "// get data from persistence", "ParameterPersistenceData", "data", "=", "parameterPersistence", ".", "getData", "(", "resolver", ",", "configurationId", ")", ";", "// ensure the types provided by persistence are valid", "Map", "<", "String", ",", "Object", ">", "configuredValues", "=", "ensureValidValueTypes", "(", "data", ".", "getValues", "(", ")", ")", ";", "// put parameter values to map (respect locked parameter names that may be defined on ancestor level)", "if", "(", "!", "ancestorLockedParameterNames", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "configuredValues", ".", "entrySet", "(", ")", ")", "{", "if", "(", "!", "ancestorLockedParameterNames", ".", "contains", "(", "entry", ".", "getKey", "(", ")", ")", ")", "{", "parameterValues", ".", "put", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "else", "{", "parameterValues", ".", "putAll", "(", "configuredValues", ")", ";", "}", "// aggregate set of locked parameter names from ancestor levels and this level", "return", "mergeSets", "(", "ancestorLockedParameterNames", ",", "data", ".", "getLockedParameterNames", "(", ")", ")", ";", "}" ]
Apply configured values for given configuration id (except those for which the parameter names are locked on a higher configuration level). @param resolver Resource resolver @param configurationId Configuration id @param parameterValues Parameter values @param ancestorLockedParameterNames Set of locked parameter names on the configuration levels above. @return Set of locked parameter names on this configuration level combined with the from the levels above.
[ "Apply", "configured", "values", "for", "given", "configuration", "id", "(", "except", "those", "for", "which", "the", "parameter", "names", "are", "locked", "on", "a", "higher", "configuration", "level", ")", "." ]
train
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/ParameterResolverImpl.java#L168-L191
mike706574/java-map-support
src/main/java/fun/mike/map/alpha/Get.java
Get.requiredStringOfType
public static <T> String requiredStringOfType(Map<String, T> map, String key, String type) { """ Validates that the value from {@code map} for the given {@code key} is a present and a string. Returns the value when valid; otherwise, throws an {@code IllegalArgumentException}, referring to the value as being of type{@code} type in the error message. @param map a map @param key a key @param type a type label @param <T> the type of value @return the string value @throws java.util.NoSuchElementException if the required value is not present @throws java.lang.IllegalArgumentException if the value is in valid """ if (!map.containsKey(key)) { String message = String.format("Missing required %s value for key \"%s\".", type, key); throw new NoSuchElementException(message); } Object value = map.get(key); if (value == null) { return null; } if (value instanceof String) { return (String) value; } String message = String.format("Value \"%s\" of class \"%s\" for key \"%s\" must be a string.", value, value.getClass().getName(), key); throw new IllegalArgumentException(message); }
java
public static <T> String requiredStringOfType(Map<String, T> map, String key, String type) { if (!map.containsKey(key)) { String message = String.format("Missing required %s value for key \"%s\".", type, key); throw new NoSuchElementException(message); } Object value = map.get(key); if (value == null) { return null; } if (value instanceof String) { return (String) value; } String message = String.format("Value \"%s\" of class \"%s\" for key \"%s\" must be a string.", value, value.getClass().getName(), key); throw new IllegalArgumentException(message); }
[ "public", "static", "<", "T", ">", "String", "requiredStringOfType", "(", "Map", "<", "String", ",", "T", ">", "map", ",", "String", "key", ",", "String", "type", ")", "{", "if", "(", "!", "map", ".", "containsKey", "(", "key", ")", ")", "{", "String", "message", "=", "String", ".", "format", "(", "\"Missing required %s value for key \\\"%s\\\".\"", ",", "type", ",", "key", ")", ";", "throw", "new", "NoSuchElementException", "(", "message", ")", ";", "}", "Object", "value", "=", "map", ".", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "value", "instanceof", "String", ")", "{", "return", "(", "String", ")", "value", ";", "}", "String", "message", "=", "String", ".", "format", "(", "\"Value \\\"%s\\\" of class \\\"%s\\\" for key \\\"%s\\\" must be a string.\"", ",", "value", ",", "value", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "key", ")", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}" ]
Validates that the value from {@code map} for the given {@code key} is a present and a string. Returns the value when valid; otherwise, throws an {@code IllegalArgumentException}, referring to the value as being of type{@code} type in the error message. @param map a map @param key a key @param type a type label @param <T> the type of value @return the string value @throws java.util.NoSuchElementException if the required value is not present @throws java.lang.IllegalArgumentException if the value is in valid
[ "Validates", "that", "the", "value", "from", "{" ]
train
https://github.com/mike706574/java-map-support/blob/7cb09f34c24adfaca73ad25a3c3e05abec72eafe/src/main/java/fun/mike/map/alpha/Get.java#L132-L155
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/cli/CLIUtils.java
CLIUtils.generateArgline
public static String generateArgline(final String scriptpath, final String[] args) { """ Create an appropriately quoted argline to use given the command (script path) and argument strings. @param scriptpath path to command or script @param args arguments to pass to the command @return a String of the command followed by the arguments, where each item which has spaces is appropriately quoted. Pre-quoted items are not changed during "unsafe" quoting. At this point in time, default behavior is "unsafe" quoting. """ return generateArgline(scriptpath, args, " ", false); }
java
public static String generateArgline(final String scriptpath, final String[] args) { return generateArgline(scriptpath, args, " ", false); }
[ "public", "static", "String", "generateArgline", "(", "final", "String", "scriptpath", ",", "final", "String", "[", "]", "args", ")", "{", "return", "generateArgline", "(", "scriptpath", ",", "args", ",", "\" \"", ",", "false", ")", ";", "}" ]
Create an appropriately quoted argline to use given the command (script path) and argument strings. @param scriptpath path to command or script @param args arguments to pass to the command @return a String of the command followed by the arguments, where each item which has spaces is appropriately quoted. Pre-quoted items are not changed during "unsafe" quoting. At this point in time, default behavior is "unsafe" quoting.
[ "Create", "an", "appropriately", "quoted", "argline", "to", "use", "given", "the", "command", "(", "script", "path", ")", "and", "argument", "strings", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/cli/CLIUtils.java#L52-L54
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/BidiOrder.java
BidiOrder.setLevels
private void setLevels(int start, int limit, byte newLevel) { """ Set resultLevels from start up to (but not including) limit to newLevel. """ for (int i = start; i < limit; ++i) { resultLevels[i] = newLevel; } }
java
private void setLevels(int start, int limit, byte newLevel) { for (int i = start; i < limit; ++i) { resultLevels[i] = newLevel; } }
[ "private", "void", "setLevels", "(", "int", "start", ",", "int", "limit", ",", "byte", "newLevel", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "limit", ";", "++", "i", ")", "{", "resultLevels", "[", "i", "]", "=", "newLevel", ";", "}", "}" ]
Set resultLevels from start up to (but not including) limit to newLevel.
[ "Set", "resultLevels", "from", "start", "up", "to", "(", "but", "not", "including", ")", "limit", "to", "newLevel", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BidiOrder.java#L1068-L1072
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/UcsApi.java
UcsApi.getContactDetails
public ApiSuccessResponse getContactDetails(String id, ContactDetailsData contactDetailsData) throws ApiException { """ Get the details of a contact @param id id of the Contact (required) @param contactDetailsData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<ApiSuccessResponse> resp = getContactDetailsWithHttpInfo(id, contactDetailsData); return resp.getData(); }
java
public ApiSuccessResponse getContactDetails(String id, ContactDetailsData contactDetailsData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = getContactDetailsWithHttpInfo(id, contactDetailsData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "getContactDetails", "(", "String", "id", ",", "ContactDetailsData", "contactDetailsData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "getContactDetailsWithHttpInfo", "(", "id", ",", "contactDetailsData", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Get the details of a contact @param id id of the Contact (required) @param contactDetailsData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "the", "details", "of", "a", "contact" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UcsApi.java#L901-L904
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.splitCostStart
private TimephasedCost splitCostStart(ProjectCalendar calendar, double totalAmount, Date start) { """ Used for Cost type Resources. Generates a TimphasedCost block for the total amount on the start date. This is useful for Cost resources that have an AccrueAt value of Start. @param calendar calendar used by this assignment @param totalAmount cost amount for this block @param start start date of the timephased cost block @return timephased cost """ TimephasedCost cost = new TimephasedCost(); cost.setStart(start); cost.setFinish(calendar.getDate(start, Duration.getInstance(1, TimeUnit.DAYS), false)); cost.setAmountPerDay(Double.valueOf(totalAmount)); cost.setTotalAmount(Double.valueOf(totalAmount)); return cost; }
java
private TimephasedCost splitCostStart(ProjectCalendar calendar, double totalAmount, Date start) { TimephasedCost cost = new TimephasedCost(); cost.setStart(start); cost.setFinish(calendar.getDate(start, Duration.getInstance(1, TimeUnit.DAYS), false)); cost.setAmountPerDay(Double.valueOf(totalAmount)); cost.setTotalAmount(Double.valueOf(totalAmount)); return cost; }
[ "private", "TimephasedCost", "splitCostStart", "(", "ProjectCalendar", "calendar", ",", "double", "totalAmount", ",", "Date", "start", ")", "{", "TimephasedCost", "cost", "=", "new", "TimephasedCost", "(", ")", ";", "cost", ".", "setStart", "(", "start", ")", ";", "cost", ".", "setFinish", "(", "calendar", ".", "getDate", "(", "start", ",", "Duration", ".", "getInstance", "(", "1", ",", "TimeUnit", ".", "DAYS", ")", ",", "false", ")", ")", ";", "cost", ".", "setAmountPerDay", "(", "Double", ".", "valueOf", "(", "totalAmount", ")", ")", ";", "cost", ".", "setTotalAmount", "(", "Double", ".", "valueOf", "(", "totalAmount", ")", ")", ";", "return", "cost", ";", "}" ]
Used for Cost type Resources. Generates a TimphasedCost block for the total amount on the start date. This is useful for Cost resources that have an AccrueAt value of Start. @param calendar calendar used by this assignment @param totalAmount cost amount for this block @param start start date of the timephased cost block @return timephased cost
[ "Used", "for", "Cost", "type", "Resources", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L964-L973
wdullaer/SwipeActionAdapter
library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionTouchListener.java
SwipeActionTouchListener.makeScrollListener
public AbsListView.OnScrollListener makeScrollListener() { """ Returns an {@link AbsListView.OnScrollListener} to be added to the {@link ListView} using {@link ListView#setOnScrollListener(AbsListView.OnScrollListener)}. If a scroll listener is already assigned, the caller should still pass scroll changes through to this listener. This will ensure that this {@link SwipeActionTouchListener} is paused during list view scrolling. @see SwipeActionTouchListener """ return new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int scrollState) { setEnabled(scrollState != AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL); } @Override public void onScroll(AbsListView absListView, int i, int i1, int i2) { } }; }
java
public AbsListView.OnScrollListener makeScrollListener() { return new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int scrollState) { setEnabled(scrollState != AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL); } @Override public void onScroll(AbsListView absListView, int i, int i1, int i2) { } }; }
[ "public", "AbsListView", ".", "OnScrollListener", "makeScrollListener", "(", ")", "{", "return", "new", "AbsListView", ".", "OnScrollListener", "(", ")", "{", "@", "Override", "public", "void", "onScrollStateChanged", "(", "AbsListView", "absListView", ",", "int", "scrollState", ")", "{", "setEnabled", "(", "scrollState", "!=", "AbsListView", ".", "OnScrollListener", ".", "SCROLL_STATE_TOUCH_SCROLL", ")", ";", "}", "@", "Override", "public", "void", "onScroll", "(", "AbsListView", "absListView", ",", "int", "i", ",", "int", "i1", ",", "int", "i2", ")", "{", "}", "}", ";", "}" ]
Returns an {@link AbsListView.OnScrollListener} to be added to the {@link ListView} using {@link ListView#setOnScrollListener(AbsListView.OnScrollListener)}. If a scroll listener is already assigned, the caller should still pass scroll changes through to this listener. This will ensure that this {@link SwipeActionTouchListener} is paused during list view scrolling. @see SwipeActionTouchListener
[ "Returns", "an", "{", "@link", "AbsListView", ".", "OnScrollListener", "}", "to", "be", "added", "to", "the", "{", "@link", "ListView", "}", "using", "{", "@link", "ListView#setOnScrollListener", "(", "AbsListView", ".", "OnScrollListener", ")", "}", ".", "If", "a", "scroll", "listener", "is", "already", "assigned", "the", "caller", "should", "still", "pass", "scroll", "changes", "through", "to", "this", "listener", ".", "This", "will", "ensure", "that", "this", "{", "@link", "SwipeActionTouchListener", "}", "is", "paused", "during", "list", "view", "scrolling", "." ]
train
https://github.com/wdullaer/SwipeActionAdapter/blob/24a7e2ed953ac11ea0d8875d375bba571ffeba55/library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionTouchListener.java#L198-L209
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java
FineUploader5DeleteFile.addParam
@Nonnull public FineUploader5DeleteFile addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue) { """ Any additional parameters to attach to delete file requests. @param sKey Parameter name @param sValue Parameter value @return this """ ValueEnforcer.notEmpty (sKey, "Key"); ValueEnforcer.notNull (sValue, "Value"); m_aDeleteFileParams.put (sKey, sValue); return this; }
java
@Nonnull public FineUploader5DeleteFile addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue) { ValueEnforcer.notEmpty (sKey, "Key"); ValueEnforcer.notNull (sValue, "Value"); m_aDeleteFileParams.put (sKey, sValue); return this; }
[ "@", "Nonnull", "public", "FineUploader5DeleteFile", "addParam", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sKey", ",", "@", "Nonnull", "final", "String", "sValue", ")", "{", "ValueEnforcer", ".", "notEmpty", "(", "sKey", ",", "\"Key\"", ")", ";", "ValueEnforcer", ".", "notNull", "(", "sValue", ",", "\"Value\"", ")", ";", "m_aDeleteFileParams", ".", "put", "(", "sKey", ",", "sValue", ")", ";", "return", "this", ";", "}" ]
Any additional parameters to attach to delete file requests. @param sKey Parameter name @param sValue Parameter value @return this
[ "Any", "additional", "parameters", "to", "attach", "to", "delete", "file", "requests", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java#L213-L221
JodaOrg/joda-time
src/main/java/org/joda/time/chrono/GJChronology.java
GJChronology.withZone
public Chronology withZone(DateTimeZone zone) { """ Gets the Chronology in a specific time zone. @param zone the zone to get the chronology in, null is default @return the chronology """ if (zone == null) { zone = DateTimeZone.getDefault(); } if (zone == getZone()) { return this; } return getInstance(zone, iCutoverInstant, getMinimumDaysInFirstWeek()); }
java
public Chronology withZone(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } if (zone == getZone()) { return this; } return getInstance(zone, iCutoverInstant, getMinimumDaysInFirstWeek()); }
[ "public", "Chronology", "withZone", "(", "DateTimeZone", "zone", ")", "{", "if", "(", "zone", "==", "null", ")", "{", "zone", "=", "DateTimeZone", ".", "getDefault", "(", ")", ";", "}", "if", "(", "zone", "==", "getZone", "(", ")", ")", "{", "return", "this", ";", "}", "return", "getInstance", "(", "zone", ",", "iCutoverInstant", ",", "getMinimumDaysInFirstWeek", "(", ")", ")", ";", "}" ]
Gets the Chronology in a specific time zone. @param zone the zone to get the chronology in, null is default @return the chronology
[ "Gets", "the", "Chronology", "in", "a", "specific", "time", "zone", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/GJChronology.java#L307-L315
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/CharsetUtil.java
CharsetUtil.convert
public static String convert(String source, String srcCharset, String destCharset) { """ 转换字符串的字符集编码 @param source 字符串 @param srcCharset 源字符集,默认ISO-8859-1 @param destCharset 目标字符集,默认UTF-8 @return 转换后的字符集 """ return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); }
java
public static String convert(String source, String srcCharset, String destCharset) { return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); }
[ "public", "static", "String", "convert", "(", "String", "source", ",", "String", "srcCharset", ",", "String", "destCharset", ")", "{", "return", "convert", "(", "source", ",", "Charset", ".", "forName", "(", "srcCharset", ")", ",", "Charset", ".", "forName", "(", "destCharset", ")", ")", ";", "}" ]
转换字符串的字符集编码 @param source 字符串 @param srcCharset 源字符集,默认ISO-8859-1 @param destCharset 目标字符集,默认UTF-8 @return 转换后的字符集
[ "转换字符串的字符集编码" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/CharsetUtil.java#L48-L50
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/QueryFactory.java
QueryFactory.newReportQuery
public static ReportQueryByCriteria newReportQuery(Class classToSearchFrom, String[] columns, Criteria criteria, boolean distinct) { """ create a new ReportQueryByCriteria @param classToSearchFrom @param criteria @param distinct @return ReportQueryByCriteria """ criteria = addCriteriaForOjbConcreteClasses(getRepository().getDescriptorFor(classToSearchFrom), criteria); return new ReportQueryByCriteria(classToSearchFrom, columns, criteria, distinct); }
java
public static ReportQueryByCriteria newReportQuery(Class classToSearchFrom, String[] columns, Criteria criteria, boolean distinct) { criteria = addCriteriaForOjbConcreteClasses(getRepository().getDescriptorFor(classToSearchFrom), criteria); return new ReportQueryByCriteria(classToSearchFrom, columns, criteria, distinct); }
[ "public", "static", "ReportQueryByCriteria", "newReportQuery", "(", "Class", "classToSearchFrom", ",", "String", "[", "]", "columns", ",", "Criteria", "criteria", ",", "boolean", "distinct", ")", "{", "criteria", "=", "addCriteriaForOjbConcreteClasses", "(", "getRepository", "(", ")", ".", "getDescriptorFor", "(", "classToSearchFrom", ")", ",", "criteria", ")", ";", "return", "new", "ReportQueryByCriteria", "(", "classToSearchFrom", ",", "columns", ",", "criteria", ",", "distinct", ")", ";", "}" ]
create a new ReportQueryByCriteria @param classToSearchFrom @param criteria @param distinct @return ReportQueryByCriteria
[ "create", "a", "new", "ReportQueryByCriteria" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/QueryFactory.java#L46-L50
Coveros/selenified
src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java
WaitForEquals.selectValues
public void selectValues(String[] expectedValues, double seconds) { """ Waits for the element's select values equal the provided expected values. If the element isn't present or a select, this will constitute a failure, same as a mismatch. The provided wait time will be used and if the element doesn't have the desired match count at that time, it will fail, and log the issue with a screenshot for traceability and added debugging support. @param expectedValues - the expected input value of the element @param seconds - how many seconds to wait for """ double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); if (!element.is().select()) { throw new TimeoutException(ELEMENT_NOT_SELECT); } while (!Arrays.toString(element.get().selectValues()).equals(Arrays.toString(expectedValues)) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkSelectValues(expectedValues, seconds, timeTook); } catch (TimeoutException e) { checkSelectValues(expectedValues, seconds, seconds); } }
java
public void selectValues(String[] expectedValues, double seconds) { double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); if (!element.is().select()) { throw new TimeoutException(ELEMENT_NOT_SELECT); } while (!Arrays.toString(element.get().selectValues()).equals(Arrays.toString(expectedValues)) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkSelectValues(expectedValues, seconds, timeTook); } catch (TimeoutException e) { checkSelectValues(expectedValues, seconds, seconds); } }
[ "public", "void", "selectValues", "(", "String", "[", "]", "expectedValues", ",", "double", "seconds", ")", "{", "double", "end", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "(", "seconds", "*", "1000", ")", ";", "try", "{", "elementPresent", "(", "seconds", ")", ";", "if", "(", "!", "element", ".", "is", "(", ")", ".", "select", "(", ")", ")", "{", "throw", "new", "TimeoutException", "(", "ELEMENT_NOT_SELECT", ")", ";", "}", "while", "(", "!", "Arrays", ".", "toString", "(", "element", ".", "get", "(", ")", ".", "selectValues", "(", ")", ")", ".", "equals", "(", "Arrays", ".", "toString", "(", "expectedValues", ")", ")", "&&", "System", ".", "currentTimeMillis", "(", ")", "<", "end", ")", ";", "double", "timeTook", "=", "Math", ".", "min", "(", "(", "seconds", "*", "1000", ")", "-", "(", "end", "-", "System", ".", "currentTimeMillis", "(", ")", ")", ",", "seconds", "*", "1000", ")", "/", "1000", ";", "checkSelectValues", "(", "expectedValues", ",", "seconds", ",", "timeTook", ")", ";", "}", "catch", "(", "TimeoutException", "e", ")", "{", "checkSelectValues", "(", "expectedValues", ",", "seconds", ",", "seconds", ")", ";", "}", "}" ]
Waits for the element's select values equal the provided expected values. If the element isn't present or a select, this will constitute a failure, same as a mismatch. The provided wait time will be used and if the element doesn't have the desired match count at that time, it will fail, and log the issue with a screenshot for traceability and added debugging support. @param expectedValues - the expected input value of the element @param seconds - how many seconds to wait for
[ "Waits", "for", "the", "element", "s", "select", "values", "equal", "the", "provided", "expected", "values", ".", "If", "the", "element", "isn", "t", "present", "or", "a", "select", "this", "will", "constitute", "a", "failure", "same", "as", "a", "mismatch", ".", "The", "provided", "wait", "time", "will", "be", "used", "and", "if", "the", "element", "doesn", "t", "have", "the", "desired", "match", "count", "at", "that", "time", "it", "will", "fail", "and", "log", "the", "issue", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java#L512-L525
phax/ph-commons
ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetDecoder.java
UTF7StyleCharsetDecoder._handleBase64
@Nullable private CoderResult _handleBase64 (final ByteBuffer in, final CharBuffer out, final byte lastRead) { """ <p> Decodes a byte in <i>base 64 mode</i>. Will directly write a character to the output buffer if completed. </p> @param in The input buffer @param out The output buffer @param lastRead Last byte read from the input buffer @return CoderResult.malformed if a non-base 64 character was encountered in strict mode, null otherwise """ CoderResult result = null; final int sextet = m_aBase64.getSextet (lastRead); if (sextet >= 0) { m_nBitsRead += 6; if (m_nBitsRead < 16) { m_nTempChar += sextet << (16 - m_nBitsRead); } else { m_nBitsRead -= 16; m_nTempChar += sextet >> (m_nBitsRead); out.put ((char) m_nTempChar); m_nTempChar = (sextet << (16 - m_nBitsRead)) & 0xFFFF; } } else { if (m_bStrict) return _malformed (in); out.put ((char) lastRead); if (_areBase64BitsWaiting ()) result = _malformed (in); _setUnshifted (); } return result; }
java
@Nullable private CoderResult _handleBase64 (final ByteBuffer in, final CharBuffer out, final byte lastRead) { CoderResult result = null; final int sextet = m_aBase64.getSextet (lastRead); if (sextet >= 0) { m_nBitsRead += 6; if (m_nBitsRead < 16) { m_nTempChar += sextet << (16 - m_nBitsRead); } else { m_nBitsRead -= 16; m_nTempChar += sextet >> (m_nBitsRead); out.put ((char) m_nTempChar); m_nTempChar = (sextet << (16 - m_nBitsRead)) & 0xFFFF; } } else { if (m_bStrict) return _malformed (in); out.put ((char) lastRead); if (_areBase64BitsWaiting ()) result = _malformed (in); _setUnshifted (); } return result; }
[ "@", "Nullable", "private", "CoderResult", "_handleBase64", "(", "final", "ByteBuffer", "in", ",", "final", "CharBuffer", "out", ",", "final", "byte", "lastRead", ")", "{", "CoderResult", "result", "=", "null", ";", "final", "int", "sextet", "=", "m_aBase64", ".", "getSextet", "(", "lastRead", ")", ";", "if", "(", "sextet", ">=", "0", ")", "{", "m_nBitsRead", "+=", "6", ";", "if", "(", "m_nBitsRead", "<", "16", ")", "{", "m_nTempChar", "+=", "sextet", "<<", "(", "16", "-", "m_nBitsRead", ")", ";", "}", "else", "{", "m_nBitsRead", "-=", "16", ";", "m_nTempChar", "+=", "sextet", ">>", "(", "m_nBitsRead", ")", ";", "out", ".", "put", "(", "(", "char", ")", "m_nTempChar", ")", ";", "m_nTempChar", "=", "(", "sextet", "<<", "(", "16", "-", "m_nBitsRead", ")", ")", "&", "0xFFFF", ";", "}", "}", "else", "{", "if", "(", "m_bStrict", ")", "return", "_malformed", "(", "in", ")", ";", "out", ".", "put", "(", "(", "char", ")", "lastRead", ")", ";", "if", "(", "_areBase64BitsWaiting", "(", ")", ")", "result", "=", "_malformed", "(", "in", ")", ";", "_setUnshifted", "(", ")", ";", "}", "return", "result", ";", "}" ]
<p> Decodes a byte in <i>base 64 mode</i>. Will directly write a character to the output buffer if completed. </p> @param in The input buffer @param out The output buffer @param lastRead Last byte read from the input buffer @return CoderResult.malformed if a non-base 64 character was encountered in strict mode, null otherwise
[ "<p", ">", "Decodes", "a", "byte", "in", "<i", ">", "base", "64", "mode<", "/", "i", ">", ".", "Will", "directly", "write", "a", "character", "to", "the", "output", "buffer", "if", "completed", ".", "<", "/", "p", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetDecoder.java#L131-L161
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
SQLInLoop.sawOpcode
@Override public void sawOpcode(int seen) { """ implements the visitor to collect positions of queries and loops @param seen the opcode of the currently parsed instruction """ if (seen == Const.INVOKEINTERFACE) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) { queryLocations.add(Integer.valueOf(getPC())); } } else if (OpcodeUtils.isBranch(seen)) { int branchTarget = getBranchTarget(); int pc = getPC(); if (branchTarget < pc) { loops.add(new LoopLocation(branchTarget, pc)); } } }
java
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEINTERFACE) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) { queryLocations.add(Integer.valueOf(getPC())); } } else if (OpcodeUtils.isBranch(seen)) { int branchTarget = getBranchTarget(); int pc = getPC(); if (branchTarget < pc) { loops.add(new LoopLocation(branchTarget, pc)); } } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "INVOKEINTERFACE", ")", "{", "String", "clsName", "=", "getClassConstantOperand", "(", ")", ";", "String", "methodName", "=", "getNameConstantOperand", "(", ")", ";", "if", "(", "queryClasses", ".", "contains", "(", "clsName", ")", "&&", "queryMethods", ".", "contains", "(", "methodName", ")", ")", "{", "queryLocations", ".", "add", "(", "Integer", ".", "valueOf", "(", "getPC", "(", ")", ")", ")", ";", "}", "}", "else", "if", "(", "OpcodeUtils", ".", "isBranch", "(", "seen", ")", ")", "{", "int", "branchTarget", "=", "getBranchTarget", "(", ")", ";", "int", "pc", "=", "getPC", "(", ")", ";", "if", "(", "branchTarget", "<", "pc", ")", "{", "loops", ".", "add", "(", "new", "LoopLocation", "(", "branchTarget", ",", "pc", ")", ")", ";", "}", "}", "}" ]
implements the visitor to collect positions of queries and loops @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "collect", "positions", "of", "queries", "and", "loops" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java#L107-L123
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
IterableOfProtosSubject.ignoringFieldDescriptors
public IterableOfProtosFluentAssertion<M> ignoringFieldDescriptors( FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) { """ Excludes all message fields matching the given {@link FieldDescriptor}s from the comparison. <p>This method adds on any previous {@link FieldScope} related settings, overriding previous changes to ensure the specified fields are ignored recursively. All sub-fields of these field descriptors are ignored, no matter where they occur in the tree. <p>If a field descriptor which does not, or cannot occur in the proto structure is supplied, it is silently ignored. """ return ignoringFieldDescriptors(asList(firstFieldDescriptor, rest)); }
java
public IterableOfProtosFluentAssertion<M> ignoringFieldDescriptors( FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) { return ignoringFieldDescriptors(asList(firstFieldDescriptor, rest)); }
[ "public", "IterableOfProtosFluentAssertion", "<", "M", ">", "ignoringFieldDescriptors", "(", "FieldDescriptor", "firstFieldDescriptor", ",", "FieldDescriptor", "...", "rest", ")", "{", "return", "ignoringFieldDescriptors", "(", "asList", "(", "firstFieldDescriptor", ",", "rest", ")", ")", ";", "}" ]
Excludes all message fields matching the given {@link FieldDescriptor}s from the comparison. <p>This method adds on any previous {@link FieldScope} related settings, overriding previous changes to ensure the specified fields are ignored recursively. All sub-fields of these field descriptors are ignored, no matter where they occur in the tree. <p>If a field descriptor which does not, or cannot occur in the proto structure is supplied, it is silently ignored.
[ "Excludes", "all", "message", "fields", "matching", "the", "given", "{", "@link", "FieldDescriptor", "}", "s", "from", "the", "comparison", "." ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java#L922-L925
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.photos_addTags
public T photos_addTags(Long photoId, Collection<PhotoTag> tags) throws FacebookException, IOException { """ Adds several tags to a photo. @param photoId The photo id of the photo to be tagged. @param tags A list of PhotoTags. @return a list of booleans indicating whether the tag was successfully added. """ assert (photoId > 0); assert (null != tags && !tags.isEmpty()); JSONArray jsonTags = new JSONArray(); for (PhotoTag tag : tags) { jsonTags.add(tag.jsonify()); } return this.callMethod(FacebookMethod.PHOTOS_ADD_TAG, new Pair<String, CharSequence>("pid", photoId.toString()), new Pair<String, CharSequence>("tags", jsonTags.toString())); }
java
public T photos_addTags(Long photoId, Collection<PhotoTag> tags) throws FacebookException, IOException { assert (photoId > 0); assert (null != tags && !tags.isEmpty()); JSONArray jsonTags = new JSONArray(); for (PhotoTag tag : tags) { jsonTags.add(tag.jsonify()); } return this.callMethod(FacebookMethod.PHOTOS_ADD_TAG, new Pair<String, CharSequence>("pid", photoId.toString()), new Pair<String, CharSequence>("tags", jsonTags.toString())); }
[ "public", "T", "photos_addTags", "(", "Long", "photoId", ",", "Collection", "<", "PhotoTag", ">", "tags", ")", "throws", "FacebookException", ",", "IOException", "{", "assert", "(", "photoId", ">", "0", ")", ";", "assert", "(", "null", "!=", "tags", "&&", "!", "tags", ".", "isEmpty", "(", ")", ")", ";", "JSONArray", "jsonTags", "=", "new", "JSONArray", "(", ")", ";", "for", "(", "PhotoTag", "tag", ":", "tags", ")", "{", "jsonTags", ".", "add", "(", "tag", ".", "jsonify", "(", ")", ")", ";", "}", "return", "this", ".", "callMethod", "(", "FacebookMethod", ".", "PHOTOS_ADD_TAG", ",", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"pid\"", ",", "photoId", ".", "toString", "(", ")", ")", ",", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"tags\"", ",", "jsonTags", ".", "toString", "(", ")", ")", ")", ";", "}" ]
Adds several tags to a photo. @param photoId The photo id of the photo to be tagged. @param tags A list of PhotoTags. @return a list of booleans indicating whether the tag was successfully added.
[ "Adds", "several", "tags", "to", "a", "photo", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1364-L1377
rollbar/rollbar-java
rollbar-android/src/main/java/com/rollbar/android/Rollbar.java
Rollbar.log
public void log(String message, Level level) { """ Record a message at the level specified. @param message the message. @param level the level. """ log(null, null, message, level); }
java
public void log(String message, Level level) { log(null, null, message, level); }
[ "public", "void", "log", "(", "String", "message", ",", "Level", "level", ")", "{", "log", "(", "null", ",", "null", ",", "message", ",", "level", ")", ";", "}" ]
Record a message at the level specified. @param message the message. @param level the level.
[ "Record", "a", "message", "at", "the", "level", "specified", "." ]
train
https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-android/src/main/java/com/rollbar/android/Rollbar.java#L765-L767
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java
WebCrawler.onUnhandledException
protected void onUnhandledException(WebURL webUrl, Throwable e) { """ This function is called when a unhandled exception was encountered during fetching @param webUrl URL where a unhandled exception occured """ if (myController.getConfig().isHaltOnError() && !(e instanceof IOException)) { throw new RuntimeException("unhandled exception", e); } else { String urlStr = (webUrl == null ? "NULL" : webUrl.getURL()); logger.warn("Unhandled exception while fetching {}: {}", urlStr, e.getMessage()); logger.info("Stacktrace: ", e); // Do nothing by default (except basic logging) // Sub-classed can override this to add their custom functionality } }
java
protected void onUnhandledException(WebURL webUrl, Throwable e) { if (myController.getConfig().isHaltOnError() && !(e instanceof IOException)) { throw new RuntimeException("unhandled exception", e); } else { String urlStr = (webUrl == null ? "NULL" : webUrl.getURL()); logger.warn("Unhandled exception while fetching {}: {}", urlStr, e.getMessage()); logger.info("Stacktrace: ", e); // Do nothing by default (except basic logging) // Sub-classed can override this to add their custom functionality } }
[ "protected", "void", "onUnhandledException", "(", "WebURL", "webUrl", ",", "Throwable", "e", ")", "{", "if", "(", "myController", ".", "getConfig", "(", ")", ".", "isHaltOnError", "(", ")", "&&", "!", "(", "e", "instanceof", "IOException", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"unhandled exception\"", ",", "e", ")", ";", "}", "else", "{", "String", "urlStr", "=", "(", "webUrl", "==", "null", "?", "\"NULL\"", ":", "webUrl", ".", "getURL", "(", ")", ")", ";", "logger", ".", "warn", "(", "\"Unhandled exception while fetching {}: {}\"", ",", "urlStr", ",", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "info", "(", "\"Stacktrace: \"", ",", "e", ")", ";", "// Do nothing by default (except basic logging)", "// Sub-classed can override this to add their custom functionality", "}", "}" ]
This function is called when a unhandled exception was encountered during fetching @param webUrl URL where a unhandled exception occured
[ "This", "function", "is", "called", "when", "a", "unhandled", "exception", "was", "encountered", "during", "fetching" ]
train
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java#L266-L276
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java
VmlGraphicsContext.drawPolygon
public void drawPolygon(Object parent, String name, Polygon polygon, ShapeStyle style) { """ Draw a {@link Polygon} geometry onto the <code>GraphicsContext</code>. @param parent parent group object @param name The Polygon's name. @param polygon The Polygon to be drawn. @param style The styling object for the Polygon. """ if (isAttached()) { Element element = helper.createOrUpdateElement(parent, name, "shape", style); if (polygon != null) { Dom.setStyleAttribute(element, "position", "absolute"); Dom.setElementAttribute(element, "fill-rule", "evenodd"); Dom.setElementAttribute(element, "path", VmlPathDecoder.decode(polygon)); applyElementSize(element, getWidth(), getHeight(), false); } } }
java
public void drawPolygon(Object parent, String name, Polygon polygon, ShapeStyle style) { if (isAttached()) { Element element = helper.createOrUpdateElement(parent, name, "shape", style); if (polygon != null) { Dom.setStyleAttribute(element, "position", "absolute"); Dom.setElementAttribute(element, "fill-rule", "evenodd"); Dom.setElementAttribute(element, "path", VmlPathDecoder.decode(polygon)); applyElementSize(element, getWidth(), getHeight(), false); } } }
[ "public", "void", "drawPolygon", "(", "Object", "parent", ",", "String", "name", ",", "Polygon", "polygon", ",", "ShapeStyle", "style", ")", "{", "if", "(", "isAttached", "(", ")", ")", "{", "Element", "element", "=", "helper", ".", "createOrUpdateElement", "(", "parent", ",", "name", ",", "\"shape\"", ",", "style", ")", ";", "if", "(", "polygon", "!=", "null", ")", "{", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"position\"", ",", "\"absolute\"", ")", ";", "Dom", ".", "setElementAttribute", "(", "element", ",", "\"fill-rule\"", ",", "\"evenodd\"", ")", ";", "Dom", ".", "setElementAttribute", "(", "element", ",", "\"path\"", ",", "VmlPathDecoder", ".", "decode", "(", "polygon", ")", ")", ";", "applyElementSize", "(", "element", ",", "getWidth", "(", ")", ",", "getHeight", "(", ")", ",", "false", ")", ";", "}", "}", "}" ]
Draw a {@link Polygon} geometry onto the <code>GraphicsContext</code>. @param parent parent group object @param name The Polygon's name. @param polygon The Polygon to be drawn. @param style The styling object for the Polygon.
[ "Draw", "a", "{", "@link", "Polygon", "}", "geometry", "onto", "the", "<code", ">", "GraphicsContext<", "/", "code", ">", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java#L311-L321
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiTransform.java
BidiTransform.resolve
private void resolve(byte level, int options) { """ Performs bidi resolution of text. @param level Base embedding level @param options Reordering options """ bidi.setInverse((options & Bidi.REORDER_INVERSE_LIKE_DIRECT) != 0); bidi.setReorderingMode(options); bidi.setPara(text, level, null); }
java
private void resolve(byte level, int options) { bidi.setInverse((options & Bidi.REORDER_INVERSE_LIKE_DIRECT) != 0); bidi.setReorderingMode(options); bidi.setPara(text, level, null); }
[ "private", "void", "resolve", "(", "byte", "level", ",", "int", "options", ")", "{", "bidi", ".", "setInverse", "(", "(", "options", "&", "Bidi", ".", "REORDER_INVERSE_LIKE_DIRECT", ")", "!=", "0", ")", ";", "bidi", ".", "setReorderingMode", "(", "options", ")", ";", "bidi", ".", "setPara", "(", "text", ",", "level", ",", "null", ")", ";", "}" ]
Performs bidi resolution of text. @param level Base embedding level @param options Reordering options
[ "Performs", "bidi", "resolution", "of", "text", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiTransform.java#L298-L302
redkale/redkale
src/org/redkale/source/FilterNode.java
FilterNode.createSQLJoin
protected <T> CharSequence createSQLJoin(final Function<Class, EntityInfo> func, final boolean update, final Map<Class, String> joinTabalis, final Set<String> haset, final EntityInfo<T> info) { """ 该方法需要重载 @param <T> Entity类的泛型 @param func EntityInfo的加载器 @param update 是否用于更新的JOIN @param joinTabalis 关联表集合 @param haset 已拼接过的字段名 @param info Entity类的EntityInfo @return SQL的join语句 不存在返回null """ if (joinTabalis == null || this.nodes == null) return null; StringBuilder sb = null; for (FilterNode node : this.nodes) { CharSequence cs = node.createSQLJoin(func, update, joinTabalis, haset, info); if (cs == null) continue; if (sb == null) sb = new StringBuilder(); sb.append(cs); } return sb; }
java
protected <T> CharSequence createSQLJoin(final Function<Class, EntityInfo> func, final boolean update, final Map<Class, String> joinTabalis, final Set<String> haset, final EntityInfo<T> info) { if (joinTabalis == null || this.nodes == null) return null; StringBuilder sb = null; for (FilterNode node : this.nodes) { CharSequence cs = node.createSQLJoin(func, update, joinTabalis, haset, info); if (cs == null) continue; if (sb == null) sb = new StringBuilder(); sb.append(cs); } return sb; }
[ "protected", "<", "T", ">", "CharSequence", "createSQLJoin", "(", "final", "Function", "<", "Class", ",", "EntityInfo", ">", "func", ",", "final", "boolean", "update", ",", "final", "Map", "<", "Class", ",", "String", ">", "joinTabalis", ",", "final", "Set", "<", "String", ">", "haset", ",", "final", "EntityInfo", "<", "T", ">", "info", ")", "{", "if", "(", "joinTabalis", "==", "null", "||", "this", ".", "nodes", "==", "null", ")", "return", "null", ";", "StringBuilder", "sb", "=", "null", ";", "for", "(", "FilterNode", "node", ":", "this", ".", "nodes", ")", "{", "CharSequence", "cs", "=", "node", ".", "createSQLJoin", "(", "func", ",", "update", ",", "joinTabalis", ",", "haset", ",", "info", ")", ";", "if", "(", "cs", "==", "null", ")", "continue", ";", "if", "(", "sb", "==", "null", ")", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "cs", ")", ";", "}", "return", "sb", ";", "}" ]
该方法需要重载 @param <T> Entity类的泛型 @param func EntityInfo的加载器 @param update 是否用于更新的JOIN @param joinTabalis 关联表集合 @param haset 已拼接过的字段名 @param info Entity类的EntityInfo @return SQL的join语句 不存在返回null
[ "该方法需要重载" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/source/FilterNode.java#L215-L225
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java
LayoutRefiner.traverseRing
private void traverseRing(int[] ringSystem, int v, int rnum) { """ Simple method for marking ring systems with a flood-fill. @param ringSystem ring system vector @param v start atom @param rnum the number to mark atoms of this ring """ ringSystem[v] = rnum; for (int w : adjList[v]) { if (ringSystem[w] == 0 && bondMap.get(v, w).isInRing()) traverseRing(ringSystem, w, rnum); } }
java
private void traverseRing(int[] ringSystem, int v, int rnum) { ringSystem[v] = rnum; for (int w : adjList[v]) { if (ringSystem[w] == 0 && bondMap.get(v, w).isInRing()) traverseRing(ringSystem, w, rnum); } }
[ "private", "void", "traverseRing", "(", "int", "[", "]", "ringSystem", ",", "int", "v", ",", "int", "rnum", ")", "{", "ringSystem", "[", "v", "]", "=", "rnum", ";", "for", "(", "int", "w", ":", "adjList", "[", "v", "]", ")", "{", "if", "(", "ringSystem", "[", "w", "]", "==", "0", "&&", "bondMap", ".", "get", "(", "v", ",", "w", ")", ".", "isInRing", "(", ")", ")", "traverseRing", "(", "ringSystem", ",", "w", ",", "rnum", ")", ";", "}", "}" ]
Simple method for marking ring systems with a flood-fill. @param ringSystem ring system vector @param v start atom @param rnum the number to mark atoms of this ring
[ "Simple", "method", "for", "marking", "ring", "systems", "with", "a", "flood", "-", "fill", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java#L180-L186
Impetus/Kundera
src/kundera-redis/src/main/java/com/impetus/client/redis/RedisClient.java
RedisClient.fetchColumn
private List fetchColumn(String columnName, Object connection, List results, Set<String> resultKeys) { """ Fetch column. @param columnName the column name @param connection the connection @param results the results @param resultKeys the result keys @return the list """ for (String hashKey : resultKeys) { List columnValues = null; if (resource != null && resource.isActive()) { Response response = ((Transaction) connection).hmget(hashKey, columnName); // ((Transaction) connection).exec(); ((RedisTransaction) resource).onExecute(((Transaction) connection)); columnValues = (List) response.get(); } else { columnValues = ((Jedis) connection).hmget(hashKey, columnName); } if (columnValues != null && !columnValues.isEmpty()) { results.addAll(columnValues); // Currently returning list of // string as known issue // with // joint table concept! } } return results; }
java
private List fetchColumn(String columnName, Object connection, List results, Set<String> resultKeys) { for (String hashKey : resultKeys) { List columnValues = null; if (resource != null && resource.isActive()) { Response response = ((Transaction) connection).hmget(hashKey, columnName); // ((Transaction) connection).exec(); ((RedisTransaction) resource).onExecute(((Transaction) connection)); columnValues = (List) response.get(); } else { columnValues = ((Jedis) connection).hmget(hashKey, columnName); } if (columnValues != null && !columnValues.isEmpty()) { results.addAll(columnValues); // Currently returning list of // string as known issue // with // joint table concept! } } return results; }
[ "private", "List", "fetchColumn", "(", "String", "columnName", ",", "Object", "connection", ",", "List", "results", ",", "Set", "<", "String", ">", "resultKeys", ")", "{", "for", "(", "String", "hashKey", ":", "resultKeys", ")", "{", "List", "columnValues", "=", "null", ";", "if", "(", "resource", "!=", "null", "&&", "resource", ".", "isActive", "(", ")", ")", "{", "Response", "response", "=", "(", "(", "Transaction", ")", "connection", ")", ".", "hmget", "(", "hashKey", ",", "columnName", ")", ";", "// ((Transaction) connection).exec();", "(", "(", "RedisTransaction", ")", "resource", ")", ".", "onExecute", "(", "(", "(", "Transaction", ")", "connection", ")", ")", ";", "columnValues", "=", "(", "List", ")", "response", ".", "get", "(", ")", ";", "}", "else", "{", "columnValues", "=", "(", "(", "Jedis", ")", "connection", ")", ".", "hmget", "(", "hashKey", ",", "columnName", ")", ";", "}", "if", "(", "columnValues", "!=", "null", "&&", "!", "columnValues", ".", "isEmpty", "(", ")", ")", "{", "results", ".", "addAll", "(", "columnValues", ")", ";", "// Currently returning list of", "// string as known issue", "// with", "// joint table concept!", "}", "}", "return", "results", ";", "}" ]
Fetch column. @param columnName the column name @param connection the connection @param results the results @param resultKeys the result keys @return the list
[ "Fetch", "column", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-redis/src/main/java/com/impetus/client/redis/RedisClient.java#L689-L718
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.retrieveUserProperties
public PropertyOwner retrieveUserProperties(String strRegistrationKey) { """ Retrieve/Create a user properties record with this lookup key. User properties are accessed in two ways. <br/>First, if you pass a null, you get the default top-level user properties (such as background color, fonts, etc.). <br/>Second, if you pass a registration key, you get a property database for that specific key (such as screen field default values, specific screen sizes, etc). @param strPropertyCode The key I'm looking up (null for the default user's properties). @return The UserProperties for this registration key. """ if ((strRegistrationKey == null) || (strRegistrationKey.length() == 0)) return this; // Use default user properties UserProperties regKey = (UserProperties)m_htRegistration.get(strRegistrationKey); if (regKey == null) regKey = new UserProperties(this, strRegistrationKey); regKey.bumpUseCount(+1); return regKey; }
java
public PropertyOwner retrieveUserProperties(String strRegistrationKey) { if ((strRegistrationKey == null) || (strRegistrationKey.length() == 0)) return this; // Use default user properties UserProperties regKey = (UserProperties)m_htRegistration.get(strRegistrationKey); if (regKey == null) regKey = new UserProperties(this, strRegistrationKey); regKey.bumpUseCount(+1); return regKey; }
[ "public", "PropertyOwner", "retrieveUserProperties", "(", "String", "strRegistrationKey", ")", "{", "if", "(", "(", "strRegistrationKey", "==", "null", ")", "||", "(", "strRegistrationKey", ".", "length", "(", ")", "==", "0", ")", ")", "return", "this", ";", "// Use default user properties", "UserProperties", "regKey", "=", "(", "UserProperties", ")", "m_htRegistration", ".", "get", "(", "strRegistrationKey", ")", ";", "if", "(", "regKey", "==", "null", ")", "regKey", "=", "new", "UserProperties", "(", "this", ",", "strRegistrationKey", ")", ";", "regKey", ".", "bumpUseCount", "(", "+", "1", ")", ";", "return", "regKey", ";", "}" ]
Retrieve/Create a user properties record with this lookup key. User properties are accessed in two ways. <br/>First, if you pass a null, you get the default top-level user properties (such as background color, fonts, etc.). <br/>Second, if you pass a registration key, you get a property database for that specific key (such as screen field default values, specific screen sizes, etc). @param strPropertyCode The key I'm looking up (null for the default user's properties). @return The UserProperties for this registration key.
[ "Retrieve", "/", "Create", "a", "user", "properties", "record", "with", "this", "lookup", "key", ".", "User", "properties", "are", "accessed", "in", "two", "ways", ".", "<br", "/", ">", "First", "if", "you", "pass", "a", "null", "you", "get", "the", "default", "top", "-", "level", "user", "properties", "(", "such", "as", "background", "color", "fonts", "etc", ".", ")", ".", "<br", "/", ">", "Second", "if", "you", "pass", "a", "registration", "key", "you", "get", "a", "property", "database", "for", "that", "specific", "key", "(", "such", "as", "screen", "field", "default", "values", "specific", "screen", "sizes", "etc", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L580-L589
jcuda/jcurand
JCurandJava/src/main/java/jcuda/jcurand/JCurand.java
JCurand.curandGenerate
public static int curandGenerate(curandGenerator generator, Pointer outputPtr, long num) { """ <pre> Generate 32-bit pseudo or quasirandom numbers. Use generator to generate num 32-bit results into the device memory at outputPtr. The device memory must have been previously allocated and be large enough to hold all the results. Launches are done with the stream set using ::curandSetStream(), or the null stream if no stream has been set. Results are 32-bit values with every bit random. @param generator - Generator to use @param outputPtr - Pointer to device memory to store CUDA-generated results, or Pointer to host memory to store CPU-generated results @param num - Number of random 32-bit values to generate @return CURAND_STATUS_NOT_INITIALIZED if the generator was never created CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is not a multiple of the quasirandom dimension CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason CURAND_STATUS_SUCCESS if the results were generated successfully </pre> """ return checkResult(curandGenerateNative(generator, outputPtr, num)); }
java
public static int curandGenerate(curandGenerator generator, Pointer outputPtr, long num) { return checkResult(curandGenerateNative(generator, outputPtr, num)); }
[ "public", "static", "int", "curandGenerate", "(", "curandGenerator", "generator", ",", "Pointer", "outputPtr", ",", "long", "num", ")", "{", "return", "checkResult", "(", "curandGenerateNative", "(", "generator", ",", "outputPtr", ",", "num", ")", ")", ";", "}" ]
<pre> Generate 32-bit pseudo or quasirandom numbers. Use generator to generate num 32-bit results into the device memory at outputPtr. The device memory must have been previously allocated and be large enough to hold all the results. Launches are done with the stream set using ::curandSetStream(), or the null stream if no stream has been set. Results are 32-bit values with every bit random. @param generator - Generator to use @param outputPtr - Pointer to device memory to store CUDA-generated results, or Pointer to host memory to store CPU-generated results @param num - Number of random 32-bit values to generate @return CURAND_STATUS_NOT_INITIALIZED if the generator was never created CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is not a multiple of the quasirandom dimension CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason CURAND_STATUS_SUCCESS if the results were generated successfully </pre>
[ "<pre", ">", "Generate", "32", "-", "bit", "pseudo", "or", "quasirandom", "numbers", "." ]
train
https://github.com/jcuda/jcurand/blob/0f463d2bb72cd93b3988f7ce148cdb6069ba4fd9/JCurandJava/src/main/java/jcuda/jcurand/JCurand.java#L527-L530
phax/ph-css
ph-css/src/main/java/com/helger/css/reader/CSSReader.java
CSSReader.readFromStringStream
@Nullable public static CascadingStyleSheet readFromStringStream (@Nonnull final String sCSS, @Nonnull final CSSReaderSettings aSettings) { """ Read the CSS from the passed String using a byte stream. @param sCSS The source string containing the CSS to be parsed. May not be <code>null</code>. @param aSettings The settings to be used for reading the CSS. May not be <code>null</code>. @return <code>null</code> if reading failed, the CSS declarations otherwise. @since 3.8.2 """ return readFromStream (new StringInputStreamProvider (sCSS, aSettings.getFallbackCharset ()), aSettings); }
java
@Nullable public static CascadingStyleSheet readFromStringStream (@Nonnull final String sCSS, @Nonnull final CSSReaderSettings aSettings) { return readFromStream (new StringInputStreamProvider (sCSS, aSettings.getFallbackCharset ()), aSettings); }
[ "@", "Nullable", "public", "static", "CascadingStyleSheet", "readFromStringStream", "(", "@", "Nonnull", "final", "String", "sCSS", ",", "@", "Nonnull", "final", "CSSReaderSettings", "aSettings", ")", "{", "return", "readFromStream", "(", "new", "StringInputStreamProvider", "(", "sCSS", ",", "aSettings", ".", "getFallbackCharset", "(", ")", ")", ",", "aSettings", ")", ";", "}" ]
Read the CSS from the passed String using a byte stream. @param sCSS The source string containing the CSS to be parsed. May not be <code>null</code>. @param aSettings The settings to be used for reading the CSS. May not be <code>null</code>. @return <code>null</code> if reading failed, the CSS declarations otherwise. @since 3.8.2
[ "Read", "the", "CSS", "from", "the", "passed", "String", "using", "a", "byte", "stream", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/reader/CSSReader.java#L503-L508
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.listConnectionsWithServiceResponseAsync
public Observable<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>> listConnectionsWithServiceResponseAsync(final String resourceGroupName, final String virtualNetworkGatewayName) { """ Gets all the connections in a virtual network gateway. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualNetworkGatewayConnectionListEntityInner&gt; object """ return listConnectionsSinglePageAsync(resourceGroupName, virtualNetworkGatewayName) .concatMap(new Func1<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>, Observable<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>>>() { @Override public Observable<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>> call(ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listConnectionsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>> listConnectionsWithServiceResponseAsync(final String resourceGroupName, final String virtualNetworkGatewayName) { return listConnectionsSinglePageAsync(resourceGroupName, virtualNetworkGatewayName) .concatMap(new Func1<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>, Observable<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>>>() { @Override public Observable<ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>>> call(ServiceResponse<Page<VirtualNetworkGatewayConnectionListEntityInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listConnectionsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "VirtualNetworkGatewayConnectionListEntityInner", ">", ">", ">", "listConnectionsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "virtualNetworkGatewayName", ")", "{", "return", "listConnectionsSinglePageAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "VirtualNetworkGatewayConnectionListEntityInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "VirtualNetworkGatewayConnectionListEntityInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "VirtualNetworkGatewayConnectionListEntityInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "VirtualNetworkGatewayConnectionListEntityInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listConnectionsNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Gets all the connections in a virtual network gateway. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualNetworkGatewayConnectionListEntityInner&gt; object
[ "Gets", "all", "the", "connections", "in", "a", "virtual", "network", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1095-L1107
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Mac.java
Mac.doFinal
public final void doFinal(byte[] output, int outOffset) throws ShortBufferException, IllegalStateException { """ Finishes the MAC operation. <p>A call to this method resets this <code>Mac</code> object to the state it was in when previously initialized via a call to <code>init(Key)</code> or <code>init(Key, AlgorithmParameterSpec)</code>. That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls to <code>update</code> and <code>doFinal</code>. (In order to reuse this <code>Mac</code> object with a different key, it must be reinitialized via a call to <code>init(Key)</code> or <code>init(Key, AlgorithmParameterSpec)</code>. <p>The MAC result is stored in <code>output</code>, starting at <code>outOffset</code> inclusive. @param output the buffer where the MAC result is stored @param outOffset the offset in <code>output</code> where the MAC is stored @exception ShortBufferException if the given output buffer is too small to hold the result @exception IllegalStateException if this <code>Mac</code> has not been initialized. """ chooseFirstProvider(); if (initialized == false) { throw new IllegalStateException("MAC not initialized"); } int macLen = getMacLength(); if (output == null || output.length-outOffset < macLen) { throw new ShortBufferException ("Cannot store MAC in output buffer"); } byte[] mac = doFinal(); System.arraycopy(mac, 0, output, outOffset, macLen); return; }
java
public final void doFinal(byte[] output, int outOffset) throws ShortBufferException, IllegalStateException { chooseFirstProvider(); if (initialized == false) { throw new IllegalStateException("MAC not initialized"); } int macLen = getMacLength(); if (output == null || output.length-outOffset < macLen) { throw new ShortBufferException ("Cannot store MAC in output buffer"); } byte[] mac = doFinal(); System.arraycopy(mac, 0, output, outOffset, macLen); return; }
[ "public", "final", "void", "doFinal", "(", "byte", "[", "]", "output", ",", "int", "outOffset", ")", "throws", "ShortBufferException", ",", "IllegalStateException", "{", "chooseFirstProvider", "(", ")", ";", "if", "(", "initialized", "==", "false", ")", "{", "throw", "new", "IllegalStateException", "(", "\"MAC not initialized\"", ")", ";", "}", "int", "macLen", "=", "getMacLength", "(", ")", ";", "if", "(", "output", "==", "null", "||", "output", ".", "length", "-", "outOffset", "<", "macLen", ")", "{", "throw", "new", "ShortBufferException", "(", "\"Cannot store MAC in output buffer\"", ")", ";", "}", "byte", "[", "]", "mac", "=", "doFinal", "(", ")", ";", "System", ".", "arraycopy", "(", "mac", ",", "0", ",", "output", ",", "outOffset", ",", "macLen", ")", ";", "return", ";", "}" ]
Finishes the MAC operation. <p>A call to this method resets this <code>Mac</code> object to the state it was in when previously initialized via a call to <code>init(Key)</code> or <code>init(Key, AlgorithmParameterSpec)</code>. That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls to <code>update</code> and <code>doFinal</code>. (In order to reuse this <code>Mac</code> object with a different key, it must be reinitialized via a call to <code>init(Key)</code> or <code>init(Key, AlgorithmParameterSpec)</code>. <p>The MAC result is stored in <code>output</code>, starting at <code>outOffset</code> inclusive. @param output the buffer where the MAC result is stored @param outOffset the offset in <code>output</code> where the MAC is stored @exception ShortBufferException if the given output buffer is too small to hold the result @exception IllegalStateException if this <code>Mac</code> has not been initialized.
[ "Finishes", "the", "MAC", "operation", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Mac.java#L649-L664
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.findNumberOption
public static int findNumberOption(String[] args, String option) { """ Scan the arguments to find an option that specifies a number. """ int rc = 0; for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) { if (args.length > i+1) { rc = Integer.parseInt(args[i+1]); } } } return rc; }
java
public static int findNumberOption(String[] args, String option) { int rc = 0; for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) { if (args.length > i+1) { rc = Integer.parseInt(args[i+1]); } } } return rc; }
[ "public", "static", "int", "findNumberOption", "(", "String", "[", "]", "args", ",", "String", "option", ")", "{", "int", "rc", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "++", "i", ")", "{", "if", "(", "args", "[", "i", "]", ".", "equals", "(", "option", ")", ")", "{", "if", "(", "args", ".", "length", ">", "i", "+", "1", ")", "{", "rc", "=", "Integer", ".", "parseInt", "(", "args", "[", "i", "+", "1", "]", ")", ";", "}", "}", "}", "return", "rc", ";", "}" ]
Scan the arguments to find an option that specifies a number.
[ "Scan", "the", "arguments", "to", "find", "an", "option", "that", "specifies", "a", "number", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L761-L771
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.generatePrivateKey
public static PrivateKey generatePrivateKey(KeyStore keyStore, String alias, char[] password) { """ 生成私钥,仅用于非对称加密 @param keyStore {@link KeyStore} @param alias 别名 @param password 密码 @return 私钥 {@link PrivateKey} """ try { return (PrivateKey) keyStore.getKey(alias, password); } catch (Exception e) { throw new CryptoException(e); } }
java
public static PrivateKey generatePrivateKey(KeyStore keyStore, String alias, char[] password) { try { return (PrivateKey) keyStore.getKey(alias, password); } catch (Exception e) { throw new CryptoException(e); } }
[ "public", "static", "PrivateKey", "generatePrivateKey", "(", "KeyStore", "keyStore", ",", "String", "alias", ",", "char", "[", "]", "password", ")", "{", "try", "{", "return", "(", "PrivateKey", ")", "keyStore", ".", "getKey", "(", "alias", ",", "password", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "CryptoException", "(", "e", ")", ";", "}", "}" ]
生成私钥,仅用于非对称加密 @param keyStore {@link KeyStore} @param alias 别名 @param password 密码 @return 私钥 {@link PrivateKey}
[ "生成私钥,仅用于非对称加密" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L255-L261
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.deleteLogEntries
public void deleteLogEntries(CmsRequestContext context, CmsLogFilter filter) throws CmsException { """ Deletes all log entries matching the given filter.<p> @param context the current user context @param filter the filter to use for deletion @throws CmsException if something goes wrong @see #getLogEntries(CmsRequestContext, CmsLogFilter) @see CmsObject#deleteLogEntries(CmsLogFilter) """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, CmsRole.WORKPLACE_MANAGER); m_driverManager.deleteLogEntries(dbc, filter); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DELETE_LOG_0), e); } finally { dbc.clear(); } }
java
public void deleteLogEntries(CmsRequestContext context, CmsLogFilter filter) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, CmsRole.WORKPLACE_MANAGER); m_driverManager.deleteLogEntries(dbc, filter); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DELETE_LOG_0), e); } finally { dbc.clear(); } }
[ "public", "void", "deleteLogEntries", "(", "CmsRequestContext", "context", ",", "CmsLogFilter", "filter", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try", "{", "checkRole", "(", "dbc", ",", "CmsRole", ".", "WORKPLACE_MANAGER", ")", ";", "m_driverManager", ".", "deleteLogEntries", "(", "dbc", ",", "filter", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_DELETE_LOG_0", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "}" ]
Deletes all log entries matching the given filter.<p> @param context the current user context @param filter the filter to use for deletion @throws CmsException if something goes wrong @see #getLogEntries(CmsRequestContext, CmsLogFilter) @see CmsObject#deleteLogEntries(CmsLogFilter)
[ "Deletes", "all", "log", "entries", "matching", "the", "given", "filter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1418-L1429
apache/incubator-heron
heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerMain.java
RuntimeManagerMain.manageTopology
public void manageTopology() throws TopologyRuntimeManagementException, TMasterException, PackingException { """ Manager a topology 1. Instantiate necessary resources 2. Valid whether the runtime management is legal 3. Complete the runtime management for a specific command """ String topologyName = Context.topologyName(config); // 1. Do prepare work // create an instance of state manager String statemgrClass = Context.stateManagerClass(config); IStateManager statemgr; try { statemgr = ReflectionUtils.newInstance(statemgrClass); } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { throw new TopologyRuntimeManagementException(String.format( "Failed to instantiate state manager class '%s'", statemgrClass), e); } // Put it in a try block so that we can always clean resources try { // initialize the statemgr statemgr.initialize(config); // TODO(mfu): timeout should read from config SchedulerStateManagerAdaptor adaptor = new SchedulerStateManagerAdaptor(statemgr, 5000); boolean hasExecutionData = validateRuntimeManage(adaptor, topologyName); // 2. Try to manage topology if valid // invoke the appropriate command to manage the topology LOG.log(Level.FINE, "Topology: {0} to be {1}ed", new Object[]{topologyName, command}); // build the runtime config Config runtime = Config.newBuilder() .put(Key.TOPOLOGY_NAME, Context.topologyName(config)) .put(Key.SCHEDULER_STATE_MANAGER_ADAPTOR, adaptor) .build(); // Create a ISchedulerClient basing on the config ISchedulerClient schedulerClient = getSchedulerClient(runtime); callRuntimeManagerRunner(runtime, schedulerClient, !hasExecutionData); } finally { // 3. Do post work basing on the result // Currently nothing to do here // 4. Close the resources SysUtils.closeIgnoringExceptions(statemgr); } }
java
public void manageTopology() throws TopologyRuntimeManagementException, TMasterException, PackingException { String topologyName = Context.topologyName(config); // 1. Do prepare work // create an instance of state manager String statemgrClass = Context.stateManagerClass(config); IStateManager statemgr; try { statemgr = ReflectionUtils.newInstance(statemgrClass); } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { throw new TopologyRuntimeManagementException(String.format( "Failed to instantiate state manager class '%s'", statemgrClass), e); } // Put it in a try block so that we can always clean resources try { // initialize the statemgr statemgr.initialize(config); // TODO(mfu): timeout should read from config SchedulerStateManagerAdaptor adaptor = new SchedulerStateManagerAdaptor(statemgr, 5000); boolean hasExecutionData = validateRuntimeManage(adaptor, topologyName); // 2. Try to manage topology if valid // invoke the appropriate command to manage the topology LOG.log(Level.FINE, "Topology: {0} to be {1}ed", new Object[]{topologyName, command}); // build the runtime config Config runtime = Config.newBuilder() .put(Key.TOPOLOGY_NAME, Context.topologyName(config)) .put(Key.SCHEDULER_STATE_MANAGER_ADAPTOR, adaptor) .build(); // Create a ISchedulerClient basing on the config ISchedulerClient schedulerClient = getSchedulerClient(runtime); callRuntimeManagerRunner(runtime, schedulerClient, !hasExecutionData); } finally { // 3. Do post work basing on the result // Currently nothing to do here // 4. Close the resources SysUtils.closeIgnoringExceptions(statemgr); } }
[ "public", "void", "manageTopology", "(", ")", "throws", "TopologyRuntimeManagementException", ",", "TMasterException", ",", "PackingException", "{", "String", "topologyName", "=", "Context", ".", "topologyName", "(", "config", ")", ";", "// 1. Do prepare work", "// create an instance of state manager", "String", "statemgrClass", "=", "Context", ".", "stateManagerClass", "(", "config", ")", ";", "IStateManager", "statemgr", ";", "try", "{", "statemgr", "=", "ReflectionUtils", ".", "newInstance", "(", "statemgrClass", ")", ";", "}", "catch", "(", "IllegalAccessException", "|", "InstantiationException", "|", "ClassNotFoundException", "e", ")", "{", "throw", "new", "TopologyRuntimeManagementException", "(", "String", ".", "format", "(", "\"Failed to instantiate state manager class '%s'\"", ",", "statemgrClass", ")", ",", "e", ")", ";", "}", "// Put it in a try block so that we can always clean resources", "try", "{", "// initialize the statemgr", "statemgr", ".", "initialize", "(", "config", ")", ";", "// TODO(mfu): timeout should read from config", "SchedulerStateManagerAdaptor", "adaptor", "=", "new", "SchedulerStateManagerAdaptor", "(", "statemgr", ",", "5000", ")", ";", "boolean", "hasExecutionData", "=", "validateRuntimeManage", "(", "adaptor", ",", "topologyName", ")", ";", "// 2. Try to manage topology if valid", "// invoke the appropriate command to manage the topology", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"Topology: {0} to be {1}ed\"", ",", "new", "Object", "[", "]", "{", "topologyName", ",", "command", "}", ")", ";", "// build the runtime config", "Config", "runtime", "=", "Config", ".", "newBuilder", "(", ")", ".", "put", "(", "Key", ".", "TOPOLOGY_NAME", ",", "Context", ".", "topologyName", "(", "config", ")", ")", ".", "put", "(", "Key", ".", "SCHEDULER_STATE_MANAGER_ADAPTOR", ",", "adaptor", ")", ".", "build", "(", ")", ";", "// Create a ISchedulerClient basing on the config", "ISchedulerClient", "schedulerClient", "=", "getSchedulerClient", "(", "runtime", ")", ";", "callRuntimeManagerRunner", "(", "runtime", ",", "schedulerClient", ",", "!", "hasExecutionData", ")", ";", "}", "finally", "{", "// 3. Do post work basing on the result", "// Currently nothing to do here", "// 4. Close the resources", "SysUtils", ".", "closeIgnoringExceptions", "(", "statemgr", ")", ";", "}", "}" ]
Manager a topology 1. Instantiate necessary resources 2. Valid whether the runtime management is legal 3. Complete the runtime management for a specific command
[ "Manager", "a", "topology", "1", ".", "Instantiate", "necessary", "resources", "2", ".", "Valid", "whether", "the", "runtime", "management", "is", "legal", "3", ".", "Complete", "the", "runtime", "management", "for", "a", "specific", "command" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerMain.java#L373-L419
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/report/ReportThrowablePanel.java
ReportThrowablePanel.newDescription
protected LabeledTextAreaPanel<String, ReportThrowableModelBean> newDescription(final String id, final IModel<ReportThrowableModelBean> model) { """ Factory method for create the new {@link LabeledTextAreaPanel}. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link LabeledTextAreaPanel}. @param id the id @param model the model @return the new {@link LabeledTextAreaPanel} """ final IModel<String> labelModel = ResourceModelFactory.newResourceModel("description.label", this, "Please provide here any useful information"); final IModel<String> placeholderModel = ResourceModelFactory.newResourceModel( "global.enter.your.description.label", this, "Enter here any useful information"); final LabeledTextAreaPanel<String, ReportThrowableModelBean> description = new LabeledTextAreaPanel<String, ReportThrowableModelBean>( id, model, labelModel) { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ @Override protected TextArea<String> newTextArea(final String id, final IModel<ReportThrowableModelBean> model) { final TextArea<String> textArea = super.newTextArea(id, model); if (placeholderModel != null) { textArea.add(new AttributeAppender("placeholder", placeholderModel)); } return super.newTextArea(id, model); } }; return description; }
java
protected LabeledTextAreaPanel<String, ReportThrowableModelBean> newDescription(final String id, final IModel<ReportThrowableModelBean> model) { final IModel<String> labelModel = ResourceModelFactory.newResourceModel("description.label", this, "Please provide here any useful information"); final IModel<String> placeholderModel = ResourceModelFactory.newResourceModel( "global.enter.your.description.label", this, "Enter here any useful information"); final LabeledTextAreaPanel<String, ReportThrowableModelBean> description = new LabeledTextAreaPanel<String, ReportThrowableModelBean>( id, model, labelModel) { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ @Override protected TextArea<String> newTextArea(final String id, final IModel<ReportThrowableModelBean> model) { final TextArea<String> textArea = super.newTextArea(id, model); if (placeholderModel != null) { textArea.add(new AttributeAppender("placeholder", placeholderModel)); } return super.newTextArea(id, model); } }; return description; }
[ "protected", "LabeledTextAreaPanel", "<", "String", ",", "ReportThrowableModelBean", ">", "newDescription", "(", "final", "String", "id", ",", "final", "IModel", "<", "ReportThrowableModelBean", ">", "model", ")", "{", "final", "IModel", "<", "String", ">", "labelModel", "=", "ResourceModelFactory", ".", "newResourceModel", "(", "\"description.label\"", ",", "this", ",", "\"Please provide here any useful information\"", ")", ";", "final", "IModel", "<", "String", ">", "placeholderModel", "=", "ResourceModelFactory", ".", "newResourceModel", "(", "\"global.enter.your.description.label\"", ",", "this", ",", "\"Enter here any useful information\"", ")", ";", "final", "LabeledTextAreaPanel", "<", "String", ",", "ReportThrowableModelBean", ">", "description", "=", "new", "LabeledTextAreaPanel", "<", "String", ",", "ReportThrowableModelBean", ">", "(", "id", ",", "model", ",", "labelModel", ")", "{", "/** The Constant serialVersionUID. */", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "/**\n\t\t\t * {@inheritDoc}\n\t\t\t */", "@", "Override", "protected", "TextArea", "<", "String", ">", "newTextArea", "(", "final", "String", "id", ",", "final", "IModel", "<", "ReportThrowableModelBean", ">", "model", ")", "{", "final", "TextArea", "<", "String", ">", "textArea", "=", "super", ".", "newTextArea", "(", "id", ",", "model", ")", ";", "if", "(", "placeholderModel", "!=", "null", ")", "{", "textArea", ".", "add", "(", "new", "AttributeAppender", "(", "\"placeholder\"", ",", "placeholderModel", ")", ")", ";", "}", "return", "super", ".", "newTextArea", "(", "id", ",", "model", ")", ";", "}", "}", ";", "return", "description", ";", "}" ]
Factory method for create the new {@link LabeledTextAreaPanel}. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link LabeledTextAreaPanel}. @param id the id @param model the model @return the new {@link LabeledTextAreaPanel}
[ "Factory", "method", "for", "create", "the", "new", "{", "@link", "LabeledTextAreaPanel", "}", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "version", "of", "a", "new", "{", "@link", "LabeledTextAreaPanel", "}", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/report/ReportThrowablePanel.java#L104-L134
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ScriptVars.java
ScriptVars.setGlobalVar
public static void setGlobalVar(String key, String value) { """ Sets or removes a global variable. <p> The variable is removed when the {@code value} is {@code null}. @param key the key of the variable. @param value the value of the variable. @throws IllegalArgumentException if one of the following conditions is met: <ul> <li>The {@code key} is {@code null} or its length is higher than the maximum allowed ({@value #MAX_KEY_SIZE});</li> <li>The {@code value}'s length is higher than the maximum allowed ({@value #MAX_VALUE_SIZE});</li> <li>The number of global variables is higher than the maximum allowed ({@value #MAX_GLOBAL_VARS});</li> </ul> """ validateKey(key); if (value == null) { globalVars.remove(key); } else { validateValueLength(value); if (globalVars.size() > MAX_GLOBAL_VARS) { throw new IllegalArgumentException("Maximum number of global variables reached: " + MAX_GLOBAL_VARS); } globalVars.put(key, value); } }
java
public static void setGlobalVar(String key, String value) { validateKey(key); if (value == null) { globalVars.remove(key); } else { validateValueLength(value); if (globalVars.size() > MAX_GLOBAL_VARS) { throw new IllegalArgumentException("Maximum number of global variables reached: " + MAX_GLOBAL_VARS); } globalVars.put(key, value); } }
[ "public", "static", "void", "setGlobalVar", "(", "String", "key", ",", "String", "value", ")", "{", "validateKey", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "globalVars", ".", "remove", "(", "key", ")", ";", "}", "else", "{", "validateValueLength", "(", "value", ")", ";", "if", "(", "globalVars", ".", "size", "(", ")", ">", "MAX_GLOBAL_VARS", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Maximum number of global variables reached: \"", "+", "MAX_GLOBAL_VARS", ")", ";", "}", "globalVars", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}" ]
Sets or removes a global variable. <p> The variable is removed when the {@code value} is {@code null}. @param key the key of the variable. @param value the value of the variable. @throws IllegalArgumentException if one of the following conditions is met: <ul> <li>The {@code key} is {@code null} or its length is higher than the maximum allowed ({@value #MAX_KEY_SIZE});</li> <li>The {@code value}'s length is higher than the maximum allowed ({@value #MAX_VALUE_SIZE});</li> <li>The number of global variables is higher than the maximum allowed ({@value #MAX_GLOBAL_VARS});</li> </ul>
[ "Sets", "or", "removes", "a", "global", "variable", ".", "<p", ">", "The", "variable", "is", "removed", "when", "the", "{", "@code", "value", "}", "is", "{", "@code", "null", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ScriptVars.java#L79-L91
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.swapCase
@GwtIncompatible("incompatible method") public static String swapCase(final String str) { """ <p>Swaps the case of a String changing upper and title case to lower case, and lower case to upper case.</p> <ul> <li>Upper case character converts to Lower case</li> <li>Title case character converts to Lower case</li> <li>Lower case character converts to Upper case</li> </ul> <p>For a word based algorithm, see {@link org.apache.commons.lang3.text.WordUtils#swapCase(String)}. A {@code null} input String returns {@code null}.</p> <pre> StringUtils.swapCase(null) = null StringUtils.swapCase("") = "" StringUtils.swapCase("The dog has a BONE") = "tHE DOG HAS A bone" </pre> <p>NOTE: This method changed in Lang version 2.0. It no longer performs a word based algorithm. If you only use ASCII, you will notice no change. That functionality is available in org.apache.commons.lang3.text.WordUtils.</p> @param str the String to swap case, may be null @return the changed String, {@code null} if null String input """ if (StringUtils.isEmpty(str)) { return str; } final int strLen = str.length(); final int newCodePoints[] = new int[strLen]; // cannot be longer than the char array int outOffset = 0; for (int i = 0; i < strLen; ) { final int oldCodepoint = str.codePointAt(i); final int newCodePoint; if (Character.isUpperCase(oldCodepoint)) { newCodePoint = Character.toLowerCase(oldCodepoint); } else if (Character.isTitleCase(oldCodepoint)) { newCodePoint = Character.toLowerCase(oldCodepoint); } else if (Character.isLowerCase(oldCodepoint)) { newCodePoint = Character.toUpperCase(oldCodepoint); } else { newCodePoint = oldCodepoint; } newCodePoints[outOffset++] = newCodePoint; i += Character.charCount(newCodePoint); } return new String(newCodePoints, 0, outOffset); }
java
@GwtIncompatible("incompatible method") public static String swapCase(final String str) { if (StringUtils.isEmpty(str)) { return str; } final int strLen = str.length(); final int newCodePoints[] = new int[strLen]; // cannot be longer than the char array int outOffset = 0; for (int i = 0; i < strLen; ) { final int oldCodepoint = str.codePointAt(i); final int newCodePoint; if (Character.isUpperCase(oldCodepoint)) { newCodePoint = Character.toLowerCase(oldCodepoint); } else if (Character.isTitleCase(oldCodepoint)) { newCodePoint = Character.toLowerCase(oldCodepoint); } else if (Character.isLowerCase(oldCodepoint)) { newCodePoint = Character.toUpperCase(oldCodepoint); } else { newCodePoint = oldCodepoint; } newCodePoints[outOffset++] = newCodePoint; i += Character.charCount(newCodePoint); } return new String(newCodePoints, 0, outOffset); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "String", "swapCase", "(", "final", "String", "str", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "str", ")", ")", "{", "return", "str", ";", "}", "final", "int", "strLen", "=", "str", ".", "length", "(", ")", ";", "final", "int", "newCodePoints", "[", "]", "=", "new", "int", "[", "strLen", "]", ";", "// cannot be longer than the char array", "int", "outOffset", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strLen", ";", ")", "{", "final", "int", "oldCodepoint", "=", "str", ".", "codePointAt", "(", "i", ")", ";", "final", "int", "newCodePoint", ";", "if", "(", "Character", ".", "isUpperCase", "(", "oldCodepoint", ")", ")", "{", "newCodePoint", "=", "Character", ".", "toLowerCase", "(", "oldCodepoint", ")", ";", "}", "else", "if", "(", "Character", ".", "isTitleCase", "(", "oldCodepoint", ")", ")", "{", "newCodePoint", "=", "Character", ".", "toLowerCase", "(", "oldCodepoint", ")", ";", "}", "else", "if", "(", "Character", ".", "isLowerCase", "(", "oldCodepoint", ")", ")", "{", "newCodePoint", "=", "Character", ".", "toUpperCase", "(", "oldCodepoint", ")", ";", "}", "else", "{", "newCodePoint", "=", "oldCodepoint", ";", "}", "newCodePoints", "[", "outOffset", "++", "]", "=", "newCodePoint", ";", "i", "+=", "Character", ".", "charCount", "(", "newCodePoint", ")", ";", "}", "return", "new", "String", "(", "newCodePoints", ",", "0", ",", "outOffset", ")", ";", "}" ]
<p>Swaps the case of a String changing upper and title case to lower case, and lower case to upper case.</p> <ul> <li>Upper case character converts to Lower case</li> <li>Title case character converts to Lower case</li> <li>Lower case character converts to Upper case</li> </ul> <p>For a word based algorithm, see {@link org.apache.commons.lang3.text.WordUtils#swapCase(String)}. A {@code null} input String returns {@code null}.</p> <pre> StringUtils.swapCase(null) = null StringUtils.swapCase("") = "" StringUtils.swapCase("The dog has a BONE") = "tHE DOG HAS A bone" </pre> <p>NOTE: This method changed in Lang version 2.0. It no longer performs a word based algorithm. If you only use ASCII, you will notice no change. That functionality is available in org.apache.commons.lang3.text.WordUtils.</p> @param str the String to swap case, may be null @return the changed String, {@code null} if null String input
[ "<p", ">", "Swaps", "the", "case", "of", "a", "String", "changing", "upper", "and", "title", "case", "to", "lower", "case", "and", "lower", "case", "to", "upper", "case", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L6815-L6840
heinrichreimer/material-drawer
library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerProfile.java
DrawerProfile.setAvatar
public DrawerProfile setAvatar(Context context, Bitmap avatar) { """ Sets an avatar image to the drawer profile @param avatar Avatar image to set """ mAvatar = new BitmapDrawable(context.getResources(), avatar); notifyDataChanged(); return this; }
java
public DrawerProfile setAvatar(Context context, Bitmap avatar) { mAvatar = new BitmapDrawable(context.getResources(), avatar); notifyDataChanged(); return this; }
[ "public", "DrawerProfile", "setAvatar", "(", "Context", "context", ",", "Bitmap", "avatar", ")", "{", "mAvatar", "=", "new", "BitmapDrawable", "(", "context", ".", "getResources", "(", ")", ",", "avatar", ")", ";", "notifyDataChanged", "(", ")", ";", "return", "this", ";", "}" ]
Sets an avatar image to the drawer profile @param avatar Avatar image to set
[ "Sets", "an", "avatar", "image", "to", "the", "drawer", "profile" ]
train
https://github.com/heinrichreimer/material-drawer/blob/7c2406812d73f710ef8bb73d4a0f4bbef3b275ce/library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerProfile.java#L126-L130
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTabRenderer.java
WTabRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WTab. @param component the WTab to paint. @param renderContext the RenderContext to paint to. """ WTab tab = (WTab) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:tab"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("open", tab.isOpen(), "true"); xml.appendOptionalAttribute("disabled", tab.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", tab.isHidden(), "true"); xml.appendOptionalAttribute("toolTip", tab.getToolTip()); switch (tab.getMode()) { case CLIENT: xml.appendAttribute("mode", "client"); break; case LAZY: xml.appendAttribute("mode", "lazy"); break; case EAGER: xml.appendAttribute("mode", "eager"); break; case DYNAMIC: xml.appendAttribute("mode", "dynamic"); break; case SERVER: xml.appendAttribute("mode", "server"); break; default: throw new SystemException("Unknown tab mode: " + tab.getMode()); } if (tab.getAccessKey() != 0) { xml.appendAttribute("accessKey", String.valueOf(Character. toUpperCase(tab.getAccessKey()))); } xml.appendClose(); // Paint label tab.getTabLabel().paint(renderContext); // Paint content WComponent content = tab.getContent(); xml.appendTagOpen("ui:tabcontent"); xml.appendAttribute("id", tab.getId() + "-content"); xml.appendClose(); // Render content if not EAGER Mode or is EAGER and is the current AJAX trigger if (content != null && (TabMode.EAGER != tab.getMode() || AjaxHelper.isCurrentAjaxTrigger( tab))) { // Visibility of content set in prepare paint content.paint(renderContext); } xml.appendEndTag("ui:tabcontent"); xml.appendEndTag("ui:tab"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WTab tab = (WTab) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:tab"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("open", tab.isOpen(), "true"); xml.appendOptionalAttribute("disabled", tab.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", tab.isHidden(), "true"); xml.appendOptionalAttribute("toolTip", tab.getToolTip()); switch (tab.getMode()) { case CLIENT: xml.appendAttribute("mode", "client"); break; case LAZY: xml.appendAttribute("mode", "lazy"); break; case EAGER: xml.appendAttribute("mode", "eager"); break; case DYNAMIC: xml.appendAttribute("mode", "dynamic"); break; case SERVER: xml.appendAttribute("mode", "server"); break; default: throw new SystemException("Unknown tab mode: " + tab.getMode()); } if (tab.getAccessKey() != 0) { xml.appendAttribute("accessKey", String.valueOf(Character. toUpperCase(tab.getAccessKey()))); } xml.appendClose(); // Paint label tab.getTabLabel().paint(renderContext); // Paint content WComponent content = tab.getContent(); xml.appendTagOpen("ui:tabcontent"); xml.appendAttribute("id", tab.getId() + "-content"); xml.appendClose(); // Render content if not EAGER Mode or is EAGER and is the current AJAX trigger if (content != null && (TabMode.EAGER != tab.getMode() || AjaxHelper.isCurrentAjaxTrigger( tab))) { // Visibility of content set in prepare paint content.paint(renderContext); } xml.appendEndTag("ui:tabcontent"); xml.appendEndTag("ui:tab"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WTab", "tab", "=", "(", "WTab", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:tab\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"open\"", ",", "tab", ".", "isOpen", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"disabled\"", ",", "tab", ".", "isDisabled", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hidden\"", ",", "tab", ".", "isHidden", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"toolTip\"", ",", "tab", ".", "getToolTip", "(", ")", ")", ";", "switch", "(", "tab", ".", "getMode", "(", ")", ")", "{", "case", "CLIENT", ":", "xml", ".", "appendAttribute", "(", "\"mode\"", ",", "\"client\"", ")", ";", "break", ";", "case", "LAZY", ":", "xml", ".", "appendAttribute", "(", "\"mode\"", ",", "\"lazy\"", ")", ";", "break", ";", "case", "EAGER", ":", "xml", ".", "appendAttribute", "(", "\"mode\"", ",", "\"eager\"", ")", ";", "break", ";", "case", "DYNAMIC", ":", "xml", ".", "appendAttribute", "(", "\"mode\"", ",", "\"dynamic\"", ")", ";", "break", ";", "case", "SERVER", ":", "xml", ".", "appendAttribute", "(", "\"mode\"", ",", "\"server\"", ")", ";", "break", ";", "default", ":", "throw", "new", "SystemException", "(", "\"Unknown tab mode: \"", "+", "tab", ".", "getMode", "(", ")", ")", ";", "}", "if", "(", "tab", ".", "getAccessKey", "(", ")", "!=", "0", ")", "{", "xml", ".", "appendAttribute", "(", "\"accessKey\"", ",", "String", ".", "valueOf", "(", "Character", ".", "toUpperCase", "(", "tab", ".", "getAccessKey", "(", ")", ")", ")", ")", ";", "}", "xml", ".", "appendClose", "(", ")", ";", "// Paint label", "tab", ".", "getTabLabel", "(", ")", ".", "paint", "(", "renderContext", ")", ";", "// Paint content", "WComponent", "content", "=", "tab", ".", "getContent", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:tabcontent\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "tab", ".", "getId", "(", ")", "+", "\"-content\"", ")", ";", "xml", ".", "appendClose", "(", ")", ";", "// Render content if not EAGER Mode or is EAGER and is the current AJAX trigger", "if", "(", "content", "!=", "null", "&&", "(", "TabMode", ".", "EAGER", "!=", "tab", ".", "getMode", "(", ")", "||", "AjaxHelper", ".", "isCurrentAjaxTrigger", "(", "tab", ")", ")", ")", "{", "// Visibility of content set in prepare paint", "content", ".", "paint", "(", "renderContext", ")", ";", "}", "xml", ".", "appendEndTag", "(", "\"ui:tabcontent\"", ")", ";", "xml", ".", "appendEndTag", "(", "\"ui:tab\"", ")", ";", "}" ]
Paints the given WTab. @param component the WTab to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WTab", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTabRenderer.java#L26-L87
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java
FileUtils.fileRename
public static void fileRename(final File file, final String newPath, final Class clazz) { """ Rename a file. Uses Java's nio library to use a lock. @param file File to rename @param newPath Path for new file name @param clazz Class associated with lock @throws com.dtolabs.rundeck.core.CoreException A CoreException is raised if any underlying I/O operation fails. """ File newDestFile = new File(newPath); File lockFile = new File(newDestFile.getAbsolutePath() + ".lock"); try { synchronized (clazz) { FileChannel channel = new RandomAccessFile(lockFile, "rw").getChannel(); FileLock lock = channel.lock(); try { try { // Create parent directory structure if necessary FileUtils.mkParentDirs(newDestFile); Files.move(file.toPath(), newDestFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException ioe) { throw new CoreException("Unable to move file " + file + " to destination " + newDestFile + ": " + ioe.getMessage()); } } finally { lock.release(); channel.close(); } } } catch (IOException e) { System.err.println("IOException: " + e.getMessage()); e.printStackTrace(System.err); throw new CoreException("Unable to rename file: " + e.getMessage(), e); } }
java
public static void fileRename(final File file, final String newPath, final Class clazz) { File newDestFile = new File(newPath); File lockFile = new File(newDestFile.getAbsolutePath() + ".lock"); try { synchronized (clazz) { FileChannel channel = new RandomAccessFile(lockFile, "rw").getChannel(); FileLock lock = channel.lock(); try { try { // Create parent directory structure if necessary FileUtils.mkParentDirs(newDestFile); Files.move(file.toPath(), newDestFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException ioe) { throw new CoreException("Unable to move file " + file + " to destination " + newDestFile + ": " + ioe.getMessage()); } } finally { lock.release(); channel.close(); } } } catch (IOException e) { System.err.println("IOException: " + e.getMessage()); e.printStackTrace(System.err); throw new CoreException("Unable to rename file: " + e.getMessage(), e); } }
[ "public", "static", "void", "fileRename", "(", "final", "File", "file", ",", "final", "String", "newPath", ",", "final", "Class", "clazz", ")", "{", "File", "newDestFile", "=", "new", "File", "(", "newPath", ")", ";", "File", "lockFile", "=", "new", "File", "(", "newDestFile", ".", "getAbsolutePath", "(", ")", "+", "\".lock\"", ")", ";", "try", "{", "synchronized", "(", "clazz", ")", "{", "FileChannel", "channel", "=", "new", "RandomAccessFile", "(", "lockFile", ",", "\"rw\"", ")", ".", "getChannel", "(", ")", ";", "FileLock", "lock", "=", "channel", ".", "lock", "(", ")", ";", "try", "{", "try", "{", "// Create parent directory structure if necessary", "FileUtils", ".", "mkParentDirs", "(", "newDestFile", ")", ";", "Files", ".", "move", "(", "file", ".", "toPath", "(", ")", ",", "newDestFile", ".", "toPath", "(", ")", ",", "StandardCopyOption", ".", "REPLACE_EXISTING", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "CoreException", "(", "\"Unable to move file \"", "+", "file", "+", "\" to destination \"", "+", "newDestFile", "+", "\": \"", "+", "ioe", ".", "getMessage", "(", ")", ")", ";", "}", "}", "finally", "{", "lock", ".", "release", "(", ")", ";", "channel", ".", "close", "(", ")", ";", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"IOException: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "e", ".", "printStackTrace", "(", "System", ".", "err", ")", ";", "throw", "new", "CoreException", "(", "\"Unable to rename file: \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Rename a file. Uses Java's nio library to use a lock. @param file File to rename @param newPath Path for new file name @param clazz Class associated with lock @throws com.dtolabs.rundeck.core.CoreException A CoreException is raised if any underlying I/O operation fails.
[ "Rename", "a", "file", ".", "Uses", "Java", "s", "nio", "library", "to", "use", "a", "lock", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java#L121-L148
OpenLiberty/open-liberty
dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLogUtils.java
FileLogUtils.compileLogFileRegex
static Pattern compileLogFileRegex(String baseName, String extension) { """ Compiles a pattern that can be used to match rolled over log file names. The first capturing group is the date/time string, and the second capturing group is the ID. @param baseName the log file basename (e.g., "messages") @param extension the log file extension (e.g., ".log") @param idOptional true if the rollover ID is optional @return """ StringBuilder builder = new StringBuilder(); // filename (dots escaped) builder.append(Pattern.quote(baseName)); // _yy.MM.dd_HH.mm.ss builder.append("(_\\d\\d\\.\\d\\d\\.\\d\\d_\\d\\d\\.\\d\\d\\.\\d\\d)"); // numeric identifier builder.append("(?:\\.(\\d+))"); // extension (dots escaped) builder.append(Pattern.quote(extension)); return Pattern.compile(builder.toString()); }
java
static Pattern compileLogFileRegex(String baseName, String extension) { StringBuilder builder = new StringBuilder(); // filename (dots escaped) builder.append(Pattern.quote(baseName)); // _yy.MM.dd_HH.mm.ss builder.append("(_\\d\\d\\.\\d\\d\\.\\d\\d_\\d\\d\\.\\d\\d\\.\\d\\d)"); // numeric identifier builder.append("(?:\\.(\\d+))"); // extension (dots escaped) builder.append(Pattern.quote(extension)); return Pattern.compile(builder.toString()); }
[ "static", "Pattern", "compileLogFileRegex", "(", "String", "baseName", ",", "String", "extension", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "// filename (dots escaped)", "builder", ".", "append", "(", "Pattern", ".", "quote", "(", "baseName", ")", ")", ";", "// _yy.MM.dd_HH.mm.ss", "builder", ".", "append", "(", "\"(_\\\\d\\\\d\\\\.\\\\d\\\\d\\\\.\\\\d\\\\d_\\\\d\\\\d\\\\.\\\\d\\\\d\\\\.\\\\d\\\\d)\"", ")", ";", "// numeric identifier", "builder", ".", "append", "(", "\"(?:\\\\.(\\\\d+))\"", ")", ";", "// extension (dots escaped)", "builder", ".", "append", "(", "Pattern", ".", "quote", "(", "extension", ")", ")", ";", "return", "Pattern", ".", "compile", "(", "builder", ".", "toString", "(", ")", ")", ";", "}" ]
Compiles a pattern that can be used to match rolled over log file names. The first capturing group is the date/time string, and the second capturing group is the ID. @param baseName the log file basename (e.g., "messages") @param extension the log file extension (e.g., ".log") @param idOptional true if the rollover ID is optional @return
[ "Compiles", "a", "pattern", "that", "can", "be", "used", "to", "match", "rolled", "over", "log", "file", "names", ".", "The", "first", "capturing", "group", "is", "the", "date", "/", "time", "string", "and", "the", "second", "capturing", "group", "is", "the", "ID", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLogUtils.java#L153-L169
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Widgets.java
Widgets.setStyleNames
public static <T extends Widget> T setStyleNames (T widget, String... styles) { """ Configures the supplied styles on the supplied widget. Existing styles will not be preserved unless you call this with no-non-null styles. Returns the widget for easy chaining. """ int idx = 0; for (String style : styles) { if (style == null) { continue; } if (idx++ == 0) { widget.setStyleName(style); } else { widget.addStyleName(style); } } return widget; }
java
public static <T extends Widget> T setStyleNames (T widget, String... styles) { int idx = 0; for (String style : styles) { if (style == null) { continue; } if (idx++ == 0) { widget.setStyleName(style); } else { widget.addStyleName(style); } } return widget; }
[ "public", "static", "<", "T", "extends", "Widget", ">", "T", "setStyleNames", "(", "T", "widget", ",", "String", "...", "styles", ")", "{", "int", "idx", "=", "0", ";", "for", "(", "String", "style", ":", "styles", ")", "{", "if", "(", "style", "==", "null", ")", "{", "continue", ";", "}", "if", "(", "idx", "++", "==", "0", ")", "{", "widget", ".", "setStyleName", "(", "style", ")", ";", "}", "else", "{", "widget", ".", "addStyleName", "(", "style", ")", ";", "}", "}", "return", "widget", ";", "}" ]
Configures the supplied styles on the supplied widget. Existing styles will not be preserved unless you call this with no-non-null styles. Returns the widget for easy chaining.
[ "Configures", "the", "supplied", "styles", "on", "the", "supplied", "widget", ".", "Existing", "styles", "will", "not", "be", "preserved", "unless", "you", "call", "this", "with", "no", "-", "non", "-", "null", "styles", ".", "Returns", "the", "widget", "for", "easy", "chaining", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L440-L454
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/TriggerDefinition.java
TriggerDefinition.toSchema
public void toSchema(Mutation mutation, String cfName, long timestamp) { """ Add specified trigger to the schema using given mutation. @param mutation The schema mutation @param cfName The name of the parent ColumnFamily @param timestamp The timestamp to use for the columns """ ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF); CFMetaData cfm = CFMetaData.SchemaTriggersCf; Composite prefix = cfm.comparator.make(cfName, name); CFRowAdder adder = new CFRowAdder(cf, prefix, timestamp); adder.addMapEntry(TRIGGER_OPTIONS, CLASS, classOption); }
java
public void toSchema(Mutation mutation, String cfName, long timestamp) { ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF); CFMetaData cfm = CFMetaData.SchemaTriggersCf; Composite prefix = cfm.comparator.make(cfName, name); CFRowAdder adder = new CFRowAdder(cf, prefix, timestamp); adder.addMapEntry(TRIGGER_OPTIONS, CLASS, classOption); }
[ "public", "void", "toSchema", "(", "Mutation", "mutation", ",", "String", "cfName", ",", "long", "timestamp", ")", "{", "ColumnFamily", "cf", "=", "mutation", ".", "addOrGet", "(", "SystemKeyspace", ".", "SCHEMA_TRIGGERS_CF", ")", ";", "CFMetaData", "cfm", "=", "CFMetaData", ".", "SchemaTriggersCf", ";", "Composite", "prefix", "=", "cfm", ".", "comparator", ".", "make", "(", "cfName", ",", "name", ")", ";", "CFRowAdder", "adder", "=", "new", "CFRowAdder", "(", "cf", ",", "prefix", ",", "timestamp", ")", ";", "adder", ".", "addMapEntry", "(", "TRIGGER_OPTIONS", ",", "CLASS", ",", "classOption", ")", ";", "}" ]
Add specified trigger to the schema using given mutation. @param mutation The schema mutation @param cfName The name of the parent ColumnFamily @param timestamp The timestamp to use for the columns
[ "Add", "specified", "trigger", "to", "the", "schema", "using", "given", "mutation", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/TriggerDefinition.java#L81-L90
m-m-m/util
xml/src/main/java/net/sf/mmm/util/xml/base/DomUtilImpl.java
DomUtilImpl.isEqualName
private boolean isEqualName(Node node1, Node node2) { """ This method determines if the given nodes have the same {@link #getLocalName(Node) name} and {@link Node#getNamespaceURI() namespace}. @param node1 is the first node. @param node2 is the second node. @return {@code true} if both nodes have equal {@link #getLocalName(Node) name} and {@link Node#getNamespaceURI() namespace}. """ if (!Objects.equals(node1.getNamespaceURI(), node2.getNamespaceURI())) { return false; } if (!Objects.equals(getLocalName(node1), getLocalName(node2))) { return false; } return true; }
java
private boolean isEqualName(Node node1, Node node2) { if (!Objects.equals(node1.getNamespaceURI(), node2.getNamespaceURI())) { return false; } if (!Objects.equals(getLocalName(node1), getLocalName(node2))) { return false; } return true; }
[ "private", "boolean", "isEqualName", "(", "Node", "node1", ",", "Node", "node2", ")", "{", "if", "(", "!", "Objects", ".", "equals", "(", "node1", ".", "getNamespaceURI", "(", ")", ",", "node2", ".", "getNamespaceURI", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "Objects", ".", "equals", "(", "getLocalName", "(", "node1", ")", ",", "getLocalName", "(", "node2", ")", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
This method determines if the given nodes have the same {@link #getLocalName(Node) name} and {@link Node#getNamespaceURI() namespace}. @param node1 is the first node. @param node2 is the second node. @return {@code true} if both nodes have equal {@link #getLocalName(Node) name} and {@link Node#getNamespaceURI() namespace}.
[ "This", "method", "determines", "if", "the", "given", "nodes", "have", "the", "same", "{", "@link", "#getLocalName", "(", "Node", ")", "name", "}", "and", "{", "@link", "Node#getNamespaceURI", "()", "namespace", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/xml/src/main/java/net/sf/mmm/util/xml/base/DomUtilImpl.java#L373-L382