repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.setTextByReflection | public void setTextByReflection(Object obj, String text)
{
try {
java.lang.reflect.Method method = obj.getClass().getMethod("setText", String.class);
if (method != null)
method.invoke(obj, text);
} catch (Exception e) {
e.printStackTrace();
}
} | java | public void setTextByReflection(Object obj, String text)
{
try {
java.lang.reflect.Method method = obj.getClass().getMethod("setText", String.class);
if (method != null)
method.invoke(obj, text);
} catch (Exception e) {
e.printStackTrace();
}
} | [
"public",
"void",
"setTextByReflection",
"(",
"Object",
"obj",
",",
"String",
"text",
")",
"{",
"try",
"{",
"java",
".",
"lang",
".",
"reflect",
".",
"Method",
"method",
"=",
"obj",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"setText\"",
",",
... | Lame method, since awt, swing, and android components all have setText methods.
@param obj
@param text | [
"Lame",
"method",
"since",
"awt",
"swing",
"and",
"android",
"components",
"all",
"have",
"setText",
"methods",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L316-L326 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java | ExpressRouteCircuitConnectionsInner.createOrUpdate | public ExpressRouteCircuitConnectionInner createOrUpdate(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).toBlocking().last().body();
} | java | public ExpressRouteCircuitConnectionInner createOrUpdate(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).toBlocking().last().body();
} | [
"public",
"ExpressRouteCircuitConnectionInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"String",
"peeringName",
",",
"String",
"connectionName",
",",
"ExpressRouteCircuitConnectionInner",
"expressRouteCircuitConnectionParameters",
... | Creates or updates a Express Route Circuit Connection in the specified express route circuits.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param peeringName The name of the peering.
@param connectionName The name of the express route circuit connection.
@param expressRouteCircuitConnectionParameters Parameters supplied to the create or update express route circuit circuit connection operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRouteCircuitConnectionInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"Express",
"Route",
"Circuit",
"Connection",
"in",
"the",
"specified",
"express",
"route",
"circuits",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java#L370-L372 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java | PixelMath.boundImage | public static void boundImage( GrayS8 img , int min , int max ) {
ImplPixelMath.boundImage(img,min,max);
} | java | public static void boundImage( GrayS8 img , int min , int max ) {
ImplPixelMath.boundImage(img,min,max);
} | [
"public",
"static",
"void",
"boundImage",
"(",
"GrayS8",
"img",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"ImplPixelMath",
".",
"boundImage",
"(",
"img",
",",
"min",
",",
"max",
")",
";",
"}"
] | Bounds image pixels to be between these two values
@param img Image
@param min minimum value.
@param max maximum value. | [
"Bounds",
"image",
"pixels",
"to",
"be",
"between",
"these",
"two",
"values"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L4329-L4331 |
authorjapps/zerocode | core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java | BasicHttpClient.handleHttpSession | public void handleHttpSession(Response serverResponse, String headerKey) {
/** ---------------
* Session handled
* ----------------
*/
if ("Set-Cookie".equals(headerKey)) {
COOKIE_JSESSIONID_VALUE = serverResponse.getMetadata().get(headerKey);
}
} | java | public void handleHttpSession(Response serverResponse, String headerKey) {
/** ---------------
* Session handled
* ----------------
*/
if ("Set-Cookie".equals(headerKey)) {
COOKIE_JSESSIONID_VALUE = serverResponse.getMetadata().get(headerKey);
}
} | [
"public",
"void",
"handleHttpSession",
"(",
"Response",
"serverResponse",
",",
"String",
"headerKey",
")",
"{",
"/** ---------------\n * Session handled\n * ----------------\n */",
"if",
"(",
"\"Set-Cookie\"",
".",
"equals",
"(",
"headerKey",
")",
")",... | This method handles the http session to be maintained between the calls.
In case the session is not needed or to be handled differently, then this
method can be overridden to do nothing or to roll your own feature.
@param serverResponse
@param headerKey | [
"This",
"method",
"handles",
"the",
"http",
"session",
"to",
"be",
"maintained",
"between",
"the",
"calls",
".",
"In",
"case",
"the",
"session",
"is",
"not",
"needed",
"or",
"to",
"be",
"handled",
"differently",
"then",
"this",
"method",
"can",
"be",
"over... | train | https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java#L371-L379 |
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java | OtpInputStream.read_port | public OtpErlangPort read_port() throws OtpErlangDecodeException {
String node;
int id;
int creation;
int tag;
tag = read1skip_version();
if (tag != OtpExternal.portTag &&
tag != OtpExternal.newPortTag) {
throw new OtpErlangDecodeException(
"Wrong tag encountered, expected " + OtpExternal.portTag
+ " or " + OtpExternal.newPortTag
+ ", got " + tag);
}
node = read_atom();
id = read4BE();
if (tag == OtpExternal.portTag)
creation = read1();
else
creation = read4BE();
return new OtpErlangPort(tag, node, id, creation);
} | java | public OtpErlangPort read_port() throws OtpErlangDecodeException {
String node;
int id;
int creation;
int tag;
tag = read1skip_version();
if (tag != OtpExternal.portTag &&
tag != OtpExternal.newPortTag) {
throw new OtpErlangDecodeException(
"Wrong tag encountered, expected " + OtpExternal.portTag
+ " or " + OtpExternal.newPortTag
+ ", got " + tag);
}
node = read_atom();
id = read4BE();
if (tag == OtpExternal.portTag)
creation = read1();
else
creation = read4BE();
return new OtpErlangPort(tag, node, id, creation);
} | [
"public",
"OtpErlangPort",
"read_port",
"(",
")",
"throws",
"OtpErlangDecodeException",
"{",
"String",
"node",
";",
"int",
"id",
";",
"int",
"creation",
";",
"int",
"tag",
";",
"tag",
"=",
"read1skip_version",
"(",
")",
";",
"if",
"(",
"tag",
"!=",
"OtpExt... | Read an Erlang port from the stream.
@return the value of the port.
@exception OtpErlangDecodeException
if the next term in the stream is not an Erlang port. | [
"Read",
"an",
"Erlang",
"port",
"from",
"the",
"stream",
"."
] | train | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java#L984-L1008 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java | PropertiesUtil.getBooleanProperty | public boolean getBooleanProperty(final String name, final boolean defaultValue) {
final String prop = getStringProperty(name);
return prop == null ? defaultValue : "true".equalsIgnoreCase(prop);
} | java | public boolean getBooleanProperty(final String name, final boolean defaultValue) {
final String prop = getStringProperty(name);
return prop == null ? defaultValue : "true".equalsIgnoreCase(prop);
} | [
"public",
"boolean",
"getBooleanProperty",
"(",
"final",
"String",
"name",
",",
"final",
"boolean",
"defaultValue",
")",
"{",
"final",
"String",
"prop",
"=",
"getStringProperty",
"(",
"name",
")",
";",
"return",
"prop",
"==",
"null",
"?",
"defaultValue",
":",
... | Gets the named property as a boolean value.
@param name the name of the property to look up
@param defaultValue the default value to use if the property is undefined
@return the boolean value of the property or {@code defaultValue} if undefined. | [
"Gets",
"the",
"named",
"property",
"as",
"a",
"boolean",
"value",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java#L132-L135 |
apache/groovy | src/main/java/org/codehaus/groovy/syntax/Token.java | Token.newSymbol | public static Token newSymbol(String type, int startLine, int startColumn) {
return new Token(Types.lookupSymbol(type), type, startLine, startColumn);
} | java | public static Token newSymbol(String type, int startLine, int startColumn) {
return new Token(Types.lookupSymbol(type), type, startLine, startColumn);
} | [
"public",
"static",
"Token",
"newSymbol",
"(",
"String",
"type",
",",
"int",
"startLine",
",",
"int",
"startColumn",
")",
"{",
"return",
"new",
"Token",
"(",
"Types",
".",
"lookupSymbol",
"(",
"type",
")",
",",
"type",
",",
"startLine",
",",
"startColumn",... | Creates a token that represents a symbol, using a library for the type. | [
"Creates",
"a",
"token",
"that",
"represents",
"a",
"symbol",
"using",
"a",
"library",
"for",
"the",
"type",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/syntax/Token.java#L268-L270 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java | BooleanExpressionParser.parseDigits | private static String parseDigits(final String expression, final int startIndex) {
final StringBuilder digitBuffer = new StringBuilder();
char currentCharacter = expression.charAt(startIndex);
int subExpressionIndex = startIndex;
do {
digitBuffer.append(currentCharacter);
++subExpressionIndex;
if (subExpressionIndex < expression.length()) {
currentCharacter = expression.charAt(subExpressionIndex);
}
} while (subExpressionIndex < expression.length() && Character.isDigit(currentCharacter));
return digitBuffer.toString();
} | java | private static String parseDigits(final String expression, final int startIndex) {
final StringBuilder digitBuffer = new StringBuilder();
char currentCharacter = expression.charAt(startIndex);
int subExpressionIndex = startIndex;
do {
digitBuffer.append(currentCharacter);
++subExpressionIndex;
if (subExpressionIndex < expression.length()) {
currentCharacter = expression.charAt(subExpressionIndex);
}
} while (subExpressionIndex < expression.length() && Character.isDigit(currentCharacter));
return digitBuffer.toString();
} | [
"private",
"static",
"String",
"parseDigits",
"(",
"final",
"String",
"expression",
",",
"final",
"int",
"startIndex",
")",
"{",
"final",
"StringBuilder",
"digitBuffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"currentCharacter",
"=",
"expression",
"... | This method reads digit characters from a given string, starting at a given index.
It will read till the end of the string or up until it encounters a non-digit character
@param expression The string to parse
@param startIndex The start index from where to parse
@return The parsed substring | [
"This",
"method",
"reads",
"digit",
"characters",
"from",
"a",
"given",
"string",
"starting",
"at",
"a",
"given",
"index",
".",
"It",
"will",
"read",
"till",
"the",
"end",
"of",
"the",
"string",
"or",
"up",
"until",
"it",
"encounters",
"a",
"non",
"-",
... | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L178-L194 |
line/armeria | jetty/src/main/java/com/linecorp/armeria/server/jetty/JettyService.java | JettyService.forServer | public static JettyService forServer(String hostname, Server jettyServer) {
requireNonNull(hostname, "hostname");
requireNonNull(jettyServer, "jettyServer");
return new JettyService(hostname, blockingTaskExecutor -> jettyServer);
} | java | public static JettyService forServer(String hostname, Server jettyServer) {
requireNonNull(hostname, "hostname");
requireNonNull(jettyServer, "jettyServer");
return new JettyService(hostname, blockingTaskExecutor -> jettyServer);
} | [
"public",
"static",
"JettyService",
"forServer",
"(",
"String",
"hostname",
",",
"Server",
"jettyServer",
")",
"{",
"requireNonNull",
"(",
"hostname",
",",
"\"hostname\"",
")",
";",
"requireNonNull",
"(",
"jettyServer",
",",
"\"jettyServer\"",
")",
";",
"return",
... | Creates a new {@link JettyService} from an existing Jetty {@link Server}.
@param hostname the default hostname
@param jettyServer the Jetty {@link Server} | [
"Creates",
"a",
"new",
"{",
"@link",
"JettyService",
"}",
"from",
"an",
"existing",
"Jetty",
"{",
"@link",
"Server",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/jetty/src/main/java/com/linecorp/armeria/server/jetty/JettyService.java#L94-L98 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.listWebAppsAsync | public Observable<Page<SiteInner>> listWebAppsAsync(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) {
return listWebAppsWithServiceResponseAsync(resourceGroupName, name, skipToken, filter, top)
.map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() {
@Override
public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<SiteInner>> listWebAppsAsync(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) {
return listWebAppsWithServiceResponseAsync(resourceGroupName, name, skipToken, filter, top)
.map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() {
@Override
public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"SiteInner",
">",
">",
"listWebAppsAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"skipToken",
",",
"final",
"String",
"filter",
",",
"final",
"String",
"to... | Get all apps associated with an App Service plan.
Get all apps associated with an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param skipToken Skip to a web app in the list of webapps associated with app service plan. If specified, the resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list contains web apps from the start of the list
@param filter Supported filter: $filter=state eq running. Returns only web apps that are currently running
@param top List page size. If specified, results are paged.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SiteInner> object | [
"Get",
"all",
"apps",
"associated",
"with",
"an",
"App",
"Service",
"plan",
".",
"Get",
"all",
"apps",
"associated",
"with",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L2546-L2554 |
auth0/Auth0.Android | auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java | AuthenticationAPIClient.delegationWithIdToken | @SuppressWarnings("WeakerAccess")
public DelegationRequest<Delegation> delegationWithIdToken(@NonNull String idToken) {
ParameterizableRequest<Delegation, AuthenticationException> request = delegation(Delegation.class)
.addParameter(ParameterBuilder.ID_TOKEN_KEY, idToken);
return new DelegationRequest<>(request)
.setApiType(DelegationRequest.DEFAULT_API_TYPE);
} | java | @SuppressWarnings("WeakerAccess")
public DelegationRequest<Delegation> delegationWithIdToken(@NonNull String idToken) {
ParameterizableRequest<Delegation, AuthenticationException> request = delegation(Delegation.class)
.addParameter(ParameterBuilder.ID_TOKEN_KEY, idToken);
return new DelegationRequest<>(request)
.setApiType(DelegationRequest.DEFAULT_API_TYPE);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"DelegationRequest",
"<",
"Delegation",
">",
"delegationWithIdToken",
"(",
"@",
"NonNull",
"String",
"idToken",
")",
"{",
"ParameterizableRequest",
"<",
"Delegation",
",",
"AuthenticationException",
">",
... | Performs a <a href="https://auth0.com/docs/api/authentication#delegation">delegation</a> request that will yield a new Auth0 'id_token'
Example usage:
<pre>
{@code
client.delegationWithIdToken("{id token}")
.start(new BaseCallback<Delegation>() {
{@literal}Override
public void onSuccess(Delegation payload) {}
{@literal}Override
public void onFailure(AuthenticationException error) {}
});
}
</pre>
@param idToken issued by Auth0 for the user. The token must not be expired.
@return a request to configure and start | [
"Performs",
"a",
"<a",
"href",
"=",
"https",
":",
"//",
"auth0",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"authentication#delegation",
">",
"delegation<",
"/",
"a",
">",
"request",
"that",
"will",
"yield",
"a",
"new",
"Auth0",
"id_token",
"Example",
"us... | train | https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java#L763-L770 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/json/JobResultDeserializer.java | JobResultDeserializer.assertNextToken | private static void assertNextToken(
final JsonParser p,
final JsonToken requiredJsonToken) throws IOException {
final JsonToken jsonToken = p.nextToken();
if (jsonToken != requiredJsonToken) {
throw new JsonMappingException(p, String.format("Expected token %s (was %s)", requiredJsonToken, jsonToken));
}
} | java | private static void assertNextToken(
final JsonParser p,
final JsonToken requiredJsonToken) throws IOException {
final JsonToken jsonToken = p.nextToken();
if (jsonToken != requiredJsonToken) {
throw new JsonMappingException(p, String.format("Expected token %s (was %s)", requiredJsonToken, jsonToken));
}
} | [
"private",
"static",
"void",
"assertNextToken",
"(",
"final",
"JsonParser",
"p",
",",
"final",
"JsonToken",
"requiredJsonToken",
")",
"throws",
"IOException",
"{",
"final",
"JsonToken",
"jsonToken",
"=",
"p",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"jsonTo... | Advances the token and asserts that it matches the required {@link JsonToken}. | [
"Advances",
"the",
"token",
"and",
"asserts",
"that",
"it",
"matches",
"the",
"required",
"{"
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/json/JobResultDeserializer.java#L160-L167 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java | SimpleOutputElement.createChild | protected SimpleOutputElement createChild(String prefix, String localName,
String uri)
{
/* At this point we can also discard attribute Map; it is assumed
* that when a child element has been opened, no more attributes
* can be output.
*/
mAttrSet = null;
return new SimpleOutputElement(this, prefix, localName, uri, mNsMapping);
} | java | protected SimpleOutputElement createChild(String prefix, String localName,
String uri)
{
/* At this point we can also discard attribute Map; it is assumed
* that when a child element has been opened, no more attributes
* can be output.
*/
mAttrSet = null;
return new SimpleOutputElement(this, prefix, localName, uri, mNsMapping);
} | [
"protected",
"SimpleOutputElement",
"createChild",
"(",
"String",
"prefix",
",",
"String",
"localName",
",",
"String",
"uri",
")",
"{",
"/* At this point we can also discard attribute Map; it is assumed\n * that when a child element has been opened, no more attributes\n *... | Full factory method, used for 'normal' namespace qualified output
methods. | [
"Full",
"factory",
"method",
"used",
"for",
"normal",
"namespace",
"qualified",
"output",
"methods",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java#L184-L193 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java | LogViewer.createOutputStream | private PrintStream createOutputStream() {
if (outputLogFilename != null) {
try {
FileOutputStream fout = new FileOutputStream(outputLogFilename, false);
BufferedOutputStream bos = new BufferedOutputStream(fout, 4096);
// We are using a PrintStream for output to match System.out
if (encoding != null) {
return new PrintStream(bos, false, encoding);
} else {
return new PrintStream(bos, false);
}
} catch (IOException e) {
throw new IllegalArgumentException(getLocalizedString("CWTRA0005E"));
}
}
// No output filename specified.
isSystemOut = true;
if (encoding != null) {
try {
// Encode output before directing it into System.out
return new PrintStream(System.out, false, encoding);
} catch (UnsupportedEncodingException e) {
// We already checked that encoding is supported
}
}
return System.out;
} | java | private PrintStream createOutputStream() {
if (outputLogFilename != null) {
try {
FileOutputStream fout = new FileOutputStream(outputLogFilename, false);
BufferedOutputStream bos = new BufferedOutputStream(fout, 4096);
// We are using a PrintStream for output to match System.out
if (encoding != null) {
return new PrintStream(bos, false, encoding);
} else {
return new PrintStream(bos, false);
}
} catch (IOException e) {
throw new IllegalArgumentException(getLocalizedString("CWTRA0005E"));
}
}
// No output filename specified.
isSystemOut = true;
if (encoding != null) {
try {
// Encode output before directing it into System.out
return new PrintStream(System.out, false, encoding);
} catch (UnsupportedEncodingException e) {
// We already checked that encoding is supported
}
}
return System.out;
} | [
"private",
"PrintStream",
"createOutputStream",
"(",
")",
"{",
"if",
"(",
"outputLogFilename",
"!=",
"null",
")",
"{",
"try",
"{",
"FileOutputStream",
"fout",
"=",
"new",
"FileOutputStream",
"(",
"outputLogFilename",
",",
"false",
")",
";",
"BufferedOutputStream",... | The createOutputSteam method.
<p>
Creates or sets up (in the case of the console) the output steam that LogViewer will use to write to.
@return PrintStream representing the output file or the System.out or console. | [
"The",
"createOutputSteam",
"method",
".",
"<p",
">",
"Creates",
"or",
"sets",
"up",
"(",
"in",
"the",
"case",
"of",
"the",
"console",
")",
"the",
"output",
"steam",
"that",
"LogViewer",
"will",
"use",
"to",
"write",
"to",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L1924-L1951 |
lucee/Lucee | core/src/main/java/lucee/runtime/ext/tag/TagImpl.java | TagImpl.required | public void required(String tagName, String actionName, String attributeName, Object attribute) throws ApplicationException {
if (attribute == null)
throw new ApplicationException("Attribute [" + attributeName + "] for tag [" + tagName + "] is required if attribute action has the value [" + actionName + "]");
} | java | public void required(String tagName, String actionName, String attributeName, Object attribute) throws ApplicationException {
if (attribute == null)
throw new ApplicationException("Attribute [" + attributeName + "] for tag [" + tagName + "] is required if attribute action has the value [" + actionName + "]");
} | [
"public",
"void",
"required",
"(",
"String",
"tagName",
",",
"String",
"actionName",
",",
"String",
"attributeName",
",",
"Object",
"attribute",
")",
"throws",
"ApplicationException",
"{",
"if",
"(",
"attribute",
"==",
"null",
")",
"throw",
"new",
"ApplicationEx... | check if value is not empty
@param tagName
@param attributeName
@param attribute
@throws ApplicationException | [
"check",
"if",
"value",
"is",
"not",
"empty"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ext/tag/TagImpl.java#L89-L93 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.updateSubscriptionPreview | public Subscription updateSubscriptionPreview(final String uuid, final SubscriptionUpdate subscriptionUpdate) {
return doPOST(Subscriptions.SUBSCRIPTIONS_RESOURCE
+ "/" + uuid + "/preview",
subscriptionUpdate,
Subscription.class);
} | java | public Subscription updateSubscriptionPreview(final String uuid, final SubscriptionUpdate subscriptionUpdate) {
return doPOST(Subscriptions.SUBSCRIPTIONS_RESOURCE
+ "/" + uuid + "/preview",
subscriptionUpdate,
Subscription.class);
} | [
"public",
"Subscription",
"updateSubscriptionPreview",
"(",
"final",
"String",
"uuid",
",",
"final",
"SubscriptionUpdate",
"subscriptionUpdate",
")",
"{",
"return",
"doPOST",
"(",
"Subscriptions",
".",
"SUBSCRIPTIONS_RESOURCE",
"+",
"\"/\"",
"+",
"uuid",
"+",
"\"/prev... | Preview an update to a particular {@link Subscription} by it's UUID
<p>
Returns information about a single subscription.
@param uuid UUID of the subscription to preview an update for
@return Subscription the updated subscription preview | [
"Preview",
"an",
"update",
"to",
"a",
"particular",
"{",
"@link",
"Subscription",
"}",
"by",
"it",
"s",
"UUID",
"<p",
">",
"Returns",
"information",
"about",
"a",
"single",
"subscription",
"."
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L603-L608 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/Conversions.java | Conversions.checkComponentType | private static Object checkComponentType(Object array, Class<?> expectedComponentType) {
Class<?> actualComponentType = array.getClass().getComponentType();
if (!expectedComponentType.isAssignableFrom(actualComponentType)) {
throw new ArrayStoreException(
String.format("The expected component type %s is not assignable from the actual type %s",
expectedComponentType.getCanonicalName(), actualComponentType.getCanonicalName()));
}
return array;
} | java | private static Object checkComponentType(Object array, Class<?> expectedComponentType) {
Class<?> actualComponentType = array.getClass().getComponentType();
if (!expectedComponentType.isAssignableFrom(actualComponentType)) {
throw new ArrayStoreException(
String.format("The expected component type %s is not assignable from the actual type %s",
expectedComponentType.getCanonicalName(), actualComponentType.getCanonicalName()));
}
return array;
} | [
"private",
"static",
"Object",
"checkComponentType",
"(",
"Object",
"array",
",",
"Class",
"<",
"?",
">",
"expectedComponentType",
")",
"{",
"Class",
"<",
"?",
">",
"actualComponentType",
"=",
"array",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
... | Checks the component type of the given array against the expected component type.
@param array
the array to be checked. May not be <code>null</code>.
@param expectedComponentType
the expected component type of the array. May not be <code>null</code>.
@return the unchanged array.
@throws ArrayStoreException
if the expected runtime {@code componentType} does not match the actual runtime component type. | [
"Checks",
"the",
"component",
"type",
"of",
"the",
"given",
"array",
"against",
"the",
"expected",
"component",
"type",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/Conversions.java#L226-L234 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.notNullNotEquals | public static <T> T notNullNotEquals (final T aValue, final String sName, @Nonnull final T aUnexpectedValue)
{
if (isEnabled ())
return notNullNotEquals (aValue, () -> sName, aUnexpectedValue);
return aValue;
} | java | public static <T> T notNullNotEquals (final T aValue, final String sName, @Nonnull final T aUnexpectedValue)
{
if (isEnabled ())
return notNullNotEquals (aValue, () -> sName, aUnexpectedValue);
return aValue;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"notNullNotEquals",
"(",
"final",
"T",
"aValue",
",",
"final",
"String",
"sName",
",",
"@",
"Nonnull",
"final",
"T",
"aUnexpectedValue",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"return",
"notNullNotEquals",
... | Check that the passed value is not <code>null</code> and not equal to the
provided value.
@param <T>
Type to be checked and returned
@param aValue
The value to check. May not be <code>null</code>.
@param sName
The name of the value (e.g. the parameter name)
@param aUnexpectedValue
The value that may not be equal to aValue. May not be
<code>null</code>.
@return The passed value. | [
"Check",
"that",
"the",
"passed",
"value",
"is",
"not",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"not",
"equal",
"to",
"the",
"provided",
"value",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L1316-L1321 |
Red5/red5-server-common | src/main/java/org/red5/server/util/ScopeUtils.java | ScopeUtils.getScopeService | public static Object getScopeService(IScope scope, Class<?> intf, Class<?> defaultClass) {
return getScopeService(scope, intf, defaultClass, true);
} | java | public static Object getScopeService(IScope scope, Class<?> intf, Class<?> defaultClass) {
return getScopeService(scope, intf, defaultClass, true);
} | [
"public",
"static",
"Object",
"getScopeService",
"(",
"IScope",
"scope",
",",
"Class",
"<",
"?",
">",
"intf",
",",
"Class",
"<",
"?",
">",
"defaultClass",
")",
"{",
"return",
"getScopeService",
"(",
"scope",
",",
"intf",
",",
"defaultClass",
",",
"true",
... | Returns scope service that implements a given interface.
@param scope
The scope service belongs to
@param intf
The interface the service must implement
@param defaultClass
Class that should be used to create a new service if no service was found.
@return Service object | [
"Returns",
"scope",
"service",
"that",
"implements",
"a",
"given",
"interface",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/util/ScopeUtils.java#L323-L325 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java | BpmnParse.parseProcess | public ProcessDefinitionEntity parseProcess(Element processElement) {
// reset all mappings that are related to one process definition
sequenceFlows = new HashMap<String, TransitionImpl>();
ProcessDefinitionEntity processDefinition = new ProcessDefinitionEntity();
/*
* Mapping object model - bpmn xml: processDefinition.id -> generated by
* processDefinition.key -> bpmn id (required) processDefinition.name ->
* bpmn name (optional)
*/
processDefinition.setKey(processElement.attribute("id"));
processDefinition.setName(processElement.attribute("name"));
processDefinition.setCategory(rootElement.attribute("targetNamespace"));
processDefinition.setProperty(PROPERTYNAME_DOCUMENTATION, parseDocumentation(processElement));
processDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
processDefinition.setDeploymentId(deployment.getId());
processDefinition.setProperty(PROPERTYNAME_JOB_PRIORITY, parsePriority(processElement, PROPERTYNAME_JOB_PRIORITY));
processDefinition.setProperty(PROPERTYNAME_TASK_PRIORITY, parsePriority(processElement, PROPERTYNAME_TASK_PRIORITY));
processDefinition.setVersionTag(processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "versionTag"));
try {
String historyTimeToLive = processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "historyTimeToLive",
Context.getProcessEngineConfiguration().getHistoryTimeToLive());
processDefinition.setHistoryTimeToLive(ParseUtil.parseHistoryTimeToLive(historyTimeToLive));
}
catch (Exception e) {
addError(new BpmnParseException(e.getMessage(), processElement, e));
}
boolean isStartableInTasklist = isStartable(processElement);
processDefinition.setStartableInTasklist(isStartableInTasklist);
LOG.parsingElement("process", processDefinition.getKey());
parseScope(processElement, processDefinition);
// Parse any laneSets defined for this process
parseLaneSets(processElement, processDefinition);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseProcess(processElement, processDefinition);
}
// now we have parsed anything we can validate some stuff
validateActivities(processDefinition.getActivities());
//unregister delegates
for (ActivityImpl activity : processDefinition.getActivities()) {
activity.setDelegateAsyncAfterUpdate(null);
activity.setDelegateAsyncBeforeUpdate(null);
}
return processDefinition;
} | java | public ProcessDefinitionEntity parseProcess(Element processElement) {
// reset all mappings that are related to one process definition
sequenceFlows = new HashMap<String, TransitionImpl>();
ProcessDefinitionEntity processDefinition = new ProcessDefinitionEntity();
/*
* Mapping object model - bpmn xml: processDefinition.id -> generated by
* processDefinition.key -> bpmn id (required) processDefinition.name ->
* bpmn name (optional)
*/
processDefinition.setKey(processElement.attribute("id"));
processDefinition.setName(processElement.attribute("name"));
processDefinition.setCategory(rootElement.attribute("targetNamespace"));
processDefinition.setProperty(PROPERTYNAME_DOCUMENTATION, parseDocumentation(processElement));
processDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
processDefinition.setDeploymentId(deployment.getId());
processDefinition.setProperty(PROPERTYNAME_JOB_PRIORITY, parsePriority(processElement, PROPERTYNAME_JOB_PRIORITY));
processDefinition.setProperty(PROPERTYNAME_TASK_PRIORITY, parsePriority(processElement, PROPERTYNAME_TASK_PRIORITY));
processDefinition.setVersionTag(processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "versionTag"));
try {
String historyTimeToLive = processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "historyTimeToLive",
Context.getProcessEngineConfiguration().getHistoryTimeToLive());
processDefinition.setHistoryTimeToLive(ParseUtil.parseHistoryTimeToLive(historyTimeToLive));
}
catch (Exception e) {
addError(new BpmnParseException(e.getMessage(), processElement, e));
}
boolean isStartableInTasklist = isStartable(processElement);
processDefinition.setStartableInTasklist(isStartableInTasklist);
LOG.parsingElement("process", processDefinition.getKey());
parseScope(processElement, processDefinition);
// Parse any laneSets defined for this process
parseLaneSets(processElement, processDefinition);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseProcess(processElement, processDefinition);
}
// now we have parsed anything we can validate some stuff
validateActivities(processDefinition.getActivities());
//unregister delegates
for (ActivityImpl activity : processDefinition.getActivities()) {
activity.setDelegateAsyncAfterUpdate(null);
activity.setDelegateAsyncBeforeUpdate(null);
}
return processDefinition;
} | [
"public",
"ProcessDefinitionEntity",
"parseProcess",
"(",
"Element",
"processElement",
")",
"{",
"// reset all mappings that are related to one process definition",
"sequenceFlows",
"=",
"new",
"HashMap",
"<",
"String",
",",
"TransitionImpl",
">",
"(",
")",
";",
"ProcessDef... | Parses one process (ie anything inside a <process> element).
@param processElement
The 'process' element.
@return The parsed version of the XML: a {@link ProcessDefinitionImpl}
object. | [
"Parses",
"one",
"process",
"(",
"ie",
"anything",
"inside",
"a",
"<",
";",
"process>",
";",
"element",
")",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L526-L579 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java | BlobServicesInner.setServiceProperties | public BlobServicePropertiesInner setServiceProperties(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) {
return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | java | public BlobServicePropertiesInner setServiceProperties(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) {
return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | [
"public",
"BlobServicePropertiesInner",
"setServiceProperties",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"BlobServicePropertiesInner",
"parameters",
")",
"{",
"return",
"setServicePropertiesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BlobServicePropertiesInner object if successful. | [
"Sets",
"the",
"properties",
"of",
"a",
"storage",
"account’s",
"Blob",
"service",
"including",
"properties",
"for",
"Storage",
"Analytics",
"and",
"CORS",
"(",
"Cross",
"-",
"Origin",
"Resource",
"Sharing",
")",
"rules",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java#L78-L80 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/TermColorImpl.java | TermColorImpl.getColorByHash | public static TermColor getColorByHash(String hash) {
if(hash==null)
throw new IllegalArgumentException("Invalid hash value (null) for color construction");
// lowercase and remove hash character, if any
hash = hash.toLowerCase().replaceAll("^#", "");
// color written in #ABC format
if(hash.matches("^[0-9a-f]{3}$")) {
String r = hash.substring(0, 1);
String g = hash.substring(1, 2);
String b = hash.substring(2, 3);
return new TermColorImpl(Integer.parseInt(r+r, 16), Integer.parseInt(g+g, 16), Integer.parseInt(b+b, 16));
}
// color written in #AABBCC format
else if(hash.matches("^[0-9a-f]{6}$")) {
String r = hash.substring(0, 2);
String g = hash.substring(2, 4);
String b = hash.substring(4, 6);
return new TermColorImpl(Integer.parseInt(r, 16), Integer.parseInt(g, 16), Integer.parseInt(b, 16));
}
// invalid hash
return null;
} | java | public static TermColor getColorByHash(String hash) {
if(hash==null)
throw new IllegalArgumentException("Invalid hash value (null) for color construction");
// lowercase and remove hash character, if any
hash = hash.toLowerCase().replaceAll("^#", "");
// color written in #ABC format
if(hash.matches("^[0-9a-f]{3}$")) {
String r = hash.substring(0, 1);
String g = hash.substring(1, 2);
String b = hash.substring(2, 3);
return new TermColorImpl(Integer.parseInt(r+r, 16), Integer.parseInt(g+g, 16), Integer.parseInt(b+b, 16));
}
// color written in #AABBCC format
else if(hash.matches("^[0-9a-f]{6}$")) {
String r = hash.substring(0, 2);
String g = hash.substring(2, 4);
String b = hash.substring(4, 6);
return new TermColorImpl(Integer.parseInt(r, 16), Integer.parseInt(g, 16), Integer.parseInt(b, 16));
}
// invalid hash
return null;
} | [
"public",
"static",
"TermColor",
"getColorByHash",
"(",
"String",
"hash",
")",
"{",
"if",
"(",
"hash",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid hash value (null) for color construction\"",
")",
";",
"// lowercase and remove hash chara... | Creates color from string in form #ABC or #AABBCC, or
just simply ABC and AABBCC.
where A, B, C are hexadecimal digits.
@param hash Hash string
@return Created color or <code>null</code> in case of error | [
"Creates",
"color",
"from",
"string",
"in",
"form",
"#ABC",
"or",
"#AABBCC",
"or",
"just",
"simply",
"ABC",
"and",
"AABBCC",
".",
"where",
"A",
"B",
"C",
"are",
"hexadecimal",
"digits",
"."
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/TermColorImpl.java#L98-L122 |
aws/aws-sdk-java | aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TransformJobDefinition.java | TransformJobDefinition.withEnvironment | public TransformJobDefinition withEnvironment(java.util.Map<String, String> environment) {
setEnvironment(environment);
return this;
} | java | public TransformJobDefinition withEnvironment(java.util.Map<String, String> environment) {
setEnvironment(environment);
return this;
} | [
"public",
"TransformJobDefinition",
"withEnvironment",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"environment",
")",
"{",
"setEnvironment",
"(",
"environment",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The environment variables to set in the Docker container. We support up to 16 key and values entries in the map.
</p>
@param environment
The environment variables to set in the Docker container. We support up to 16 key and values entries in
the map.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"environment",
"variables",
"to",
"set",
"in",
"the",
"Docker",
"container",
".",
"We",
"support",
"up",
"to",
"16",
"key",
"and",
"values",
"entries",
"in",
"the",
"map",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TransformJobDefinition.java#L290-L293 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | HadoopUtils.sanitizePath | public static String sanitizePath(String path, String substitute) {
Preconditions.checkArgument(substitute.replaceAll(HDFS_ILLEGAL_TOKEN_REGEX, "").equals(substitute),
"substitute contains illegal characters: " + substitute);
return path.replaceAll(HDFS_ILLEGAL_TOKEN_REGEX, substitute);
} | java | public static String sanitizePath(String path, String substitute) {
Preconditions.checkArgument(substitute.replaceAll(HDFS_ILLEGAL_TOKEN_REGEX, "").equals(substitute),
"substitute contains illegal characters: " + substitute);
return path.replaceAll(HDFS_ILLEGAL_TOKEN_REGEX, substitute);
} | [
"public",
"static",
"String",
"sanitizePath",
"(",
"String",
"path",
",",
"String",
"substitute",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"substitute",
".",
"replaceAll",
"(",
"HDFS_ILLEGAL_TOKEN_REGEX",
",",
"\"\"",
")",
".",
"equals",
"(",
"subst... | Remove illegal HDFS path characters from the given path. Illegal characters will be replaced
with the given substitute. | [
"Remove",
"illegal",
"HDFS",
"path",
"characters",
"from",
"the",
"given",
"path",
".",
"Illegal",
"characters",
"will",
"be",
"replaced",
"with",
"the",
"given",
"substitute",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L919-L924 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java | EJBJavaColonNamingHelper.processJavaColonApp | private Object processJavaColonApp(String lookupName) throws NamingException {
ComponentMetaData cmd = getComponentMetaData(JavaColonNamespace.APP, lookupName);
ModuleMetaData mmd = cmd.getModuleMetaData();
ApplicationMetaData amd = mmd.getApplicationMetaData();
Lock readLock = javaColonLock.readLock();
readLock.lock();
EJBBinding binding = null;
try {
JavaColonNamespaceBindings<EJBBinding> appMap = getAppBindingMap(amd);
if (appMap != null) {
binding = appMap.lookup(lookupName);
}
} finally {
readLock.unlock();
}
return processJavaColon(binding, JavaColonNamespace.APP, lookupName);
} | java | private Object processJavaColonApp(String lookupName) throws NamingException {
ComponentMetaData cmd = getComponentMetaData(JavaColonNamespace.APP, lookupName);
ModuleMetaData mmd = cmd.getModuleMetaData();
ApplicationMetaData amd = mmd.getApplicationMetaData();
Lock readLock = javaColonLock.readLock();
readLock.lock();
EJBBinding binding = null;
try {
JavaColonNamespaceBindings<EJBBinding> appMap = getAppBindingMap(amd);
if (appMap != null) {
binding = appMap.lookup(lookupName);
}
} finally {
readLock.unlock();
}
return processJavaColon(binding, JavaColonNamespace.APP, lookupName);
} | [
"private",
"Object",
"processJavaColonApp",
"(",
"String",
"lookupName",
")",
"throws",
"NamingException",
"{",
"ComponentMetaData",
"cmd",
"=",
"getComponentMetaData",
"(",
"JavaColonNamespace",
".",
"APP",
",",
"lookupName",
")",
";",
"ModuleMetaData",
"mmd",
"=",
... | This method process lookup requests for java:app.
@param appName Application name.
@param lookupName JNDI lookup name.
@param cmd Component metadata.
@return the EJB object instance.
@throws NamingException | [
"This",
"method",
"process",
"lookup",
"requests",
"for",
"java",
":",
"app",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L198-L218 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.notifications_send | public void notifications_send(Collection<Integer> recipientIds, CharSequence notification)
throws FacebookException, IOException {
assert (null != notification);
ArrayList<Pair<String, CharSequence>> args = new ArrayList<Pair<String, CharSequence>>(3);
if (null != recipientIds && !recipientIds.isEmpty()) {
args.add(new Pair<String, CharSequence>("to_ids", delimit(recipientIds)));
}
args.add(new Pair<String, CharSequence>("notification", notification));
this.callMethod(FacebookMethod.NOTIFICATIONS_SEND, args);
} | java | public void notifications_send(Collection<Integer> recipientIds, CharSequence notification)
throws FacebookException, IOException {
assert (null != notification);
ArrayList<Pair<String, CharSequence>> args = new ArrayList<Pair<String, CharSequence>>(3);
if (null != recipientIds && !recipientIds.isEmpty()) {
args.add(new Pair<String, CharSequence>("to_ids", delimit(recipientIds)));
}
args.add(new Pair<String, CharSequence>("notification", notification));
this.callMethod(FacebookMethod.NOTIFICATIONS_SEND, args);
} | [
"public",
"void",
"notifications_send",
"(",
"Collection",
"<",
"Integer",
">",
"recipientIds",
",",
"CharSequence",
"notification",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"assert",
"(",
"null",
"!=",
"notification",
")",
";",
"ArrayList",
"<... | Send a notification message to the specified users on behalf of the logged-in user.
@param recipientIds the user ids to which the message is to be sent. if empty,
notification will be sent to logged-in user.
@param notification the FBML to be displayed on the notifications page; only a stripped-down
set of FBML tags that result in text and links is allowed
@return a URL, possibly null, to which the user should be redirected to finalize
the sending of the email
@see <a href="http://wiki.developers.facebook.com/index.php/Notifications.sendEmail">
Developers Wiki: notifications.send</a> | [
"Send",
"a",
"notification",
"message",
"to",
"the",
"specified",
"users",
"on",
"behalf",
"of",
"the",
"logged",
"-",
"in",
"user",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1156-L1165 |
orbisgis/h2gis | postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java | JtsBinaryParser.parseLineString | private LineString parseLineString(ValueGetter data, boolean haveZ, boolean haveM) {
return JtsGeometry.geofac.createLineString(this.parseCS(data, haveZ, haveM));
} | java | private LineString parseLineString(ValueGetter data, boolean haveZ, boolean haveM) {
return JtsGeometry.geofac.createLineString(this.parseCS(data, haveZ, haveM));
} | [
"private",
"LineString",
"parseLineString",
"(",
"ValueGetter",
"data",
",",
"boolean",
"haveZ",
",",
"boolean",
"haveM",
")",
"{",
"return",
"JtsGeometry",
".",
"geofac",
".",
"createLineString",
"(",
"this",
".",
"parseCS",
"(",
"data",
",",
"haveZ",
",",
... | Parse the given {@link org.postgis.binary.ValueGetter} into a JTS
{@link org.locationtech.jts.geom.LineString}.
@param data {@link org.postgis.binary.ValueGetter} to parse.
@param haveZ True if the {@link org.locationtech.jts.geom.LineString} has a Z component.
@param haveM True if the {@link org.locationtech.jts.geom.LineString} has a M component.
@return The parsed {@link org.locationtech.jts.geom.LineString}. | [
"Parse",
"the",
"given",
"{",
"@link",
"org",
".",
"postgis",
".",
"binary",
".",
"ValueGetter",
"}",
"into",
"a",
"JTS",
"{",
"@link",
"org",
".",
"locationtech",
".",
"jts",
".",
"geom",
".",
"LineString",
"}",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java#L253-L255 |
rometools/rome-certiorem | src/main/java/com/rometools/certiorem/hub/Hub.java | Hub.sendNotification | public void sendNotification(final String requestHost, final String topic) {
// FIXME assert should not be used for validation because it can be disabled
assert validTopics.isEmpty() || validTopics.contains(topic) : "That topic is not supported by this hub. " + topic;
LOG.debug("Sending notification for {}", topic);
try {
final List<? extends Subscriber> subscribers = dao.subscribersForTopic(topic);
if (subscribers.isEmpty()) {
LOG.debug("No subscribers to notify for {}", topic);
return;
}
final List<? extends SubscriptionSummary> summaries = dao.summariesForTopic(topic);
int total = 0;
final StringBuilder hosts = new StringBuilder();
for (final SubscriptionSummary s : summaries) {
if (s.getSubscribers() > 0) {
total += s.getSubscribers();
hosts.append(" (").append(s.getHost()).append("; ").append(s.getSubscribers()).append(" subscribers)");
}
}
final StringBuilder userAgent = new StringBuilder("ROME-Certiorem (+http://").append(requestHost).append("; ").append(total)
.append(" subscribers)").append(hosts);
final SyndFeed feed = fetcher.retrieveFeed(userAgent.toString(), new URL(topic));
LOG.debug("Got feed for {} Sending to {} subscribers.", topic, subscribers.size());
notifier.notifySubscribers(subscribers, feed, new SubscriptionSummaryCallback() {
@Override
public void onSummaryInfo(final SubscriptionSummary summary) {
dao.handleSummary(topic, summary);
}
});
} catch (final Exception ex) {
LOG.debug("Exception getting " + topic, ex);
throw new HttpStatusCodeException(500, ex.getMessage(), ex);
}
} | java | public void sendNotification(final String requestHost, final String topic) {
// FIXME assert should not be used for validation because it can be disabled
assert validTopics.isEmpty() || validTopics.contains(topic) : "That topic is not supported by this hub. " + topic;
LOG.debug("Sending notification for {}", topic);
try {
final List<? extends Subscriber> subscribers = dao.subscribersForTopic(topic);
if (subscribers.isEmpty()) {
LOG.debug("No subscribers to notify for {}", topic);
return;
}
final List<? extends SubscriptionSummary> summaries = dao.summariesForTopic(topic);
int total = 0;
final StringBuilder hosts = new StringBuilder();
for (final SubscriptionSummary s : summaries) {
if (s.getSubscribers() > 0) {
total += s.getSubscribers();
hosts.append(" (").append(s.getHost()).append("; ").append(s.getSubscribers()).append(" subscribers)");
}
}
final StringBuilder userAgent = new StringBuilder("ROME-Certiorem (+http://").append(requestHost).append("; ").append(total)
.append(" subscribers)").append(hosts);
final SyndFeed feed = fetcher.retrieveFeed(userAgent.toString(), new URL(topic));
LOG.debug("Got feed for {} Sending to {} subscribers.", topic, subscribers.size());
notifier.notifySubscribers(subscribers, feed, new SubscriptionSummaryCallback() {
@Override
public void onSummaryInfo(final SubscriptionSummary summary) {
dao.handleSummary(topic, summary);
}
});
} catch (final Exception ex) {
LOG.debug("Exception getting " + topic, ex);
throw new HttpStatusCodeException(500, ex.getMessage(), ex);
}
} | [
"public",
"void",
"sendNotification",
"(",
"final",
"String",
"requestHost",
",",
"final",
"String",
"topic",
")",
"{",
"// FIXME assert should not be used for validation because it can be disabled",
"assert",
"validTopics",
".",
"isEmpty",
"(",
")",
"||",
"validTopics",
... | Sends a notification to the subscribers
@param requestHost the host name the hub is running on. (Used for the user agent)
@param topic the URL of the topic that was updated.
@throws HttpStatusCodeException a wrapper exception with a recommended status code for the
request. | [
"Sends",
"a",
"notification",
"to",
"the",
"subscribers"
] | train | https://github.com/rometools/rome-certiorem/blob/e5a003193dd2abd748e77961c0f216a7f5690712/src/main/java/com/rometools/certiorem/hub/Hub.java#L125-L162 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JaxbPUnit21.java | JaxbPUnit21.getProperties | public Properties getProperties() {
Properties rtnProperties = null;
// Convert this Properties from the class defined in JAXB
// (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties)
// to standard JDK classes (java.util.Properties).
com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties puProperties = ivPUnit.getProperties();
if (puProperties != null) {
List<com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties.Property> propertyList =
puProperties.getProperty();
if (propertyList != null && !propertyList.isEmpty()) {
rtnProperties = new Properties();
for (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties.Property puProperty : propertyList) {
// It is possible that a syntax error will exist in the persistence.xml
// where the property or value is null. Neither is acceptable for
// a Hashtable and will result in an exception.
try {
rtnProperties.setProperty(puProperty.getName(), puProperty.getValue());
} catch (Throwable ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".getProperties", "219", this);
Tr.error(tc, "PROPERTY_SYNTAX_ERROR_IN_PERSISTENCE_XML_CWWJP0039E",
ivPUnit.getName(), puProperty.getName(), puProperty.getValue(), ex);
String exMsg =
"A severe error occurred while processing the properties "
+ "within the persistence.xml of Persistence Unit: " + ivPUnit.getName()
+ " (Property = " + puProperty.getName() + ", Value = " + puProperty.getValue()
+ ").";
throw new RuntimeException(exMsg, ex);
}
}
}
}
return rtnProperties;
} | java | public Properties getProperties() {
Properties rtnProperties = null;
// Convert this Properties from the class defined in JAXB
// (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties)
// to standard JDK classes (java.util.Properties).
com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties puProperties = ivPUnit.getProperties();
if (puProperties != null) {
List<com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties.Property> propertyList =
puProperties.getProperty();
if (propertyList != null && !propertyList.isEmpty()) {
rtnProperties = new Properties();
for (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties.Property puProperty : propertyList) {
// It is possible that a syntax error will exist in the persistence.xml
// where the property or value is null. Neither is acceptable for
// a Hashtable and will result in an exception.
try {
rtnProperties.setProperty(puProperty.getName(), puProperty.getValue());
} catch (Throwable ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".getProperties", "219", this);
Tr.error(tc, "PROPERTY_SYNTAX_ERROR_IN_PERSISTENCE_XML_CWWJP0039E",
ivPUnit.getName(), puProperty.getName(), puProperty.getValue(), ex);
String exMsg =
"A severe error occurred while processing the properties "
+ "within the persistence.xml of Persistence Unit: " + ivPUnit.getName()
+ " (Property = " + puProperty.getName() + ", Value = " + puProperty.getValue()
+ ").";
throw new RuntimeException(exMsg, ex);
}
}
}
}
return rtnProperties;
} | [
"public",
"Properties",
"getProperties",
"(",
")",
"{",
"Properties",
"rtnProperties",
"=",
"null",
";",
"// Convert this Properties from the class defined in JAXB",
"// (com.ibm.ws.jpa.pxml21.Persistence.PersistenceUnit.Properties)",
"// to standard JDK classes (java.util.Properties).",
... | Gets the value of the properties property.
@return value of the properties property. | [
"Gets",
"the",
"value",
"of",
"the",
"properties",
"property",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JaxbPUnit21.java#L248-L283 |
realtime-framework/RealtimeMessaging-Java | library/src/main/java/ibt/ortc/api/Balancer.java | Balancer.getServerFromBalancer | public static String getServerFromBalancer(String balancerUrl,String applicationKey, Proxy proxy) throws IOException, InvalidBalancerServerException {
Matcher protocolMatcher = urlProtocolPattern.matcher(balancerUrl);
String protocol = protocolMatcher.matches() ? "" : protocolMatcher.group(1);
String parsedUrl = String.format("%s%s", protocol, balancerUrl);
if(!Strings.isNullOrEmpty(applicationKey)){
// CAUSE: Prefer String.format to +
parsedUrl += String.format("?appkey=%s", applicationKey);
}
URL url = new URL(parsedUrl);
String balancer = IOUtil.doGetRequest(url, proxy);
Matcher matcher = balancerServerPattern.matcher(balancer);
if (!matcher.matches()) {
throw new InvalidBalancerServerException(balancer);
}
return matcher.group(1);
} | java | public static String getServerFromBalancer(String balancerUrl,String applicationKey, Proxy proxy) throws IOException, InvalidBalancerServerException {
Matcher protocolMatcher = urlProtocolPattern.matcher(balancerUrl);
String protocol = protocolMatcher.matches() ? "" : protocolMatcher.group(1);
String parsedUrl = String.format("%s%s", protocol, balancerUrl);
if(!Strings.isNullOrEmpty(applicationKey)){
// CAUSE: Prefer String.format to +
parsedUrl += String.format("?appkey=%s", applicationKey);
}
URL url = new URL(parsedUrl);
String balancer = IOUtil.doGetRequest(url, proxy);
Matcher matcher = balancerServerPattern.matcher(balancer);
if (!matcher.matches()) {
throw new InvalidBalancerServerException(balancer);
}
return matcher.group(1);
} | [
"public",
"static",
"String",
"getServerFromBalancer",
"(",
"String",
"balancerUrl",
",",
"String",
"applicationKey",
",",
"Proxy",
"proxy",
")",
"throws",
"IOException",
",",
"InvalidBalancerServerException",
"{",
"Matcher",
"protocolMatcher",
"=",
"urlProtocolPattern",
... | Retrieves an Ortc Server url from the Ortc Balancer
@param balancerUrl
The Ortc Balancer url
@return An Ortc Server url
@throws java.io.IOException
@throws UnknownHostException
@throws InvalidBalancerServerException | [
"Retrieves",
"an",
"Ortc",
"Server",
"url",
"from",
"the",
"Ortc",
"Balancer"
] | train | https://github.com/realtime-framework/RealtimeMessaging-Java/blob/cae0dfd01567a2d9e55a0849c0c9b09ad4b2cc08/library/src/main/java/ibt/ortc/api/Balancer.java#L76-L96 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/output/Values.java | Values.getObject | public <V> V getObject(final String key, final Class<V> type) {
final Object obj = this.values.get(key);
return type.cast(obj);
} | java | public <V> V getObject(final String key, final Class<V> type) {
final Object obj = this.values.get(key);
return type.cast(obj);
} | [
"public",
"<",
"V",
">",
"V",
"getObject",
"(",
"final",
"String",
"key",
",",
"final",
"Class",
"<",
"V",
">",
"type",
")",
"{",
"final",
"Object",
"obj",
"=",
"this",
".",
"values",
".",
"get",
"(",
"key",
")",
";",
"return",
"type",
".",
"cast... | Get a value as a string.
@param key the key for looking up the value.
@param type the type of the object
@param <V> the type | [
"Get",
"a",
"value",
"as",
"a",
"string",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/output/Values.java#L333-L336 |
unbescape/unbescape | src/main/java/org/unbescape/javascript/JavaScriptEscape.java | JavaScriptEscape.unescapeJavaScript | public static void unescapeJavaScript(final char[] text, final int offset, final int len, final Writer writer)
throws IOException{
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
final int textLen = (text == null? 0 : text.length);
if (offset < 0 || offset > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
if (len < 0 || (offset + len) > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
JavaScriptEscapeUtil.unescape(text, offset, len, writer);
} | java | public static void unescapeJavaScript(final char[] text, final int offset, final int len, final Writer writer)
throws IOException{
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
final int textLen = (text == null? 0 : text.length);
if (offset < 0 || offset > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
if (len < 0 || (offset + len) > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
JavaScriptEscapeUtil.unescape(text, offset, len, writer);
} | [
"public",
"static",
"void",
"unescapeJavaScript",
"(",
"final",
"char",
"[",
"]",
"text",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"len",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
"... | <p>
Perform a JavaScript <strong>unescape</strong> operation on a <tt>char[]</tt> input.
</p>
<p>
No additional configuration arguments are required. Unescape operations
will always perform <em>complete</em> JavaScript unescape of SECs, x-based, u-based
and octal escapes.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>char[]</tt> to be unescaped.
@param offset the position in <tt>text</tt> at which the unescape operation should start.
@param len the number of characters in <tt>text</tt> that should be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs | [
"<p",
">",
"Perform",
"a",
"JavaScript",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"char",
"[]",
"<",
"/",
"tt",
">",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">",
"No",
"additional",
"configuration",
"argume... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/javascript/JavaScriptEscape.java#L1065-L1086 |
alkacon/opencms-core | src/org/opencms/gwt/CmsIconUtil.java | CmsIconUtil.getResourceIconClasses | private static String getResourceIconClasses(String resourceTypeName, String fileName, boolean small) {
StringBuffer sb = new StringBuffer(CmsGwtConstants.TYPE_ICON_CLASS);
sb.append(" ").append(getResourceTypeIconClass(resourceTypeName, small)).append(" ").append(
getFileTypeIconClass(resourceTypeName, fileName, small));
return sb.toString();
} | java | private static String getResourceIconClasses(String resourceTypeName, String fileName, boolean small) {
StringBuffer sb = new StringBuffer(CmsGwtConstants.TYPE_ICON_CLASS);
sb.append(" ").append(getResourceTypeIconClass(resourceTypeName, small)).append(" ").append(
getFileTypeIconClass(resourceTypeName, fileName, small));
return sb.toString();
} | [
"private",
"static",
"String",
"getResourceIconClasses",
"(",
"String",
"resourceTypeName",
",",
"String",
"fileName",
",",
"boolean",
"small",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"CmsGwtConstants",
".",
"TYPE_ICON_CLASS",
")",
";",
"s... | Returns the CSS classes of the resource icon for the given resource type and filename.<p>
Use this the resource type and filename is known.<p>
@param resourceTypeName the resource type name
@param fileName the filename
@param small if true, get the icon classes for the small icon, else for the biggest one available
@return the CSS classes | [
"Returns",
"the",
"CSS",
"classes",
"of",
"the",
"resource",
"icon",
"for",
"the",
"given",
"resource",
"type",
"and",
"filename",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsIconUtil.java#L494-L500 |
ansell/restlet-utils | src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java | FixedRedirectCookieAuthenticator.challenge | @Override
public void challenge(final Response response, final boolean stale)
{
this.log.debug("Calling super.challenge");
super.challenge(response, stale);
} | java | @Override
public void challenge(final Response response, final boolean stale)
{
this.log.debug("Calling super.challenge");
super.challenge(response, stale);
} | [
"@",
"Override",
"public",
"void",
"challenge",
"(",
"final",
"Response",
"response",
",",
"final",
"boolean",
"stale",
")",
"{",
"this",
".",
"log",
".",
"debug",
"(",
"\"Calling super.challenge\"",
")",
";",
"super",
".",
"challenge",
"(",
"response",
",",... | This method should be overridden to return a login form representation. | [
"This",
"method",
"should",
"be",
"overridden",
"to",
"return",
"a",
"login",
"form",
"representation",
"."
] | train | https://github.com/ansell/restlet-utils/blob/6c39a3e91aa8295936af1dbfccd6ba27230c40a9/src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java#L364-L369 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/Util.java | Util.unsignedBinarySearch | public static int unsignedBinarySearch(final short[] array, final int begin, final int end,
final short k) {
if (USE_HYBRID_BINSEARCH) {
return hybridUnsignedBinarySearch(array, begin, end, k);
} else {
return branchyUnsignedBinarySearch(array, begin, end, k);
}
} | java | public static int unsignedBinarySearch(final short[] array, final int begin, final int end,
final short k) {
if (USE_HYBRID_BINSEARCH) {
return hybridUnsignedBinarySearch(array, begin, end, k);
} else {
return branchyUnsignedBinarySearch(array, begin, end, k);
}
} | [
"public",
"static",
"int",
"unsignedBinarySearch",
"(",
"final",
"short",
"[",
"]",
"array",
",",
"final",
"int",
"begin",
",",
"final",
"int",
"end",
",",
"final",
"short",
"k",
")",
"{",
"if",
"(",
"USE_HYBRID_BINSEARCH",
")",
"{",
"return",
"hybridUnsig... | Look for value k in array in the range [begin,end). If the value is found, return its index. If
not, return -(i+1) where i is the index where the value would be inserted. The array is assumed
to contain sorted values where shorts are interpreted as unsigned integers.
@param array array where we search
@param begin first index (inclusive)
@param end last index (exclusive)
@param k value we search for
@return count | [
"Look",
"for",
"value",
"k",
"in",
"array",
"in",
"the",
"range",
"[",
"begin",
"end",
")",
".",
"If",
"the",
"value",
"is",
"found",
"return",
"its",
"index",
".",
"If",
"not",
"return",
"-",
"(",
"i",
"+",
"1",
")",
"where",
"i",
"is",
"the",
... | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L586-L593 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java | HelpFormatter.printHelp | public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)
{
printHelp(getWidth(), cmdLineSyntax, header, options, footer, autoUsage);
} | java | public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)
{
printHelp(getWidth(), cmdLineSyntax, header, options, footer, autoUsage);
} | [
"public",
"void",
"printHelp",
"(",
"String",
"cmdLineSyntax",
",",
"String",
"header",
",",
"Options",
"options",
",",
"String",
"footer",
",",
"boolean",
"autoUsage",
")",
"{",
"printHelp",
"(",
"getWidth",
"(",
")",
",",
"cmdLineSyntax",
",",
"header",
",... | Print the help for <code>options</code> with the specified
command line syntax. This method prints help information to
System.out.
@param cmdLineSyntax the syntax for this application
@param header the banner to display at the beginning of the help
@param options the Options instance
@param footer the banner to display at the end of the help
@param autoUsage whether to print an automatically generated
usage statement | [
"Print",
"the",
"help",
"for",
"<code",
">",
"options<",
"/",
"code",
">",
"with",
"the",
"specified",
"command",
"line",
"syntax",
".",
"This",
"method",
"prints",
"help",
"information",
"to",
"System",
".",
"out",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java#L453-L456 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/easydl/AipEasyDL.java | AipEasyDL.sendImageRequest | public JSONObject sendImageRequest(String url, byte[] image, HashMap<String, Object> options) {
AipRequest request = new AipRequest();
preOperation(request);
String content = Base64Util.encode(image);
request.addBody("image", content);
if (options != null) {
request.addBody(options);
}
request.setUri(url);
request.addHeader(Headers.CONTENT_ENCODING,
HttpCharacterEncoding.ENCODE_UTF8);
request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} | java | public JSONObject sendImageRequest(String url, byte[] image, HashMap<String, Object> options) {
AipRequest request = new AipRequest();
preOperation(request);
String content = Base64Util.encode(image);
request.addBody("image", content);
if (options != null) {
request.addBody(options);
}
request.setUri(url);
request.addHeader(Headers.CONTENT_ENCODING,
HttpCharacterEncoding.ENCODE_UTF8);
request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"sendImageRequest",
"(",
"String",
"url",
",",
"byte",
"[",
"]",
"image",
",",
"HashMap",
"<",
"String",
",",
"Object",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",... | easyDL通用请求方法
@param url 服务的url
@param image 图片二进制数据
@param options 可选参数
@return Json返回 | [
"easyDL通用请求方法"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/easydl/AipEasyDL.java#L48-L63 |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/ConfigUtil.java | ConfigUtil.normalizeYaml | public static DescriptorProperties normalizeYaml(Map<String, Object> yamlMap) {
final Map<String, String> normalized = new HashMap<>();
yamlMap.forEach((k, v) -> normalizeYamlObject(normalized, k, v));
final DescriptorProperties properties = new DescriptorProperties(true);
properties.putProperties(normalized);
return properties;
} | java | public static DescriptorProperties normalizeYaml(Map<String, Object> yamlMap) {
final Map<String, String> normalized = new HashMap<>();
yamlMap.forEach((k, v) -> normalizeYamlObject(normalized, k, v));
final DescriptorProperties properties = new DescriptorProperties(true);
properties.putProperties(normalized);
return properties;
} | [
"public",
"static",
"DescriptorProperties",
"normalizeYaml",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"yamlMap",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"normalized",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"yamlMap",
".",
... | Normalizes key-value properties from Yaml in the normalized format of the Table API. | [
"Normalizes",
"key",
"-",
"value",
"properties",
"from",
"Yaml",
"in",
"the",
"normalized",
"format",
"of",
"the",
"Table",
"API",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/ConfigUtil.java#L48-L54 |
knowm/XChange | xchange-cryptonit/src/main/java/org/knowm/xchange/cryptonit2/CryptonitAdapters.java | CryptonitAdapters.adaptTicker | public static Ticker adaptTicker(CryptonitTicker cryptonitTicker, CurrencyPair currencyPair) {
BigDecimal open = cryptonitTicker.getOpen();
BigDecimal last = cryptonitTicker.getLast();
BigDecimal bid = cryptonitTicker.getBid();
BigDecimal ask = cryptonitTicker.getAsk();
BigDecimal high = cryptonitTicker.getHigh();
BigDecimal low = cryptonitTicker.getLow();
BigDecimal vwap = cryptonitTicker.getVwap();
BigDecimal volume = cryptonitTicker.getVolume();
Date timestamp = new Date(cryptonitTicker.getTimestamp() * 1000L);
return new Ticker.Builder()
.currencyPair(currencyPair)
.open(open)
.last(last)
.bid(bid)
.ask(ask)
.high(high)
.low(low)
.vwap(vwap)
.volume(volume)
.timestamp(timestamp)
.build();
} | java | public static Ticker adaptTicker(CryptonitTicker cryptonitTicker, CurrencyPair currencyPair) {
BigDecimal open = cryptonitTicker.getOpen();
BigDecimal last = cryptonitTicker.getLast();
BigDecimal bid = cryptonitTicker.getBid();
BigDecimal ask = cryptonitTicker.getAsk();
BigDecimal high = cryptonitTicker.getHigh();
BigDecimal low = cryptonitTicker.getLow();
BigDecimal vwap = cryptonitTicker.getVwap();
BigDecimal volume = cryptonitTicker.getVolume();
Date timestamp = new Date(cryptonitTicker.getTimestamp() * 1000L);
return new Ticker.Builder()
.currencyPair(currencyPair)
.open(open)
.last(last)
.bid(bid)
.ask(ask)
.high(high)
.low(low)
.vwap(vwap)
.volume(volume)
.timestamp(timestamp)
.build();
} | [
"public",
"static",
"Ticker",
"adaptTicker",
"(",
"CryptonitTicker",
"cryptonitTicker",
",",
"CurrencyPair",
"currencyPair",
")",
"{",
"BigDecimal",
"open",
"=",
"cryptonitTicker",
".",
"getOpen",
"(",
")",
";",
"BigDecimal",
"last",
"=",
"cryptonitTicker",
".",
"... | Adapts a CryptonitTicker to a Ticker Object
@param cryptonitTicker The exchange specific ticker
@param currencyPair (e.g. BTC/USD)
@return The ticker | [
"Adapts",
"a",
"CryptonitTicker",
"to",
"a",
"Ticker",
"Object"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-cryptonit/src/main/java/org/knowm/xchange/cryptonit2/CryptonitAdapters.java#L162-L186 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/assembly/AssemblyFiles.java | AssemblyFiles.addEntry | public void addEntry(File srcFile, File destFile) {
entries.add(new Entry(srcFile,destFile));
} | java | public void addEntry(File srcFile, File destFile) {
entries.add(new Entry(srcFile,destFile));
} | [
"public",
"void",
"addEntry",
"(",
"File",
"srcFile",
",",
"File",
"destFile",
")",
"{",
"entries",
".",
"add",
"(",
"new",
"Entry",
"(",
"srcFile",
",",
"destFile",
")",
")",
";",
"}"
] | Add a entry to the list of assembly files which possible should be monitored
@param srcFile source file to monitor. The source file must exist.
@param destFile the destination to which it is eventually copied. The destination file must be relative. | [
"Add",
"a",
"entry",
"to",
"the",
"list",
"of",
"assembly",
"files",
"which",
"possible",
"should",
"be",
"monitored"
] | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/assembly/AssemblyFiles.java#L49-L51 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.applyDefaultMethodTarget | public static MethodCallExpression applyDefaultMethodTarget(final MethodCallExpression methodCallExpression, final Class<?> targetClass) {
return applyDefaultMethodTarget(methodCallExpression, ClassHelper.make(targetClass).getPlainNodeReference());
} | java | public static MethodCallExpression applyDefaultMethodTarget(final MethodCallExpression methodCallExpression, final Class<?> targetClass) {
return applyDefaultMethodTarget(methodCallExpression, ClassHelper.make(targetClass).getPlainNodeReference());
} | [
"public",
"static",
"MethodCallExpression",
"applyDefaultMethodTarget",
"(",
"final",
"MethodCallExpression",
"methodCallExpression",
",",
"final",
"Class",
"<",
"?",
">",
"targetClass",
")",
"{",
"return",
"applyDefaultMethodTarget",
"(",
"methodCallExpression",
",",
"Cl... | Set the method target of a MethodCallExpression to the first matching method with same number of arguments.
This doesn't check argument types.
@param methodCallExpression
@param targetClass
@return The method call expression | [
"Set",
"the",
"method",
"target",
"of",
"a",
"MethodCallExpression",
"to",
"the",
"first",
"matching",
"method",
"with",
"same",
"number",
"of",
"arguments",
".",
"This",
"doesn",
"t",
"check",
"argument",
"types",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1211-L1213 |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java | PreprocessorContext.removeLocalVariable | @Nonnull
public PreprocessorContext removeLocalVariable(@Nonnull final String name) {
assertNotNull("Variable name is null", name);
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
throw makeException("Empty variable name", null);
}
if (mapVariableNameToSpecialVarProcessor.containsKey(normalized) || globalVarTable.containsKey(normalized)) {
throw makeException("Attempting to remove either a global variable or a special variable as a local one [" + normalized + ']', null);
}
if (isVerbose()) {
logForVerbose("Removing local variable '" + normalized + "\'");
}
localVarTable.remove(normalized);
return this;
} | java | @Nonnull
public PreprocessorContext removeLocalVariable(@Nonnull final String name) {
assertNotNull("Variable name is null", name);
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
throw makeException("Empty variable name", null);
}
if (mapVariableNameToSpecialVarProcessor.containsKey(normalized) || globalVarTable.containsKey(normalized)) {
throw makeException("Attempting to remove either a global variable or a special variable as a local one [" + normalized + ']', null);
}
if (isVerbose()) {
logForVerbose("Removing local variable '" + normalized + "\'");
}
localVarTable.remove(normalized);
return this;
} | [
"@",
"Nonnull",
"public",
"PreprocessorContext",
"removeLocalVariable",
"(",
"@",
"Nonnull",
"final",
"String",
"name",
")",
"{",
"assertNotNull",
"(",
"\"Variable name is null\"",
",",
"name",
")",
";",
"final",
"String",
"normalized",
"=",
"assertNotNull",
"(",
... | Remove a local variable value from the context.
@param name the variable name, must not be null, remember that the name will be normalized and will be entirely in lower case
@return this preprocessor context
@see Value | [
"Remove",
"a",
"local",
"variable",
"value",
"from",
"the",
"context",
"."
] | train | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java#L479-L497 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeAssignment.java | KeyGroupRangeAssignment.assignKeyToParallelOperator | public static int assignKeyToParallelOperator(Object key, int maxParallelism, int parallelism) {
return computeOperatorIndexForKeyGroup(maxParallelism, parallelism, assignToKeyGroup(key, maxParallelism));
} | java | public static int assignKeyToParallelOperator(Object key, int maxParallelism, int parallelism) {
return computeOperatorIndexForKeyGroup(maxParallelism, parallelism, assignToKeyGroup(key, maxParallelism));
} | [
"public",
"static",
"int",
"assignKeyToParallelOperator",
"(",
"Object",
"key",
",",
"int",
"maxParallelism",
",",
"int",
"parallelism",
")",
"{",
"return",
"computeOperatorIndexForKeyGroup",
"(",
"maxParallelism",
",",
"parallelism",
",",
"assignToKeyGroup",
"(",
"ke... | Assigns the given key to a parallel operator index.
@param key the key to assign
@param maxParallelism the maximum supported parallelism, aka the number of key-groups.
@param parallelism the current parallelism of the operator
@return the index of the parallel operator to which the given key should be routed. | [
"Assigns",
"the",
"given",
"key",
"to",
"a",
"parallel",
"operator",
"index",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeAssignment.java#L47-L49 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.extractMultiAndDelPre | public static String extractMultiAndDelPre(Pattern pattern, Holder<CharSequence> contentHolder, String template) {
if (null == contentHolder || null == pattern || null == template) {
return null;
}
HashSet<String> varNums = findAll(PatternPool.GROUP_VAR, template, 1, new HashSet<String>());
final CharSequence content = contentHolder.get();
Matcher matcher = pattern.matcher(content);
if (matcher.find()) {
for (String var : varNums) {
int group = Integer.parseInt(var);
template = template.replace("$" + var, matcher.group(group));
}
contentHolder.set(StrUtil.sub(content, matcher.end(), content.length()));
return template;
}
return null;
} | java | public static String extractMultiAndDelPre(Pattern pattern, Holder<CharSequence> contentHolder, String template) {
if (null == contentHolder || null == pattern || null == template) {
return null;
}
HashSet<String> varNums = findAll(PatternPool.GROUP_VAR, template, 1, new HashSet<String>());
final CharSequence content = contentHolder.get();
Matcher matcher = pattern.matcher(content);
if (matcher.find()) {
for (String var : varNums) {
int group = Integer.parseInt(var);
template = template.replace("$" + var, matcher.group(group));
}
contentHolder.set(StrUtil.sub(content, matcher.end(), content.length()));
return template;
}
return null;
} | [
"public",
"static",
"String",
"extractMultiAndDelPre",
"(",
"Pattern",
"pattern",
",",
"Holder",
"<",
"CharSequence",
">",
"contentHolder",
",",
"String",
"template",
")",
"{",
"if",
"(",
"null",
"==",
"contentHolder",
"||",
"null",
"==",
"pattern",
"||",
"nul... | 从content中匹配出多个值并根据template生成新的字符串<br>
匹配结束后会删除匹配内容之前的内容(包括匹配内容)<br>
例如:<br>
content 2013年5月 pattern (.*?)年(.*?)月 template: $1-$2 return 2013-5
@param pattern 匹配正则
@param contentHolder 被匹配的内容的Holder,value为内容正文,经过这个方法的原文将被去掉匹配之前的内容
@param template 生成内容模板,变量 $1 表示group1的内容,以此类推
@return 新字符串 | [
"从content中匹配出多个值并根据template生成新的字符串<br",
">",
"匹配结束后会删除匹配内容之前的内容(包括匹配内容)<br",
">",
"例如:<br",
">",
"content",
"2013年5月",
"pattern",
"(",
".",
"*",
"?",
")",
"年",
"(",
".",
"*",
"?",
")",
"月",
"template:",
"$1",
"-",
"$2",
"return",
"2013",
"-",
"5"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L230-L248 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/helpers/HeaderPositionCalculator.java | HeaderPositionCalculator.getFirstViewUnobscuredByHeader | private View getFirstViewUnobscuredByHeader(RecyclerView parent, View firstHeader) {
boolean isReverseLayout = mOrientationProvider.isReverseLayout(parent);
int step = isReverseLayout ? -1 : 1;
int from = isReverseLayout ? parent.getChildCount() - 1 : 0;
for (int i = from; i >= 0 && i <= parent.getChildCount() - 1; i += step) {
View child = parent.getChildAt(i);
if (!itemIsObscuredByHeader(parent, child, firstHeader, mOrientationProvider.getOrientation(parent))) {
return child;
}
}
return null;
} | java | private View getFirstViewUnobscuredByHeader(RecyclerView parent, View firstHeader) {
boolean isReverseLayout = mOrientationProvider.isReverseLayout(parent);
int step = isReverseLayout ? -1 : 1;
int from = isReverseLayout ? parent.getChildCount() - 1 : 0;
for (int i = from; i >= 0 && i <= parent.getChildCount() - 1; i += step) {
View child = parent.getChildAt(i);
if (!itemIsObscuredByHeader(parent, child, firstHeader, mOrientationProvider.getOrientation(parent))) {
return child;
}
}
return null;
} | [
"private",
"View",
"getFirstViewUnobscuredByHeader",
"(",
"RecyclerView",
"parent",
",",
"View",
"firstHeader",
")",
"{",
"boolean",
"isReverseLayout",
"=",
"mOrientationProvider",
".",
"isReverseLayout",
"(",
"parent",
")",
";",
"int",
"step",
"=",
"isReverseLayout",... | Returns the first item currently in the RecyclerView that is not obscured by a header.
@param parent Recyclerview containing all the list items
@return first item that is fully beneath a header | [
"Returns",
"the",
"first",
"item",
"currently",
"in",
"the",
"RecyclerView",
"that",
"is",
"not",
"obscured",
"by",
"a",
"header",
"."
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/helpers/HeaderPositionCalculator.java#L209-L220 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java | PacketUtil.packetExtensionfromCollection | @Deprecated
public static <PE extends ExtensionElement> PE packetExtensionfromCollection(
Collection<ExtensionElement> collection, String element,
String namespace) {
return extensionElementFrom(collection, element, namespace);
} | java | @Deprecated
public static <PE extends ExtensionElement> PE packetExtensionfromCollection(
Collection<ExtensionElement> collection, String element,
String namespace) {
return extensionElementFrom(collection, element, namespace);
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"PE",
"extends",
"ExtensionElement",
">",
"PE",
"packetExtensionfromCollection",
"(",
"Collection",
"<",
"ExtensionElement",
">",
"collection",
",",
"String",
"element",
",",
"String",
"namespace",
")",
"{",
"return",
"e... | Get a extension element from a collection.
@param collection
@param element
@param namespace
@param <PE>
@return the extension element
@deprecated use {@link #extensionElementFrom(Collection, String, String)} instead. | [
"Get",
"a",
"extension",
"element",
"from",
"a",
"collection",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java#L34-L39 |
jsurfer/JsonSurfer | jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java | JsonSurfer.collectAll | public Collection<Object> collectAll(InputStream inputStream, JsonPath... paths) {
return collectAll(inputStream, Object.class, paths);
} | java | public Collection<Object> collectAll(InputStream inputStream, JsonPath... paths) {
return collectAll(inputStream, Object.class, paths);
} | [
"public",
"Collection",
"<",
"Object",
">",
"collectAll",
"(",
"InputStream",
"inputStream",
",",
"JsonPath",
"...",
"paths",
")",
"{",
"return",
"collectAll",
"(",
"inputStream",
",",
"Object",
".",
"class",
",",
"paths",
")",
";",
"}"
] | Collect all matched value into a collection
@param inputStream Json reader
@param paths JsonPath
@return All matched value | [
"Collect",
"all",
"matched",
"value",
"into",
"a",
"collection"
] | train | https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L358-L360 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/subset/neigh/SingleSwapNeighbourhood.java | SingleSwapNeighbourhood.getRandomMove | @Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// get set of candidate IDs for removal and addition (possibly fixed IDs are discarded)
Set<Integer> removeCandidates = getRemoveCandidates(solution);
Set<Integer> addCandidates = getAddCandidates(solution);
// check if swap is possible
if(removeCandidates.isEmpty() || addCandidates.isEmpty()){
// impossible to perform a swap
return null;
}
// select random ID to remove from selection
int del = SetUtilities.getRandomElement(removeCandidates, rnd);
// select random ID to add to selection
int add = SetUtilities.getRandomElement(addCandidates, rnd);
// create and return swap move
return new SwapMove(add, del);
} | java | @Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// get set of candidate IDs for removal and addition (possibly fixed IDs are discarded)
Set<Integer> removeCandidates = getRemoveCandidates(solution);
Set<Integer> addCandidates = getAddCandidates(solution);
// check if swap is possible
if(removeCandidates.isEmpty() || addCandidates.isEmpty()){
// impossible to perform a swap
return null;
}
// select random ID to remove from selection
int del = SetUtilities.getRandomElement(removeCandidates, rnd);
// select random ID to add to selection
int add = SetUtilities.getRandomElement(addCandidates, rnd);
// create and return swap move
return new SwapMove(add, del);
} | [
"@",
"Override",
"public",
"SubsetMove",
"getRandomMove",
"(",
"SubsetSolution",
"solution",
",",
"Random",
"rnd",
")",
"{",
"// get set of candidate IDs for removal and addition (possibly fixed IDs are discarded)",
"Set",
"<",
"Integer",
">",
"removeCandidates",
"=",
"getRem... | Generates a random swap move for the given subset solution that removes a single ID from the set of currently selected IDs,
and replaces it with a random ID taken from the set of currently unselected IDs. Possible fixed IDs are not considered to be
swapped. If no swap move can be generated, <code>null</code> is returned.
@param solution solution for which a random swap move is generated
@param rnd source of randomness used to generate random move
@return random swap move, <code>null</code> if no swap move can be generated | [
"Generates",
"a",
"random",
"swap",
"move",
"for",
"the",
"given",
"subset",
"solution",
"that",
"removes",
"a",
"single",
"ID",
"from",
"the",
"set",
"of",
"currently",
"selected",
"IDs",
"and",
"replaces",
"it",
"with",
"a",
"random",
"ID",
"taken",
"fro... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SingleSwapNeighbourhood.java#L71-L87 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java | CPDefinitionOptionValueRelPersistenceImpl.countByC_K | @Override
public int countByC_K(long CPDefinitionOptionRelId, String key) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_C_K;
Object[] finderArgs = new Object[] { CPDefinitionOptionRelId, key };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_CPDEFINITIONOPTIONVALUEREL_WHERE);
query.append(_FINDER_COLUMN_C_K_CPDEFINITIONOPTIONRELID_2);
boolean bindKey = false;
if (key == null) {
query.append(_FINDER_COLUMN_C_K_KEY_1);
}
else if (key.equals("")) {
query.append(_FINDER_COLUMN_C_K_KEY_3);
}
else {
bindKey = true;
query.append(_FINDER_COLUMN_C_K_KEY_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CPDefinitionOptionRelId);
if (bindKey) {
qPos.add(key);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByC_K(long CPDefinitionOptionRelId, String key) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_C_K;
Object[] finderArgs = new Object[] { CPDefinitionOptionRelId, key };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_CPDEFINITIONOPTIONVALUEREL_WHERE);
query.append(_FINDER_COLUMN_C_K_CPDEFINITIONOPTIONRELID_2);
boolean bindKey = false;
if (key == null) {
query.append(_FINDER_COLUMN_C_K_KEY_1);
}
else if (key.equals("")) {
query.append(_FINDER_COLUMN_C_K_KEY_3);
}
else {
bindKey = true;
query.append(_FINDER_COLUMN_C_K_KEY_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CPDefinitionOptionRelId);
if (bindKey) {
qPos.add(key);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByC_K",
"(",
"long",
"CPDefinitionOptionRelId",
",",
"String",
"key",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_COUNT_BY_C_K",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object",
"[",
"]",
"{",
"CP... | Returns the number of cp definition option value rels where CPDefinitionOptionRelId = ? and key = ?.
@param CPDefinitionOptionRelId the cp definition option rel ID
@param key the key
@return the number of matching cp definition option value rels | [
"Returns",
"the",
"number",
"of",
"cp",
"definition",
"option",
"value",
"rels",
"where",
"CPDefinitionOptionRelId",
"=",
"?",
";",
"and",
"key",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java#L3808-L3869 |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/util/CommonHelper.java | CommonHelper.urlEncode | public static String urlEncode(final String text) {
try {
return URLEncoder.encode(text, StandardCharsets.UTF_8.name());
} catch (final UnsupportedEncodingException e) {
final String message = "Unable to encode text : " + text;
throw new TechnicalException(message, e);
}
} | java | public static String urlEncode(final String text) {
try {
return URLEncoder.encode(text, StandardCharsets.UTF_8.name());
} catch (final UnsupportedEncodingException e) {
final String message = "Unable to encode text : " + text;
throw new TechnicalException(message, e);
}
} | [
"public",
"static",
"String",
"urlEncode",
"(",
"final",
"String",
"text",
")",
"{",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"text",
",",
"StandardCharsets",
".",
"UTF_8",
".",
"name",
"(",
")",
")",
";",
"}",
"catch",
"(",
"final",
"Un... | URL encode a text using UTF-8.
@param text text to encode
@return the encoded text | [
"URL",
"encode",
"a",
"text",
"using",
"UTF",
"-",
"8",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/util/CommonHelper.java#L192-L199 |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/MultipleEvaluationMetricRunner.java | MultipleEvaluationMetricRunner.getAllPredictionFiles | public static void getAllPredictionFiles(final Set<String> predictionFiles, final File path, final String predictionPrefix) {
if (path == null) {
return;
}
File[] files = path.listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (file.isDirectory()) {
getAllPredictionFiles(predictionFiles, file, predictionPrefix);
} else if (file.getName().startsWith(predictionPrefix)) {
predictionFiles.add(file.getAbsolutePath().replaceAll(predictionPrefix, ""));
}
}
} | java | public static void getAllPredictionFiles(final Set<String> predictionFiles, final File path, final String predictionPrefix) {
if (path == null) {
return;
}
File[] files = path.listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (file.isDirectory()) {
getAllPredictionFiles(predictionFiles, file, predictionPrefix);
} else if (file.getName().startsWith(predictionPrefix)) {
predictionFiles.add(file.getAbsolutePath().replaceAll(predictionPrefix, ""));
}
}
} | [
"public",
"static",
"void",
"getAllPredictionFiles",
"(",
"final",
"Set",
"<",
"String",
">",
"predictionFiles",
",",
"final",
"File",
"path",
",",
"final",
"String",
"predictionPrefix",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"return",
";",
"... | Gets all prediction files.
@param predictionFiles The prediction files.
@param path The path where the splits are.
@param predictionPrefix The prefix of the prediction files. | [
"Gets",
"all",
"prediction",
"files",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/MultipleEvaluationMetricRunner.java#L231-L246 |
jbundle/jbundle | base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/ServletTask.java | ServletTask.doProcess | public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter outExt)
throws ServletException, IOException
{
ScreenModel screen = this.doProcessInput(servlet, req, res);
this.doProcessOutput(servlet, req, res, outExt, screen);
} | java | public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter outExt)
throws ServletException, IOException
{
ScreenModel screen = this.doProcessInput(servlet, req, res);
this.doProcessOutput(servlet, req, res, outExt, screen);
} | [
"public",
"void",
"doProcess",
"(",
"BasicServlet",
"servlet",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"PrintWriter",
"outExt",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"ScreenModel",
"screen",
"=",
"this",
".",
... | Process an HTML get or post.
@exception ServletException From inherited class.
@exception IOException From inherited class. | [
"Process",
"an",
"HTML",
"get",
"or",
"post",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/ServletTask.java#L99-L104 |
josueeduardo/snappy | snappy/src/main/java/io/joshworks/snappy/SnappyServer.java | SnappyServer.add | public static void add(HttpString method, String url, HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) {
addResource(method, url, endpoint, mediaTypes);
} | java | public static void add(HttpString method, String url, HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) {
addResource(method, url, endpoint, mediaTypes);
} | [
"public",
"static",
"void",
"add",
"(",
"HttpString",
"method",
",",
"String",
"url",
",",
"HttpConsumer",
"<",
"HttpExchange",
">",
"endpoint",
",",
"MediaTypes",
"...",
"mediaTypes",
")",
"{",
"addResource",
"(",
"method",
",",
"url",
",",
"endpoint",
",",... | Define a REST endpoint mapped to the specified HTTP method with default path "/" as url
@param method The HTTP method
@param url The relative URL of the endpoint.
@param endpoint The endpoint handler
@param mediaTypes (Optional) The accepted and returned types for this endpoint | [
"Define",
"a",
"REST",
"endpoint",
"mapped",
"to",
"the",
"specified",
"HTTP",
"method",
"with",
"default",
"path",
"/",
"as",
"url"
] | train | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/snappy/src/main/java/io/joshworks/snappy/SnappyServer.java#L486-L488 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.checkManagerOfProjectRole | public void checkManagerOfProjectRole(CmsDbContext dbc, CmsProject project) throws CmsRoleViolationException {
boolean hasRole = false;
try {
if (hasRole(dbc, dbc.currentUser(), CmsRole.ROOT_ADMIN)) {
return;
}
hasRole = m_driverManager.getAllManageableProjects(
dbc,
m_driverManager.readOrganizationalUnit(dbc, project.getOuFqn()),
false).contains(project);
} catch (CmsException e) {
// should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
if (!hasRole) {
throw new CmsRoleViolationException(
org.opencms.security.Messages.get().container(
org.opencms.security.Messages.ERR_NOT_MANAGER_OF_PROJECT_2,
dbc.currentUser().getName(),
dbc.currentProject().getName()));
}
} | java | public void checkManagerOfProjectRole(CmsDbContext dbc, CmsProject project) throws CmsRoleViolationException {
boolean hasRole = false;
try {
if (hasRole(dbc, dbc.currentUser(), CmsRole.ROOT_ADMIN)) {
return;
}
hasRole = m_driverManager.getAllManageableProjects(
dbc,
m_driverManager.readOrganizationalUnit(dbc, project.getOuFqn()),
false).contains(project);
} catch (CmsException e) {
// should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
if (!hasRole) {
throw new CmsRoleViolationException(
org.opencms.security.Messages.get().container(
org.opencms.security.Messages.ERR_NOT_MANAGER_OF_PROJECT_2,
dbc.currentUser().getName(),
dbc.currentProject().getName()));
}
} | [
"public",
"void",
"checkManagerOfProjectRole",
"(",
"CmsDbContext",
"dbc",
",",
"CmsProject",
"project",
")",
"throws",
"CmsRoleViolationException",
"{",
"boolean",
"hasRole",
"=",
"false",
";",
"try",
"{",
"if",
"(",
"hasRole",
"(",
"dbc",
",",
"dbc",
".",
"c... | Checks if the current user has management access to the given project.<p>
@param dbc the current database context
@param project the project to check
@throws CmsRoleViolationException if the user does not have the required role permissions | [
"Checks",
"if",
"the",
"current",
"user",
"has",
"management",
"access",
"to",
"the",
"given",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L382-L406 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/data/AnyValueMap.java | AnyValueMap.getAsNullableType | public <T> T getAsNullableType(Class<T> type, String key) {
Object value = getAsObject(key);
return TypeConverter.toNullableType(type, value);
} | java | public <T> T getAsNullableType(Class<T> type, String key) {
Object value = getAsObject(key);
return TypeConverter.toNullableType(type, value);
} | [
"public",
"<",
"T",
">",
"T",
"getAsNullableType",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"key",
")",
"{",
"Object",
"value",
"=",
"getAsObject",
"(",
"key",
")",
";",
"return",
"TypeConverter",
".",
"toNullableType",
"(",
"type",
",",
"va... | Converts map element into a value defined by specied typecode. If conversion
is not possible it returns null.
@param type the Class type that defined the type of the result
@param key a key of element to get.
@return element value defined by the typecode or null if conversion is not
supported.
@see TypeConverter#toNullableType(Class, Object) | [
"Converts",
"map",
"element",
"into",
"a",
"value",
"defined",
"by",
"specied",
"typecode",
".",
"If",
"conversion",
"is",
"not",
"possible",
"it",
"returns",
"null",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L463-L466 |
lucee/Lucee | core/src/main/java/lucee/commons/io/res/type/compress/Compress.java | Compress.getInstance | public static Compress getInstance(Resource zipFile, int format, boolean caseSensitive) throws IOException {
ConfigImpl config = (ConfigImpl) ThreadLocalPageContext.getConfig();
return config.getCompressInstance(zipFile, format, caseSensitive);
} | java | public static Compress getInstance(Resource zipFile, int format, boolean caseSensitive) throws IOException {
ConfigImpl config = (ConfigImpl) ThreadLocalPageContext.getConfig();
return config.getCompressInstance(zipFile, format, caseSensitive);
} | [
"public",
"static",
"Compress",
"getInstance",
"(",
"Resource",
"zipFile",
",",
"int",
"format",
",",
"boolean",
"caseSensitive",
")",
"throws",
"IOException",
"{",
"ConfigImpl",
"config",
"=",
"(",
"ConfigImpl",
")",
"ThreadLocalPageContext",
".",
"getConfig",
"(... | return zip instance matching the zipfile, singelton instance only 1 zip for one file
@param zipFile
@param format
@param caseSensitive
@return
@throws IOException | [
"return",
"zip",
"instance",
"matching",
"the",
"zipfile",
"singelton",
"instance",
"only",
"1",
"zip",
"for",
"one",
"file"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/compress/Compress.java#L90-L93 |
i-net-software/jlessc | src/com/inet/lib/less/UrlUtils.java | UrlUtils.appendEncode | private static void appendEncode( CssFormatter formatter, byte[] bytes ) {
for( byte b : bytes ) {
if ((b >= 'a' && b <= 'z' ) || (b >= 'A' && b <= 'Z' ) || (b >= '0' && b <= '9' )) {
formatter.append( (char )b );
} else {
switch( b ) {
case '-':
case '_':
case '*':
case '.':
formatter.append( (char )b );
break;
default:
formatter.append( '%' );
formatter.append( Character.toUpperCase( Character.forDigit((b >> 4) & 0xF, 16) ) );
formatter.append( Character.toUpperCase( Character.forDigit(b & 0xF, 16) ) );
}
}
}
} | java | private static void appendEncode( CssFormatter formatter, byte[] bytes ) {
for( byte b : bytes ) {
if ((b >= 'a' && b <= 'z' ) || (b >= 'A' && b <= 'Z' ) || (b >= '0' && b <= '9' )) {
formatter.append( (char )b );
} else {
switch( b ) {
case '-':
case '_':
case '*':
case '.':
formatter.append( (char )b );
break;
default:
formatter.append( '%' );
formatter.append( Character.toUpperCase( Character.forDigit((b >> 4) & 0xF, 16) ) );
formatter.append( Character.toUpperCase( Character.forDigit(b & 0xF, 16) ) );
}
}
}
} | [
"private",
"static",
"void",
"appendEncode",
"(",
"CssFormatter",
"formatter",
",",
"byte",
"[",
"]",
"bytes",
")",
"{",
"for",
"(",
"byte",
"b",
":",
"bytes",
")",
"{",
"if",
"(",
"(",
"b",
">=",
"'",
"'",
"&&",
"b",
"<=",
"'",
"'",
")",
"||",
... | Append the bytes URL encoded.
@param formatter current formatter
@param bytes the bytes | [
"Append",
"the",
"bytes",
"URL",
"encoded",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/UrlUtils.java#L254-L273 |
vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/text/WildcardMatcher.java | WildcardMatcher.matchPathOne | public static int matchPathOne(String platformDependentPath, String... patterns) {
for (int i = 0; i < patterns.length; i++) {
if (matchPath(platformDependentPath, patterns[i])) {
return i;
}
}
return -1;
} | java | public static int matchPathOne(String platformDependentPath, String... patterns) {
for (int i = 0; i < patterns.length; i++) {
if (matchPath(platformDependentPath, patterns[i])) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"matchPathOne",
"(",
"String",
"platformDependentPath",
",",
"String",
"...",
"patterns",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"patterns",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"matchPath",... | Matches path to at least one pattern. Returns index of matched pattern or <code>-1</code> otherwise.
@see #matchPath(String, String, char) | [
"Matches",
"path",
"to",
"at",
"least",
"one",
"pattern",
".",
"Returns",
"index",
"of",
"matched",
"pattern",
"or",
"<code",
">",
"-",
"1<",
"/",
"code",
">",
"otherwise",
"."
] | train | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/text/WildcardMatcher.java#L162-L169 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java | ViewUtils.showView | public static void showView(Activity context, int id) {
if (context != null) {
View view = context.findViewById(id);
if (view != null) {
view.setVisibility(View.VISIBLE);
} else {
Log.e("Caffeine", "View does not exist. Could not show it.");
}
}
} | java | public static void showView(Activity context, int id) {
if (context != null) {
View view = context.findViewById(id);
if (view != null) {
view.setVisibility(View.VISIBLE);
} else {
Log.e("Caffeine", "View does not exist. Could not show it.");
}
}
} | [
"public",
"static",
"void",
"showView",
"(",
"Activity",
"context",
",",
"int",
"id",
")",
"{",
"if",
"(",
"context",
"!=",
"null",
")",
"{",
"View",
"view",
"=",
"context",
".",
"findViewById",
"(",
"id",
")",
";",
"if",
"(",
"view",
"!=",
"null",
... | Sets visibility of the given view to <code>View.VISIBLE</code>.
@param context The current Context or Activity that this method is called from.
@param id R.id.xxxx value for the view to show. | [
"Sets",
"visibility",
"of",
"the",
"given",
"view",
"to",
"<code",
">",
"View",
".",
"VISIBLE<",
"/",
"code",
">",
"."
] | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L266-L275 |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.appendHex | void appendHex( int value, int digits ) {
if( digits > 1 ) {
appendHex( value >>> 4, digits-1 );
}
output.append( DIGITS[ value & 0xF ] );
} | java | void appendHex( int value, int digits ) {
if( digits > 1 ) {
appendHex( value >>> 4, digits-1 );
}
output.append( DIGITS[ value & 0xF ] );
} | [
"void",
"appendHex",
"(",
"int",
"value",
",",
"int",
"digits",
")",
"{",
"if",
"(",
"digits",
">",
"1",
")",
"{",
"appendHex",
"(",
"value",
">>>",
"4",
",",
"digits",
"-",
"1",
")",
";",
"}",
"output",
".",
"append",
"(",
"DIGITS",
"[",
"value"... | Append an hex value to the output.
@param value the value
@param digits the digits to write. | [
"Append",
"an",
"hex",
"value",
"to",
"the",
"output",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L641-L646 |
google/j2objc | jre_emul/Classes/com/google/j2objc/util/NativeTimeZone.java | NativeTimeZone.getOffset | @Override
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) {
long calc = (year / 400) * MILLISECONDS_PER_400_YEARS;
year %= 400;
calc += year * (365 * MILLISECONDS_PER_DAY);
calc += ((year + 3) / 4) * MILLISECONDS_PER_DAY;
if (year > 0) {
calc -= ((year - 1) / 100) * MILLISECONDS_PER_DAY;
}
boolean isLeap = (year == 0 || (year % 4 == 0 && year % 100 != 0));
int[] mlen = isLeap ? LEAP : NORMAL;
calc += mlen[month] * MILLISECONDS_PER_DAY;
calc += (day - 1) * MILLISECONDS_PER_DAY;
calc += millis;
calc -= rawOffset;
calc -= UNIX_OFFSET;
return getOffset(calc);
} | java | @Override
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) {
long calc = (year / 400) * MILLISECONDS_PER_400_YEARS;
year %= 400;
calc += year * (365 * MILLISECONDS_PER_DAY);
calc += ((year + 3) / 4) * MILLISECONDS_PER_DAY;
if (year > 0) {
calc -= ((year - 1) / 100) * MILLISECONDS_PER_DAY;
}
boolean isLeap = (year == 0 || (year % 4 == 0 && year % 100 != 0));
int[] mlen = isLeap ? LEAP : NORMAL;
calc += mlen[month] * MILLISECONDS_PER_DAY;
calc += (day - 1) * MILLISECONDS_PER_DAY;
calc += millis;
calc -= rawOffset;
calc -= UNIX_OFFSET;
return getOffset(calc);
} | [
"@",
"Override",
"public",
"int",
"getOffset",
"(",
"int",
"era",
",",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
",",
"int",
"dayOfWeek",
",",
"int",
"millis",
")",
"{",
"long",
"calc",
"=",
"(",
"year",
"/",
"400",
")",
"*",
"MILLISEC... | This implementation is adapted from libcore's ZoneInfo.
The method always assumes Gregorian calendar, and uses a simple formula to first derive the
instant of the local datetime arguments and then call {@link #getOffset(long)} to get the
actual offset. The local datetime used here is always in the non-DST time zone, i.e. the time
zone with the "raw" offset, as evidenced by actual JDK implementation and the code below. This
means it's possible to call getOffset with a practically non-existent date time, such as 2:30
AM, March 13, 2016, which does not exist in US Pacific Time -- it falls in the DST gap of that
day.
When we compute the milliseconds for the year component, we need to take leap years into
consideration. According to http://aa.usno.navy.mil/faq/docs/calendars.php: "The Gregorian leap
year rule is: Every year that is exactly divisible by four is a leap year, except for years
that are exactly divisible by 100, but these centurial years are leap years if they are exactly
divisible by 400. For example, the years 1700, 1800, and 1900 are not leap years, but the year
2000 is." Hence the rules and constants used here.
Since this method only supports Gregorian calendar, the return value of any date before October
4, 1582 is not reliable. In addition, the era and dayOfWeek arguments are not used in this
method. | [
"This",
"implementation",
"is",
"adapted",
"from",
"libcore",
"s",
"ZoneInfo",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/util/NativeTimeZone.java#L217-L240 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java | SDNN.layerNorm | public SDVariable layerNorm(SDVariable input, SDVariable gain, int... dimensions) {
return layerNorm((String)null, input, gain, dimensions);
} | java | public SDVariable layerNorm(SDVariable input, SDVariable gain, int... dimensions) {
return layerNorm((String)null, input, gain, dimensions);
} | [
"public",
"SDVariable",
"layerNorm",
"(",
"SDVariable",
"input",
",",
"SDVariable",
"gain",
",",
"int",
"...",
"dimensions",
")",
"{",
"return",
"layerNorm",
"(",
"(",
"String",
")",
"null",
",",
"input",
",",
"gain",
",",
"dimensions",
")",
";",
"}"
] | Apply Layer Normalization without bias
y = gain * standardize(x)
@return Output variable | [
"Apply",
"Layer",
"Normalization",
"without",
"bias"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L731-L733 |
phax/ph-commons | ph-matrix/src/main/java/com/helger/matrix/QRDecomposition.java | QRDecomposition.getH | @Nonnull
@ReturnsMutableCopy
public Matrix getH ()
{
final Matrix aNewMatrix = new Matrix (m_nRows, m_nCols);
final double [] [] aNewArray = aNewMatrix.internalGetArray ();
for (int nRow = 0; nRow < m_nRows; nRow++)
{
final double [] aSrcRow = m_aQR[nRow];
final double [] aDstRow = aNewArray[nRow];
for (int nCol = 0; nCol < m_nCols; nCol++)
{
aDstRow[nCol] = (nRow >= nCol ? aSrcRow[nCol] : 0d);
}
}
return aNewMatrix;
} | java | @Nonnull
@ReturnsMutableCopy
public Matrix getH ()
{
final Matrix aNewMatrix = new Matrix (m_nRows, m_nCols);
final double [] [] aNewArray = aNewMatrix.internalGetArray ();
for (int nRow = 0; nRow < m_nRows; nRow++)
{
final double [] aSrcRow = m_aQR[nRow];
final double [] aDstRow = aNewArray[nRow];
for (int nCol = 0; nCol < m_nCols; nCol++)
{
aDstRow[nCol] = (nRow >= nCol ? aSrcRow[nCol] : 0d);
}
}
return aNewMatrix;
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"Matrix",
"getH",
"(",
")",
"{",
"final",
"Matrix",
"aNewMatrix",
"=",
"new",
"Matrix",
"(",
"m_nRows",
",",
"m_nCols",
")",
";",
"final",
"double",
"[",
"]",
"[",
"]",
"aNewArray",
"=",
"aNewMatrix",
... | Return the Householder vectors
@return Lower trapezoidal matrix whose columns define the reflections | [
"Return",
"the",
"Householder",
"vectors"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-matrix/src/main/java/com/helger/matrix/QRDecomposition.java#L142-L158 |
astrapi69/jaulp-wicket | jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/panels/confirm/YesNoPanel.java | YesNoPanel.newNoButton | protected AjaxButton newNoButton(final String id)
{
final AjaxButton ajaxButton = new AjaxButton(id)
{
/**
* The serialVersionUID.
*/
private static final long serialVersionUID = 1L;
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form)
{
onNo(target, form, true);
}
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form)
{
onNo(target, form, false);
}
};
final IModel<String> noLabelModel = ResourceModelFactory.newResourceModel(
ResourceBundleKey.builder().key("global.no.label").defaultValue("No").build(), this);
ajaxButton.add(newLabel("noLabel", noLabelModel));
return ajaxButton;
} | java | protected AjaxButton newNoButton(final String id)
{
final AjaxButton ajaxButton = new AjaxButton(id)
{
/**
* The serialVersionUID.
*/
private static final long serialVersionUID = 1L;
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form)
{
onNo(target, form, true);
}
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form)
{
onNo(target, form, false);
}
};
final IModel<String> noLabelModel = ResourceModelFactory.newResourceModel(
ResourceBundleKey.builder().key("global.no.label").defaultValue("No").build(), this);
ajaxButton.add(newLabel("noLabel", noLabelModel));
return ajaxButton;
} | [
"protected",
"AjaxButton",
"newNoButton",
"(",
"final",
"String",
"id",
")",
"{",
"final",
"AjaxButton",
"ajaxButton",
"=",
"new",
"AjaxButton",
"(",
"id",
")",
"{",
"/**\n\t\t\t * The serialVersionUID.\n\t\t\t */",
"private",
"static",
"final",
"long",
"serialVersion... | Factory method for creating a new no {@link AjaxButton}. This method is invoked in the
constructor from the derived classes and can be overridden so users can provide their own
version of a no {@link AjaxButton}.
@param id
the id
@return the new {@link AjaxButton} | [
"Factory",
"method",
"for",
"creating",
"a",
"new",
"no",
"{",
"@link",
"AjaxButton",
"}",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"pro... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/panels/confirm/YesNoPanel.java#L96-L121 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointRequest.java | EndpointRequest.setAttributes | public void setAttributes(java.util.Map<String, java.util.List<String>> attributes) {
this.attributes = attributes;
} | java | public void setAttributes(java.util.Map<String, java.util.List<String>> attributes) {
this.attributes = attributes;
} | [
"public",
"void",
"setAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"attributes",
")",
"{",
"this",
".",
"attributes",
"=",
"attributes",
";",
"}"
] | Custom attributes that describe the endpoint by associating a name with an array of values. For example, an
attribute named "interests" might have the values ["science", "politics", "travel"]. You can use these attributes
as selection criteria when you create a segment of users to engage with a messaging campaign.
The following characters are not recommended in attribute names: # : ? \ /. The Amazon Pinpoint console does not
display attributes that include these characters in the name. This limitation does not apply to attribute values.
@param attributes
Custom attributes that describe the endpoint by associating a name with an array of values. For example,
an attribute named "interests" might have the values ["science", "politics", "travel"]. You can use these
attributes as selection criteria when you create a segment of users to engage with a messaging campaign.
The following characters are not recommended in attribute names: # : ? \ /. The Amazon Pinpoint console
does not display attributes that include these characters in the name. This limitation does not apply to
attribute values. | [
"Custom",
"attributes",
"that",
"describe",
"the",
"endpoint",
"by",
"associating",
"a",
"name",
"with",
"an",
"array",
"of",
"values",
".",
"For",
"example",
"an",
"attribute",
"named",
"interests",
"might",
"have",
"the",
"values",
"[",
"science",
"politics"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointRequest.java#L165-L167 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java | AbstractValidate.inclusiveBetween | public long inclusiveBetween(long start, long end, long value, String message) {
if (value < start || value > end) {
fail(message);
}
return value;
} | java | public long inclusiveBetween(long start, long end, long value, String message) {
if (value < start || value > end) {
fail(message);
}
return value;
} | [
"public",
"long",
"inclusiveBetween",
"(",
"long",
"start",
",",
"long",
"end",
",",
"long",
"value",
",",
"String",
"message",
")",
"{",
"if",
"(",
"value",
"<",
"start",
"||",
"value",
">",
"end",
")",
"{",
"fail",
"(",
"message",
")",
";",
"}",
... | Validate that the specified primitive value falls between the two inclusive values specified; otherwise, throws an exception with the specified message.
<pre>Validate.inclusiveBetween(0, 2, 1, "Not in range");</pre>
@param start
the inclusive start value
@param end
the inclusive end value
@param value
the value to validate
@param message
the exception message if invalid, not null
@return the value
@throws IllegalArgumentValidationException
if the value falls outside the boundaries | [
"Validate",
"that",
"the",
"specified",
"primitive",
"value",
"falls",
"between",
"the",
"two",
"inclusive",
"values",
"specified",
";",
"otherwise",
"throws",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"<pre",
">",
"Validate",
".",
"inclusiv... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1308-L1313 |
sonyxperiadev/gerrit-events | src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java | GerritQueryHandler.queryJava | public List<JSONObject> queryJava(String queryString, boolean getPatchSets, boolean getCurrentPatchSet,
boolean getFiles) throws SshException, IOException, GerritQueryException {
return queryJava(queryString, getPatchSets, getCurrentPatchSet, getFiles, false);
} | java | public List<JSONObject> queryJava(String queryString, boolean getPatchSets, boolean getCurrentPatchSet,
boolean getFiles) throws SshException, IOException, GerritQueryException {
return queryJava(queryString, getPatchSets, getCurrentPatchSet, getFiles, false);
} | [
"public",
"List",
"<",
"JSONObject",
">",
"queryJava",
"(",
"String",
"queryString",
",",
"boolean",
"getPatchSets",
",",
"boolean",
"getCurrentPatchSet",
",",
"boolean",
"getFiles",
")",
"throws",
"SshException",
",",
"IOException",
",",
"GerritQueryException",
"{"... | Runs the query and returns the result as a list of Java JSONObjects.
@param queryString the query.
@param getPatchSets getPatchSets if all patch-sets of the projects found should be included in the result.
Meaning if --patch-sets should be appended to the command call.
@param getCurrentPatchSet if the current patch-set for the projects found should be included in the result.
Meaning if --current-patch-set should be appended to the command call.
@param getFiles if the files of the patch sets should be included in the result.
Meaning if --files should be appended to the command call.
@return the query result as a List of JSONObjects.
@throws GerritQueryException if Gerrit reports an error with the query.
@throws SshException if there is an error in the SSH Connection.
@throws IOException for some other IO problem. | [
"Runs",
"the",
"query",
"and",
"returns",
"the",
"result",
"as",
"a",
"list",
"of",
"Java",
"JSONObjects",
".",
"@param",
"queryString",
"the",
"query",
".",
"@param",
"getPatchSets",
"getPatchSets",
"if",
"all",
"patch",
"-",
"sets",
"of",
"the",
"projects"... | train | https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java#L156-L159 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java | PyGenerator._generate | protected void _generate(SarlAnnotationType annotation, PyAppendable it, IExtraLanguageGeneratorContext context) {
generateTypeDeclaration(
this.qualifiedNameProvider.getFullyQualifiedName(annotation).toString(),
annotation.getName(), false, Collections.emptyList(),
getTypeBuilder().getDocumentation(annotation),
true,
annotation.getMembers(), it, context, null);
} | java | protected void _generate(SarlAnnotationType annotation, PyAppendable it, IExtraLanguageGeneratorContext context) {
generateTypeDeclaration(
this.qualifiedNameProvider.getFullyQualifiedName(annotation).toString(),
annotation.getName(), false, Collections.emptyList(),
getTypeBuilder().getDocumentation(annotation),
true,
annotation.getMembers(), it, context, null);
} | [
"protected",
"void",
"_generate",
"(",
"SarlAnnotationType",
"annotation",
",",
"PyAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"generateTypeDeclaration",
"(",
"this",
".",
"qualifiedNameProvider",
".",
"getFullyQualifiedName",
"(",
"anno... | Generate the given object.
@param annotation the annotation.
@param it the target for the generated content.
@param context the context. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L923-L930 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/OperatingSystem.java | OperatingSystem.getPageSize | public static synchronized int getPageSize() throws OperatingSystemException {
if (cachedPageSize == -1) {
switch (instance().getOperatingSystemType()) {
case AIX:
case HPUX:
case IBMi:
case Linux:
case Mac:
case Solaris:
case zOS:
cachedPageSize = getPageSizePOSIX();
break;
default:
throw new OperatingSystemException(Tr.formatMessage(tc, "os.pagesize.unavailable"));
}
}
return cachedPageSize;
} | java | public static synchronized int getPageSize() throws OperatingSystemException {
if (cachedPageSize == -1) {
switch (instance().getOperatingSystemType()) {
case AIX:
case HPUX:
case IBMi:
case Linux:
case Mac:
case Solaris:
case zOS:
cachedPageSize = getPageSizePOSIX();
break;
default:
throw new OperatingSystemException(Tr.formatMessage(tc, "os.pagesize.unavailable"));
}
}
return cachedPageSize;
} | [
"public",
"static",
"synchronized",
"int",
"getPageSize",
"(",
")",
"throws",
"OperatingSystemException",
"{",
"if",
"(",
"cachedPageSize",
"==",
"-",
"1",
")",
"{",
"switch",
"(",
"instance",
"(",
")",
".",
"getOperatingSystemType",
"(",
")",
")",
"{",
"cas... | Get the base OS page size (this current Java process may not
necessarily be using this page size). Not implemented on Windows.
@return Page size.
@throws OperatingSystemException Error computing page size. | [
"Get",
"the",
"base",
"OS",
"page",
"size",
"(",
"this",
"current",
"Java",
"process",
"may",
"not",
"necessarily",
"be",
"using",
"this",
"page",
"size",
")",
".",
"Not",
"implemented",
"on",
"Windows",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/OperatingSystem.java#L92-L109 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java | StringBuilders.appendKeyDqValue | public static StringBuilder appendKeyDqValue(final StringBuilder sb, final Entry<String, String> entry) {
return appendKeyDqValue(sb, entry.getKey(), entry.getValue());
} | java | public static StringBuilder appendKeyDqValue(final StringBuilder sb, final Entry<String, String> entry) {
return appendKeyDqValue(sb, entry.getKey(), entry.getValue());
} | [
"public",
"static",
"StringBuilder",
"appendKeyDqValue",
"(",
"final",
"StringBuilder",
"sb",
",",
"final",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
")",
"{",
"return",
"appendKeyDqValue",
"(",
"sb",
",",
"entry",
".",
"getKey",
"(",
")",
",",
... | Appends in the following format: key=double quoted value.
@param sb a string builder
@param entry a map entry
@return {@code key="value"} | [
"Appends",
"in",
"the",
"following",
"format",
":",
"key",
"=",
"double",
"quoted",
"value",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java#L48-L50 |
FrodeRanders/java-vopn | src/main/java/org/gautelis/vopn/xml/Serializer.java | Serializer.obj2Xml | public static String obj2Xml(Class clazz, Object o) throws JAXBException, ParserConfigurationException {
Document doc = obj2Doc(clazz, o);
DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();
LSSerializer lsSerializer = domImplementation.createLSSerializer();
DOMConfiguration domConfiguration = lsSerializer.getDomConfig();
if (domConfiguration.canSetParameter("format-pretty-print", Boolean.TRUE)) {
lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
}
lsSerializer.setNewLine("\n");
try {
// Encode as UTF-8
ByteArrayOutputStream baos = new ByteArrayOutputStream();
LSOutput lsOutput = domImplementation.createLSOutput();
lsOutput.setEncoding("UTF-8");
lsOutput.setByteStream(baos);
lsSerializer.write(doc, lsOutput);
return baos.toString("UTF-8");
}
catch (UnsupportedEncodingException uee) {
return lsSerializer.writeToString(doc); // Produces UTF-16
}
} | java | public static String obj2Xml(Class clazz, Object o) throws JAXBException, ParserConfigurationException {
Document doc = obj2Doc(clazz, o);
DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();
LSSerializer lsSerializer = domImplementation.createLSSerializer();
DOMConfiguration domConfiguration = lsSerializer.getDomConfig();
if (domConfiguration.canSetParameter("format-pretty-print", Boolean.TRUE)) {
lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
}
lsSerializer.setNewLine("\n");
try {
// Encode as UTF-8
ByteArrayOutputStream baos = new ByteArrayOutputStream();
LSOutput lsOutput = domImplementation.createLSOutput();
lsOutput.setEncoding("UTF-8");
lsOutput.setByteStream(baos);
lsSerializer.write(doc, lsOutput);
return baos.toString("UTF-8");
}
catch (UnsupportedEncodingException uee) {
return lsSerializer.writeToString(doc); // Produces UTF-16
}
} | [
"public",
"static",
"String",
"obj2Xml",
"(",
"Class",
"clazz",
",",
"Object",
"o",
")",
"throws",
"JAXBException",
",",
"ParserConfigurationException",
"{",
"Document",
"doc",
"=",
"obj2Doc",
"(",
"clazz",
",",
"o",
")",
";",
"DOMImplementationLS",
"domImplemen... | Serializes an object into XML
<p>
You need to catch the JAXBException, but beware that the cause is not conveyed correctly through getCause().
Take a peek at the internal 'cause' member and look out for detailed information about the problem.
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
x.y.A does not have a no-arg default constructor.
this problem is related to the following location:
at x.y.A
at public java.util.Collection x.y.A.getEntries()
at x.y.Z
x.y.B does not have a no-arg default constructor.
this problem is related to the following location:
at x.y.B
at public java.util.Collection x.y.A.getEntries()
at x.y.A
at public java.util.Collection x.y.Z.getEntries()
at x.y.Z
You need to take a peek at 'cause' in a debugger when initially developing the application. | [
"Serializes",
"an",
"object",
"into",
"XML",
"<p",
">",
"You",
"need",
"to",
"catch",
"the",
"JAXBException",
"but",
"beware",
"that",
"the",
"cause",
"is",
"not",
"conveyed",
"correctly",
"through",
"getCause",
"()",
".",
"Take",
"a",
"peek",
"at",
"the",... | train | https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/xml/Serializer.java#L92-L116 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java | ComputeNodeOperations.getComputeNodeRemoteLoginSettings | public ComputeNodeGetRemoteLoginSettingsResult getComputeNodeRemoteLoginSettings(String poolId, String nodeId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeGetRemoteLoginSettingsOptions options = new ComputeNodeGetRemoteLoginSettingsOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().computeNodes().getRemoteLoginSettings(poolId, nodeId, options);
} | java | public ComputeNodeGetRemoteLoginSettingsResult getComputeNodeRemoteLoginSettings(String poolId, String nodeId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeGetRemoteLoginSettingsOptions options = new ComputeNodeGetRemoteLoginSettingsOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().computeNodes().getRemoteLoginSettings(poolId, nodeId, options);
} | [
"public",
"ComputeNodeGetRemoteLoginSettingsResult",
"getComputeNodeRemoteLoginSettings",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
... | Gets the settings required for remote login to a compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node for which to get a remote login settings.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@return The remote login settings for the specified compute node.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Gets",
"the",
"settings",
"required",
"for",
"remote",
"login",
"to",
"a",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L490-L496 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java | IPAddressString.adjustPrefixLength | public IPAddressString adjustPrefixLength(int adjustment) {
if(isPrefixOnly()) {
int newBits = adjustment > 0 ? Math.min(IPv6Address.BIT_COUNT, getNetworkPrefixLength() + adjustment) : Math.max(0, getNetworkPrefixLength() + adjustment);
return new IPAddressString(IPAddressNetwork.getPrefixString(newBits), validationOptions);
}
IPAddress address = getAddress();
if(address == null) {
return null;
}
if(adjustment == 0) {
return this;
}
Integer prefix = address.getNetworkPrefixLength();
if(prefix != null && prefix + adjustment < 0 && address.isPrefixBlock()) {
return new IPAddressString(IPAddress.SEGMENT_WILDCARD_STR, validationOptions);
}
return address.adjustPrefixLength(adjustment).toAddressString();
} | java | public IPAddressString adjustPrefixLength(int adjustment) {
if(isPrefixOnly()) {
int newBits = adjustment > 0 ? Math.min(IPv6Address.BIT_COUNT, getNetworkPrefixLength() + adjustment) : Math.max(0, getNetworkPrefixLength() + adjustment);
return new IPAddressString(IPAddressNetwork.getPrefixString(newBits), validationOptions);
}
IPAddress address = getAddress();
if(address == null) {
return null;
}
if(adjustment == 0) {
return this;
}
Integer prefix = address.getNetworkPrefixLength();
if(prefix != null && prefix + adjustment < 0 && address.isPrefixBlock()) {
return new IPAddressString(IPAddress.SEGMENT_WILDCARD_STR, validationOptions);
}
return address.adjustPrefixLength(adjustment).toAddressString();
} | [
"public",
"IPAddressString",
"adjustPrefixLength",
"(",
"int",
"adjustment",
")",
"{",
"if",
"(",
"isPrefixOnly",
"(",
")",
")",
"{",
"int",
"newBits",
"=",
"adjustment",
">",
"0",
"?",
"Math",
".",
"min",
"(",
"IPv6Address",
".",
"BIT_COUNT",
",",
"getNet... | Increases or decreases prefix length by the given increment.
<p>
This acts on address strings with an associated prefix length, whether or not there is also an associated address value.
<p>
If the address string has prefix length 0 and represents all addresses of the same version,
and the prefix length is being decreased, then the address representing all addresses of any version is returned.
<p>
When there is an associated address value and the prefix length is increased, the bits moved within the prefix become zero,
and if prefix lengthis extended beyond the segment series boundary, it is removed.
When there is an associated address value
and the prefix length is decreased, the bits moved outside the prefix become zero.
Also see {@link IPAddress#adjustPrefixLength(int)}
@param adjustment
@return | [
"Increases",
"or",
"decreases",
"prefix",
"length",
"by",
"the",
"given",
"increment",
".",
"<p",
">",
"This",
"acts",
"on",
"address",
"strings",
"with",
"an",
"associated",
"prefix",
"length",
"whether",
"or",
"not",
"there",
"is",
"also",
"an",
"associate... | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java#L843-L860 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java | Math.floorDiv | public static int floorDiv(int x, int y) {
int r = x / y;
// if the signs are different and modulo not zero, round down
if ((x ^ y) < 0 && (r * y != x)) {
r--;
}
return r;
} | java | public static int floorDiv(int x, int y) {
int r = x / y;
// if the signs are different and modulo not zero, round down
if ((x ^ y) < 0 && (r * y != x)) {
r--;
}
return r;
} | [
"public",
"static",
"int",
"floorDiv",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"r",
"=",
"x",
"/",
"y",
";",
"// if the signs are different and modulo not zero, round down",
"if",
"(",
"(",
"x",
"^",
"y",
")",
"<",
"0",
"&&",
"(",
"r",
"*",
... | Returns the largest (closest to positive infinity)
{@code int} value that is less than or equal to the algebraic quotient.
There is one special case, if the dividend is the
{@linkplain Integer#MIN_VALUE Integer.MIN_VALUE} and the divisor is {@code -1},
then integer overflow occurs and
the result is equal to the {@code Integer.MIN_VALUE}.
<p>
Normal integer division operates under the round to zero rounding mode
(truncation). This operation instead acts under the round toward
negative infinity (floor) rounding mode.
The floor rounding mode gives different results than truncation
when the exact result is negative.
<ul>
<li>If the signs of the arguments are the same, the results of
{@code floorDiv} and the {@code /} operator are the same. <br>
For example, {@code floorDiv(4, 3) == 1} and {@code (4 / 3) == 1}.</li>
<li>If the signs of the arguments are different, the quotient is negative and
{@code floorDiv} returns the integer less than or equal to the quotient
and the {@code /} operator returns the integer closest to zero.<br>
For example, {@code floorDiv(-4, 3) == -2},
whereas {@code (-4 / 3) == -1}.
</li>
</ul>
<p>
@param x the dividend
@param y the divisor
@return the largest (closest to positive infinity)
{@code int} value that is less than or equal to the algebraic quotient.
@throws ArithmeticException if the divisor {@code y} is zero
@see #floorMod(int, int)
@see #floor(double)
@since 1.8 | [
"Returns",
"the",
"largest",
"(",
"closest",
"to",
"positive",
"infinity",
")",
"{",
"@code",
"int",
"}",
"value",
"that",
"is",
"less",
"than",
"or",
"equal",
"to",
"the",
"algebraic",
"quotient",
".",
"There",
"is",
"one",
"special",
"case",
"if",
"the... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L1056-L1063 |
graphql-java/graphql-java | src/main/java/graphql/language/NodeTraverser.java | NodeTraverser.preOrder | public Object preOrder(NodeVisitor nodeVisitor, Node root) {
return preOrder(nodeVisitor, Collections.singleton(root));
} | java | public Object preOrder(NodeVisitor nodeVisitor, Node root) {
return preOrder(nodeVisitor, Collections.singleton(root));
} | [
"public",
"Object",
"preOrder",
"(",
"NodeVisitor",
"nodeVisitor",
",",
"Node",
"root",
")",
"{",
"return",
"preOrder",
"(",
"nodeVisitor",
",",
"Collections",
".",
"singleton",
"(",
"root",
")",
")",
";",
"}"
] | Version of {@link #preOrder(NodeVisitor, Collection)} with one root.
@param nodeVisitor the visitor of the nodes
@param root the root node
@return the accumulation result of this traversal | [
"Version",
"of",
"{",
"@link",
"#preOrder",
"(",
"NodeVisitor",
"Collection",
")",
"}",
"with",
"one",
"root",
"."
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/language/NodeTraverser.java#L90-L92 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java | DisasterRecoveryConfigurationsInner.listAsync | public Observable<List<DisasterRecoveryConfigurationInner>> listAsync(String resourceGroupName, String serverName) {
return listWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<DisasterRecoveryConfigurationInner>>, List<DisasterRecoveryConfigurationInner>>() {
@Override
public List<DisasterRecoveryConfigurationInner> call(ServiceResponse<List<DisasterRecoveryConfigurationInner>> response) {
return response.body();
}
});
} | java | public Observable<List<DisasterRecoveryConfigurationInner>> listAsync(String resourceGroupName, String serverName) {
return listWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<DisasterRecoveryConfigurationInner>>, List<DisasterRecoveryConfigurationInner>>() {
@Override
public List<DisasterRecoveryConfigurationInner> call(ServiceResponse<List<DisasterRecoveryConfigurationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"DisasterRecoveryConfigurationInner",
">",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
... | Lists a server's disaster recovery configuration.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<DisasterRecoveryConfigurationInner> object | [
"Lists",
"a",
"server",
"s",
"disaster",
"recovery",
"configuration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java#L135-L142 |
apache/groovy | subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java | Groovyc.scanDir | protected void scanDir(File srcDir, File destDir, String[] files) {
GlobPatternMapper m = new GlobPatternMapper();
SourceFileScanner sfs = new SourceFileScanner(this);
File[] newFiles;
for (String extension : getScriptExtensions()) {
m.setFrom("*." + extension);
m.setTo("*.class");
newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
addToCompileList(newFiles);
}
if (jointCompilation) {
m.setFrom("*.java");
m.setTo("*.class");
newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
addToCompileList(newFiles);
}
} | java | protected void scanDir(File srcDir, File destDir, String[] files) {
GlobPatternMapper m = new GlobPatternMapper();
SourceFileScanner sfs = new SourceFileScanner(this);
File[] newFiles;
for (String extension : getScriptExtensions()) {
m.setFrom("*." + extension);
m.setTo("*.class");
newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
addToCompileList(newFiles);
}
if (jointCompilation) {
m.setFrom("*.java");
m.setTo("*.class");
newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
addToCompileList(newFiles);
}
} | [
"protected",
"void",
"scanDir",
"(",
"File",
"srcDir",
",",
"File",
"destDir",
",",
"String",
"[",
"]",
"files",
")",
"{",
"GlobPatternMapper",
"m",
"=",
"new",
"GlobPatternMapper",
"(",
")",
";",
"SourceFileScanner",
"sfs",
"=",
"new",
"SourceFileScanner",
... | Scans the directory looking for source files to be compiled.
The results are returned in the class variable compileList
@param srcDir The source directory
@param destDir The destination directory
@param files An array of filenames | [
"Scans",
"the",
"directory",
"looking",
"for",
"source",
"files",
"to",
"be",
"compiled",
".",
"The",
"results",
"are",
"returned",
"in",
"the",
"class",
"variable",
"compileList"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java#L898-L915 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaiveFive.java | StereoDisparityWtoNaiveFive.process | public void process( I left , I right , GrayF32 imageDisparity ) {
// check inputs and initialize data structures
InputSanityCheck.checkSameShape(left,right,imageDisparity);
this.imageLeft = left;
this.imageRight = right;
w = left.width; h = left.height;
// Compute disparity for each pixel
for( int y = radiusY*2; y < h-radiusY*2; y++ ) {
for( int x = radiusX*2+minDisparity; x < w-radiusX*2; x++ ) {
// take in account image border when computing max disparity
int max = x-Math.max(radiusX*2-1,x-score.length);
// compute match score across all candidates
processPixel(x, y, max);
// select the best disparity
imageDisparity.set(x,y,(float)selectBest(max));
}
}
} | java | public void process( I left , I right , GrayF32 imageDisparity ) {
// check inputs and initialize data structures
InputSanityCheck.checkSameShape(left,right,imageDisparity);
this.imageLeft = left;
this.imageRight = right;
w = left.width; h = left.height;
// Compute disparity for each pixel
for( int y = radiusY*2; y < h-radiusY*2; y++ ) {
for( int x = radiusX*2+minDisparity; x < w-radiusX*2; x++ ) {
// take in account image border when computing max disparity
int max = x-Math.max(radiusX*2-1,x-score.length);
// compute match score across all candidates
processPixel(x, y, max);
// select the best disparity
imageDisparity.set(x,y,(float)selectBest(max));
}
}
} | [
"public",
"void",
"process",
"(",
"I",
"left",
",",
"I",
"right",
",",
"GrayF32",
"imageDisparity",
")",
"{",
"// check inputs and initialize data structures",
"InputSanityCheck",
".",
"checkSameShape",
"(",
"left",
",",
"right",
",",
"imageDisparity",
")",
";",
"... | Computes the disparity for two stereo images along the image's right axis. Both
image must be rectified.
@param left Left camera image.
@param right Right camera image. | [
"Computes",
"the",
"disparity",
"for",
"two",
"stereo",
"images",
"along",
"the",
"image",
"s",
"right",
"axis",
".",
"Both",
"image",
"must",
"be",
"rectified",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaiveFive.java#L75-L96 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java | AbstractIndexWriter.addDescription | protected void addDescription(MemberDoc member, Content dlTree, SearchIndexItem si) {
String name = (member instanceof ExecutableMemberDoc)?
member.name() + ((ExecutableMemberDoc)member).flatSignature() :
member.name();
si.setContainingPackage(utils.getPackageName((member.containingClass()).containingPackage()));
si.setContainingClass((member.containingClass()).typeName());
if (member instanceof ExecutableMemberDoc) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
si.setLabel(member.name() + emd.flatSignature());
if (!((emd.signature()).equals(emd.flatSignature()))) {
si.setUrl(getName(getAnchor((ExecutableMemberDoc) member)));
}
} else {
si.setLabel(member.name());
}
si.setCategory(getResource("doclet.Members").toString());
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
Content dt = HtmlTree.DT(span);
dt.addContent(" - ");
addMemberDesc(member, dt);
dlTree.addContent(dt);
Content dd = new HtmlTree(HtmlTag.DD);
addComment(member, dd);
dlTree.addContent(dd);
} | java | protected void addDescription(MemberDoc member, Content dlTree, SearchIndexItem si) {
String name = (member instanceof ExecutableMemberDoc)?
member.name() + ((ExecutableMemberDoc)member).flatSignature() :
member.name();
si.setContainingPackage(utils.getPackageName((member.containingClass()).containingPackage()));
si.setContainingClass((member.containingClass()).typeName());
if (member instanceof ExecutableMemberDoc) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
si.setLabel(member.name() + emd.flatSignature());
if (!((emd.signature()).equals(emd.flatSignature()))) {
si.setUrl(getName(getAnchor((ExecutableMemberDoc) member)));
}
} else {
si.setLabel(member.name());
}
si.setCategory(getResource("doclet.Members").toString());
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
Content dt = HtmlTree.DT(span);
dt.addContent(" - ");
addMemberDesc(member, dt);
dlTree.addContent(dt);
Content dd = new HtmlTree(HtmlTag.DD);
addComment(member, dd);
dlTree.addContent(dd);
} | [
"protected",
"void",
"addDescription",
"(",
"MemberDoc",
"member",
",",
"Content",
"dlTree",
",",
"SearchIndexItem",
"si",
")",
"{",
"String",
"name",
"=",
"(",
"member",
"instanceof",
"ExecutableMemberDoc",
")",
"?",
"member",
".",
"name",
"(",
")",
"+",
"(... | Add description for Class, Field, Method or Constructor.
@param member MemberDoc for the member of the Class Kind
@param dlTree the content tree to which the description will be added | [
"Add",
"description",
"for",
"Class",
"Field",
"Method",
"or",
"Constructor",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java#L243-L268 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java | BlockMetadataManager.moveBlockMeta | public BlockMeta moveBlockMeta(BlockMeta blockMeta, TempBlockMeta tempBlockMeta)
throws BlockDoesNotExistException, WorkerOutOfSpaceException, BlockAlreadyExistsException {
StorageDir srcDir = blockMeta.getParentDir();
StorageDir dstDir = tempBlockMeta.getParentDir();
srcDir.removeBlockMeta(blockMeta);
BlockMeta newBlockMeta =
new BlockMeta(blockMeta.getBlockId(), blockMeta.getBlockSize(), dstDir);
dstDir.removeTempBlockMeta(tempBlockMeta);
dstDir.addBlockMeta(newBlockMeta);
return newBlockMeta;
} | java | public BlockMeta moveBlockMeta(BlockMeta blockMeta, TempBlockMeta tempBlockMeta)
throws BlockDoesNotExistException, WorkerOutOfSpaceException, BlockAlreadyExistsException {
StorageDir srcDir = blockMeta.getParentDir();
StorageDir dstDir = tempBlockMeta.getParentDir();
srcDir.removeBlockMeta(blockMeta);
BlockMeta newBlockMeta =
new BlockMeta(blockMeta.getBlockId(), blockMeta.getBlockSize(), dstDir);
dstDir.removeTempBlockMeta(tempBlockMeta);
dstDir.addBlockMeta(newBlockMeta);
return newBlockMeta;
} | [
"public",
"BlockMeta",
"moveBlockMeta",
"(",
"BlockMeta",
"blockMeta",
",",
"TempBlockMeta",
"tempBlockMeta",
")",
"throws",
"BlockDoesNotExistException",
",",
"WorkerOutOfSpaceException",
",",
"BlockAlreadyExistsException",
"{",
"StorageDir",
"srcDir",
"=",
"blockMeta",
".... | Moves an existing block to another location currently hold by a temp block.
@param blockMeta the metadata of the block to move
@param tempBlockMeta a placeholder in the destination directory
@return the new block metadata if success, absent otherwise
@throws BlockDoesNotExistException when the block to move is not found
@throws BlockAlreadyExistsException when the block to move already exists in the destination
@throws WorkerOutOfSpaceException when destination have no extra space to hold the block to
move | [
"Moves",
"an",
"existing",
"block",
"to",
"another",
"location",
"currently",
"hold",
"by",
"a",
"temp",
"block",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java#L376-L386 |
riversun/string-grabber | src/main/java/org/riversun/string_grabber/StringCropper.java | StringCropper.removeHead | public String removeHead(String srcStr, int charCount) {
return getRightOf(srcStr, srcStr.length() - charCount);
} | java | public String removeHead(String srcStr, int charCount) {
return getRightOf(srcStr, srcStr.length() - charCount);
} | [
"public",
"String",
"removeHead",
"(",
"String",
"srcStr",
",",
"int",
"charCount",
")",
"{",
"return",
"getRightOf",
"(",
"srcStr",
",",
"srcStr",
".",
"length",
"(",
")",
"-",
"charCount",
")",
";",
"}"
] | Return the rest of the string that is cropped the number of chars from
the beginning
@param srcStr
@param charCount
@return | [
"Return",
"the",
"rest",
"of",
"the",
"string",
"that",
"is",
"cropped",
"the",
"number",
"of",
"chars",
"from",
"the",
"beginning"
] | train | https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringCropper.java#L431-L433 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/PayMchAPI.java | PayMchAPI.payMicropay | public static MicropayResult payMicropay(Micropay micropay,String key){
Map<String,String> map = MapUtil.objectToMap(micropay);
//@since 2.8.14 detail 字段签名处理
if(micropay.getDetail() != null){
map.put("detail",JsonUtil.toJSONString(micropay.getDetail()));
}
String sign = SignatureUtil.generateSign(map,micropay.getSign_type(),key);
micropay.setSign(sign);
String closeorderXML = XMLConverUtil.convertToXML(micropay);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(xmlHeader)
.setUri(baseURI()+ "/pay/micropay")
.setEntity(new StringEntity(closeorderXML,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeXmlResult(httpUriRequest,MicropayResult.class,micropay.getSign_type(),key);
} | java | public static MicropayResult payMicropay(Micropay micropay,String key){
Map<String,String> map = MapUtil.objectToMap(micropay);
//@since 2.8.14 detail 字段签名处理
if(micropay.getDetail() != null){
map.put("detail",JsonUtil.toJSONString(micropay.getDetail()));
}
String sign = SignatureUtil.generateSign(map,micropay.getSign_type(),key);
micropay.setSign(sign);
String closeorderXML = XMLConverUtil.convertToXML(micropay);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(xmlHeader)
.setUri(baseURI()+ "/pay/micropay")
.setEntity(new StringEntity(closeorderXML,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeXmlResult(httpUriRequest,MicropayResult.class,micropay.getSign_type(),key);
} | [
"public",
"static",
"MicropayResult",
"payMicropay",
"(",
"Micropay",
"micropay",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"MapUtil",
".",
"objectToMap",
"(",
"micropay",
")",
";",
"//@since 2.8.14 detail 字段签名处理",
"... | 刷卡支付 提交被扫支付API
@param micropay micropay
@param key key
@return MicropayResult | [
"刷卡支付",
"提交被扫支付API"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/PayMchAPI.java#L122-L137 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipHandlerImpl.java | MembershipHandlerImpl.findMembership | private MembershipByUserGroupTypeWrapper findMembership(Session session, String id) throws Exception
{
IdComponents ids;
try
{
ids = utils.splitId(id);
}
catch (IndexOutOfBoundsException e)
{
throw new ItemNotFoundException("Can not find membership by id=" + id, e);
}
Node groupNode = session.getNodeByUUID(ids.groupNodeId);
Node refUserNode = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNode(ids.userName);
Node refTypeNode =
refUserNode.getNode(ids.type.equals(MembershipTypeHandler.ANY_MEMBERSHIP_TYPE)
? JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY : ids.type);
String groupId = utils.getGroupIds(groupNode).groupId;
MembershipImpl membership = new MembershipImpl();
membership.setId(id);
membership.setGroupId(groupId);
membership.setMembershipType(ids.type);
membership.setUserName(ids.userName);
putInCache(membership);
return new MembershipByUserGroupTypeWrapper(membership, refUserNode, refTypeNode);
} | java | private MembershipByUserGroupTypeWrapper findMembership(Session session, String id) throws Exception
{
IdComponents ids;
try
{
ids = utils.splitId(id);
}
catch (IndexOutOfBoundsException e)
{
throw new ItemNotFoundException("Can not find membership by id=" + id, e);
}
Node groupNode = session.getNodeByUUID(ids.groupNodeId);
Node refUserNode = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNode(ids.userName);
Node refTypeNode =
refUserNode.getNode(ids.type.equals(MembershipTypeHandler.ANY_MEMBERSHIP_TYPE)
? JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY : ids.type);
String groupId = utils.getGroupIds(groupNode).groupId;
MembershipImpl membership = new MembershipImpl();
membership.setId(id);
membership.setGroupId(groupId);
membership.setMembershipType(ids.type);
membership.setUserName(ids.userName);
putInCache(membership);
return new MembershipByUserGroupTypeWrapper(membership, refUserNode, refTypeNode);
} | [
"private",
"MembershipByUserGroupTypeWrapper",
"findMembership",
"(",
"Session",
"session",
",",
"String",
"id",
")",
"throws",
"Exception",
"{",
"IdComponents",
"ids",
";",
"try",
"{",
"ids",
"=",
"utils",
".",
"splitId",
"(",
"id",
")",
";",
"}",
"catch",
... | Use this method to search for an membership record with the given id. | [
"Use",
"this",
"method",
"to",
"search",
"for",
"an",
"membership",
"record",
"with",
"the",
"given",
"id",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipHandlerImpl.java#L224-L253 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java | Download.toFile | public static void toFile(final HttpConfig config, final String contentType, final File file) {
config.context(contentType, ID, file);
config.getResponse().parser(contentType, Download::fileParser);
} | java | public static void toFile(final HttpConfig config, final String contentType, final File file) {
config.context(contentType, ID, file);
config.getResponse().parser(contentType, Download::fileParser);
} | [
"public",
"static",
"void",
"toFile",
"(",
"final",
"HttpConfig",
"config",
",",
"final",
"String",
"contentType",
",",
"final",
"File",
"file",
")",
"{",
"config",
".",
"context",
"(",
"contentType",
",",
"ID",
",",
"file",
")",
";",
"config",
".",
"get... | Downloads the content to a specified file with the specified content type.
@param config the `HttpConfig` instance
@param file the file where content will be downloaded
@param contentType the content type | [
"Downloads",
"the",
"content",
"to",
"a",
"specified",
"file",
"with",
"the",
"specified",
"content",
"type",
"."
] | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java#L92-L95 |
fcrepo3/fcrepo | fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/utility/validate/process/ValidatorProcessParameters.java | ValidatorProcessParameters.assembleFieldSearchQuery | private FieldSearchQuery assembleFieldSearchQuery(String query, String terms) {
if (terms != null) {
return new FieldSearchQuery(terms);
} else {
try {
return new FieldSearchQuery(Condition.getConditions(query));
} catch (QueryParseException e) {
throw new ValidatorProcessUsageException("Value '" + query
+ "' of parameter '" + PARAMETER_QUERY
+ "' is not a valid query string.");
}
}
} | java | private FieldSearchQuery assembleFieldSearchQuery(String query, String terms) {
if (terms != null) {
return new FieldSearchQuery(terms);
} else {
try {
return new FieldSearchQuery(Condition.getConditions(query));
} catch (QueryParseException e) {
throw new ValidatorProcessUsageException("Value '" + query
+ "' of parameter '" + PARAMETER_QUERY
+ "' is not a valid query string.");
}
}
} | [
"private",
"FieldSearchQuery",
"assembleFieldSearchQuery",
"(",
"String",
"query",
",",
"String",
"terms",
")",
"{",
"if",
"(",
"terms",
"!=",
"null",
")",
"{",
"return",
"new",
"FieldSearchQuery",
"(",
"terms",
")",
";",
"}",
"else",
"{",
"try",
"{",
"ret... | A {@link FieldSearchQuery} may be made from a terms string or a query
string, but not both. | [
"A",
"{"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/utility/validate/process/ValidatorProcessParameters.java#L283-L295 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/sort/NormalizedKeySorter.java | NormalizedKeySorter.writeToOutput | @Override
public void writeToOutput(final ChannelWriterOutputView output, final int start, int num) throws IOException {
int currentMemSeg = start / this.indexEntriesPerSegment;
int offset = (start % this.indexEntriesPerSegment) * this.indexEntrySize;
while (num > 0)
{
final MemorySegment currentIndexSegment = this.sortIndex.get(currentMemSeg++);
// check whether we have a full or partially full segment
if (num >= this.indexEntriesPerSegment && offset == 0) {
// full segment
for (;offset <= this.lastIndexEntryOffset; offset += this.indexEntrySize) {
final long pointer = currentIndexSegment.getLong(offset);
this.recordBuffer.setReadPosition(pointer);
this.serializer.copy(this.recordBuffer, output);
}
num -= this.indexEntriesPerSegment;
} else {
// partially filled segment
for (; num > 0 && offset <= this.lastIndexEntryOffset; num--, offset += this.indexEntrySize)
{
final long pointer = currentIndexSegment.getLong(offset);
this.recordBuffer.setReadPosition(pointer);
this.serializer.copy(this.recordBuffer, output);
}
}
offset = 0;
}
} | java | @Override
public void writeToOutput(final ChannelWriterOutputView output, final int start, int num) throws IOException {
int currentMemSeg = start / this.indexEntriesPerSegment;
int offset = (start % this.indexEntriesPerSegment) * this.indexEntrySize;
while (num > 0)
{
final MemorySegment currentIndexSegment = this.sortIndex.get(currentMemSeg++);
// check whether we have a full or partially full segment
if (num >= this.indexEntriesPerSegment && offset == 0) {
// full segment
for (;offset <= this.lastIndexEntryOffset; offset += this.indexEntrySize) {
final long pointer = currentIndexSegment.getLong(offset);
this.recordBuffer.setReadPosition(pointer);
this.serializer.copy(this.recordBuffer, output);
}
num -= this.indexEntriesPerSegment;
} else {
// partially filled segment
for (; num > 0 && offset <= this.lastIndexEntryOffset; num--, offset += this.indexEntrySize)
{
final long pointer = currentIndexSegment.getLong(offset);
this.recordBuffer.setReadPosition(pointer);
this.serializer.copy(this.recordBuffer, output);
}
}
offset = 0;
}
} | [
"@",
"Override",
"public",
"void",
"writeToOutput",
"(",
"final",
"ChannelWriterOutputView",
"output",
",",
"final",
"int",
"start",
",",
"int",
"num",
")",
"throws",
"IOException",
"{",
"int",
"currentMemSeg",
"=",
"start",
"/",
"this",
".",
"indexEntriesPerSeg... | Writes a subset of the records in this buffer in their logical order to the given output.
@param output The output view to write the records to.
@param start The logical start position of the subset.
@param num The number of elements to write.
@throws IOException Thrown, if an I/O exception occurred writing to the output view. | [
"Writes",
"a",
"subset",
"of",
"the",
"records",
"in",
"this",
"buffer",
"in",
"their",
"logical",
"order",
"to",
"the",
"given",
"output",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/sort/NormalizedKeySorter.java#L470-L498 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.toInteger | public static final Function<String,Integer> toInteger(final RoundingMode roundingMode, final Locale locale) {
return new ToInteger(roundingMode, locale);
} | java | public static final Function<String,Integer> toInteger(final RoundingMode roundingMode, final Locale locale) {
return new ToInteger(roundingMode, locale);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"Integer",
">",
"toInteger",
"(",
"final",
"RoundingMode",
"roundingMode",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"new",
"ToInteger",
"(",
"roundingMode",
",",
"locale",
")",
";",
"}... | <p>
Converts a String into an Integer, using the specified locale for determining
decimal point. Rounding mode is used for removing the
decimal part of the number. The integer part of the input string must be between
{@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
</p>
@param roundingMode the rounding mode to be used when setting the scale
@param locale the locale defining the way in which the number was written
@return the resulting Integer object | [
"<p",
">",
"Converts",
"a",
"String",
"into",
"an",
"Integer",
"using",
"the",
"specified",
"locale",
"for",
"determining",
"decimal",
"point",
".",
"Rounding",
"mode",
"is",
"used",
"for",
"removing",
"the",
"decimal",
"part",
"of",
"the",
"number",
".",
... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L955-L957 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoLocationUtil.java | GeoLocationUtil.makeInternalId | @Pure
public static String makeInternalId(float minx, float miny, float maxx, float maxy) {
final StringBuilder buf = new StringBuilder("rectangle"); //$NON-NLS-1$
buf.append('(');
buf.append(minx);
buf.append(';');
buf.append(miny);
buf.append(")-("); //$NON-NLS-1$
buf.append(maxx);
buf.append(';');
buf.append(maxy);
buf.append(')');
return Encryption.md5(buf.toString());
} | java | @Pure
public static String makeInternalId(float minx, float miny, float maxx, float maxy) {
final StringBuilder buf = new StringBuilder("rectangle"); //$NON-NLS-1$
buf.append('(');
buf.append(minx);
buf.append(';');
buf.append(miny);
buf.append(")-("); //$NON-NLS-1$
buf.append(maxx);
buf.append(';');
buf.append(maxy);
buf.append(')');
return Encryption.md5(buf.toString());
} | [
"@",
"Pure",
"public",
"static",
"String",
"makeInternalId",
"(",
"float",
"minx",
",",
"float",
"miny",
",",
"float",
"maxx",
",",
"float",
"maxy",
")",
"{",
"final",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"\"rectangle\"",
")",
";",
"//... | Compute and replies the internal identifier that may
be used to create a GeoId from the given rectangle.
@param minx minimum x coordinate of the bounding rectangle.
@param miny minimum y coordinate of the bounding rectangle.
@param maxx maximum x coordinate of the bounding rectangle.
@param maxy maximum y coordinate of the bounding rectangle.
@return the internal identifier. | [
"Compute",
"and",
"replies",
"the",
"internal",
"identifier",
"that",
"may",
"be",
"used",
"to",
"create",
"a",
"GeoId",
"from",
"the",
"given",
"rectangle",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoLocationUtil.java#L376-L389 |
jillesvangurp/jsonj | src/main/java/com/github/jsonj/tools/JsonBuilder.java | JsonBuilder.put | public @Nonnull JsonBuilder put(String key, boolean b) {
object.put(key, primitive(b));
return this;
} | java | public @Nonnull JsonBuilder put(String key, boolean b) {
object.put(key, primitive(b));
return this;
} | [
"public",
"@",
"Nonnull",
"JsonBuilder",
"put",
"(",
"String",
"key",
",",
"boolean",
"b",
")",
"{",
"object",
".",
"put",
"(",
"key",
",",
"primitive",
"(",
"b",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a boolean value to the object.
@param key key
@param b value
@return the builder | [
"Add",
"a",
"boolean",
"value",
"to",
"the",
"object",
"."
] | train | https://github.com/jillesvangurp/jsonj/blob/1da0c44c5bdb60c0cd806c48d2da5a8a75bf84af/src/main/java/com/github/jsonj/tools/JsonBuilder.java#L100-L103 |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/TableUtilities.java | TableUtilities.caseIdentifier | public static String caseIdentifier(TableLocation requestedTable, String tableName, boolean isH2) {
return new TableLocation(requestedTable.getCatalog(), requestedTable.getSchema(),
TableLocation.parse(tableName, isH2).getTable()).toString();
} | java | public static String caseIdentifier(TableLocation requestedTable, String tableName, boolean isH2) {
return new TableLocation(requestedTable.getCatalog(), requestedTable.getSchema(),
TableLocation.parse(tableName, isH2).getTable()).toString();
} | [
"public",
"static",
"String",
"caseIdentifier",
"(",
"TableLocation",
"requestedTable",
",",
"String",
"tableName",
",",
"boolean",
"isH2",
")",
"{",
"return",
"new",
"TableLocation",
"(",
"requestedTable",
".",
"getCatalog",
"(",
")",
",",
"requestedTable",
".",
... | Return the table identifier in the best fit depending on database type
@param requestedTable Catalog and schema used
@param tableName Table without quotes
@param isH2 True if H2, false if PostGRES
@return Find table identifier | [
"Return",
"the",
"table",
"identifier",
"in",
"the",
"best",
"fit",
"depending",
"on",
"database",
"type"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/TableUtilities.java#L133-L136 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/shp/SHPWrite.java | SHPWrite.exportTable | public static void exportTable(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException {
SHPDriverFunction shpDriverFunction = new SHPDriverFunction();
shpDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), encoding);
} | java | public static void exportTable(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException {
SHPDriverFunction shpDriverFunction = new SHPDriverFunction();
shpDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), encoding);
} | [
"public",
"static",
"void",
"exportTable",
"(",
"Connection",
"connection",
",",
"String",
"fileName",
",",
"String",
"tableReference",
",",
"String",
"encoding",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"SHPDriverFunction",
"shpDriverFunction",
"=",
... | Read a table and write it into a shape file.
@param connection Active connection
@param fileName Shape file name or URI
@param tableReference Table name or select query
Note : The select query must be enclosed in parenthesis
@param encoding File encoding
@throws IOException
@throws SQLException | [
"Read",
"a",
"table",
"and",
"write",
"it",
"into",
"a",
"shape",
"file",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/shp/SHPWrite.java#L69-L72 |
voldemort/voldemort | src/java/voldemort/store/stats/ClientSocketStats.java | ClientSocketStats.recordCheckoutQueueLength | public void recordCheckoutQueueLength(SocketDestination dest, int queueLength) {
if(dest != null) {
getOrCreateNodeStats(dest).recordCheckoutQueueLength(null, queueLength);
recordCheckoutQueueLength(null, queueLength);
} else {
this.checkoutQueueLengthHistogram.insert(queueLength);
checkMonitoringInterval();
}
} | java | public void recordCheckoutQueueLength(SocketDestination dest, int queueLength) {
if(dest != null) {
getOrCreateNodeStats(dest).recordCheckoutQueueLength(null, queueLength);
recordCheckoutQueueLength(null, queueLength);
} else {
this.checkoutQueueLengthHistogram.insert(queueLength);
checkMonitoringInterval();
}
} | [
"public",
"void",
"recordCheckoutQueueLength",
"(",
"SocketDestination",
"dest",
",",
"int",
"queueLength",
")",
"{",
"if",
"(",
"dest",
"!=",
"null",
")",
"{",
"getOrCreateNodeStats",
"(",
"dest",
")",
".",
"recordCheckoutQueueLength",
"(",
"null",
",",
"queueL... | Record the checkout queue length
@param dest Destination of the socket to checkout. Will actually record
if null. Otherwise will call this on self and corresponding child
with this param null.
@param queueLength The number of entries in the "synchronous" checkout
queue. | [
"Record",
"the",
"checkout",
"queue",
"length"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/ClientSocketStats.java#L283-L291 |
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.listSiteAnalysesSlotAsync | public Observable<Page<AnalysisDefinitionInner>> listSiteAnalysesSlotAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot) {
return listSiteAnalysesSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, slot)
.map(new Func1<ServiceResponse<Page<AnalysisDefinitionInner>>, Page<AnalysisDefinitionInner>>() {
@Override
public Page<AnalysisDefinitionInner> call(ServiceResponse<Page<AnalysisDefinitionInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<AnalysisDefinitionInner>> listSiteAnalysesSlotAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot) {
return listSiteAnalysesSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, slot)
.map(new Func1<ServiceResponse<Page<AnalysisDefinitionInner>>, Page<AnalysisDefinitionInner>>() {
@Override
public Page<AnalysisDefinitionInner> call(ServiceResponse<Page<AnalysisDefinitionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"AnalysisDefinitionInner",
">",
">",
"listSiteAnalysesSlotAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"siteName",
",",
"final",
"String",
"diagnosticCategory",
",",
"final",
"String",
"slot",
... | Get Site Analyses.
Get Site Analyses.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param diagnosticCategory Diagnostic Category
@param slot Slot Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<AnalysisDefinitionInner> object | [
"Get",
"Site",
"Analyses",
".",
"Get",
"Site",
"Analyses",
"."
] | 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#L1635-L1643 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getStorageAccountAsync | public Observable<StorageBundle> getStorageAccountAsync(String vaultBaseUrl, String storageAccountName) {
return getStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() {
@Override
public StorageBundle call(ServiceResponse<StorageBundle> response) {
return response.body();
}
});
} | java | public Observable<StorageBundle> getStorageAccountAsync(String vaultBaseUrl, String storageAccountName) {
return getStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() {
@Override
public StorageBundle call(ServiceResponse<StorageBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StorageBundle",
">",
"getStorageAccountAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
")",
"{",
"return",
"getStorageAccountWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"storageAccountName",
")",
".",
"map... | Gets information about a specified storage account. This operation requires the storage/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StorageBundle object | [
"Gets",
"information",
"about",
"a",
"specified",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"get",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9806-L9813 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/graph/Cycles.java | Cycles.getBond | private static IBond getBond(IAtomContainer container, EdgeToBondMap bondMap, int u, int v) {
if (bondMap != null) return bondMap.get(u, v);
return container.getBond(container.getAtom(u), container.getAtom(v));
} | java | private static IBond getBond(IAtomContainer container, EdgeToBondMap bondMap, int u, int v) {
if (bondMap != null) return bondMap.get(u, v);
return container.getBond(container.getAtom(u), container.getAtom(v));
} | [
"private",
"static",
"IBond",
"getBond",
"(",
"IAtomContainer",
"container",
",",
"EdgeToBondMap",
"bondMap",
",",
"int",
"u",
",",
"int",
"v",
")",
"{",
"if",
"(",
"bondMap",
"!=",
"null",
")",
"return",
"bondMap",
".",
"get",
"(",
"u",
",",
"v",
")",... | Obtain the bond between the atoms at index 'u' and 'v'. If the 'bondMap'
is non-null it is used for direct lookup otherwise the slower linear
lookup in 'container' is used.
@param container a structure
@param bondMap optimised map of atom indices to bond instances
@param u an atom index
@param v an atom index (connected to u)
@return the bond between u and v | [
"Obtain",
"the",
"bond",
"between",
"the",
"atoms",
"at",
"index",
"u",
"and",
"v",
".",
"If",
"the",
"bondMap",
"is",
"non",
"-",
"null",
"it",
"is",
"used",
"for",
"direct",
"lookup",
"otherwise",
"the",
"slower",
"linear",
"lookup",
"in",
"container",... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/graph/Cycles.java#L969-L972 |
OpenLiberty/open-liberty | dev/com.ibm.ws.javamail/src/com/ibm/ws/javamail/internal/injection/MailSessionDefinitionInjectionProcessor.java | MailSessionDefinitionInjectionProcessor.processXML | @Override
public void processXML()
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "processXML : " + this);
List<? extends MailSession> mailSessionDefinitions = ivNameSpaceConfig.getJNDIEnvironmentRefs(MailSession.class);
if (mailSessionDefinitions != null)
{
for (MailSession mailSession : mailSessionDefinitions)
{
String jndiName = mailSession.getName();
InjectionBinding<MailSessionDefinition> injectionBinding = ivAllAnnotationsCollection.get(jndiName);
MailSessionDefinitionInjectionBinding binding;
if (injectionBinding != null)
{
binding = (MailSessionDefinitionInjectionBinding) injectionBinding;
}
else
{
binding = new MailSessionDefinitionInjectionBinding(jndiName, ivNameSpaceConfig);
addInjectionBinding(binding);
}
binding.mergeXML(mailSession);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processXML : " + this);
} | java | @Override
public void processXML()
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "processXML : " + this);
List<? extends MailSession> mailSessionDefinitions = ivNameSpaceConfig.getJNDIEnvironmentRefs(MailSession.class);
if (mailSessionDefinitions != null)
{
for (MailSession mailSession : mailSessionDefinitions)
{
String jndiName = mailSession.getName();
InjectionBinding<MailSessionDefinition> injectionBinding = ivAllAnnotationsCollection.get(jndiName);
MailSessionDefinitionInjectionBinding binding;
if (injectionBinding != null)
{
binding = (MailSessionDefinitionInjectionBinding) injectionBinding;
}
else
{
binding = new MailSessionDefinitionInjectionBinding(jndiName, ivNameSpaceConfig);
addInjectionBinding(binding);
}
binding.mergeXML(mailSession);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processXML : " + this);
} | [
"@",
"Override",
"public",
"void",
"processXML",
"(",
")",
"throws",
"InjectionException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
"... | Processes {@link ComponentNameSpaceConfiguration#getJNDIEnvironmnetRefs} for MailSessions.
</ul>
@throws InjectionException if an error is found processing the XML. | [
"Processes",
"{",
"@link",
"ComponentNameSpaceConfiguration#getJNDIEnvironmnetRefs",
"}",
"for",
"MailSessions",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail/src/com/ibm/ws/javamail/internal/injection/MailSessionDefinitionInjectionProcessor.java#L55-L90 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java | AbstractEventSerializer.convertToDate | private Date convertToDate(String dateInString) throws IOException {
Date date = null;
if (dateInString != null) {
try {
date = LibraryUtils.getUtcSdf().parse(dateInString);
} catch (ParseException e) {
throw new IOException("Cannot parse " + dateInString + " as Date", e);
}
}
return date;
} | java | private Date convertToDate(String dateInString) throws IOException {
Date date = null;
if (dateInString != null) {
try {
date = LibraryUtils.getUtcSdf().parse(dateInString);
} catch (ParseException e) {
throw new IOException("Cannot parse " + dateInString + " as Date", e);
}
}
return date;
} | [
"private",
"Date",
"convertToDate",
"(",
"String",
"dateInString",
")",
"throws",
"IOException",
"{",
"Date",
"date",
"=",
"null",
";",
"if",
"(",
"dateInString",
"!=",
"null",
")",
"{",
"try",
"{",
"date",
"=",
"LibraryUtils",
".",
"getUtcSdf",
"(",
")",
... | This method convert a String to Date type. When parse error happened return current date.
@param dateInString the String to convert to Date
@return Date the date and time in coordinated universal time
@throws IOException | [
"This",
"method",
"convert",
"a",
"String",
"to",
"Date",
"type",
".",
"When",
"parse",
"error",
"happened",
"return",
"current",
"date",
"."
] | train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java#L530-L540 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMessages.java | WMessages.addMessage | private void addMessage(final WMessageBox box, final Message message, final boolean encode) {
String code = message.getMessage();
if (!Util.empty(code)) {
box.addMessage(encode, code, message.getArgs());
}
} | java | private void addMessage(final WMessageBox box, final Message message, final boolean encode) {
String code = message.getMessage();
if (!Util.empty(code)) {
box.addMessage(encode, code, message.getArgs());
}
} | [
"private",
"void",
"addMessage",
"(",
"final",
"WMessageBox",
"box",
",",
"final",
"Message",
"message",
",",
"final",
"boolean",
"encode",
")",
"{",
"String",
"code",
"=",
"message",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"!",
"Util",
".",
"empty"... | Convenience method to add a message to a message box.
@param box the message box to add the message to
@param message the message to add
@param encode true to encode the message, false otherwise. | [
"Convenience",
"method",
"to",
"add",
"a",
"message",
"to",
"a",
"message",
"box",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMessages.java#L398-L404 |
prestodb/presto | presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java | Indexer.getIndexColumnFamily | public static ByteBuffer getIndexColumnFamily(byte[] columnFamily, byte[] columnQualifier)
{
return wrap(ArrayUtils.addAll(ArrayUtils.add(columnFamily, UNDERSCORE), columnQualifier));
} | java | public static ByteBuffer getIndexColumnFamily(byte[] columnFamily, byte[] columnQualifier)
{
return wrap(ArrayUtils.addAll(ArrayUtils.add(columnFamily, UNDERSCORE), columnQualifier));
} | [
"public",
"static",
"ByteBuffer",
"getIndexColumnFamily",
"(",
"byte",
"[",
"]",
"columnFamily",
",",
"byte",
"[",
"]",
"columnQualifier",
")",
"{",
"return",
"wrap",
"(",
"ArrayUtils",
".",
"addAll",
"(",
"ArrayUtils",
".",
"add",
"(",
"columnFamily",
",",
... | Gets the column family of the index table based on the given column family and qualifier.
@param columnFamily Presto column family
@param columnQualifier Presto column qualifier
@return ByteBuffer of the given index column family | [
"Gets",
"the",
"column",
"family",
"of",
"the",
"index",
"table",
"based",
"on",
"the",
"given",
"column",
"family",
"and",
"qualifier",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java#L397-L400 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201902/labelservice/GetActiveLabels.java | GetActiveLabels.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
LabelServiceInterface labelService =
adManagerServices.get(session, LabelServiceInterface.class);
// Create a statement to select labels.
StatementBuilder statementBuilder =
new StatementBuilder()
.where("isActive = :isActive")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("isActive", true);
// Retrieve a small amount of labels at a time, paging through
// until all labels have been retrieved.
int totalResultSetSize = 0;
do {
LabelPage page = labelService.getLabelsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each label.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Label label : page.getResults()) {
System.out.printf(
"%d) Label with ID %d and name '%s' was found.%n",
i++, label.getId(), label.getName());
}
}
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 {
LabelServiceInterface labelService =
adManagerServices.get(session, LabelServiceInterface.class);
// Create a statement to select labels.
StatementBuilder statementBuilder =
new StatementBuilder()
.where("isActive = :isActive")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("isActive", true);
// Retrieve a small amount of labels at a time, paging through
// until all labels have been retrieved.
int totalResultSetSize = 0;
do {
LabelPage page = labelService.getLabelsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each label.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Label label : page.getResults()) {
System.out.printf(
"%d) Label with ID %d and name '%s' was found.%n",
i++, label.getId(), label.getName());
}
}
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",
"{",
"LabelServiceInterface",
"labelService",
"=",
"adManagerServices",
".",
"get",
"(",
"session",
",",
"Label... | 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/labelservice/GetActiveLabels.java#L51-L85 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.